algo2t / alphatrade

Python APIs for SAS Online Alpha Trade Web platform for creating algo trading using python
https://algo2t.github.io/alphatrade
MIT License
45 stars 25 forks source link

Getting the Intraday data and the historical data together for Talib Library #39

Open parthshah19 opened 2 years ago

parthshah19 commented 2 years ago

fetching the data for this

from datetime import datetime nifty_bank_nse_index = sas.get_instrument_by_symbol('NSE', 'Nifty Bank') print(sas.get_intraday_candles(nifty_bank_nse_index.exchange, nifty_bank_nse_index.symbol, datetime(2020, 10, 19), datetime.now(), interval=10))

is giving error of number of arguments here ! i guesss there is an issue ! getting the historical as well as intraday in this code : get_intraday_candles() takes from 3 to 4 positional arguments but 6 were given get_intraday_candles() got multiple values for argument 'interval'

algo2t commented 2 years ago

Documentation needs an update, please use below code to get the historical candles.


nifty_bank_nse_index = sas.get_instrument_by_symbol('NSE', 'Nifty Bank')
# print(nifty_bank_nse_index)
print(sas.history(nifty_bank_nse_index, datetime(2022, 2, 2, 9, 15, 0), datetime.now(), interval=30, is_index=True))

output

                        open      high       low     close  volume
datetime
2022-02-02 09:15:00  38841.55  39105.00  38760.85  39016.75       0
2022-02-02 09:45:00  39019.35  39164.10  38983.40  39136.00       0
2022-02-02 10:15:00  39134.25  39176.60  38991.45  39044.30       0
2022-02-02 10:45:00  39044.05  39166.95  39040.00  39123.25       0
2022-02-02 11:15:00  39123.80  39163.65  39093.35  39161.70       0
...                       ...       ...       ...       ...     ...
2022-04-01 13:15:00  36939.40  37028.40  36937.50  37013.25       0
2022-04-01 13:45:00  37012.90  37090.15  36990.95  37074.00       0
2022-04-01 14:15:00  37075.80  37145.10  37067.60  37098.75       0
2022-04-01 14:45:00  37100.15  37139.15  37042.65  37124.80       0
2022-04-01 15:15:00  37126.70  37201.75  37110.55  37158.90       0

[533 rows x 5 columns]

Will keep this issue open till documentation is fixed

parthshah19 commented 2 years ago

Does this include the Historical data with the Intraday data in it ?

himanshuevents commented 2 years ago

Try it yourself. Be clear on one thing. Historical Data and Intraday data is one and same thing. WebSocket data is different. In here, if market is live and you fetch data using history command say at 10 am then it is called as intraday data if the candles are from 9:15 to 10 am. Everything else like yesterday and last 1 month or 1 year is historical data.