Error while getting LTP data

  • @admin
    Getting an error while getting LTP data
    I am using the following code snippet

    //import used
    SmartApi ""
    ltp, err := GetABClient().GetLTP(SmartApi.LTPParams{
    		Exchange:      instr.ExchSeg,
    		TradingSymbol: instr.Symbol,
    		SymbolToken:   instr.Token,

    Getting following error:

    base.HTTP: 2021/09/15 16:04:26 http.go:154: Error parsing JSON response: json: cannot unmarshal number into Go struct field of type string | {"status":true,"message":"SUCCESS","errorcode":"","data":{"exchange":"NSE","tradingsymbol":"ULTRACEMCO-EQ","symboltoken":"11532","open":7889.0,"high":7929.0,"low":7790.0,"close":7856.45,"ltp":7820.85}}
    time="2021-09-15T16:04:26+05:30" level=info msg="json: cannot unmarshal number into Go struct field of type string"

    It seems that SmartApi.LTPResponse struct has OHLC fields defined as string and response from api server is in float.

    Please help to fix me this.

  • HI @devendrav this issue has been resolved.

  • This post is deleted!

  • HI @devendrav We have reported this we will test and update you.

  • Bugs

    Found a bug? Use this category to report us.

  • Java SDK

    Ask Java SDK related queries here.

  • R SDK

    Ask R SDK related queries here.

  • Go SDK

    Ask Go SDK related queries here.

How SmartAPI works