This repo contains several ongoing financial market projects implemented Python(Version 3.6.2).
Last Updated: 7/12/2020
NOTES:
- NOT FINANCIAL ADVICE; IF YOU ARE TO USE THESE PROGRAMS TO MAKE FINANCIAL DECISIONS IT WILL BE DONE AT YOUR OWN RISK.
- You will only witness stock and forex quotes update during market open hours/days,
this does not apply to cryptocurrency quotes. - You will need your own Alpaca & AlphaVantage API keys. I keep mine in a local 'confing.py/js' files
- This folder contains projects from analyzing various strategies I plan to use on a paper account with Alpaca
- main.py executes the backtest, 3 arguments needed unless you delete [ticker] in the tData[] list which then allows the program
to iterates through the uncommented tickers in tData.
- 1st argument is the ticker (unless commented)
- 2nd argument is the number of shares (shares > 0) NOTE: this is the 1st argument if ticker is disabled
- 3rd argument is the initial account balance for each backtest (balance > 0) NOTE: this is the 2nd argument if ticker is disabled
- Example Usage w/ 3 arguments): main.py spy 1 1000 /li>
- Example Usage w/ 2 arguments): main.py 1 1000
- stragegies.py are the 4 strategies I've implemented a backtest for
- analysis.py in this folder is different than the one in the outer/root repo; contains staistics helpers for strategies.py
- alpaca_util.py contains several functions that work with alpaca_trade_api.REST accounts
- I have a file data.txt where I output the results to as a whitespace-delimited file
- Dependencies: Pandas, alpaca_trade_api, alpha_vantage, matplotlib
- Simple script which uses Alpaca's JavaScript API wrapper for account information and the ability to trade(paper or live)
- Needs a config.js file which contains your API keys and correctly imports them as this is written with Node.js in mind
- Demo configuration file for Alpaca & AlphaVantage API keys
- Demo configuration file for Alpaca & AlphaVantage api keys
- Uses Object.defineProperty to stay within boundaries of Node.js for exporting constants
- A python module of functions used for technical analysis.
- Contains:
- Typial & Average price
- Simple/Exponential/Double-Exponential Moving Averages
- ROC Indicator
- Standard Deviation over time
- True Strength Index
- Commodity Channel Index
- Dependencies: Pandas
- Fetches single stock/ETF quote via marketwatch.com
- 1st and only argument is the ticker/symbol of desired stock
- Example Usage: "stock_quote.py spy"
- Dependencies: BeautifulSoup
- Fetches multitude of stock/ETF quotes via marketwatch.com
- 1st argument is the ticker/symbol of desired stock
- 2nd argument is the number of quotes
- Example Usage: "stock_quote_stream.py spy 100"
- Dependencies: BeautifulSoup
- Utilizes the alpha_vantage.TimeSeries module to generate a chart for specified ticker/symbol
- Constructs daily close price chart with various moving averages for the dedsired stock/ETF
- 1st and only argument is the ticker/symbol
- Example Usage: "stock_chart.py spy"
- Dependencies: Pandas, Matplotlib, alpha_vantage
- Fetches single cryptocurrency quote via marketwatch.com
- 1st argument is the foreign currency symbol
- 2nd argument is the relative currency for the quote
- Example Usage: "crypto_quote.py btc usd"
- Dependencies: BeautifulSoup
- Fetches multitude of cryptocurrency quotes via marketwatch.com
- 1st argument is the symbol of desired cryptocurrency
- 2nd argument is the relative currency for the quotes
- 3rd argument is the number of quotes
- Example Usage: "crypto_quote_stream.py btc usd 100"
- Dependencies: BeautifulSoup
- Utilizes the alpha_vantage.CryptoCurrencies module to genereate a chart for specified coin and currency
- Constructs daily close price chart with various moving averages for desired cryptocurrency
- 1st argument is the symbol of desired cryptocurrency
- 2nd argument is the relative currency
- Example Usage: "crypto_chart.py btc usd"
- Dependencies: Pandas, Matplotlib, alpha_vantage
- Fetches single foreign exchange cross quote via marketwatch.com
- 1st argument is the foreign currency symbol
- 2nd argument is the domestic currency symbol
- Example Usage: "forex_quote.py eur usd"
- Dependencies: BeautifulSoup
- Fetches multitude of foreign exchange quotes via marketwatch.com
- 1st argument is the foreign currency symbol
- 2nd argument is the domestic currency symbol
- 3rd argument is the number of quotes
- Example Usage: "forex_quote_stream.py eur usd 100"
- Dependencies: BeautifulSoup
- Utilizes the alpha_vantage.ForeignExchange module to generate a chart for specified forex pair
- Constructs daily close price chart with various moving averages for the desired currency crossing
- 1st argument is the foreign currency symbol
- 2nd argument is the domestic currency symbol
- Example Usage: "forex_chart.py eur usd"
- Dependencies: Pandas, Matplotlib, alpha_vantage
- Gold/Silver Ratio (XAU/XAG) using GLDM and SLV ETFs (Short lookback period)
- When the XAU/XAG increases, Gold strengthens relative to Silver
- When the XAU/XAG decreases, Silver strengthens relative to Gold
- Dependencies: Pandas, Matplotlib, alpha_vantage
- Bitcoin/Ethereum Ratio (BTC/ETH) using BTC/USD and ETH/USD
- When BTC/USD increases, Bitcoin strengthens relative to Ethereum
- When BTC/USD decreases, Ethereum strengthens relative to Bitcoin and other Altcoins tend to strengthen too.
- Dependencies: Pandas, Matplotlib, alpha_vantage
- Bitcoin/Tezos Ratio (BTC/XTZ) using BTC/USD and XTZ/USD
- Dependencies: Pandas, Matplotlib, alpha_vantage
- Rough implementation of the Black-Scholes options pricing model
- Also contains implementations for 'greeks' or derivatives of Black-Scholes partial differential equation
- Dependencies: Scipy, Numpy, Matplotlib
- Extracts the CBOE Put/Call Ratio from https://ycharts.com/indicators/cboe_equity_put_call_ratio
- Dependencies: BeautifulSoup