Skip to main content

Getting Started with Zerodha API using C#


Getting Started with Zerodha API

   In today's era, every thing is automated. now day's technology changing things rapidly. Many of us might have started imagination of automating the trades. This will be very interesting if you automate your trading action using your computer. If you planing to automate your trading, then here is some important information you may get.

  Zerodha offering API for trading purpose, with the help of  API you can place order, cancel, modify.
Zerodha Kite API V3 is very useful for automating trades. API is available in two forms one is Ticker which will give you tick data in market hours, another is historical API which will allow you to get old data.
 
   To subscribe Kite API you must have Zerodha Dmat Account. Once you got your account with Zerodha login/Signup to Kite Connect. You need to create app for API . Refer below image to create app. Fill the details. It will ask you to login your Kite Dmat account to link. So you can see this option in kite account. It will deduct monthly charges.





After completing above process you will able to start accessing API. To access API you need API KEY and API Secret. You need these will login to kite API. How To Start With Zerodha Kite api using C# programming. Zerodha already create simple console application for under standing usage of API   Git URL For kite App.
Using above information you can start your algo trading. I will adding more information and will create our own client to process normal trades using API.


If you need more information please post your question into comment section. if possible please share with you friends.


Thanks.


Comments

  1. Thanks Sunil. It is useful to start algo trading using zerodha.

    ReplyDelete
  2. Your welcome, Keep following i will be coming opening range break out strategy soon
    Happy Trading, Happy Coding

    ReplyDelete
  3. i have one excel sheet , is it possible to use api and trade in zerodha

    ReplyDelete
  4. Yes, using C# application you can process excel, but once you can check for amibroker they do deal trading with excel.

    ReplyDelete
  5. This is what I wrote to Zerodha....Will zerodha help me code my strategies using kite api
    Query

    I have no idea of coding....but create formulas (not conventional) and use them for trading (in Excel/Google Spreadsheets)...rely mostly on Google prices or NSE site...both of them are delayed data....suppose I ask for a simple formula to be created for me in API for me to able to punch orders directly whenever my formula gives buy/sell order.....its not like the usual stuffs...crossovers....etc etc Don't even know if its possible. What kind of costs are involved one time/recurring...for API...development of code....real time F&O data...etc etc Might sound crude.....like in websites there an admin section wherein one can keep adding things.....is it possible with APIs....The code will be something like a calculation (using some factors) that gives buy above and sell below kind of a thing....all I need is its automatically calculates after every interval (of my choice) and punches order when price reaches that level automatically.....the factors are SQRT of price value/adding subtracting some pre defined values/percentages....etc

    And the reply
    Hi Ashish,

    Thank you for writing to Rainmatter. The Kite connect API is for tech-savvy traders to build their own trade execution platform. With the API, you can stream live data, place/modify orders, fetch your order book, margin limits, etc. The API is charged Rs 2000 per API key per month. The historical API is an add-on to the Kite connect API and will be charged an additional Rs 2000 per API key per month. To access the API, you simply have to sign up here. For more details on the API, read the API documentation. All your technical queries can be posted on the developer forum.

    You can also check this link.

    Hope, I have answered your query. Kindly, write back if something needs more clarification.

    Regards,
    Hafsa

    Can you guide me so that I can manage this....regards
    amukh69[at]gmail[dot]com

    ReplyDelete
  6. Hi Ashish,
    Thanks for visiting my blog. Please check your email.

    ReplyDelete
  7. This is Krishnakant. I have a demat account with Zerodha. I have a requirement of automating my trades on a larger scale. I have no knowledge about coding and programming. What are the charges and how can i start using API connect to automate my trades

    ReplyDelete
  8. Hello Sir,

    Have you implemented ORB strategy. would you mind sharing the details of it.

    Thanks

    ReplyDelete
    Replies
    1. Hi Pintu,

      Honestly i did not tried it. I am just creating some basic setup where then i will apply such strategy. I will post once i done.



      Thanks for visiting

      Delete
  9. Hi Sunil
    I want to do a simple difference between last 5 minutes candle close value and current value for bank nifty future.

    I think I can use api to get previous 5 minutes candles close value and same for current price but how?

    Can anyone help me to get these 2 values?

    ReplyDelete
  10. Hi Ashuthinks,

    yes sure.
    To get data you need api for sure. As Zerodha provide api for historical and Ticker. if you have ticker data then you need to work on converting your ticks to atleast 1 min candle. Please have look at lib https://github.com/lppkarl/Trady
    This library help you to transform you tick data to candle.

    var transformedCandles = candles.Transform();

    var diff= transformedCandles.Last().Close -LTP;

    ReplyDelete
  11. thanks for reply hmm but instead of using Trady can i simply call 2 zerodha api calls?
    1st call will give me last 5 minutes candle close data and 2nd api call will give me LTP so that i can do difference easily? pls guide

    ReplyDelete
  12. but my issue is i will execute my azure function after every 5 minutes and want to read recent 5minute candle OHLC and base don that want to take trade? how is this possible if i tried to convert ticks into candle data.? pls guide

    ReplyDelete
  13. yes you can do that but it is not good approach, if you have ticker service on then you can always having latest data for every tick.
    you can persist and keep converting you data to candle. you can apply your logic or you can use above mention library.

    but yet I am not clear your trading strategy. if you found +ve difference between last candle and LTP then you are planning to take trad Buy/Sell then this wont work.

    you must back test your strategy. you must have key levels with you before placing trad.

    This trading strategy will not be good to go.

    ReplyDelete
  14. yea my strategy is simple i have support resistance values with me before market start I just want to check weather current 5 min candle close cross that value or not. but im confused what should be done to form a 5 minutes candle using tick data. it seems i need to run c# webjob continuously to read tick data and form a candle. hmm any help?

    ReplyDelete
  15. ok.
    you can check with historical api to get last candle and ticker service for latest data. once you have both you can check Diff.

    ReplyDelete
  16. you can share your code over email only , share only where you got stuck,
    if possible over the weekend i will check and let you know.

    sunilbrokerhedge@gmail.com

    ReplyDelete
  17. thanks let me share it with you , it will be great help :) thanks a lot

    ReplyDelete
  18. The knowledge through the post is very useful and provided me awesome knowledge and give a clearity. The fundadvisor can be a great source of knowledge for financial management.

    ReplyDelete
  19. its very cool and meaningful information than you
    HDFC bank share price

    ReplyDelete
  20. Let's connect and create good system
    9921668368

    ReplyDelete

Post a Comment

Popular posts from this blog

How to generate the request_token for zerodha api using C#

Zerodha Kite Api How login Zerodha api using C# application? Hi Friends, recently i have started create application for zerodha api to make my own client for trading. Many of us have question how to login and trade using our custom C# application. I also face same problem i was looking solution for the same but  i was not able to fine exact way of doing it. I have gone through zerodha api document  According to them we need web view to make us to work this. Please follow be steps to get login token for API. Steps : 1) Creaet your login URL which is kite login + API key  eg.   var kiteURL="https://kite.trade/connect/login?v=3&api_key="    var apiKey="xpma3rmciorheitb"     2) Add web Browser to you web form set below properties             webBrowser1.AllowNavigation = true;             webBrowser1.ScriptErrorsSuppressed = true;             webBrowser1.Navigate(new Uri(kiteURL+apiKey)); 3) Now you need to register event "webBrowser1_

How to Fetch Data Tick from Kite Connect API (Nifty50)

Get Nifty50 data from Zerodha API In Last blog we discuss about how to generate request token and now we are going to look how to get data from Kite Connect. Here we will subscribe Nifty50. We will go step by step If you have code from zerodha official  git hub we can start further if not you get it from my previous blog "Getting Started with Zerodha " 1) We need list of Nifty50 stock which below Can verify this list on NSE India site. Below is json which you can use you code. if need we can key value pair using it. var stocks= [{"instrumenttoken" :3861249, "tradingsymbol" : "ADANIPORTS"}, {"instrumenttoken" :60417, "tradingsymbol" : "ASIANPAINT"}, {"instrumenttoken" :1510401, "tradingsymbol" : "AXISBANK"}, {"instrumenttoken" :4267265, "tradingsymbol" : "BAJAJ-AUTO"}, {"instrumenttoken" :4268801, "tradingsymbol" : "BAJA