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:
Field | Description |
---|---|
isShadow | Deprecated 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:
|
exchangeCode | This bar contains information about market data from this exchange code |
timestamp | Bar 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. |
openTimestamp | Timestamp of the first quote (first incremental update or snapshot) in bar time period coming from bar exchange. |
closeTimestamp | Timestamp of the last quote (last incremental update or snapshot) in bar time period coming from the bar exchange. |
symbol | The symbol (instrument name) for which this bar is built. Standard component uses GUID to identify instruments inside CryptoCortex part of the system. |
openAsk | Best 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. |
closeAsk | Best 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. |
lowAsk | The minimum value of all best ASK prices in this bar time period for the bar exchange. |
highAsk | The maximum value of all best ASK prices in this bar time period for the bar exchange. |
openBid | Best 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. |
closeBid | Best 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. |
lowBid | The minimum value of all best BID prices in this bar time period for the bar exchange. |
highBid | The maximum value of all best BID prices in this bar time period for the bar exchange. |
lowMid | The 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. |
highMid | The 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. |
volume | Total trade volume happened on bar exchange in this bar time period. |
closeAskQuoteId | Unique 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. |
closeBidQuoteId | Unique 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. |
currencyCode | Deprecated 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'
}