18 lines
470 B
Python
18 lines
470 B
Python
|
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)
|
||
|
)
|