Python-How to get time of LTP, ?

satya12345
Hi I am new to this algo codes. I am doing it in python.

I needed LTP and time and volume.
Only full quote gives time and volume.

example yesterday after market hours:

'last_trade_time': datetime.datetime(2019, 10, 1, 15, 29, 59),
'timestamp': datetime.datetime(1970, 1, 1, 5, 30),

So in today live, I caught 'last_trade_time'
It is giving as same time for all readings..
Which should be used to know appx the time of LTP?

Can someone help? Thanks in advance.

Tagged:
  • ZI4453
    are you referring to "timestamp"? i believe its epoch of exchange... ltt is actual traded time.
    If you could brief a bit we can give you some suggestion.
  • satya12345
    I get following in MODE_FULL,QUOTE and LTP:
    Mode_FULL

    {'tradable': True,
    'mode': 'full',
    'instrument_token': 13176834,
    'last_price': 28874.65,
    'last_quantity': 20,
    'average_price': 0.0,
    'volume': 0,
    'buy_quantity': 0,
    'sell_quantity': 0,
    'ohlc': {'open': 29440.0, 'high': 29724.0, 'low': 28218.0, 'close': 28874.65},
    'change': 0.0,
    'last_trade_time': datetime.datetime(2019, 10, 1, 15, 29, 59),
    'oi': 1513360,
    'oi_day_high': 0,
    'oi_day_low': 0,
    'timestamp': datetime.datetime(1970, 1, 1, 5, 30),
    'depth':
    {'buy': [{'quantity': 0, 'price': 0.0, 'orders': 0}, {'quantity': 0, 'price': 0.0, 'orders': 0}, {'quantity': 0, 'price': 0.0, 'orders': 0}, {'quantity': 0, 'price': 0.0, 'orders': 0}, {'quantity': 0, 'price': 0.0, 'orders': 0}],
    'sell': [{'quantity': 0, 'price': 0.0, 'orders': 0}, {'quantity': 0, 'price': 0.0, 'orders': 0}, {'quantity': 0, 'price': 0.0, 'orders': 0}, {'quantity': 0, 'price': 0.0, 'orders': 0}, {'quantity': 0, 'price': 0.0, 'orders': 0}]
    }
    }

    MODE QUOTE
    {'tradable': True,
    'mode': 'quote',
    'instrument_token': 341249,
    'last_price': 1248.8,
    'last_quantity': 5,
    'average_price': 0.0
    , 'volume': 0,
    'buy_quantity': 0,
    'sell_quantity': 0,
    'ohlc': {'open': 1231.5, 'high': 1255.0, 'low': 1221.1, 'close': 1248.8},
    'change': 0.0}

    MODE_LTP
    {'tradable': True,
    'mode': 'ltp',
    'instrument_token': 7670273,
    'last_price': 690.75}

    The 'last_trade_time': was however not correct Hence the question...
  • ZI4453
    ZI4453 edited October 2019
    fyi
    this broker dont provide full and partial updates like other data providers.
    If you could give clarity on why ltt is important then we can figure out a workaround.
    If your script is not "latency sensitive" you should be able to process full quote in few micro seconds.
  • satya12345
    i am interested in forming candles of one min.
    That may not be very correct, as I think we dont get all ticks.
    The algorithm is something like this, I hv thought:
    (1) Get ticks on on_ticks: into some variable.
    (2) Dump it to a table
    (3) Let the first tick be Open and last be close. High and low of tick for one min range can be obtained.

    That was what I was working on, fyi
  • ZI4453
    ZI4453 edited October 2019
    @satya12345 ,Thanks.
    Candle is useless,utter waste of time and computation,
    API is a powerful tool and using candles is disrespecting its sole purpose.

    Since you would like to start with Graphs->Candles,
    Graph or candles doesn't mean that value should be changing in all instances(time intervals),if this is for real time display just carry over last updated value(whatever the tick you have) as current value until a new update comes from tick.This is how all graphs work.
Sign In or Register to comment.