This commit is contained in:
wassname
2022-07-16 15:41:36 +08:00
parent 47ea8722ff
commit e0931585df
12 changed files with 1626 additions and 6 deletions
+2 -2
View File
@@ -10,7 +10,7 @@ def GetStockData(symbols, interval='day', span='5year'):
load_dotenv()
username = os.getenv("robinhood_username")
password = os.getenv("robinhood_password")
r.login(username, password);
r.login(username, password)
data = pd.DataFrame(r.stocks.get_stock_historicals(symbols, interval, span))
data['date'] = pd.to_datetime(data['begins_at'], format='%Y-%m-%d').dt.date
@@ -19,4 +19,4 @@ def GetStockData(symbols, interval='day', span='5year'):
data[ohlc] = data[ohlc].astype("float")
return data[['date', 'symbol', 'open_price', 'close_price',
'high_price', 'low_price']]
'high_price', 'low_price']]