End of historical flag

Today (Saturday: It’s maybe related to the holiday), I receive “end of the historical flag (eoh)” from some contracts and don’t receive from the others. For example, consider two contracts ESH2, which I did not receive the eoh flag, and GCG2, which I received the eoh flag.
I received the following messages from ESH2:

a[{"s":200,"i":1}]
a[{"s":200,"i":3,"d":{"mode":"RealTime","historicalId":34024,"realtimeId":34024}}]
a[{"e":"chart","d":{"charts":[{"id":34024,"s":"db","td":20220114,"bars":[{"timestamp":"2022-01-14T21:51Z","open":4663.75,"high":4663.75,"low":4663.25,"close":4663.25,"upVolume":151,"downVolume":23,"upTicks":78,"downTicks":8,"histogram":{},"bidVolume":81,"offerVolume":93},{"timestamp":"2022-01-14T21:52Z","open":4663.25,"high":4663.25,"low":4662.5,"close":4663.0,"upVolume":148,"downVolume":14,"upTicks":90,"downTicks":8,"histogram":{},"bidVolume":69,"offerVolume":93},{"timestamp":"2022-01-14T21:53Z","open":4663.25,"high":4663.75,"low":4663.25,"close":4663.25,"upVolume":153,"downVolume":15,"upTicks":87,"downTicks":4,"histogram":{},"bidVolume":73,"offerVolume":95},{"timestamp":"2022-01-14T21:54Z","open":4663.0,"high":4663.75,"low":4663.0,"close":4663.75,"upVolume":152,"downVolume":6,"upTicks":88,"downTicks":4,"histogram":{},"bidVolume":34,"offerVolume":124},{"timestamp":"2022-01-14T21:55Z","open":4663.5,"high":4664.0,"low":4663.0,"close":4663.25,"upVolume":165,"downVolume":16,"upTicks":112,"downTicks":13,"histogram":{},"bidVolume":81,"offerVolume":100},{"timestamp":"2022-01-14T21:56Z","open":4663.5,"high":4663.5,"low":4663.0,"close":4663.25,"upVolume":77,"downVolume":9,"upTicks":39,"downTicks":6,"histogram":{},"bidVolume":30,"offerVolume":56},{"timestamp":"2022-01-14T21:57Z","open":4663.25,"high":4663.75,"low":4663.25,"close":4663.75,"upVolume":154,"downVolume":13,"upTicks":66,"downTicks":4,"histogram":{},"bidVolume":71,"offerVolume":96},{"timestamp":"2022-01-14T21:58Z","open":4663.5,"high":4664.0,"low":4663.25,"close":4663.75,"upVolume":95,"downVolume":25,"upTicks":51,"downTicks":8,"histogram":{},"bidVolume":55,"offerVolume":65},{"timestamp":"2022-01-14T21:59Z","open":4664.0,"high":4664.75,"low":4663.75,"close":4664.0,"upVolume":376,"downVolume":45,"upTicks":175,"downTicks":23,"histogram":{},"bidVolume":129,"offerVolume":292}]}]}}]

and the following messages from GCG2:

a[{"s":200,"i":1}]
a[{"s":200,"i":3,"d":{"mode":"RealTime","historicalId":34686,"realtimeId":34686}}]
a[{"e":"chart","d":{"charts":[{"id":34686,"s":"db","td":20220114,"bars":[{"timestamp":"2022-01-14T21:51Z","open":1817.1,"high":1817.3,"low":1817.1,"close":1817.2,"upVolume":12,"downVolume":3,"upTicks":11,"downTicks":3,"histogram":{},"bidVolume":5,"offerVolume":10},{"timestamp":"2022-01-14T21:52Z","open":1817.1,"high":1817.4,"low":1817.1,"close":1817.4,"upVolume":31,"downVolume":0,"upTicks":31,"downTicks":0,"histogram":{},"bidVolume":13,"offerVolume":18},{"timestamp":"2022-01-14T21:53Z","open":1817.2,"high":1817.2,"low":1817.1,"close":1817.1,"upVolume":1,"downVolume":2,"upTicks":1,"downTicks":1,"histogram":{},"bidVolume":3,"offerVolume":0},{"timestamp":"2022-01-14T21:54Z","open":1817.1,"high":1817.1,"low":1817.0,"close":1817.0,"upVolume":6,"downVolume":1,"upTicks":6,"downTicks":1,"histogram":{},"bidVolume":7,"offerVolume":0},{"timestamp":"2022-01-14T21:55Z","open":1817.0,"high":1817.3,"low":1816.8,"close":1816.8,"upVolume":59,"downVolume":7,"upTicks":58,"downTicks":7,"histogram":{},"bidVolume":55,"offerVolume":11},{"timestamp":"2022-01-14T21:56Z","open":1816.9,"high":1816.9,"low":1816.8,"close":1816.8,"upVolume":11,"downVolume":2,"upTicks":7,"downTicks":2,"histogram":{},"bidVolume":4,"offerVolume":9},{"timestamp":"2022-01-14T21:57Z","open":1816.9,"high":1817.3,"low":1816.7,"close":1817.2,"upVolume":39,"downVolume":6,"upTicks":29,"downTicks":3,"histogram":{},"bidVolume":26,"offerVolume":19},{"timestamp":"2022-01-14T21:58Z","open":1817.2,"high":1817.4,"low":1817.0,"close":1817.0,"upVolume":20,"downVolume":5,"upTicks":14,"downTicks":5,"histogram":{},"bidVolume":19,"offerVolume":6},{"timestamp":"2022-01-14T21:59Z","open":1816.9,"high":1817.4,"low":1816.7,"close":1817.3,"upVolume":12,"downVolume":2,"upTicks":10,"downTicks":2,"histogram":{},"bidVolume":8,"offerVolume":6}]}]}}]
a[{"e":"chart","d":{"charts":[{"id":34686,"eoh":true}]}}]

What is the problem?

The EoH flag simply means its the end of historically loaded bars. So if you asked for 50 bars and got 50 bars you’d get EoH at the end of that 50 bars. You can use this to do a few things:

  • ask for more bars on large chart requests.
  • know that a request is finished and you can operate on the data.
  • know that you are receiving real time data, if your request intersects with the current bar time or if you ask for a specific number of elements with no other parameters.

The market data server will also limit your requests to an arbitrary and non-concrete number of bars based on chart params, and the EOH flag will let you know when you’ve reached that limit. This is where you’d typically want to ask for more bars by starting a new md/getchart request.

You can also leverage it to know when you’re OK to do a certain operation (say you want to calculate 200 day MA, you’d need at least 200 bars so you can sort and count how many you got after you receive the EoH, and determine whether it will be accurate to try and plot the MA).

If you’re strictly looking forward in time (such as when you specify only the number of elements to receive) EoH also can mean that you’ll receive real-time data from this point forward. So if you’re storing that data, the EoH flag can be used as an indication that you’ve loaded the past data and now incoming data will be received in real time as it changes.