1
$\begingroup$

I'm trying to stream option chain data into mathematica from the

url: https://www.nseindia.com/api/option-chain-indices?symbol=BANKNIFTY

Import["https://www.nseindia.com/api/option-chain-indices?symbol=BANKNIFTY"]/.Rule->List

I'm gettting the data however it's not streaming. If I use 'Dynamic', 'Refresh' with 'UpdateInterval' or run the 'Import' in loop every 1 sec, it's going to cost me 20-30 GB data per day (download rate is more that 1mbps) even though the size of the data is only 12KB. This seems impractical.

Is there a way to check, if the data changed/updated at the source without downloading and download only when the data changed/updated at the source. For example if the "timestamp" (it's there in the data) could be accessed/read then it's possible to know exactly when the data is being changed/updated. Tried to use 'OpenRead' but unsuccessful.

I could give exact amount of 'Pause' in side the loop before 'Import' if the time interval for data update is fixed. Problem is data update interval is irregular.

Could anyone let me know how to remedy the situation.

$\endgroup$
8
  • $\begingroup$ Import["https://www.nseindia.com/api/option-chain-indices?symbol=BANKNIFTY", "JSON"] $\endgroup$
    – I.M.
    Commented Sep 2, 2021 at 2:37
  • $\begingroup$ "JSON" isn't working. It's stuck at 'Running...' $\endgroup$
    – csk 7
    Commented Sep 2, 2021 at 3:01
  • $\begingroup$ I tried with "DATA" , "CSV" , "Table" as well. Not working. Stuck at 'Running...' $\endgroup$
    – csk 7
    Commented Sep 2, 2021 at 3:06
  • $\begingroup$ It does work for me in V12.2, but sometimes returns an error, perhaps when data is updated. Check your internet connectivity setting in Mathematica, try importing other url $\endgroup$
    – I.M.
    Commented Sep 2, 2021 at 3:11
  • $\begingroup$ I see. I have mathematica 9. Internet connection is fine as it's working for Import["edms5.cern.ch/cedar/plsql/…\code=EqCode"] $\endgroup$
    – csk 7
    Commented Sep 2, 2021 at 3:14

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.