> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://partner.ninjatrader.com/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://partner.ninjatrader.com/_mcp/server.

# Request Reference

## Subscribe Quote

**Endpoint**: `md/subscribeQuote`

### Parameters:

```js
{ "symbol": "ESM7" | 123456 }
```

### Data message

```js
{
    "e":"md",
    "d": {
        "quotes": [ // "quotes" may contain multiple quote objects
            {
                "timestamp":"2021-04-13T04:59:06.588Z",
                "contractId":123456,
                "entries": {
                    "Bid": { "price":18405.123, "size":7.123 },
                    "TotalTradeVolume": { "size":4118.123 },
                    "Offer": { "price":18410.012, "size":12.35 },
                    "LowPrice": { "price":18355.23 },
                    "Trade": { "price":18405.023, "size":2.10 },
                    "OpenInterest": { "size":40702.024 },
                    "OpeningPrice": { "price":18515.123 },
                    "HighPrice": { "price":18520.125 },
                    "SettlementPrice": { "price":18520.257 }
                }
            }
        ]
    }
}
```

## Unsubscribe Quote

**Endpoint**: `md/unsubscribeQuote`

### Parameters:

```js
{ "symbol": "ESM7" | 123456 }
```

## Subscribe DOM

**Endpoint**: `md/subscribeDOM`

### Parameters:

```
{ "symbol": "ESM7" | 123456 }
```

### Data message

```js
{
  "e":"md",
  "d": {
    "doms": [ // "doms" may contain multiple DOM objects
      {
        "contractId":123456, // ID of the DOM contract
        "timestamp":"2021-04-13T11:33:57.488Z",
        "bids": [ // Actual depth of "bids" may varies depending on available data
          {"price":2335.25,"size":33.54},
          ...
          {"price":2333,"size":758.21}
        ],
        "offers": [ // Actual depth of "offers" may varies depending on available data
          {"price":2335.5,"size":255.12},
          ...
          {"price":2337.75,"size":466.64}
        ]
      }
    ]
  }
}
```

## Unsubscribe DOM

**Endpoint**: `md/unsubscribeDOM`

### Parameters:

```js
{ "symbol": "ESM7" | 123456 }
```

## Subscribe Histogram

**Endpoint**: `md/subscribeHistogram`

### Parameters:

```js
{ "symbol": "ESM7" | 123456 }
```

### Data message

```js
{
  "e":"md",
  "d": {
    "histograms": [ // "histograms" may contain multiple histogram objects
      {
        "contractId":123456, // ID of the histogram contract
        "timestamp":"2017-04-13T11:33:57.412Z",
        "tradeDate": {
          "year":2022,
          "month":4,
          "day":13
        },
        "base":2338.75,
        "items": { // Actual number of histogram items may depend on data
          "-14":5906.67,
          ...
          "2":1234.55,
        },
        "refresh":false
      }
    ]
  }
}
```

## Unsubscribe Histogram

**Endpoint**: `md/unsubscribeHistogram`

### Parameters:

```js
{ "symbol": "ESM7" | 123456 }
```

## Get Chart

A client application may have multiple charts for the same contract, so the response for `md/getChart` request contains a subscription ID to properly track and unsubscribe from a real-time chart subscription. If you're using JavaScript, don't forget to check the section on charts in our API's comprehensive JavaScript tutorial.

**Endpoint**: `md/getChart`

### Parameters:

```js
{
  "symbol":"ESM7" | 123456,
  "chartDescription": {
    "underlyingType":"MinuteBar", // Available values: Tick, DailyBar, MinuteBar, Custom, DOM
    "elementSize":15,
    "elementSizeUnit":"UnderlyingUnits", // Available values: Volume, Range, UnderlyingUnits, Renko, MomentumRange, PointAndFigure, OFARange
    "withHistogram": true | false
  },
  "timeRange": {
    // All fields in "timeRange" are optional, but at least anyone is required
    "closestTimestamp":"2017-04-13T11:33Z",
    "closestTickId":123,
    "asFarAsTimestamp":"2017-04-13T11:33Z",
    "asMuchAsElements":66
  },
}
```

### Response

A response for `md/getChart` request contains two subscription ID, historicalId and realtimeId. Client needs to store realtimeId value to properly cancel real-time chart subscription via `md/cancelChart` request.

```js
{
  "s":200,
  "i":13,
  "d":{
    "historicalId":32,
    "realtimeId":31
  }
}
```

### Data message

```js
{
  "e":"chart",
  "d": {
    "charts": [ // "charts" may contain multiple chart objects
      {
        "id":9, // "id" matches either historicalId or realtimeId values from response
        "td":20170413, // Trade date as a number with value YYYYMMDD
        "bars": [ // "bars" may contain multiple bar objects
          {
            "timestamp":"2017-04-13T11:00:00.000Z",
            "open":2334.25,
            "high":2334.5,
            "low":2333,
            "close":2333.75,
            "upVolume":4712.234,
            "downVolume":201.124,
            "upTicks":1333.567,
            "downTicks":82.890,
            "bidVolume":2857.123,
            "offerVolume":2056.224
          }
        ]
      }
    ]
  }
}
```

## Cancel Chart

**Endpoint**: `md/cancelChart`

### Parameters:

```js
{
  "subscriptionId": 123456 // The value of historical chart subscription ID from `md/getChart` response
}
```