@skkarwasra02 It seems admin introduced this limitation to prohibit large data downloads. Earlier API allowed downloading 1min data of years too which might not be of much use. Also, it would be expensive for them as this is data-transfer-out from cloud and chargeable by cloud providers.
ashigro
@ashigro
Best posts made by ashigro
-
RE: Historical API Max Records:500
-
RE: Error in WebSocket 2.0: byte indices must be integers or slices, not str
<Error: SmartWebSocketV2._on_close() takes 2 positional arguments but 4 were given>
We can fix this error by updating _on_close method with additional arguments in SmartWebSocketV2.py file.
def _on_close(self, wsapp, close_status_code, close_msg):
This error is thrown because on_close method of websocket class takes multiple arguments which are missing in SmartWebSocket library. Example code:
https://websocket-client.readthedocs.io/en/latest/examples.html -
smartWebSocketV2:304] Error occurred during WebSocket connection: WebSocketApp.run_forever()
[E 240226 09:00:36 smartWebSocketV2:304] Error occurred during WebSocket connection: WebSocketApp.run_forever() got an unexpected keyword argument 'ping_payload'
Exception in thread Thread-8 (feed):
Traceback (most recent call last):
File "C:\Users\ashig\anaconda3\envs\trader-env\lib\threading.py", line 1016, in _bootstrap_inner
self.run()
File "C:\Users\ashig\anaconda3\envs\trader-env\lib\threading.py", line 953, in run
self._target(*self._args, **self._kwargs)
File "C:\Users\ashig\AppData\Local\Temp\ipykernel_11200\1613896697.py", line 325, in feed
File "C:\Users\ashig\anaconda3\envs\trader-env\lib\site-packages\SmartApi\smartWebSocketV2.py", line 305, in connect
raise e
File "C:\Users\ashig\anaconda3\envs\trader-env\lib\site-packages\SmartApi\smartWebSocketV2.py", line 301, in connect
self.wsapp.run_forever(sslopt={"cert_reqs": ssl.CERT_NONE}, ping_interval=self.HEART_BEAT_INTERVAL,
TypeError: WebSocketApp.run_forever() got an unexpected keyword argument 'ping_payload' -
RE: Not able to connect to the websocket, please help!
@Moderator_2
client code is MVY398
Latest posts made by ashigro
-
RE: Convert position error: 'Something went wrong. Please try after sometime', 'errorcode': 'AB1004'
@Moderator_2 , Please help. My auto trading on AngelOne is halted for months because convertPosition is not working.
I tried with postman as well, getting same error.{
"message": "Something went wrong. Please try after sometime",
"errorcode": "AB1004",
"status": false,
"data": null
} -
RE: Wrong LTP data
@bansal3amardeep I believe this is the case for all, even I am converting the incoming stream to decimal value in my code.
-
RE: Convert position error: 'Something went wrong. Please try after sometime', 'errorcode': 'AB1004'
@Moderator_2
No I have not used postman in past.
Client code is MVY398, convert position was issued multiple times between 11:00 am - 2:00 pm, script PAYTM. -
Convert position error: 'Something went wrong. Please try after sometime', 'errorcode': 'AB1004'
{'message': 'Something went wrong. Please try after sometime', 'errorcode': 'AB1004', 'status': False, 'data': None}
dict1 = obj.position() for stock in dict1['data']: if stock['symboltoken'] == '6705': stock['newproducttype']: 'INTRADAY' print(stock) posParameters = { "exchange": stock['exchange'], "symboltoken": stock['symboltoken'], "producttype": stock['producttype'], "newproducttype": "INTRADAY", "tradingsymbol": stock['tradingsymbol'], "symbolname": stock['symbolname'], "instrumenttype": stock['instrumenttype'], "priceden": stock['priceden'], "pricenum": stock['pricenum'], "genden": stock['genden'], "gennum": stock['gennum'], "precision": stock['precision'], "multiplier": stock['multiplier'], "boardlotsize": stock['boardlotsize'], "buyqty": stock['buyqty'], "sellqty": stock['sellqty'], "buyamount": stock['buyamount'], "sellamount": stock['sellamount'], "transactiontype": "BUY", "quantity": quantity, "type": "DAY" } status = obj.convertPosition(posParameters) print(status)
-
RE: smartWebSocketV2:304] Error occurred during WebSocket connection: WebSocketApp.run_forever()
@Moderator_1 Resolved the issue by using version numbers of dependencies mentioned in git repo. It seems there is some conflict with updated versions of any of the dependency packages.
Following requirements listed in requirements_dev.txt helped:
attrs==23.1.0
autobahn==23.6.2
Automat==22.10.0
certifi==2023.5.7
cffi==1.15.1
charset-normalizer==3.1.0
constantly==15.1.0
cryptography==41.0.5
hyperlink==21.0.0
idna==3.4
incremental==22.10.0
isodate==0.6.1
logzero==1.7.0
pycparser==2.21
pyotp==2.8.0
pyparsing==3.1.0
python-dateutil==2.8.2
pytz==2023.3
rdflib==6.3.2
rdflib-jsonld==0.6.2
requests==2.31.0
simplejson==3.19.1
six==1.16.0
Twisted==22.10.0
txaio==23.1.1
typing_extensions==4.6.3
urllib3==2.0.3
websocket-client==1.6.0
zope.interface==6.0 -
Fix smartapi-python requirements_dev.txt
correct smartapi-python version to 1.4.5
remove pycrypto
correct cryptography version to >=41.0.5Following errors are reported if using current requirements_dev.txt
ERROR: Could not find a version that satisfies the requirement smartapi-python==1.4.4 (from versions: 1.0.1, 1.0.2, 1.0.3, 1.0.3.1, 1.0.3.2, 1.0.3.3, 1.0.3.4, 1.0.4, 1.0.5, 1.0.5.1, 1.0.5.2, 1.0.5.3, 1.0.5.4, 1.0.5.5, 1.0.6, 1.1.0, 1.1.1, 1.2.0, 1.2.1, 1.2.2, 1.2.3, 1.2.4, 1.2.5, 1.2.6, 1.2.7, 1.2.8, 1.2.9, 1.3.0, 1.3.1, 1.3.4, 1.3.5, 1.3.6, 1.3.7, 1.3.8, 1.3.9, 1.4.0, 1.4.1, 1.4.5)
ERROR: No matching distribution found for smartapi-python==1.4.4ERROR: Could not build wheels for pycrypto, which is required to install pyproject.toml-based projects
ERROR: pip's dependency resolver does not currently take into account all the packages that are installed. This behaviour is the source of the following dependency conflicts.
pyopenssl 24.0.0 requires cryptography<43,>=41.0.5, but you have cryptography 41.0.1 which is incompatible.