- Python 3.5.2 +
- pip 3+
- virtualenv (optional, but recommended)
pip3 install tweepy
pip3 install pandas
pip3 install flask
pip3 install pytest
pip3 install PyGithub
git clone
this repo.- Create a
secrets.py
file at the root - Place your
consumer_key = 'XXXX'
in thesecrets.py
- Place your
consumer_secret = 'XXX'
in thesecrets.py
- Modify the
twitter_tickers.py
for all the stocks/twitter accounts you care about
python twitter_tweets_retrieval.py
will retrieve pull all tweets from stock accounts and place them in individual .json files + csv (for backup).python retrieve_stock_prices.py
will pull the stock prices from morningstar and store it indatasets/prices.csv
python twitter_sentiment.py
will organize the tweets and calculate the twitter sentimentpython portfolio_calculator.py
will determine buy or sells and record the backtesting. Note: Portfolio starts at 1M and you can only buy/sell 100 shares of each stock at a given timepython query_app.py
will run a simple REST-based flask micro webservice on127.0.0.1:5000
utilizing thequery.py
module
http://127.0.0.1:5000/backtesting/api/v1.0/results/portfolio_balance/maxdrawdown
will calculate the max drawdown percentagehttp://127.0.0.1:5000/backtesting/api/v1.0/results/portfolio_balance/netgainloss
will calculate the net/gain loss percentagehttp://127.0.0.1:5000/backtesting/api/v1.0/results/portfolio_balance/YYYY-MM-DD
will calculate the balance on a given date
pytest --cov=. .
git clone <repo>
you want to monitor (i.e.git clone https://github.com/SxMShaDoW/backtesting-example/
- Copy the
cicd_github_monitor.py
inside the repo (already there in this case) - Create a
secrets.py
file (if it doesn't already exist) - Place your
github_token = 'XXX'
in thesecrets.py
- Modify the repo you want to monitor in
cicd_github_monitor.py
(Line 13) (blockchain-example
) - Run
python cicd_github_monitor.py