Get historical data not accepting parameters start_time and end_time

Mayank S. shared this problem 6 months ago
Not a Problem

The function get historical data gives the error : "Unexpected Additional Parameter"

Code is as follows:

Hist= td_obj.get_historic_data("symbol", bars= "5 mins", start_time= datetime(2020, 8, 2, 9, 30,0), end_time=datetime(2020,8,2,15,30,0)

Pls give a solution for the above error, I have sent this error earlier also and asked the question......the solution provided by the support team did not work.

Pls give a working solution asap

Comments (1)

photo
1

In the code, you have written the error is in the "symbol".

Here, the "symbol", is no more a variable but you are asking for the data of a stock whose name is 'symbol'.

I am guessing removing the quotes on either side of the symbol should solve it for you.

Here are the other options to call historic data:-

symbol = 'NIFTY-I'
barsize = '1min'
hist_data_1 = td_app.get_historic_data(symbol)
hist_data_2 = td_app.get_historic_data(symbol, bar_size=barsize)
hist_data_3 = td_app.get_historic_data(symbol, duration='1 D', bar_size=barsize)
hist_data_4 = td_app.get_historic_data(symbol, start_time=datetime.datetime(2020, 8, 4, 0, 0, 0), bar_size=barsize) end_time=datetime.datetime(2020, 8, 5, 9, 15, 20)
hist_data_5=td_app.get_n_historical_bars(symbol, no_of_bars=10, bar_size=barsize)

Leave a Comment
 
Attach a file