Getting LTP values like Margins

arjunender
arjunender edited September 2021 in .Net API client
Hi,

Can i get LTP values like Margins (https://api.kite.trade/margins/basket?consider_positions=false)

Thanks
  • sujith
    You can use this API.
  • arjunender
    trying to get this using javascript but getting CORS Error

    cross-origin resource sharing error preflightmissingalloworiginheader

    $.ajax({
    url: "https://api.kite.trade/quote/ltp?i=NSE:INFY",
    type: 'GET',
    dataType: 'json',
    cors: true,
    contentType: 'application/json',
    secure: true,
    headers: {
    'Access-Control-Allow-Origin': '*',
    },
    beforeSend: function (xhr) {
    xhr.setRequestHeader("Authorization", "token api:token");
    },
    success: function (data) {
    alert(data);
    }
    })

  • sujith
    A third party app can't show our data on their website. You can contact any exchange registered data vendor for live market data and candle data.
  • arjunender

    i am able to get margins (https://api.kite.trade/margins/basket?consider_positions=false) with API AND TOKEN

    can i get LTP ("https://api.kite.trade/quote/ltp?i=NSE:INFY") with API AND TOKEN

    If yes
    below is the code not working am i missing something

    var url = "https://api.kite.trade/quote/ltp?i=NSE:INFY";
    var httpRequest = (HttpWebRequest)WebRequest.Create(url);
    httpRequest.Method = "POST";

    httpRequest.Headers["Authorization"] = "token " + api + ":" + accesstoken;
    httpRequest.ContentType = "application/x-www-form-urlencoded";

    //var data = "['NSE:INFY', 'BSE:INFY']"; //
    //using (var streamWriter = new StreamWriter(httpRequest.GetRequestStream()))
    //{
    // streamWriter.Write(data);
    //}


    var httpResponse = (HttpWebResponse)httpRequest.GetResponse();
    string result;
    using (var streamReader = new StreamReader(httpResponse.GetResponseStream()))
    {
    result = streamReader.ReadToEnd();
    }
    json = JsonConvert.DeserializeObject(result);

    return result;
  • sujith
    @arjunender,
    A third party website can't display our market data and candle data. You can speak to compliance at kiteconnect(at)zerodha.com for more information.
  • AnastasiaSin
    I totally agree, but I think that you shouldn't learn coding if you want to open, for example, an e-commerce site, or if you already have a site on Magento, and you want to make it on Magento 2. It's better to entrust this to professionals https://dinarys.com/magento-to-magento2
Sign In or Register to comment.