diff --git a/refresh.py b/refresh.py new file mode 100644 index 00000000..9c067816 --- /dev/null +++ b/refresh.py @@ -0,0 +1,26 @@ +import os, csv, sys +import talib +import yfinance as yf +import pandas +from flask import Flask, escape, request, render_template +from patterns import candlestick_patterns +import datetime + +if __name__ == '__main__': + if(len(sys.argv)<2): + sys.exit('Usage: '+__file__+" [all|symbol]") + symbol = sys.argv[1] + + if(symbol and symbol != 'all'): + data = yf.download(symbol, start="2020-01-01", end=datetime.date.today()) + data.to_csv('datasets/daily/{}.csv'.format(symbol)) + + if(symbol == 'all'): + with open('datasets/symbols.csv') as f: + for line in f: + if "," not in line: + continue + symbol = line.split(",")[0] + data = yf.download(symbol, start="2020-01-01", end=datetime.date.today()) + data.to_csv('datasets/daily/{}.csv'.format(symbol)) +