Announcing Top Gainers/ Losers, PCR and OI BuildUp APIs for SmartAPI Users
-
Hello @SIMAMONDAL
Please go through the below link to get the idea
https://github.com/angel-one/smartapi-python
Regards,
SmartAPI Team -
Is it still not working for you?
Since you're getting Invalid API key error, can you please confirm that you're able to consume other APIs? Click here -
I got a question after going through the documentation of smart-api websocket2.0.
Question: Can we get top gainers/losers through the websocket ?
Is this currently supported ?Can some one kindly address my question. Thanks!
-
@omcv It is not supported via websocket.
-
@Moderator_1 Hi Team, I am also getting the same error.
Response: {'success': False, 'message': 'Invalid API Key', 'errorCode': 'AG8004', 'data': ''}.
Below is the code I tried. Could you please helpimport requests
Define the API endpoint
url = "https://apiconnect.angelbroking.com/rest/secure/angelbroking/marketData/v1/gainersLosers"
Define the headers (replace with actual values as required)
headers = {
"Authorization": "Bearer eyJhbGciOiJIUzxxxxxxx", #token
"Content-Type": "application/json",
"Accept": "application/json"
}Define the request packet
payload = {
"datatype": "PercPriceGainers", # datatype
"expirytype": "NEAR" # expiry type
}Send the POST request
response = requests.post(url, headers=headers, json=payload)
Check the response
if response.status_code == 200:
print("Request Successful")
print("Response:", response.json())
else:
print(f"Request Failed with status code {response.status_code}")
print("Response:", response.text) -
PercPriceGainers , PercOIGainers , Long Built Up are showing negative stocks. The data is not valid data
-
Top gainers and loosers are displaying wrong values. Long build up is returning wrong value.
-
hello @Moderator_1
I am getting an error AB1004 when the datatype = PercPriceGainers. Other datatypes PercOIGainers, PercOILosers, PercPriceLosers all working fine
login_obj = user_details['obj']
params = {
"datatype": "PercPriceGainers",
"expirytype": "NEAR"
}print(login_obj.gainersLosers(params))
{'message': 'Something Went Wrong, Please Try After Sometime', 'errorcode': 'AB1004', 'status': False, 'data': None}
This was working fine till yesterday.
-
Am I the only one encountering this error? Why am I experiencing this issue only with 'PercPriceGainers' and not with 'PercPriceLosers'?
This has been happening since yesterday; it was working perfectly fine before that.
@Moderator_1 @Moderator_2 @Moderator_3, @Moderator_4 , could you please respond to this?
[E 250128 10:19:46 smartConnect:242] Error occurred while making a POST request to https://apiconnect.angelbroking.com/rest/secure/angelbroking/marketData/v1/gainersLosers. Error: Something Went Wrong, Please Try After Sometime. URL: https://apiconnect.angelbroking.com/rest/secure/angelbroking/marketData/v1/gainersLosers, Headers: {'Content-type': 'application/json', 'X-ClientLocalIP': '127.0.0.1', 'X-ClientPublicIP': '106.193.147.98', 'X-MACAddress': '87:9e:2a:03:ef:88', 'Accept': 'application/json', 'X-PrivateKey': 'hidden', 'X-UserType': 'USER', 'X-SourceID': 'WEB'}, Request: {'datatype': 'PercPriceGainers', 'expirytype': 'NEAR'}, Response: {'message': 'Something Went Wrong, Please Try After Sometime', 'errorcode': 'AB1004', 'status': False, 'data': None}
-