Add example of retrieving / streaming historical data
This commit is contained in:
parent
42e4641cf3
commit
b06a407109
18
historical_data_example.py
Normal file
18
historical_data_example.py
Normal file
@ -0,0 +1,18 @@
|
||||
from datetime import datetime, timedelta
|
||||
from dotenv import load_dotenv
|
||||
from os import getenv
|
||||
from tastytrade import Tastytrade
|
||||
|
||||
load_dotenv()
|
||||
account = getenv("TASTYTRADE_ACCOUNT")
|
||||
username = getenv("TASTYTRADE_USERNAME")
|
||||
password = getenv("TASTYTRADE_PASSWORD")
|
||||
|
||||
tastytrade = Tastytrade(username, password)
|
||||
tastytrade.login()
|
||||
|
||||
tastytrade.stream_historical_data(
|
||||
symbol = 'SPX',
|
||||
period = 1, type = 'd',
|
||||
from_time = datetime.now() - timedelta(days = 365)
|
||||
)
|
Loading…
Reference in New Issue
Block a user