Scripts & trading instruments

itsram90
Hi,

Can you please explain:
1. if i want to run one strategy for NATURAL GAS (MCX) and same strategy for RELIANCE FUT (NFO)
for this setup do i need to have two scripts for websocket streaming and two for strategy (total 4 running all at same time)using same api key, public key etc..

2. in webinar video i have seen two scripts for relience one websocket and another stretegy.py but in stretegy script again there is streaming of historical data. can you please explain how data is coming and getting stored?

Thanks
Ram
  • sujith
    Hi,
    Websocket streaming is live market data. You can fetch live ticks for multiple tokens.
    For historical data you have to make http request which allows to make request for one scrip at a time. You can use any numbers of scripts simultaneously but, make sure you don't hit API rate limit. You can only send 3 requests per second.
  • itsram90
    Thanks @sujith for quick response

    Ok, So i need to only include
    def get_historical_data():
    return kite.historical(instrument_token , from_dt , to_dt , interval)

    in my single script to stream data and store it as record.

    When you say historical, does it mean there is any time limit ? can it give me live data with from_date= today-1 to_date=today ?

    API doc says it can not give me data with open high close low details ? can you please suggest how i can get this data?

    Thanks
    Ram
  • sujith
    Hi,
    Rate limit is for all http requests not only historical data.

    You can get intraday data till 6 to 8 months and you can get day's data upto 2007.

    Historical data can give you OHLCV of the time interval you have choose like 1minute, 5minute, etc.

    During market hours, you can get data till previous minute. For example if you are requesting for 1minute data at 12:01PM then you will get data till 12:00PM.
  • itsram90
    Below mentioned comment is regarding Historical() function ?

    "During market hours, you can get data till previous minute. For example if you are requesting for 1minute data at 12:01PM then you will get data till 12:00PM."
  • sujith
    Yes. It is regarding historical() function.
  • itsram90
    thank you so much sujith: sorry for bugging :)
  • sujith
    No problem :)
This discussion has been closed.