Technical Notes & Details:

Calculations are written in Python with a significant emphasis on Pandas use. The application itself was developed using a Flask framework. A Bootstrap template is used for the navigation bar and certain button / form styles. WTforms is used to handle forms. Most of the HTML, CSS & Javascript design/implementation on the Home, Analytics, Technical Notes, and About pages are my own. SQL Alchemy is used as an ORM (Object Relational Mapper) for "database" access. Portfolio charts are rendered using Chart JS.

Server configuration details:

  • Virtual Private Server provider: Linode
  • CPUs: 2 (shared); RAM: 4GB
  • Operating System: Ubuntu 21.10
  • Web server: NGINX
  • Server region: Dallas, TX



Charts below are the initial versions rendered using MatPlotLib and Seaborn:

Displays a chart showing Market cap vs Daily Trade volume of stocks. X axis shows Daily Volume (Millions of Shares per Day), Y axis shows Market Cap in billions. Multiple circles are displayed including the Market cap and revenue of the company the circle represents. The size of each company's circle is dependent on its Net Income relative to the other company's circles Example of optimal portfolios being generated for a given stock portfolio. X axis is the Volatility, Y axis is the portfolio percent return. Estimate portfolios are shown in blue forming a curved cone of sorts skewing rightward towards to the tip. Points are shown with shades of blue depending on their Sharpe Ratio. With a higher Sharpe ratio being darker blue. The max Sharpe Ratio is shown in with a purple plus sign, located approximately at the center of all the points. and the minimum volatility portfolio is shown with a black plus, located at the bottom left of the chart. Multiple arbitrary stocks being compared Two charts are displayed. The top chart shows an average of 1000 random walks over a 252 day period. X axis is days, Y axis is the stock price. The bottom chart shows 1000 random walks over a 252 day period. X axis is days, Y axis is the stock price. 7 Charts displaying the Number of days that the stock price changed a given percent. percent change in stock price is on the X axis and the count of days is on the Y axis. Each chart corresponds to one example stock Example of daily percent return correlation map for a given stock portfolio. Multiple arbitrary stocks being compared. 8 stocks, in this picture, on the X axis are displayed along with those same stocks being displayed on the Y axis. 8 by 8 squares are displayed. Each square displays the correlation between the two stocks being compared along with a shading of blue representing the correlation degree of the two stocks. The more correlated, the darker the shade of blue. A correlation degree index is displayed next to the chart. Two charts are displayed. The top chart shows the change in stock price over a certain time period. X axis is the date, Y axis is the stock price. The bottom chart shows the percent change of the stock price over time. X axis is the date, Y axis is the yearly percent change in stock price.

Images below show optimal searching along a sphere. I ultimately decided not to display this on the website:

Example 1 of a sphere being traversed by Dijkstra shortest path algorithm to find the shortest path between two points. Black dots make up the sphere body, a turquoise line traces part of a path through the dots in between two points, one blue one yellow. Example 2 of a sphere being traversed by Dijkstra shortest path algorithm to find the shortest path between two points. Same as prior image, with the line progressing further to connect the start and finish dots. Black dots make up the sphere body, a turquoise line traces part of a path through the dots in between two points, one blue one yellow. Example 3 of a sphere being traversed by Dijkstra shortest path algorithm to find the shortest path between two points. Same as prior image, with the progressing even further to connect the start and finish dots. Black dots make up the sphere body, a turquoise line traces part of a path through the dots in between two points, one blue one yellow.



Math & Programming Resources:

Below are links to helpful resources I used/ referenced to build the website!



Portfolio Optimization:

The portfolio optimization module is an interactive web application designed to assist with basic portfolio allocation. The website utilizes two methods to approach the question of how to best allocate weights with the aim of constructing the "optimal" portfolio.

  • Monte-Carlo (Random) simulation wherein n-thousand portfolios are generated and the portfolio with the maximum sharpe ratio is selected.
  • Maximizing the Sharpe Ratio using Sequential Least Squares Programming (SLSQP) via Scikit.Optimize.minimize.
Here "optimal" relates to maximizing the Sharpe Ratio. The Sharpe Ratio can be understood as the ratio of excess return for the portfolio (Expected return of the portfolio less the risk free rate) over the standard deviation of the portfolio.

Every portfolio entered is stored in a database. The number of the portfolio, the stocks entered, and the start date used are all logged.

While there is the ability to create an account, login/logout, reset your password etc. there is no benefit in creating one. Usernames/emails are stored and can be referenced but these features were only added to learn more on how to actually do it. As such I will remove these features sometime in the future.

Features that were omitted from the current version include:

  • The ability for the user to manually enter weights and compare their inputs to the optimal weights
  • The ability to create an account and add past portfolios to your account
  • Comparing two separate portfolios on the same page
  • Individual asset linear regression analysis using Sklearn
  • Charts showing the 30day average, a correlation heat map, and an overlapping percent return histogram
  • Random walk simulations and visualizations

Initially all charts were rendered using MatPlotLib and Seaborn. All charts on the Analytics page are rendered using Chart JS. For the sake of time, not all charts and features initially written in python were implemented in the the website you see here today.

Math:

Programming:



Electrostatic Potential / Static Fields:

Math & Physics:

Programming:



Path Algorithms:

Math & Physics:

Programming: