Getting LTP values like Margins

arjunender
arjunender edited September 16 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.
  • katemiller
    Thanks for these tips!
  • katemiller
    katemiller edited September 27
    As mentioned earlier, many people are able to complete software development tasks without having to learn any complicated coding. However, there are still some individuals who would prefer to learn about coding so that they could understand how different coding patterns work when it comes to developing a specific piece of software by https://syndicode.com/online-marketplace-development/. This is because these people are usually more interested in finding ways to cut down on the time it takes for their employees to develop the specific piece of software that they need. Learning about the various programming languages, however, can definitely help you become a better software developer.
Sign In or Register to comment.