@divyadesala Get historical api call using ONE_DAY as parameter. During or after trading hours last record shows Last date's OHLC & Vol
Posts made by onitahorner96
-
RE: Need volume data in getLTPdata apiposted in General Discussion
-
RE: Historical API Call returning Max 500 Records for any time frameposted in General Discussion
Date Range 2020-08-09 14:33 to 2022-10-18 14:33 Interval ONE_DAY
Date Open High Low Close Volume0 2020-10-13 00:00:00+05:30 170.45 174.90 169.75 173.25 9712363
1 2020-10-14 00:00:00+05:30 173.00 175.00 171.05 174.20 10704122
2 2020-10-15 00:00:00+05:30 174.90 178.25 171.70 173.65 19813787
3 2020-10-16 00:00:00+05:30 174.10 180.55 172.35 179.80 15546424
4 2020-10-19 00:00:00+05:30 181.00 183.85 177.70 182.70 17095601
.. ... ... ... ... ... ...
495 2022-10-12 00:00:00+05:30 398.05 401.40 391.75 400.20 6584165
496 2022-10-13 00:00:00+05:30 411.00 416.50 400.00 401.55 16563626
497 2022-10-14 00:00:00+05:30 411.25 411.25 396.40 397.15 6115863
498 2022-10-17 00:00:00+05:30 395.05 395.90 386.30 388.30 8964609
499 2022-10-18 00:00:00+05:30 391.50 398.40 391.35 392.95 5865887[500 rows x 6 columns]
Stock Name : HINDALCO-EQ -
Historical API Call returning Max 500 Records for any time frameposted in General Discussion
I have seen for any time frame historical api call whether 1 min data, 5 min data, 15 min data returning 500 Max rows of OHLC Data
Instead of what has been mentioned in this link below - https://smartapi.angelbroking.com/docs/Historical
Interval | Max Days in one Request
ONE_MINUTE 30
THREE_MINUTE 90
FIVE_MINUTE 90
TEN_MINUTE 90
FIFTEEN_MINUTE 180
THIRTY_MINUTE 180
ONE_HOUR 365
ONE_DAY 2000 -
RE: Access rateposted in General Discussion
@admin What is the recommended rate of Historical Data Fetch please mention.. Also some issue on it pls see the link here - https://smartapi.angelbroking.com/topic/2411/python-api-historical-data-fetch-became-arbitrary-dataframe-not-coming-after-totp-has-been-imposed
-
RE: Python API - Historical Data Fetch became arbitrary & DataFrame not coming after TOTP has been imposedposted in General Discussion
Sometimes TOTP working and sometimes failing shown here : https://smartapi.angelbroking.com/topic/2408/arbitrary-output-of-python-api-sometimes-totp-failing-and-also-historical-data-fetch-failing
-
Python API - Historical Data Fetch became arbitrary & DataFrame not coming after TOTP has been imposedposted in General Discussion
Historical Data Fetch became very arbitrary its not INTERNET connection problem. Yesterday night at 1 AM midnight all worked perfectly but today now during market hours now 10 AM around DataFrame not coming
The Code remained same as past before TOTP system using PYTHON
usr = SmartAPI(api_key,client_code,client_pass, totp)
if(usr.sessionData['status'] == True):
smartapiObj = usr.smartapiObj
else:
print("SmartAPI Object Session Data is not TRUE, exiting...")
exit()df = None
status = None
msg = None
stockObj = StockClass('NSE', symbol, token_mumber, smartapiObj)
df, status, msg = stockObj.getDF_Daily(no_of_candles, fromDate, todayDate)In the above code the class function stockObj.getDF_Daily() returns DataFrame only with status and message. All worked perfectly before TOTP. and in this function or class nothing about TOTP used. smartapiObj is generated using TOTP only
The Output shown by program
Checking NIFTY50 Stocks : Please wait..
Traceback (most recent call last):
File "E:\projects\python\talib-smartapi\mainOTP.py", line 108, in <module>
if df == None or df.empty : # if len(df.columns) == 0:
File "C:\python\python39\lib\site-packages\pandas\core\generic.py", line 1537,
in nonzero
raise ValueError(
ValueError: The truth value of a DataFrame is ambiguous. Use a.empty, a.bool(),
a.item(), a.any() or a.all(). -
RE: Arbitrary output of Python API - Sometimes TOTP failing and Also Historical data fetch failingposted in General Discussion
Historical Data Fetch became very arbitrary its not INTERNET connection problem. Yesterday night at 1 AM midnight all worked perfectly but today now during market hours now 10 AM around DataFrame not coming I have set a new TOPIC on it. Read the whole post here : https://smartapi.angelbroking.com/topic/2411/python-api-historical-data-fetch-became-arbitrary-dataframe-not-coming-after-totp-has-been-imposed
-
Arbitrary output of Python API - Sometimes TOTP failing and Also Historical data fetch failingposted in General Discussion
When I am running my program with TOTP with python API after 5 fail 6th time program runs as follows also Historical Data Fetch became very arbitrary and most of the time failing with TOTP new system
-
FAIL:
E:\projects\python>python mainOTP.py
Error Occurred in SMARTAPI : Invalid totp | PROGRAM ENDING... -
FAIL
E:\projects\python>python mainOTP.py
Error Occurred in SMARTAPI : Invalid totp | PROGRAM ENDING... -
FAIL
E:\projects\python>python mainOTP.py
Error Occurred in SMARTAPI : Invalid totp | PROGRAM ENDING... -
FAIL
E:\projects\python>python mainOTP.py
Error Occurred in SMARTAPI : Invalid totp | PROGRAM ENDING... -
FAIL
E:\projects\python>python mainOTP.py
Error Occurred in SMARTAPI : Invalid totp | PROGRAM ENDING... -
RUNS SUCCESS
E:\projects\python>python mainOTP.py
Choose Option :
Nifty50 Stocks type 1 ....
-
-
RE: Guide to secure your SmartAPI Account with two factor authenticationposted in General Discussion
@aj_Brk I have used similar code as given below , but got the following exception
Exception : Object of type TOTP is not JSON serializablebut then I solved the problem
But then I added last two lines and problem solved the last two lines given at the end of the following code- qrOtp is the code generated here : https://smartapi.angelbroking.com/enable-totp below the QR Code. So you have to generate your own qrOtp code here in this site. Then Install pyotp using command line "pip install pyotp"
My Code Below ( Last line totp = totp.now() is very important)
from smartapi import SmartConnect #or from smartapi.smartConnect import SmartConnect
import config
import pyotpclient_code = "aaaaaa"
client_pass = "bbbbbb"apiKey="yyyyyyy"
qrOtp = "xxxxxxxx"
totp = pyotp.TOTP(qrOtp)
totp = totp.now()smartapiObj =SmartConnect(apiKey)
data = smartapiObj.generateSession(client_code,client_pass,totp)
print(data) -
RE: Invalid TOTPposted in General Discussion
PyOtp was not working and I was getting the following error :
Error : Object of type TOTP is not JSON serializableBut then I added last two lines and problem solved the last two lines given at the end of the following code- qrOtp is the code generated here : https://smartapi.angelbroking.com/enable-totp below the QR Code
My Code Below
from smartapi import SmartConnect #or from smartapi.smartConnect import SmartConnect
import config
import pyotp------- Angel Account -----------------
client_code = "aaaaaa"
client_pass = "bbbbbb"apiKey="yyyyyyy"
qrOtp = "xxxxxxxx"
totp = pyotp.TOTP(qrOtp)
totp = totp.now()create object of call
smartapiObj =SmartConnect(apiKey)
login api call
data = smartapiObj.generateSession(client_code,client_pass,totp)
print(data) -
How to get websocket ohlc data on multiple stocks in pythonposted in Python SDK
Re: Comparing static price with websocket LTP
How to get websocket ohlc data on multiple stocks in python. Does it requires mutithread. Any sample code available!!!
How websocket data comes to client. I am not getting real feeling of it. I saw historical ohlc data but not websocket.
I have worked on historical ohlc data on daily and 5 min candles. I have got historical ohlc data attached to a datetime per row or record. But not getting any idea how websocket comes to client comparing historical ohlc.
In historical ohlc can get 5 min interval candle data. In real trading hour. How websocket improve it??
Does websocket data comes with time stamp. I have read docs on websocket streaming but that has no real feeling how frequently it will come.
Not getting good document on it. No video Also available.
-
RE: fetch banknifty index dataposted in Python SDK
@admin This is a 16MB File to refer anybody full of text/ Search a needle in haystack
-
RE: "YOUR USER ID OR PASSWORD IS INVALID","errorcode":"AB1007"posted in General Discussion
Problem in my account to login: When I am logging in Angel App using my USER / PASS working fine. But API showing 'status': False, 'message': 'Login Password has been Expired'when generating smartObj
Also API Key ACTIVE when I am logging in SMART API My Smart APIs & Apps (APP NAME API TYPE API KEY SECRET KEY STATUS)
Status ACTIVE for API Key
Now I am checking at night 12 Midnight..try:
# create object of call
smartapiObj =SmartConnect(api_key)# login api call data = smartapiObj.generateSession(client_code ,client_pass) print(data).......
{'status': False, 'message': 'Login Password has been Expired', 'errorcode': 'AB1035', 'data': {'jwtToken': '....
-
RE: Histocial data with a monthly intervalposted in General Discussion
@ananya weekly or monthly candles could have been helpful. I don't know why they don't provide it.
You have to generate it by python pandas resampling feature.
-
RE: Tick values are refreshing very slowly in websocket streaming.posted in Python SDK
@admin I saw this , filtered out stock equity info of 1522 stocks symbol and token to a JSON file, but didnot parsed FNO data yet because of too much strike prices , expiry data,
Saw different bank nifty , nifty strike, but could not find spot
Can you tell the symbol to FIND exact JSON record for NIFTY Bank NIFTY Spot -
RE: Tick values are refreshing very slowly in websocket streaming.posted in Python SDK
@admin What is SFI ? What is websocket's specialty over LTP or Historical API (Daily to 1 min)
Can we get many stock's data at once by multithreading?
-
What is WebSocket data necessity when we are getting historical api & LTPposted in General Discussion
Why is WebSocket data? What is its necessity when we are getting historical api & LTP, what more can be done with websocket data, can anybody explain
What is its specialty. Because I am new to websocket and I am getting LTP and last 1/5/15 Min Candle Data by Historical api
-
Clarification: Does historical api data during trading hour shows LTP/SPOT in Historical API's today's CLOSE recordposted in Python SDK
Clarification: Does historical api data during trading hour shows LTP/SPOT in Historical API's today's CLOSE record
Say today 23 August , 11 AM
Now I am fetching Historical API for last 10 days from today
So first record will be of today's OHLC Volume etcIs the 'CLOSE' value same as LTP or SPOT?
-
RE: Tick values are refreshing very slowly in websocket streaming.posted in Python SDK
@admin Can you show a sample code to get NIFTY/ BankNifty SPOT LTP Data. I think it always same, because NIFTY spot has no expiry
Query : Also can we get LTP of a premium related to a strike / expiry , e,g NIFTY 16000 CE 26 August 2021
Can we get LIVE premium ?
-
RE: Websocket to obtain Order Statusposted in Python SDK
@admin Which Package to Install in python for WebSocket, the modulename please
e.g pip install ..... ?