.Net client library (3rd party) released

Kailash
Kite Connect developer (@botany) has developed a .Net interface for Kite Connect and open sourced it.

The library and the documentation are available here: https://howutrade.in/downloads-page/

A tutorial is available on Youtube.
  • botany02
    botany02 edited October 2016
    To All Forum Members,
    A Sample App Built with KiteDotNet contributed @ https://github.com/HowUTrade/KiteDotNet
  • Ganesh
    @Kailash

    I have installed the .Net Library and it looks good. I am able to establish connection however I don't see any option to get Historic data. The .net wrapper as functions is available for all the Kite APIs except Historical Data. Am I missing something or that is not implemented at all?

    If that is not available when is the plan to add it? As without the historical data no strategy can be implemented :-(
  • botany02
    botany02 edited October 2016
    @Ganesh
    Present version doesn't support historical API.
    We 'll be adding it in coming days and let you know once done.
  • Ganesh
    @botany02
    That's unfortunate :-(, that was the primary feature I was looking for. Do you have any planned dates by when this will be implemented?

    I really want to stick to .Net instead of Python but need to know how long the wait is going to be before I take the decision.

    Thanks,
    Ganesh
  • botany02
    botany02 edited October 2016
    @Ganesh
    We will release updated library on Monday.
  • Ganesh
    @botany02

    Thanks for the update, I was trying to take the latest update however I am getting access denied error. See the error below :( . Please suggest.

    I got this error for the below url:

    http://www.howutrade.in/docs/kitedotnet/html/KiteDotNet.zip

    Server Error

    401 - Unauthorized: Access is denied due to invalid credentials.
    You do not have permission to view this directory or page using the credentials that you supplied.

    Earlier I had downloaded the previous version so I guess something is wrong with permission. Can you fix it or suggest alternate to get the updated release?

    Thanks,
    Ganesh
  • botany02
    @Ganesh
    We have fixed this.
    Could pls try now....?
  • botany02
    @Ganesh
    We added two Methods for Historical Data.
    (1) GetHistData()
    (2) GetHistDataField()

    GetHistData:-
    This will return array of string.
    Each element in the array represent single DOHLCV seperated by comma.
    Below is the example how to loop

     Dim Fromdt As Date = New Date(2016, 10, 25) '25 Oct 2016
    Dim Todt As Date = Today() 'Till Today

    Dim HistData As String() = Kite.GetHistData("NSE", "AXISBANK", "minute", Fromdt, Todt)

    For Each s As String In HistData 'Looping through each Bar/DOHLCV
    '2016-01-01 13:30:00,1392.95,1393,1392,1392.15,1869
    Dim fields() As String = s.Split(New String() {","}, StringSplitOptions.None) 'Just Splitting to Get the Values

    Dim ddtt As Date = Date.ParseExact(fields(0), "yyyy-MM-dd HH:mm:ss", CultureInfo.InvariantCulture)
    Dim Op As Double
    Dim Hi As Double
    Dim Lo As Double
    Dim Cl As Double
    Dim Vol As Integer

    Double.TryParse(fields(1), Op)
    Double.TryParse(fields(2), Hi)
    Double.TryParse(fields(3), Lo)
    Double.TryParse(fields(4), Cl)
    Integer.TryParse(fields(5), Vol)

    'Now We have all Price Fields icluding the Time Stamp
    'ToDo....Your Trading System Logic Goes here

    Next



    GetHistDataField:- 'This can be useful where you only Require particular Price
    This will return array of double
    Each element in the array represent represent the requested Price Field.
    Below is the example how to loop

     Dim Fromdt As Date = New Date(2016, 10, 25) '25 Oct 2016
    Dim Todt As Date = Today() 'Till Today

    Dim HistDataClose As Double() = Kite.GetHistDataField("NSE", "AXISBANK", "minute", Fromdt, Todt, "Close")
    '{1360.15,1361.25,1360.25}

    For Each cl In HistDataClose 'Looping through Close Price

    'Now We have all Close Price
    'ToDo....Your Trading System Logic Goes here

    Next


  • Ganesh
    Thanks @botany02

    I am able to download now. I am implementing this with TA-Lib. I am looking at 5 minute interval data for past 30 days to as of current time to be passed to TA-Lib for performing trading system logic.I will seek help if I hit a road block.

    Ganesh
  • Ganesh
    Ganesh edited November 2016
    Can you please confirm Symbol Code for commodities?
  • botany02
    @Ganesh
    The GetInstruments call will download the symbol & write in a text file at your app folder.
    SymbolList_MCX.txt.

    Anyway..here is the list.
    LEAD17JANFUT
    NATURALGAS16OCTFUT
    ALMOCTNO1616OCTFUT
    SLMFEBAP1717FEBFUT
    SLMNOVAP1716NOVFUT
    ZIMOCTNO1616OCTFUT
    ZINOCTNO1616OCTFUT
    NICKEL17JANFUT
    NICKELM17JANFUT
    SILVER100017AUGFUT
    LEADMINI17JANFUT
    CRMNOVDE1616NOVFUT
    CRUDEOIL17MARFUT
    GOLD16DECFUT
    CPO16OCTFUT
    CARDAMOM16NOVFUT
    COTNOVDE1616NOVFUT
    COTOCTDE1616OCTFUT
    GOLDGUINEA16NOVFUT
    GOLDPETAL16NOVFUT
    GOLDPTLDEL16NOVFUT
    LEAD16DECFUT
    LEADMINI16DECFUT
    LEMOCTNO1616OCTFUT
    MENTHAOIL16DECFUT
    NICOCTNO1616OCTFUT
    CPPNOVAP1716NOVFUT
    ALUMINIUM17JANFUT
    COPPER17APRFUT
    COPPERM17APRFUT
    COTTON17FEBFUT
    GOLDPTLDEL16DECFUT
    ZINC17JANFUT
    ZINCMINI17JANFUT
    CPMFEBAP1717FEBFUT
    CRUDEOILM17MARFUT
    KAPAS17MARFUT
    ZIMNOVDE1616NOVFUT
    ZIMOCTDE1616OCTFUT
    ZINNOVDE1616NOVFUT
    ZINOCTDE1616OCTFUT
    MENTHAOIL17JANFUT
    GLDDECAP1716DECFUT
    SILVERM17APRFUT
    CRUDEOIL16NOVFUT
    ALUMINIUM16OCTFUT
    ALUMINIUM16DECFUT
    GOLD17AUGFUT
    ZINCMINI16DECFUT
    CARDAMOM17JANFUT
    COTTON17JANFUT
    CPO16DECFUT
    ZINC16DECFUT
    SILVERM16NOVFUT
    GOLD17JUNFUT
    MENTHAOIL16NOVFUT
    NICKEL16DECFUT
    NICKELM16DECFUT
    SILVER100017JULFUT
    SILVERMIC17APRFUT
    LEDOCTNO1616OCTFUT
    SILVER17MARFUT
    SILVERM17FEBFUT
    SILVER100016DECFUT
    SILVER100016OCTFUT
    GOLD17FEBFUT
    SILVER100016NOVFUT
    BRCRUDEOIL16OCTFUT
    SILVER100017FEBFUT
    SILVERMIC16NOVFUT
    COTOCTNO1616OCTFUT
    COPPER17FEBFUT
    COPPERM17FEBFUT
    ALUMINI16NOVFUT
    ALUMINIUM16NOVFUT
    CPO16NOVFUT
    CRUDEOIL16DECFUT
    CRUDEOILM16DECFUT
    SILVER100017MARFUT
    GOLD17APRFUT
    BRCRUDEOIL16DECFUT
    CRDNOVDE1616NOVFUT
    CPMNOVFE1716NOVFUT
    CPPNOVFE1716NOVFUT
    GOLDGUINEA16OCTFUT
    GOLDPETAL16OCTFUT
    SLVDECMA1716DECFUT
    COTTON16NOVFUT
    COTTON16DECFUT
    ALUMINI16OCTFUT
    NATURALGAS16DECFUT
    NTGNOVDE1616NOVFUT
    NTGOCTDE1616OCTFUT
    CARDAMOM17FEBFUT
    SILVER17SEPFUT
    SILVERM17AUGFUT
    ALUOCTNO1616OCTFUT
    CPOOCTNO1616OCTFUT
    NIMOCTNO1616OCTFUT
    GLDDECFE1716DECFUT
    GOLDM16NOVFUT
    SILVERMIC17FEBFUT
    SILVER17MAYFUT
    CARDAMOM17MARFUT
    GOLD17OCTFUT
    SILVERM17NOVFUT
    NATURALGAS16NOVFUT
    NTGOCTNO1616OCTFUT
    CARDAMOM16DECFUT
    SILVER17JULFUT
    SILVERM17JUNFUT
    GOLDM16DECFUT
    SLVDECMY1716DECFUT
    SLVMARMY1717MARFUT
    GDMNOVDE1616NOVFUT
    CRUDEOILM16NOVFUT
    BRCRUDEOIL16NOVFUT
    SLMNOVFE1716NOVFUT
    LEAD16OCTFUT
    LEADMINI16OCTFUT
    KAPAS17APRFUT
    ALMNOVDE1616NOVFUT
    ALMOCTDE1616OCTFUT
    ALUOCTDE1616OCTFUT
    GOLDPTLDEL16OCTFUT
    LEAD16NOVFUT
    LEADMINI16NOVFUT
    ALUMINI17FEBFUT
    NICKEL16OCTFUT
    NICKELM16OCTFUT
    SILVER100017MAYFUT
    ZINC16OCTFUT
    ZINCMINI16OCTFUT
    ALUNOVDE1616NOVFUT
    CPONOVDE1616NOVFUT
    CPOOCTDE1616OCTFUT
    LEDNOVDE1616NOVFUT
    LEDOCTDE1616OCTFUT
    ALUMINIUM17FEBFUT
    GOLDGUINEA17JANFUT
    GOLDPETAL17JANFUT
    GOLDPTLDEL17JANFUT
    LEAD17FEBFUT
    LEADMINI17FEBFUT
    NICKEL17FEBFUT
    NICKELM17FEBFUT
    NICKELM16NOVFUT
    SILVER100017JUNFUT
    ZINC16NOVFUT
    ZINCMINI16NOVFUT
    CRUDEOIL17JANFUT
    ALUMINI16DECFUT
    CPO17JANFUT
    GOLDGUINEA16DECFUT
    GOLDPETAL16DECFUT
    LEMNOVDE1616NOVFUT
    LEMOCTDE1616OCTFUT
    NICNOVDE1616NOVFUT
    NICOCTDE1616OCTFUT
    SILVER100017SEPFUT
    SILVERMIC17JUNFUT
    ZINC17FEBFUT
    ZINCMINI17FEBFUT
    COTTON17MARFUT
    CPO17FEBFUT
    NIMNOVDE1616NOVFUT
    NIMOCTDE1616OCTFUT
    NICKEL16NOVFUT
    ALUMINI17JANFUT
    CPMNOVAP1716NOVFUT
    CPPFEBAP1717FEBFUT
    SILVER100017APRFUT
    SILVER100017JANFUT
    MENTHAOIL16OCTFUT
    CRUDEOIL17FEBFUT
    CRUDEOILM17FEBFUT
    CRUDEOILM17JANFUT
    GLDFEBAP1717FEBFUT
    GOLDM17JANFUT
    GDMDECJA1716DECFUT
    GDMNOVJA1716NOVFUT
    COPPER16NOVFUT
    COPPERM16NOVFUT
    COTTON16OCTFUT
    SILVER16DECFUT
    CRDDECJA1716DECFUT
    CRDNOVJA1716NOVFUT
    CRMDECJA1716DECFUT
    CRMNOVJA1716NOVFUT
    CRUDEOIL17APRFUT
    CRUDEOILM17APRFUT
  • Ganesh
    Thanks @botany02 ,

    I am able to download commodities data now. I noticed that the sequence is in reverse order. i.e. newest candle (tick) is the last in the array. Ideally the first element in array should be the latest tick data. Is there anyway to control the order? Most technical analysis libraries/tools will expect the newest tick to be the first element (HistData(0)).
    Please confirm.
  • ishwarm
    Hi @botany , Kailash has mentioned above that the library is open sourced. Where can I see the code for this?

    Thanks,
    Ishwar.
  • botany02
    @Ganesh
    Kite.Trade provides data like that only.
    But you can Just Reverse it.
    use the Array.Reverse(HistData)
    After the above code your array will have New element at index 0 and older elements at last.
  • Ganesh
    @botany02
    The current KiteDotNet is targeting x86 Processor. I have AmiBroker 6.10 / x64 so this KiteDotNet is giving run time error. Do you have x64 targeted version of KiteDotNet (Or All version).

    My development is stuck as I dont have KiteDotNet code to compile x64 version and hence can't proceed. Can you please provide x64 version at the earliest?

    Thanks,
  • Ganesh
    @botany02

    Thanks, That was very quick :)
  • Ganesh
    @botany02

    Now I am getting the same error for the other dependencies.

    WebSocket4Net
    Newtonsoft.Json
    WebServ

    These are also targeting x86 and need x64 version of these :'( . Please share.

    Thanks,
  • botany02
    @Ganesh

    You can remove WebServ as it doesn't required for KiteDotNet.
    Websocket4Net and Newtonsoft.Json are third party and You can check it at GitHub for x64.

    Could You pls explain what you are trying to achieve, so that I can check other possibilities..?
  • Ganesh
    @botany02

    Thanks, I will search GitHub and convert them to x64.
    I have tested AmiBroker strategy so I am trying to develop an Amibroker Plug-in that can trigger Buy/Sell call as and when conditions met. This plug-in will use KiteDotNet to place/modify orders. I am also trying to implement a trailing SL continuous update to be triggered from Amibroker.

    Based on Sample KiteDotNet my order execution code is ready now I am looking at developing the plug in that will trigger order execution from Amibroker based on my trading systems conditions.

    Hope this helps, I explored a third party solution WhatuTrade.in but found it very minimalist and does not satisfy my requirement. I am exploring another paid third party tool however what ever tool I use for plug in I first need the x64 dependencies to work.

    Thanks,
    Ganesh
  • Gyan.Sikdar
    Gyan.Sikdar edited November 2016
    @botany02

    Hello Botany,

    Is it possible to Stream Bids quantity and Offers with prices form live market.
    Also same in Historical data ??
    Current Historical method only gives Open, High, Low, closed and vol.
    Thanks
    Gyan Sikdar
  • Ganesh
    Ganesh edited November 2016
    @botany02

    I am getting an error.
    KiteDotNet_x64 Doesnt have a strong name hence it is throwing error in Amibroker. I wanted to attach a screen shot of the error however not sure how to attach a screen shot. Here is the error message:

    "An exception has been caught while executing .Net plugin method: System.IO.FileLoadException: could not load file or assembly KiteDotNet_x64 ver 1.0.00 etc.. or one of its dependencies. A Strongly - named assembly is required "

    I am getting a similar warning in .Net code BC41997, that KiteDotNet_x64 doesnt have strong name.

    Can you suggest or provide strongly named version of KiteDotNet?

    BTW: I am using Visual Studio 2015 targeting .Net Framework 4 with x64 CPU if that matters.

    If I use Visual Studio 2010 I am getting a different error in AmiBroker as : " AxtiveX Control (long number xxxxx) cannot be instantiated because the current thread is not in a single-threaded apartment"

    This is confusing, can you help?

    Thanks in Advance,

    Ganesh
  • sujith
    Hi @Gyan.Sikdar,
    Yes you get bid and ask data (market depth) from websocket. You have to subscribe for a token and then set mode to mode full.
    OHLC in websocket corresponds to day's data whereas OHLC in historical data corresponds to time interval's (like minute or 5minute) data
  • botany02
    @Gyan.Sikdar

    The QuotesReceivedEvent Suppots all Price Fields including market depth.
    You Just add a handler to retrieve the Price Fields.
    Historical data supports only DOHLCV.
    http://www.howutrade.in/docs/kitedotnet/html/T_KiteDotNet_QuotesReceivedEventArgs.htm

    You can use the Sample Project @ https://github.com/HowUTrade/KiteDotNet
    It has methods to get all price fields.
  • botany02
    @Ganesh

    Are you signing your assembly..? Try removing the Signing.
    will release signed assembly soon.
  • Ganesh
    Thanks @botany02

    Yes, My assembly is signed, I will wait for signed assembly. Please confirm here when you release it.
  • Gyan.Sikdar
    Gyan.Sikdar edited November 2016
    thanks :)
  • Gyan.Sikdar
    Gyan.Sikdar edited November 2016
    @botany02

    Hello Botany,

    I want Nifty Index in my script , Could you please help me with nifty 50 index symbol.
    I tried with NIFTY50 and also NIFTY51, I am getting exception Null Symbol in null or Invalid.
    Thanks
    Gyan Sikdar
  • botany02
    @Gyan.Sikdar

    It is NIFTY 50

    and also when you call GetInstruments, it will download & save instruments list for all exchange enabled for your a/c in your application directory.

    You can check the SymbolList_NSE.txt, it has all index names.

  • Ganesh
    @Kailash , @botany02

    You mentioned that this is open sourced, where is the code? The community will not have to request minor things and updates if it is open sources.

    Please release the code location.

    Thanks,
    Ganesh
  • Ganesh
    @vivek

    This is just code for sample referring to KiteDotNet.DLL, what I was asking is code for KiteDotNet so that we can change it as required based on individual needs,

    Thanks,
    Ganesh
  • k365
    yes you are right ganesh

    where is the code VIVEK
  • sujith
    It is released by third party, his Id is @botany02

    You can have a word with him.
  • Ganesh
    Ganesh edited November 2016
    Thanks @sujith for confirming this. @k365 I don't think the third party has any intention of providing source code. So better we develop our own dll to access KiteAPIs. I am going to work on @chaudhariapurva provided KiteCore to add features that I want. @ishwarm has also contributed to the same KiteCore. Let's all build our own community provided KiteCore.

    It will take some time and automation activities may get delayed due to this development work but in the end we all will have a truly open source utility to work with KiteAPIs.
  • k365
    k365 edited November 2016
    thats great ganesh... if there's anything i can also do plz let me knw

    but anybody can plz help in authentication issue ? are you able to get the access code from sample application GANESH ? can you solv my query as the experts here are just replying the documentation texts.. nobody is looking for the real problem

    sometimes I am in doubt that this is the second time i have purchased Kite connect, nobody is able to solve the authentication problem? so is this kite connect really working or just taking money from developers. Even the sample application is not working

  • Ganesh
    @k365 Both KiteDotNet and https://github.com/apurvaChaudhari/KiteCore are working perfectly fine for me. I have moved to https://github.com/apurvaChaudhari/KiteCore now since KiteDotNet code is not available but earlier when using it I had no problems. do you have sufficient rights on your machine? Are you able to do a normal login through browser? There seems to be machine specific problem in your case.
  • k365
    k365 edited December 2016
    no there is no machine problem. i tried core library and found that the sample application of vb.net does not respond when browser has finished loading. for this i asked that the code of browser should also be there like in core library

    ok Ganesh.. tell me the steps for login in browser ? normal login is done.. but access token is the main problem..
    can you get access token through browser only ? i mean putting the uri in address bar ?
Sign In or Register to comment.