diff options
Diffstat (limited to 'api.py')
-rw-r--r-- | api.py | 10 |
1 files changed, 5 insertions, 5 deletions
@@ -150,14 +150,14 @@ def fetch_chart_data_yahoo(ticker='ADA-USD', interval='1m', period_end_date=None if period_end_date == None: period_end_date = datetime.now() if period_length == None: - period_length = timedelta(days=5) + period_length = timedelta(days=8) # cast to int to truncate the decimal period2 = int(datetime.timestamp(period_end_date)) # find the first period via subtracting the period length period1 = int(datetime.timestamp(period_end_date - period_length)) - print(datetime.isoformat(datetime.fromtimestamp(period2)), datetime.isoformat(datetime.fromtimestamp(period1))) + # print(datetime.isoformat(datetime.fromtimestamp(period2)), datetime.isoformat(datetime.fromtimestamp(period1))) params = { 'period1' : period1, # the start date (in epoch time) @@ -170,8 +170,8 @@ def fetch_chart_data_yahoo(ticker='ADA-USD', interval='1m', period_end_date=None headers = {'User-agent' : 'fin-backtesting-proj'} r = requests.get("https://query2.finance.yahoo.com/v8/finance/chart/" + ticker, headers=headers, params=params) - print(r.url) - print("status_code:\t", r.status_code) + # print(r.url) + # print("status_code:\t", r.status_code) # decode the JSON response data into a Python object try: @@ -209,4 +209,4 @@ def fetch_chart_data_yahoo(ticker='ADA-USD', interval='1m', period_end_date=None def test(): fetch_chart_data_backtest() -test()
\ No newline at end of file +# test()
\ No newline at end of file |