osparamatrix / ks-orderapi-python

47 stars 59 forks source link

Instrument code? #24

Open imvinaypatil opened 3 years ago

imvinaypatil commented 3 years ago

What's the api to get instrument code by symbol ?

imSyntaxError commented 3 years ago

I have literally the same question. How to get Instrument tokens and Symbols to completely automate python trading script...? If there's any website link to scrap for the Instrument Tokens and Symbols DataFrame or any function to be called.. Please developers tell us. Thanks a lot for helping

nishu88 commented 3 years ago

https://gist.github.com/nishu88/428c5ea4adb8a58d93bdfa13c4a6bb9d

Feel free to follow ;)

imvinaypatil commented 3 years ago

Awesome! Thanks for sharing.

automation-dv commented 3 years ago

@nishu88 Kotak api is not working. I am getting below error: HTTP Server Error 503 No available server to handle this request

Can you pls check at your end once? Thanks

nishu88 commented 3 years ago

I'm not sure about that. The instrument list is working right? https://preferred.kotaksecurities.com/security/production/TradeApiInstruments_FNO_02_07_2021.txt

bhushanjawle commented 3 years ago

Thank you @nishu88 . @automation-dv assuming you are using right date and expiry (I changed it in code) you would need to change the parameter passed to split to "\n" instead of default space and the above code will work i.e. r = r.text.split("\n") instead of r = r.text.split()

automation-dv commented 3 years ago

I'm not sure about that. The instrument list is working right? https://preferred.kotaksecurities.com/security/production/TradeApiInstruments_FNO_02_07_2021.txt

@nishu88 @bhushanjawle It was not working last night. It's working for me today. May be their page was down. Thanks..

nishu88 commented 3 years ago

@bhushanjawle @thebhushanp Hi Sir, I could not find the instrument code for NIFTY SPOT and BANKNIFTY SPOT price. Do you have any idea where to find it? or whats its instrument code?

kalilinux-png commented 3 years ago

i would like to know that if by mistake i use the wrong date will i get the wrong Instrument Code bcz i don't have to anything with other information

Wadia-007 commented 3 years ago

Once the instrument code is assigned to any instrument then will it be valid till its expiry or it may change on any day...?

kalilinux-png commented 3 years ago

@Wadia-007 got it Thanks brother

Wadia-007 commented 3 years ago

@Wadia-007 got it Thanks brother

I was asking a question plz read it again...!

WhiteBlackGray commented 3 years ago

import requests

headers = { 'accept': 'application/json', 'consumerKey': 'ConsumerKey', 'Authorization': 'Bearer APIAccessToken', }

response = requests.get('https://tradeapi.kotaksecurities.com/apim/scripmaster/1.1/filename', headers=headers)

nishu88 commented 3 years ago

@WhiteBlackGray what's the response from this request?