Barchart Market Data Solutions » Streaming API » Protocol
XML Query/Response
The Query/Response protocol is based on an HTTP connection to the JERQ server.
Contact Us
XML Query/Response
The Query/Response protocol is based on an HTTP connection to the JERQ server. The query string contains the username, password, and symbol request. The server will then return a standalone XML document that contains the requested data.
HTTP Request Format:
http://[servername]/stream/quotes.jsx?username=[username]&password=[password]&symbols[symbols]
Here, you will need to insert the
[servername]
, [username]
, [password]
, and [symbols]
. Note: The servername, username, and password will be provided to you by your ddf account representative.Example:
For example, if the username were
testuser
and the password were testpass
and the server were test.ddfplus.com
and the symbols that we wanted data for were IBM
and QQQQ
, then the resulting query would be:http://test.ddfplus.com/stream/quotes.jsx?username=testuser&password=testpass&symbols=IBM,QQQ
Resulting XML:
The resulting XML document would look like this:
<data> <QUOTE symbol="IBM" name="International Business Machines Corp." exchange="NYSE" basecode="A" pointvalue="1.0" tickincrement="1" ddfexchange="N" lastupdate="20120208173827" bid="19231" bidsize="2" ask="19235" asksize="2" mode="R"> <SESSION day="8" session="R" timestamp="20120208123827" open="19268" high="19358" low="19173" last="19235" previous="19335" tradesize="100" volume="2076756" numtrades="11034" pricevolume="338752982.34" tradetime="20120208123820" ticks=".." id="combined"/> <SESSION day="7" timestamp="20120207000000" open="19244" high="19414" low="19197" last="19335" previous="19282" volume="3432900" ticks=".." id="previous"/> <SESSION day="8" session="R" timestamp="20120208123827" previous="19335" id="session_8_R"/> </QUOTE> <QUOTE symbol="QQQ" name="Nasdaq-100 ETF" exchange="NASDAQ" basecode="A" pointvalue="1.0" tickincrement="1" ddfexchange="Q" lastupdate="20120208173828" bid="6212" bidsize="115" ask="6213" asksize="765" mode="R"> <SESSION day="8" session="R" timestamp="20120208123828" open="6215" high="6238" low="6191" last="6212" previous="6213" tradesize="650" volume="12156987" numtrades="20678" pricevolume="674620498.26" tradetime="20120208123818" ticks="+." id="combined"/> <SESSION day="7" timestamp="20120207000000" open="6195" high="6225" low="6167" last="6213" previous="6200" volume="37935600" ticks=".." id="previous"/> <SESSION day="8" session="R" timestamp="20120208123828" previous="6213" id="session_8_R"/> </QUOTE> </data>
Attributes in red are always present. Each QUOTE object is essentailly a wrapper for prices. QUOTE objects contain at least two SESSION objects, one with an id of combined, and one with an id of previous. These equate, roughly, to the concepts of "today" and "tomorrow". There may be other sessions also, depending of if there are special session codes (such as after hours trading, pit session trading, etc.). Also, please read the special note regarding prices in the notes section.
QUOTE
objectThe
QUOTE
object can (but may not always) contain the following fields:- ask: The latest ask (offer) price.
- asksize: The latest ask (offer) size (quantity).
- basecode: The basecode of the object, to assist in converting the values of the prices. Click here for a more explicit definition of the basecode.
- bid: The latest bid price.
- bidsize: The latest bid size (quantity).
- ddfexchange: The ddf exchange code for the instrument.
- exchange: The exchange of the instrument.
- flag: If present, can be one of the following:
- c - meaning that the market is closed for this instrument.
- p - meaning that the market is in a pre-open state. This occurs when there are bids and offers being placed, but no trade has occured yet. This is normally seen shortly before the official opening time for busy markets, but can also be seen throughout the day for lightly traded markets.
- s - meaning that the instrument has settled, and that this is the final, settlement price.
- lastupdate: The Chicago Central Time of the last time the Quote Object was updated.
- marketcondition: If present, the market condition indicator. See the ddfplus feed specs for definitions.
- mode: Indicates if this is a realtime (R), delayed (I), or end-of-day (D) quote. This is the permission based on the username.
- name: The name associated with the symbol.
- pointvalue: Indicates the value of one point in dollar terms. This applies to futures. For example, the large S&P 500 contract on the CME has a point value of $250, meaning that for every 1 point in the S&P, the monetary value of the futures contract is $250.
- symbol: symbol of the object
- tickincrement: A number which says how may units, per basecode, the instrument trades in. In the example above, equities can trade per penny. So the basecode says that the item trades in 2 decimal places, the a tickincrement of 1 means 1 decimal place. A counter example would be something like the e-Mini S&P futures. This trades in 25 cent incerements.
SESSION
objectThe
SESSION
object contains the following fields:- id: The id of the session.
combined
is the combined, latest session for data.previous
is the previous session, i.e. "yesterday". Those are the two special sessions. All other sessions are simply session_<day>_<session> - day: The day code for the session. Day codes are
1
-9
for days 1 through 9,0
for the 10th of the month, andA
-U
for days 11 through 31. - high: The high for the session.
- last: The last for the session.
- low The low for the session.
- open The open price for the session.
- openinterest The open interest for the session.
- numtrades: The number of trades. Each trade (regardless of volume) increases this value by 1.
- previous: The previous price
- pricevolume: The total dollar value traded. For each tick, this value increments the trade size * price. Please note that this is not meaningful in futures as contract size is not taken into account.
- session The session code for the message. Click here for a more information on session codes..
- ticks: Indicator of the last trades being up (+), down (-), or even (.)
- timestamp The last time the session object was updated by a message, not just a trade. In YYYYMMDDhhmmss format.
- tradesize: The size of the last trade
- tradetime: The last time of a trade.
- volume The volume for the session.
Notes
Prices: Prices are delivered as ascii text, always in an integer style format. To derive the actual float value, you will need to process the integer along with the basecode.
Processing the prices of base codes 8, 9, A, B, and on is relatively straight-forward. These correspond to 0, 1, 2, 3, .... decimal places. So the value:
If the base code is a fractional indicator, then the last n maximum digits must be removed as the fractional part. For example, a base code of 2 means 1/8ths. So you would remove just 1 character, the 6 and the value would be 12345 6/8. For base code of 3, which is 32nds, you would remove the last two digits, and the value would be 1234 56/32 (understanding that the simple example creates an impossible value of 56/32, but the illustration still stands).
123456
means:- 123456 if base code is 8
- 12345.6 if base code is 9
- 1234.56 if base code is A
- 123.456 if base code is B
If the base code is a fractional indicator, then the last n maximum digits must be removed as the fractional part. For example, a base code of 2 means 1/8ths. So you would remove just 1 character, the 6 and the value would be 12345 6/8. For base code of 3, which is 32nds, you would remove the last two digits, and the value would be 1234 56/32 (understanding that the simple example creates an impossible value of 56/32, but the illustration still stands).