the same code,It can build the socket after get token: connect socket,received ‘o’ and send token and receove 200 , in demo host.
but yesterday,I found I can sub the quote and chart data normally,the log :sub MNQM2 Quote result:{“mode”:“RealTime”,“subscriptionId”:2553028},and socker listener just receive one frame data.
restart my program is not good. so what the problem?
Hi @zhangdc007. I may need more info, but it could be a few things. First, were you listening during market close hours? That would give you successful responses but wouldn’t show data until the market opens up again.
yes ,I sub in a close time,but It has no data in open time,and I wake up in 9:00am UTC+8 zone, it still no data
now I restart program,I copy the log about socket (log time is UTC+8 timeZone)
2022-04-12 21:14:44.011 [][main] INFO c.a.q.f.t.TradoMainAPI get token: // login in OK,get token
2022-04-12 21:14:44.104 [][main] INFO c.a.q.f.c.TradoSocket Trade socket begin connect
2022-04-12 21:14:44.220 [][main] INFO c.a.q.f.c.TradoSocket Trade socket connect ok
2022-04-12 21:14:44.262 [][main] INFO c.a.q.f.c.TradoSocket Market socket begin connect
2022-04-12 21:14:44.300 [][main] INFO c.a.q.f.c.TradoSocket Market socket connect ok
2022-04-12 21:14:44.538 [][OkHttp https://demo.tradovateapi.com/...] INFO c.a.q.f.c.TradoSocketListener Trade socket open
2022-04-12 21:14:44.539 [][OkHttp https://demo.tradovateapi.com/...] INFO c.a.q.f.c.TradoSocketListener Trade get session open
2022-04-12 21:14:44.539 [][OkHttp https://md.tradovateapi.com/...] INFO c.a.q.f.c.TradoSocketListener Market socket open
2022-04-12 21:14:44.539 [][OkHttp https://md.tradovateapi.com/...] INFO c.a.q.f.c.TradoSocketListener Market get session open
2022-04-12 21:14:44.650 [][OkHttp https://demo.tradovateapi.com/...] INFO c.a.q.f.c.TradoSocketListener Trade socket session build!
2022-04-12 21:14:44.650 [][OkHttp https://md.tradovateapi.com/...] INFO c.a.q.f.c.TradoSocketListener Market socket session build!
now,I login in OK,get token,and build trade and md socker OK,when log ‘socket session build’ it mean receive the ‘o’ and send token,get 200 back.
and the hear beat recevie is ok, send heart is ok too
2022-04-12 21:15:18.154 [][scheduling-1] INFO c.a.q.f.c.TradoSocketListener Trade send 15 heart
2022-04-12 21:15:18.172 [][scheduling-1] INFO c.a.q.f.c.TradoSocketListener Market send 15 heart
2022-04-12 21:15:22.105 [][OkHttp https://demo.tradovateapi.com/...] INFO c.a.q.f.c.TradoSocketListener Trade get 15 heart beat
2022-04-12 21:15:22.156 [][OkHttp https://md.tradovateapi.com/...] INFO c.a.q.f.c.TradoSocketListener Market get 15 heart beat
2022-04-12 21:15:54.154 [][scheduling-1] INFO c.a.q.f.c.TradoSocketListener Trade send 15 heart
2022-04-12 21:15:54.172 [][scheduling-1] INFO c.a.q.f.c.TradoSocketListener Market send 15 heart
2022-04-12 21:15:59.606 [][OkHttp https://demo.tradovateapi.com/...] INFO c.a.q.f.c.TradoSocketListener Trade get 15 heart beat
2022-04-12 21:15:59.687 [][OkHttp https://md.tradovateapi.com/...] INFO c.a.q.f.c.TradoSocketListener Market get 15 heart beat
now will sub real quote,response is seem ok.
2022-04-12 21:16:22.747 [][main] INFO c.a.q.f.m.MarketService sub MNQM2 Quote result:{"mode":"RealTime","subscriptionId":2553028}
but sub chart is timeout ,has no responce with request id 2
2022-04-12 21:16:32.752 [][main] WARN c.a.q.b.c.BlockingResult socket timeout:10s by :2
2022-04-12 21:16:32.753 [][main] ERROR c.a.q.f.c.SocketSync send:md/getChart body:{"symbol":"MNQM2","chartDescription":{"underlyingType":"Tick","elementSize":1,"elementSizeUnit":"Seconds","withHistogram":false},"timeRange":{"asMuchAsElements":10}} error:null
2022-04-12 21:16:32.753 [][main] ERROR c.a.q.f.m.MarketService subSecondChart MNQM2, chartDescription=underlyingType:Tick, elementSize:1, elementSizeUnit:Seconds, withHistogram:false, timeRange= asMuchAsElements:10} error
and has no recevie md hear beat,just trade hear beat recevied.
2022-04-12 21:17:08.108 [11683f38b080d460fbeba6ad2f1b0f4e][scheduling-1] INFO c.a.q.f.c.TradoSocketListener Trade send 15 heart
2022-04-12 21:17:08.108 [11683f38b080d460fbeba6ad2f1b0f4e][scheduling-1] INFO c.a.q.f.c.TradoSocketListener Market send 15 heart
2022-04-12 21:17:14.608 [][OkHttp https://demo.tradovateapi.com/...] INFO c.a.q.f.c.TradoSocketListener Trade get 15 heart beat
and md socket recevie a single quote msg,and no more
2022-04-12 21:16:22.742 [][OkHttp https://md.tradovateapi.com/...] INFO future event:md data:{"quotes":[{"id":2553028,"timestamp":"2022-04-12T13:16:22.694Z","contractId":2553028,"entries":{"Bid":{"price":14225.25,"size":2},"Offer":{"price":14225.5,"size":1},"Trade":{"price":14225.25,"size":1},"OpeningPrice":{"price":14004.5},"SettlementPrice":{"price":14000.0},"TotalTradeVolume":{"size":366435},"OpenInterest":{"size":98024},"HighPrice":{"price":14284.0},"LowPrice":{"price":13902.5}}}]}
What environment are you using to build this? Are you possibly using Python websocket client and asyncio? Your logs look similar to some Python user’s I’ve worked with. I’ve seen some people have difficulties with that particular Python setup - it can be complicated to get the websocket to send heartbeats without blocking the async loop.
I use java ,and the ok http lib for build websocket ,May be I need change the websocket lib and try again
java can easy use multi thread ,I regist a schedul task to send heart beat for every socket after build session.and the heart beat recevie and send log seem ok
thanks ,when I try to change websocket lib,I found I has miss log the error call back,and I make up the error log,I find the BUG: it is the null point error in socker call back thread,so the MD socker is down when I has catch the NPE ,
the date delay is good!
the log is 2 sencod chart and the quote data, sencod chart delay is 800~1470ms ,quote data delay is 19~56ms
2022-04-13 07:51:35.290 [][OkHttp https://md.tradovateapi.com/...] INFO future event:chart data:{"charts":[{"id":533442,"s":"","td":20220413,"bars":[{"timestamp":"2022-04-12T23:51:33Z","open":13992.25,"high":13992.25,"low":13992.25,"close":13992.25,"upVolume":3,"downVolume":0,"upTicks":3,"downTicks":0,"histogram":{},"bidVolume":0,"offerVolume":3},{"timestamp":"2022-04-12T23:51:35Z","open":13992.25,"high":13992.25,"low":13992.25,"close":13992.25,"upVolume":1,"downVolume":0,"upTicks":1,"downTicks":0,"histogram":{},"bidVolume":1,"offerVolume":0}]}]}
2022-04-13 07:51:35.391 [][OkHttp https://md.tradovateapi.com/...] INFO future event:md data:{"quotes":[{"id":2553028,"timestamp":"2022-04-12T23:51:35.370Z","contractId":2553028,"entries":{"Bid":{"price":13992.0,"size":2},"Offer":{"price":13992.5,"size":2},"Trade":{"price":13992.25,"size":1},"OpeningPrice":{"price":13954.0},"SettlementPrice":{"price":13945.0},"TotalTradeVolume":{"size":13652},"OpenInterest":{"size":97809},"HighPrice":{"price":13993.5},"LowPrice":{"price":13941.25}}}]}
2022-04-13 07:51:35.658 [][OkHttp https://md.tradovateapi.com/...] INFO future event:md data:{"quotes":[{"id":2553028,"timestamp":"2022-04-12T23:51:35.637Z","contractId":2553028,"entries":{"Bid":{"price":13992.25,"size":1},"Offer":{"price":13992.75,"size":5},"Trade":{"price":13992.25,"size":1},"OpeningPrice":{"price":13954.0},"SettlementPrice":{"price":13945.0},"TotalTradeVolume":{"size":13652},"OpenInterest":{"size":97809},"HighPrice":{"price":13993.5},"LowPrice":{"price":13941.25}}}]}
2022-04-13 07:51:35.703 [][OkHttp https://md.tradovateapi.com/...] INFO future event:md data:{"quotes":[{"id":2553028,"timestamp":"2022-04-12T23:51:35.650Z","contractId":2553028,"entries":{"Bid":{"price":13992.25,"size":3},"Offer":{"price":13992.75,"size":5},"Trade":{"price":13992.25,"size":1},"OpeningPrice":{"price":13954.0},"SettlementPrice":{"price":13945.0},"TotalTradeVolume":{"size":13652},"OpenInterest":{"size":97809},"HighPrice":{"price":13993.5},"LowPrice":{"price":13941.25}}}]}
2022-04-13 07:51:35.749 [][OkHttp https://md.tradovateapi.com/...] INFO future event:md data:{"quotes":[{"id":2553028,"timestamp":"2022-04-12T23:51:35.699Z","contractId":2553028,"entries":{"Bid":{"price":13992.25,"size":2},"Offer":{"price":13992.75,"size":5},"Trade":{"price":13992.25,"size":1},"OpeningPrice":{"price":13954.0},"SettlementPrice":{"price":13945.0},"TotalTradeVolume":{"size":13652},"OpenInterest":{"size":97809},"HighPrice":{"price":13993.5},"LowPrice":{"price":13941.25}}}]}
2022-04-13 07:51:36.221 [][OkHttp https://md.tradovateapi.com/...] INFO future event:md data:{"quotes":[{"id":2553028,"timestamp":"2022-04-12T23:51:36.200Z","contractId":2553028,"entries":{"Bid":{"price":13992.25,"size":3},"Offer":{"price":13992.75,"size":5},"Trade":{"price":13992.25,"size":1},"OpeningPrice":{"price":13954.0},"SettlementPrice":{"price":13945.0},"TotalTradeVolume":{"size":13652},"OpenInterest":{"size":97809},"HighPrice":{"price":13993.5},"LowPrice":{"price":13941.25}}}]}
2022-04-13 07:51:36.357 [][OkHttp https://md.tradovateapi.com/...] INFO future event:md data:{"quotes":[{"id":2553028,"timestamp":"2022-04-12T23:51:36.336Z","contractId":2553028,"entries":{"Bid":{"price":13992.5,"size":1},"Offer":{"price":13992.75,"size":5},"Trade":{"price":13992.25,"size":1},"OpeningPrice":{"price":13954.0},"SettlementPrice":{"price":13945.0},"TotalTradeVolume":{"size":13652},"OpenInterest":{"size":97809},"HighPrice":{"price":13993.5},"LowPrice":{"price":13941.25}}}]}
2022-04-13 07:51:36.403 [][OkHttp https://md.tradovateapi.com/...] INFO future event:md data:{"quotes":[{"id":2553028,"timestamp":"2022-04-12T23:51:36.367Z","contractId":2553028,"entries":{"Bid":{"price":13992.5,"size":2},"Offer":{"price":13993.0,"size":2},"Trade":{"price":13992.25,"size":1},"OpeningPrice":{"price":13954.0},"SettlementPrice":{"price":13945.0},"TotalTradeVolume":{"size":13652},"OpenInterest":{"size":97809},"HighPrice":{"price":13993.5},"LowPrice":{"price":13941.25}}}]}
2022-04-13 07:51:36.442 [][OkHttp https://md.tradovateapi.com/...] INFO future event:md data:{"quotes":[{"id":2553028,"timestamp":"2022-04-12T23:51:36.367Z","contractId":2553028,"entries":{"Bid":{"price":13992.5,"size":2},"Offer":{"price":13993.0,"size":2},"Trade":{"price":13992.75,"size":1},"OpeningPrice":{"price":13954.0},"SettlementPrice":{"price":13945.0},"TotalTradeVolume":{"size":13656},"OpenInterest":{"size":97809},"HighPrice":{"price":13993.5},"LowPrice":{"price":13941.25}}}]}
2022-04-13 07:51:36.449 [][OkHttp https://md.tradovateapi.com/...] INFO future event:md data:{"quotes":[{"id":2553028,"timestamp":"2022-04-12T23:51:36.390Z","contractId":2553028,"entries":{"Bid":{"price":13992.5,"size":1},"Offer":{"price":13993.0,"size":3},"Trade":{"price":13992.75,"size":1},"OpeningPrice":{"price":13954.0},"SettlementPrice":{"price":13945.0},"TotalTradeVolume":{"size":13656},"OpenInterest":{"size":97809},"HighPrice":{"price":13993.5},"LowPrice":{"price":13941.25}}}]}
2022-04-13 07:51:36.470 [][OkHttp https://md.tradovateapi.com/...] INFO future event:chart data:{"charts":[{"id":533442,"s":"","td":20220413,"bars":[{"timestamp":"2022-04-12T23:51:35Z","open":13992.25,"high":13992.25,"low":13992.25,"close":13992.25,"upVolume":1,"downVolume":0,"upTicks":1,"downTicks":0,"histogram":{},"bidVolume":1,"offerVolume":0},{"timestamp":"2022-04-12T23:51:36Z","open":13992.75,"high":13992.75,"low":13992.75,"close":13992.75,"upVolume":4,"downVolume":0,"upTicks":4,"downTicks":0,"histogram":{},"bidVolume":0,"offerVolume":4}]}]}
2022-04-13 07:51:36.507 [][OkHttp https://md.tradovateapi.com/...] INFO future event:md data:{"quotes":[{"id":2553028,"timestamp":"2022-04-12T23:51:36.486Z","contractId":2553028,"entries":{"Bid":{"price":13992.5,"size":2},"Offer":{"price":13993.0,"size":3},"Trade":{"price":13992.75,"size":1},"OpeningPrice":{"price":13954.0},"SettlementPrice":{"price":13945.0},"TotalTradeVolume":{"size":13656},"OpenInterest":{"size":97809},"HighPrice":{"price":13993.5},"LowPrice":{"price":13941.25}}}]}
2022-04-13 07:51:36.727 [][OkHttp https://md.tradovateapi.com/...] INFO future event:md data:{"quotes":[{"id":2553028,"timestamp":"2022-04-12T23:51:36.706Z","contractId":2553028,"entries":{"Bid":{"price":13992.25,"size":1},"Offer":{"price":13992.75,"size":1},"Trade":{"price":13992.75,"size":1},"OpeningPrice":{"price":13954.0},"SettlementPrice":{"price":13945.0},"TotalTradeVolume":{"size":13656},"OpenInterest":{"size":97809},"HighPrice":{"price":13993.5},"LowPrice":{"price":13941.25}}}]}
2022-04-13 07:51:36.773 [][OkHttp https://md.tradovateapi.com/...] INFO future event:md data:{"quotes":[{"id":2553028,"timestamp":"2022-04-12T23:51:36.735Z","contractId":2553028,"entries":{"Bid":{"price":13992.0,"size":1},"Offer":{"price":13992.5,"size":1},"Trade":{"price":13992.75,"size":1},"OpeningPrice":{"price":13954.0},"SettlementPrice":{"price":13945.0},"TotalTradeVolume":{"size":13656},"OpenInterest":{"size":97809},"HighPrice":{"price":13993.5},"LowPrice":{"price":13941.25}}}]}
2022-04-13 07:51:36.783 [][OkHttp https://md.tradovateapi.com/...] INFO future event:md data:{"quotes":[{"id":2553028,"timestamp":"2022-04-12T23:51:36.735Z","contractId":2553028,"entries":{"Bid":{"price":13992.0,"size":1},"Offer":{"price":13992.5,"size":1},"Trade":{"price":13992.5,"size":1},"OpeningPrice":{"price":13954.0},"SettlementPrice":{"price":13945.0},"TotalTradeVolume":{"size":13658},"OpenInterest":{"size":97809},"HighPrice":{"price":13993.5},"LowPrice":{"price":13941.25}}}]}
2022-04-13 07:51:36.805 [][OkHttp https://md.tradovateapi.com/...] INFO future event:chart data:{"charts":[{"id":533442,"s":"","td":20220413,"bars":[{"timestamp":"2022-04-12T23:51:36Z","open":13992.75,"high":13992.75,"low":13992.5,"close":13992.5,"upVolume":4,"downVolume":2,"upTicks":4,"downTicks":2,"histogram":{},"bidVolume":2,"offerVolume":4}]}]}
ping md.tradovateapi.com delay is 0.5~0.6ms
PING md.tradovateapi.com (34.120.3.201) 56(84) bytes of data.
64 bytes from 201.3.120.34.bc.googleusercontent.com (34.120.3.201): icmp_seq=1 ttl=118 time=0.542 ms
64 bytes from 201.3.120.34.bc.googleusercontent.com (34.120.3.201): icmp_seq=2 ttl=118 time=0.557 ms
64 bytes from 201.3.120.34.bc.googleusercontent.com (34.120.3.201): icmp_seq=3 ttl=118 time=0.594 ms
64 bytes from 201.3.120.34.bc.googleusercontent.com (34.120.3.201): icmp_seq=4 ttl=118 time=0.577 ms
64 bytes from 201.3.120.34.bc.googleusercontent.com (34.120.3.201): icmp_seq=5 ttl=118 time=0.528 ms
64 bytes from 201.3.120.34.bc.googleusercontent.com (34.120.3.201): icmp_seq=6 ttl=118 time=0.600 ms