> For the complete documentation index, see [llms.txt](https://developer.barchart.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://developer.barchart.com/openfeed-api/snapshot-rest.md).

# Snapshot REST API

Snapshot REST-Based Openfeed API&#x20;

## Openfeed Snapshot

> A high-performance REST based API for quickly accessing Market Data.

If your use case doesn't require a constant stream of data, you can utilize Openfeed's Snapshot (REST) service to quickly access a "snapshot" of market data.

* Endpoint: `https://openfeed.aws.barchart.com`
* OpenAPI Specification: \[coming soon]

### Authentication

You can authenticate with Opeenfeed Snapshot using the same set of credentials as Openfeed Streaming.

If you do not already have a set of credentials, please see Accessing Openfeed.

Authentication is not required for all APIs - but when it is - your `username` and `password` should be set in the query string as follows:

* `?username={user}&password={pass}`

### Authorization

Consistent with Openfeed Streaming, your credentials determine what exchanges you are allowed to access (including wether or not you are authorized to view real-time data, best bid / ask, etc.).

You can see your level of service and exchange permissions here:

`https://www.ddfplus.com/getUserSettings.php?username={user}`

### Data Services

#### Metadata and Instrument Lookups

Find a full description of our workflows obtaining metadata for both Streaming and REST APIs: &#x20;

[Metadata](/getting-started/metadata.md)

#### Available Exchanges

Learn more about Barchart's Openfeed-specific global coverage:

[Available Exchanges](/getting-started/available-exchanges.md)

#### Market Data

You can obtain a full market snapshot via the `quote` endpoint:

`https://openfeed.aws.barchart.com/stream/quote.jsx?symbols=ES*0,TSLA&username={user}&password={pass}&version=json`

* The `symbols` parameter can either be a string (single symbol) a comma separated list of symbols.
* The `version` parameter can be set to `json` or `xml`.

In the example below, you can see snapshot market data for `ESZ21` and `TSLA`.

**Snapshot (REST) API XML Payload**

<details>

<summary>Expected XML Output (click to expand)</summary>

```xml
<?xml version="1.0" encoding="us-ascii"?>
<data>
	<QUOTE symbol="ESZ1" name="S&amp;P 500 E-Mini" exchange="GBLX" basecode="A" pointvalue="50.0" tickincrement="25" ddfexchange="M" lastupdate="20211004131415" bid="427800" bidsize="15" ask="427825" asksize="40" mode="R"><SESSION day="4" session="G" timestamp="20211004131415" open="434900" high="436200" low="426750" last="427800" previous="434375" tradesize="2" openinterest="2375977" volume="1534645" numtrades="1014211" pricevolume="6606182070.07" tradetime="20211004131415" ticks=".." id="combined"/><SESSION day="1" timestamp="20211001000000" open="430100" high="436575" low="426000" last="434375" previous="429775" settlement="434375" openinterest="2375977" volume="2269695" ticks=".." id="previous"/></QUOTE>
	<QUOTE symbol="TSLA" name="Tesla Inc" exchange="NASDAQ" basecode="A" pointvalue="1.0" tickincrement="1" ddfexchange="Q" lastupdate="20211004131415" bid="78441" bidsize="1" ask="78471" asksize="1" mode="R"><SESSION day="4" session="R" timestamp="20211004141415" open="79650" high="80697" low="77612" last="78440" previous="77522" tradesize="500" volume="24922918" numtrades="534844" pricevolume="19749509608.51" tradetime="20211004141414" ticks="--" last_z="78459" tradesize_z="1" tradetime_z="20211004141415" id="combined"/><SESSION day="1" timestamp="20211001000000" open="77840" high="78078" low="76359" last="77522" previous="77548" settlement="77522" volume="17031400" id="previous"/><SESSION day="4" session="T" timestamp="20211004093001" last="79635" tradesize="100" volume="724263" numtrades="3032" pricevolume="577604999.14" tradetime="20211004093001" ticks="--" id="session_4_T"/></QUOTE>
</data>
```

</details>

**Snapshot (REST) API JSON Payload**

<details>

<summary>Expected JSON Output (click to expand)</summary>

```json
// Some code{
	"servertime": 1633371215511,
	"data": {
		"ESZ1": {
			"symbol": "ESZ1",
			"name": "S&P 500 E-Mini",
			"exchange": "GBLX",
			"basecode": "A",
			"pointvalue": 50.0,
			"tickincrement": 25,
			"ddfexchange": "M",
			"day": "4",
			"date": "2021-10-04",
			"flag": null,
			"lastupdate": 20211004131335,
			"bid": 4278.50,
			"bidsize": 2500,
			"ask": 4278.75,
			"asksize": 2800,
			"open": 4349.00,
			"high": 4362.00,
			"low": 4267.50,
			"last": 4278.75,
			"last2": 4278.50,
			"last3": 4278.50,
			"last_t": null,
			"lastsize": 2,
			"tradetimestamp": 1633371215311,
			"settlement": null,
			"previous": 4343.75,
			"volume": 1533219,
			"openinterest": 2375977,
			"numtrades": 1013192,
			"pricevolume": 6600080350.82,
			"timestamp": 1633371215312,
			"seqno": 17261579,
			"previous_session": {
				"last": 4343.75,
				"open": 4301.00,
				"high": 4365.75,
				"low": 4260.00,
				"previous": 4297.75,
				"volume": 2269695,
				"openinterest": 2375977,
				"settlement": 4343.75,
				"day": "1",
				"date": "2021-10-01"
			}
		},
		"TSLA": {
			"symbol": "TSLA",
			"name": "Tesla Inc",
			"exchange": "NASDAQ",
			"basecode": "A",
			"pointvalue": 1.0,
			"tickincrement": 1,
			"ddfexchange": "Q",
			"day": "4",
			"date": "2021-10-04",
			"flag": null,
			"lastupdate": 20211004131335,
			"bid": 784.2400,
			"bidsize": 100,
			"ask": 784.5400,
			"asksize": 100,
			"open": 796.5000,
			"high": 806.9699,
			"low": 776.1200,
			"last": 784.4300,
			"last2": 784.5000,
			"last3": 784.5100,
			"last_t": 796.3500,
			"lastsize": 100,
			"tradetimestamp": 1633374814420,
			"settlement": null,
			"previous": 775.2200,
			"volume": 24904752,
			"openinterest": null,
			"numtrades": 534361,
			"pricevolume": 19735255075.14,
			"timestamp": 1633374815343,
			"last_z": 784.4498,
			"lastsize_z": 1,
			"tradetimestamp_z": 1633374815303,
			"seqno": 5172964,
			"t_session": {
				"last": 796.3500,
				"lastsize": 100,
				"tradetimestamp": 1633357801589,
				"timestamp": 1633357801589,
				"numtrades": 3032,
				"volume": 724263,
				"pricevolume": 577604999.14
			},
			"previous_session": {
				"last": 775.2200,
				"open": 778.4000,
				"high": 780.7800,
				"low": 763.5900,
				"previous": 775.4800,
				"volume": 17031400,
				"settlement": 775.2200,
				"day": "1",
				"date": "2021-10-01"
			}
		}
	}
}
```

</details>

> Note: Base codes in snapshot messages indicate the incoming message precision

Below is the detailed description of various base codes

* 2 = 1/8 = one digit fraction, range is 0 - 7
* 3 = 1/16 = two digit fraction, range is 0 - 15
* 4 = 1/32 = two digit fraction, range is 0 - 31
* 5 = 1/64 = two digit fraction, range is 0 - 63
* 6 = 1/128 = three digit fraction, range is 0 - 127
* 7 = 1/256 = three digit fraction, range is 0 - 255
* 8 = 0 = no decimal places, a whole number
* 9 = 0.1 = one decimal place
* A = 0.01 = two decimal places
* B = 0.001 = three decimal places
* C = 0.0001 = four decimal places
* D = 0.00001 = five decimal places
* E = 0.000001 = six decimal places
* F = 0.0000001 = seven decimal places
* '\*' = unchanged = transmitted with size only data

{% hint style="info" %}
If you have multiple files, GitBook makes it easy to import full repositories too — allowing you to keep your GitBook content in sync.
{% endhint %}


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://developer.barchart.com/openfeed-api/snapshot-rest.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
