# Confirmation on md/getChart parameters and volume

**URL:** <https://community.tradovate.com/t/confirmation-on-md-getchart-parameters-and-volume/3740>\
**Category:** Community Support\
**Created:** [January 18, 2022, 11:40pm UTC](https://community.tradovate.com/t/confirmation-on-md-getchart-parameters-and-volume/3740 "2022-01-18T23:40:31Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Mikeb](https://avatars.discourse-cdn.com/v4/letter/m/e95f7d/32.png) [@Mikeb](https://community.tradovate.com/u/Mikeb)\
**Post date:** [January 18, 2022, 11:40pm UTC](https://community.tradovate.com/t/confirmation-on-md-getchart-parameters-and-volume/3740/1 "2022-01-18T23:40:31Z")

</div>

Looking at the example [example-api-js/tutorial/WebSockets/EX-10-Chart-Data at main · tradovate/example-api-js · GitHub](https://github.com/tradovate/example-api-js/tree/main/tutorial/WebSockets/EX-10-Chart-Data) it’s not clear how to get the volume for a bar from the data returned, I assume it’s to sum the up and down volume’s, but is that correct ?

Also, when getting a chart via the market replay with the following description:

```auto
chartDescription: {
	underlyingType: 'MinuteBar', // Available values: Tick, DailyBar, MinuteBar, Custom, DOM
	elementSize: 1,
	elementSizeUnit: 'UnderlyingUnits', // Available values: Volume, Range, UnderlyingUnits, Renko, MomentumRange, PointAndFigure, OFARange
	withHistogram: false,
},
timeRange: {
	asMuchAsElements: 20,
},

```

The same timestamp will be emitted multiple times after the initial set of 20, I assume this is to get the progressive effect of the bar being built out in real time, and the final bar is the one prior to the timestamp moving to the next minute ?

---

<div class="post-metadata">

**Author:** ![Alexander](https://sea1.discourse-cdn.com/flex015/user_avatar/community.tradovate.com/alexander/32/988_2.png) [@Alexander](https://community.tradovate.com/u/Alexander)\
**Post date:** [January 20, 2022, 2:26pm UTC](https://community.tradovate.com/t/confirmation-on-md-getchart-parameters-and-volume/3740/2 "2022-01-20T14:26:52Z")

</div>

Hi @Mikeb,

You’re assumption is correct, you add the bid volume to the offer volume to find total volume over a set. Regarding incoming chart data, yes the same timestamp being emitted again and again means you’re in a real-time bar. When the timestamp changes, you’ve moved to the next latest bar.

Market Replay will play back market history from the given timestamp forward as if it were happening live. You can adjust the speed parameter up to a value of `400` to make it play at up to 400% of its real time speed.

For chart `timeRange` parameters and knowing about the end-of-history flag:

- The `asMuchAsElements` parameter will tell the server to emit `n` elements (or the rate limit on elements at the time of request if `n` is too big) up to the latest bar. Once it has loaded the elements up to the real time data, it will also emit an ‘end of history’ flag object. The only data contained in the EoH object is `{ id: 12345, eoh: true }`. You can tailor your `onmessage` callback for the socket to watch for that flag to know when you’ve hit the latest bar.

- If you want to request a specific set from the past you need to use the `asCloseAsTimestamp` and `asFarAsTimestamp` parameters. You can provide them as JSON encoded dates to get a specific range of history -`asFarAsTimestamp` being the oldest piece of data in the set, and `asCloseAsTimestamp` being the nearest. In this scenario the `{ id: 12345, eoh: true }` flag indicates you’ve either hit the rate limit on bars from one request, or all the bars from the set you requested have been retrieved.

- If you hit the rate limit going back in history, which is fairly common for large sets, you’ll need to `md/cancelchart` on the current subscription. You should send the body of `md/cancelChart` as `{ subscriptionId: <realtimeId of req> }`. The `realtimeId` will come in the first response from `md/getChart`. Once you’ve unsubscribed, take the oldest piece of data in the set you’ve retrieved so far and start a new request with the oldest timestamp being the new `asCloseAsTimestamp` parameter in your request.

---

<div class="post-metadata">

**Author:** ![Mikeb](https://avatars.discourse-cdn.com/v4/letter/m/e95f7d/32.png) [@Mikeb](https://community.tradovate.com/u/Mikeb)\
**Post date:** [January 20, 2022, 9:19pm UTC](https://community.tradovate.com/t/confirmation-on-md-getchart-parameters-and-volume/3740/3 "2022-01-20T21:19:16Z")

</div>

@Alexander thanks for the detail and answering those!

The one thing I noticed with historic data it’s not guaranteed to be in order. Just leaving that as a note for anyone else who reads this.

---

<div class="post-metadata">

**Author:** ![PRATIK\_BABHULKAR](https://avatars.discourse-cdn.com/v4/letter/p/8e8cbc/32.png) [@PRATIK\_BABHULKAR](https://community.tradovate.com/u/PRATIK_BABHULKAR)\
**Post date:** [September 8, 2022, 9:42am UTC](https://community.tradovate.com/t/confirmation-on-md-getchart-parameters-and-volume/3740/4 "2022-09-08T09:42:35Z")

</div>

Hi @Alexander ,

Can you elaborate more on the option of “OFARange” as it appears on API documentation page for chart.

I tried to use it but did not receive any historic or realtime data. However, did not receive any error as well.

Thanks and Regards,  
Pratik
