Skip to main content

OHLC Bars

Deltix CryptoCortex software has component that can generate Bar messages out of Level2 market data. This document describes output message format of this component.

CryptoCortex uses bars of different resolution (1 minute, 10 minutes, 1 hour, 1 day, etc.) to support various use cases where system need approximate prices (for example, charts that display how instrument price changed during each month).

Data format

Basic sample

A bar is a kind of OHLC (Open;High;Low;Close) message, that describes price statistics for some time period using best order book ASK and BID values.  We have a sample of this message below.

{
symbol: '47C5F80A259B474EB74EB32C4EECB410',
exchangeCode: 'BITFINEX',
timestamp: '2021-04-15T15:04:28.000Z',
openTimestamp: '2021-04-15T15:04:27.175Z',
closeTimestamp: '2021-04-15T15:04:27.987Z',
barType: 'ONE_SECOND',
openAsk: '0.039243',
openBid: '0.039224',
highAsk: '0.039243',
highBid: '0.039224',
highMid: '0.0392335',
lowAsk: '0.039242',
lowBid: '0.039223',
lowMid: '0.0392325',
closeAsk: '0.039242',
closeBid: '0.039223',
volume: '1.1'
}

As you can see each message has open/close timestamp that defines time range, symbol and exchange that identify instrument, and a set of price metrics that are described in detail in the next section.

Field descriptions

Bar is represented by class WCTBarMessage and has the following fields:

FieldDescription
isShadowDeprecated field. Previously used as indicator of data availability in the order book for the exchange of this bar in the time frame of this bar.
barType  Bar duration type. Can take next values:
  • ONE_SECOND – describe time periods that start and end in seconds, like from 'YYYY-MM-DDTHH:MM:01.000Z' to 'YYYY-MM-DDTHH:MM:02.000Z'.
  • ONE_MINUTE – describe time periods that start and end in minutes, like from 'YYYY-MM-DDTHH:31:00.000Z' to 'YYYY-MM-DDTHH:32:00.000Z'.
  • FIVE_MINUTES – describe time periods that start and end in minutes multiple of 5, like from 'YYYY-MM-DDTHH:05:00.000Z' to 'YYYY-MM-DDTHH:10:00.000Z'.
  • FIFTEEN_MINUTES – describe time periods that start and end in minutes multiple of 15, like from 'YYYY-MM-DDTHH:30:00.000Z' to 'YYYY-MM-DDTHH:45:00.000Z'.
  • THIRTY MINUTES  – describe time periods that start and end in minutes multiple of 30, like from 'YYYY-MM-DDTHH:00:00.000Z' to 'YYYY-MM-DDTHH:30:00.000Z'.
  • ONE_HOUR – describe time periods that start and end in hours, like from 'YYYY-MM-DDT01:00:00.000Z' to 'YYYY-MM-DDT02:00:00.000Z'.
  • FOUR_HOURS – describe time periods that start and end in hours multiple of 4, like from 'YYYY-MM-DDT04:00:00.000Z' to 'YYYY-MM-DDT08:00:00.000Z'.
  • EIGHT_HOURS – describe time periods that start and end in hours multiple of 8, like from 'YYYY-MM-DDT08:00:00.000Z' to 'YYYY-MM-DDT:00:00.000Z'.
  • DAY – describe time periods that start and end in days, like from 'YYYY-MM-01T00:00:00.000Z' to 'YYYY-MM-02T:00:00.000Z'
  • WEEK – describe time periods which started that start and end on Thursday, because the Unix epoch is 00:00:00 UTC on 1 January 1970(Thursday).
  • MONTH – describe time periods that start and end in months, like from 'YYYY-01-00T00:00:00.000Z' to 'YYYY-02-00T:00:00.000Z'
exchangeCodeThis bar contains information about market data from this exchange code
timestampBar start time. Always a multiple of the bar duration. You can see barType field description to clarify how time period for a bar is calculated.
openTimestampTimestamp of the first quote (first incremental update or snapshot) in bar time period coming from bar exchange.
closeTimestampTimestamp of the last quote (last incremental update or snapshot) in bar time period coming from the bar exchange.
symbolThe symbol (instrument name) for which this bar is built. Standard component uses GUID to identify instruments inside CryptoCortex part of the system.
openAskBest ASK price when the first update is coming to this bar for the bar exchange, or last best ASK price for the bar exchange if there were no updates.
closeAskBest ASK price when the last update is coming to this bar for the bar exchange, or last best ASK price for the bar exchange if there were no updates.
lowAskThe minimum value of all best ASK prices in this bar time period for the bar exchange.
highAskThe maximum value of all best ASK prices in this bar time period for the bar exchange.
openBidBest BID price when the first update is coming to this bar for the bar exchange, or last best BID price for the bar exchange if there were no updates.
closeBidBest BID price when the last update is coming to this bar for the bar exchange, or last best BID price for the bar exchange if there were no updates.
lowBidThe minimum value of all best BID prices in this bar time period for the bar exchange.
highBidThe maximum value of all best BID prices in this bar time period for the bar exchange.
lowMidThe lowest mid-price value which calculated like  minimum of all (currentAsk(t) + currentBid(t)) / 2 values, where t is any time point in the bar time period, currentAsk is the best ASK value at this time point and currentBid is the best BID value at this time point for the bar exchange.
highMidThe highest mid-price value which calculated like  minimum of all (currentAsk(t) + currentBid(t)) / 2 values, where t is any time point in the bar time period, currentAsk is the best ASK value at this time point and currentBid is the best BID value at this time point for the bar exchange.
volumeTotal trade volume happened on bar exchange in this bar time period.
closeAskQuoteIdUnique identifier of best ASK quote when the last update is coming to this bar. Represents like byte array of size 32, each byte can have value from 0 to 255.
closeBidQuoteIdUnique identifier of best BID quote when the last update is coming to this bar. Represents like byte array of size 32, each byte can have value from 0 to 255.
currencyCodeDeprecated field. Value is always 999 (unknown based on ISO 4217)

Complete Sample

{
'$type': 'deltix.wct.marketdata.historical.WCTBarMessage',
symbol: '47C5F80A259B474EB74EB32C4EECB410',
timestamp: '2021-04-15T15:04:28.000Z',
currencyCode: 999,
barType: 'ONE_SECOND',
closeAsk: '0.039242',
closeAskQuoteId: [
55, 52, 65, 48, 66, 68, 50, 67, 45,
67, 70, 57, 55, 45, 52, 53, 69, 51,
45, 56, 70, 48, 53, 45, 67, 49, 69,
65, 57, 56, 65, 50, 66, 48, 51, 68
],
closeBid: '0.039223',
closeBidQuoteId: [
51, 65, 53, 69, 67, 67, 65, 54, 45,
49, 69, 54, 55, 45, 52, 56, 55, 51,
45, 56, 56, 66, 52, 45, 65, 69, 57,
48, 49, 68, 55, 57, 53, 70, 51, 68
],
closeTimestamp: '2021-04-15T15:04:27.987Z',
exchangeCode: 'BITFINEX',
highAsk: '0.039243',
highBid: '0.039224',
highMid: '0.0392335',
isShadow: false,
lowAsk: '0.039242',
lowBid: '0.039223',
lowMid: '0.0392325',
openAsk: '0.039243',
openBid: '0.039224',
openTimestamp: '2021-04-15T15:04:27.175Z',
volume: '1.1'
}