Skip to content

prpercy/Trading-App-using-Python

Repository files navigation

XPLytics

Fintech bootcamp project 1


User would be able to trade stocks, perform stock / portfolio analysis and generate relevant reports.


Technologies

Program uses Python 3.10.6 version and Jupyter Lab

Program uses following libraries:

  • 'Pandas' library to work with dataframes and analyse timeseries data.
  • 'YFinance' API to download market data.
  • 'Numpy' library in integration with 'Pandas' to manipulate financial data.
  • 'MCForecastTools' file for Monte Carlo Simulations.
  • 'Panel' library for creating an interactive web dashboard.
  • 'Fire' and 'Questionary' library for Command Line Interface.
  • 'SQLAlchemy' toolkit for application development.
  • 'hvplot' and 'matlabplot' for data visualization.
  • 'statsmodels' for linear regression to calculate stock alphas

xxx


Installation Guide

Program requires following packages:

  • Hvplot (0.8.0 or above version)
  • sqlalchemy
  • yfinance
  • Panel

All programs needed for application usage can be installed using "pip or conda install" command in terminal.
'MCForecastTools' file must be in same folder as 'app.py' folder.
File directory can and should be downloaded/cloned to ensure proper file retrieval.


Usage

In terminal, open conda environment. Run python app.py Once inside authentication module, use arrow keys and enter key to choose if 'new' or 'returning' user. If 'new' user, then set up username and password.Screen Shot 2022-10-18 at 7 13 08 PM

After creating a username and password, or logging in, terminal will ask what you would like to do. WWYLTD

The first option available is Update Available Amount for Trading. This option allows you to update the funds in your account to use for buying stocks.

UAAFT

The next available option is to trade stocks. A buy/sell option will appear. For buying stocks, the terminal will prompt you to include the TICKER for the stock to be purchased. Followed by the amount of stocks to be purchased. Then, the portfolio will be updated. BUY2

To sell a stock, terminal will prompt you to include the Ticker for the stock from your portfolio to be sold. Followed by the amount of stocks to sell. Then, the portfolio will be updated.

SELL

The next available option is to perform Stock Analysis. The terminal will prompt to include a Ticker for stock to analyze.

STOCKANA

The panel dashboard will open promptly. In the dashboard, a chart with the correlation, volatility, Sharpe ratio, Sortino ratio, Covariance, Beta, and Alpha values can be viewed. The historical data for the past 5 years of stocks, portfolio, and markets were turned into a dataframe. By combining the closing price of each data frame, a 'returns' dataframe is created. Using the standard deviation, the annualized standard deviation can be calculated. From there, the rolling standard deviation for the past 30 days was calculated, which refers to the volatility. Once covariance and variance were calculated from returns, beta was calculated by dividing covariance/variance. Annualized average returns were calculated by taking the average of returns and multiplying by number of trading days. The sharpe and sortino ratios were calculated using the standard deviation and average of returns. Both sharpe and sortino ratios are both risk-adjusted evaluations, however the sortino ratio only factors in downside risk. By having both the sharpe and sortino ratio, we can evaluate both low and high volatility. Alpha was calculated by using 'statsmodel' for linear regression.

Screen Shot 2022-10-19 at 8 27 30 PM

The following option is to perform Portfolio Analysis. The Portfolio Analysis includes Monte-Carlo simulations performed for the user portfolio with weights calculated according to number of shares s/he holds.

Screen Shot 2022-10-20 at 2 47 58 PM

The remaining two options are "Delete User" and "Exit Application." The 'Delete' option allows you to delete your portfolio and username/password information. The 'Exit' options allows you to safely exit out of the application.

Screen Shot 2022-10-20 at 3 08 17 PM
Screen Shot 2022-10-20 at 3 08 11 PM

Contributors

Contributors are:

  1. Pravin Patil
  2. Esteban Lopez
  3. Jorge Villacreses
  4. [Liset Lopez]
  5. William Wolfenbarger

License

Open

About

Fintech bootcamp project 1

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 5