getBars¶
Bar Services: Get data for pre-aggregated bar charts
Syntax: getBars parms
Where parms is a dictionary of parameters, returns data for bar charts. The parameter dictionary is constructed from two lists: keys and values:
getTicks `key1`key2`key3!(value1;value2;value3)
Parameters for getTicks and getStats are also parameters for getBars.
Some (R) are required: omitting a required parameter signals an error.
analytics R Analytics granularity Bucketing and bars granularityUnit Bucketing and bars
Differences from getStats¶
Note the following differences from parameters for getStats.
analyticsandgranularity-
There are subtle differences in the valid inputs for analytics and granularity as well as the arguments that can be passed.
applyCanCor-
In a standard deployment the parameter
applyCanCorwill not work forgetBars. By default, the bars will be written without cancellations/corrections applied. If you require bars with cancellations/corrections applied, then this will need to be configured. Only once this has been done will you be able to use theapplyCanCorparameter forgetBars. filterRule-
In a standard deployment the only option for the
filterRuleparameter is the default. If you require bars with different filters applied, this will have to be configured. Only once this has been done will you be able to request bars that correspond to specific filters using thefilterRuleparameter.
Bar Services operate against pre-aggregated and persisted time-bar analytics, allowing for faster and less intensive queries on certain granularity units. Therefore, the Bar Service works only on historical data.
Analytics background¶
The purpose of the getBars API is to quickly and efficiently retrieve aggregate values from large tick databases. The API queries pre-calculated trade stats and quote stats. These tables (tradeStats and quoteStats) are updated at the end of every day.
Many of the values in tradeStats and quoteStats are generated using analytics that are common to the getStats analytics; e.g. sumPrice, sumVolume, firstPrice, lastPrice, etc, although there are some exceptions. The aggregate values used to fill tradeStats and quoteStats are calculated at 1-minute granularity.
getBars also has user-defined granularity level, meaning that getBars often returns aggregations of aggregations. The values returned from getBars are more easily understood with this in mind.
Example query:
getBars .[!]flip(
(symList ; `VOD.L);
(dataType ; `trade);
(startDate ; .z.d-7);
(endDate ; .z.d-1);
(startTime ; 14:00:00);
(endTime ; 03:00:00);
(granularity ; 1);
(granularityUnit; `hour);
(temporality ; `continuous);
(analytics ; `firstFirstPrice`firstLastVolume);
(assetClass ; `equity)
)
The above getBars query returns two aggregate values firstFirstPrice and firstLastVolume at a 1-hour granularity. The names, while confusing at first, are made clearer when we remember that getBars queries aggregations of aggregations.
Therefore, firstFirstPrice will return the first price from the first minute for each hour queried. It then follows that firstLastVolume last volume of the first minute for each hour queried.
Analytics¶
Key analytics required Value one or more analytics as symbol atom or vector Valid (see lists below) ` (calculate all)
Examples `VWAP `VWAP`TWAP `
Trade stats:
avgPrice lastFirstPrice maxLastVolume minOpenPrice
avgVolume lastFirstVolume maxMaxPrice minSumPrice
firstClosePrice lastLastExchangeTime maxMaxVolume minSumVolume
firstFirstExchangeTime lastLastInsertTime maxMinPrice minTradeCount
firstFirstInsertTime lastLastPrice maxMinVolume minTurnover
firstFirstPrice lastLastVolume maxOpenPrice return
firstFirstVolume lastMaxPrice maxSumPrice sumClosePrice
firstLastExchangeTime lastMaxVolume maxSumVolume sumFirstPrice
firstLastInsertTime lastMinPrice maxTradeCount sumFirstVolume
firstLastPrice lastMinVolume maxTurnover sumLastPrice
firstLastVolume lastOpenPrice minClosePrice sumLastVolume
firstMaxPrice lastSumPrice minFirstExchangeTime sumMaxPrice
firstMaxVolume lastSumVolume minFirstInsertTime sumMaxVolume
firstMinPrice lastTradeCount minFirstPrice sumMinPrice
firstMinVolume lastTurnover minFirstVolume sumMinVolume
firstOpenPrice maxClosePrice minLastExchangeTime sumOpenPrice
firstSumPrice maxFirstExchangeTime minLastInsertTime sumSumPrice
firstSumVolume maxFirstInsertTime minLastPrice sumSumVolume
firstTradeCount maxFirstPrice minLastVolume sumTradeCount
firstTurnover maxFirstVolume minMaxPrice sumTurnover
lastClosePrice maxLastExchangeTime minMaxVolume TWAP
lastFirstExchangeTime maxLastInsertTime minMinPrice VWAP
lastFirstInsertTime maxLastPrice minMinVolume
Quote stats:
avgAskPrice lastFirstBidSize maxLastExchangeTime minMaxSpread
avgAskSize lastFirstExchangeTime maxLastInsertTime minMinAskPrice
avgBidPrice lastFirstInsertTime maxLastMidPrice minMinAskSize
avgBidSize lastFirstMidPrice maxLastSpread minMinBidPrice
avgMidPrice lastFirstSpread maxMaxAskPrice minMinBidSize
avgSpread lastLastAskPrice maxMaxAskSize minMinMidPrice
firstFirstAskPrice lastLastAskSize maxMaxBidPrice minMinSpread
firstFirstAskSize lastLastBidPrice maxMaxBidSize minQuoteCount
firstFirstBidPrice lastLastBidSize maxMaxMidPrice minSumAskPrice
firstFirstBidSize lastLastExchangeTime maxMaxSpread minSumAskSize
firstFirstExchangeTime lastLastInsertTime maxMinAskPrice minSumBidPrice
firstFirstInsertTime lastLastMidPrice maxMinAskSize minSumBidSize
firstFirstMidPrice lastLastSpread maxMinBidPrice minSumMidPrice
firstFirstSpread lastMaxAskPrice maxMinBidSize sumFirstAskPrice
firstLastAskPrice lastMaxAskSize maxMinMidPrice sumFirstAskSize
firstLastAskSize lastMaxBidPrice maxMinSpread sumFirstBidPrice
firstLastBidPrice lastMaxBidSize maxQuoteCount sumFirstBidSize
firstLastBidSize lastMaxMidPrice maxSumAskPrice sumFirstMidPrice
firstLastExchangeTime lastMaxSpread maxSumAskSize sumFirstSpread
firstLastInsertTime lastMinAskPrice maxSumBidPrice sumLastAskPrice
firstLastMidPrice lastMinAskSize maxSumBidSize sumLastAskSize
firstLastSpread lastMinBidPrice maxSumMidPrice sumLastBidPrice
firstMaxAskPrice lastMinBidSize minFirstAskPrice sumLastBidSize
firstMaxAskSize lastMinMidPrice minFirstAskSize sumLastMidPrice
firstMaxBidPrice lastMinSpread minFirstBidPrice sumLastSpread
firstMaxBidSize lastQuoteCount minFirstBidSize sumMaxAskPrice
firstMaxMidPrice lastSumAskPrice minFirstExchangeTime sumMaxAskSize
firstMaxSpread lastSumAskSize minFirstInsertTime sumMaxBidPrice
firstMinAskPrice lastSumBidPrice minFirstMidPrice sumMaxBidSize
firstMinAskSize lastSumBidSize minFirstSpread sumMaxMidPrice
firstMinBidPrice lastSumMidPrice minLastAskPrice sumMaxSpread
firstMinBidSize maxFirstAskPrice minLastAskSize sumMinAskPrice
firstMinMidPrice maxFirstAskSize minLastBidPrice sumMinAskSize
firstMinSpread maxFirstBidPrice minLastBidSize sumMinBidPrice
firstQuoteCount maxFirstBidSize minLastExchangeTime sumMinBidSize
firstSumAskPrice maxFirstExchangeTime minLastInsertTime sumMinMidPrice
firstSumAskSize maxFirstInsertTime minLastMidPrice sumMinSpread
firstSumBidPrice maxFirstMidPrice minLastSpread sumQuoteCount
firstSumBidSize maxFirstSpread minMaxAskPrice sumSumAskPrice
firstSumMidPrice maxLastAskPrice minMaxAskSize sumSumAskSize
lastFirstAskPrice maxLastAskSize minMaxBidPrice sumSumBidPrice
lastFirstAskSize maxLastBidPrice minMaxBidSize sumSumBidSize
lastFirstBidPrice maxLastBidSize minMaxMidPrice sumSumMidPrice
Analytics are generated based on data type: i.e. trade or quote. The analytics are called by providing a list of the analytic names in the parameter. These are generally constructed using an abbreviation of the operator as a prefix to the name of the value, for example, avgVolume.
As with getStats, using a back-tick (`) will give all analytics available for the chosen data type. The above list is not exhaustive; additional analytics will continue to be added.
Trade analytics¶
Bar data is saved into two pre-aggregated buckets, by minute and day. In the following table, the pre-aggregated bucket will be:
- minute, if the granularity unit is minute or hour
- day, if the granularity unit is day, week or month
| Analytic | Result | Datatype |
|---|---|---|
| avgPrice | average price for the relevant interval | float |
| avgVolume | average volume for the relevant interval | float |
| firstClosePrice | day close price | float |
| firstFirstExchangeTime | first exchange time for the relevant interval | timestamp |
| firstFirstInsertTime | first insert time for the relevant interval | timestamp |
| firstFirstPrice | first price of the first pre-aggregated bucket of the specified time interval | float |
| firstFirstVolume | first volume of the first pre-aggregated bucket of the specified time interval | long |
| firstLastExchangeTime | last exchange time for the first pre-aggregated bucket of the relevant interval | timestamp |
| firstLastInsertTime | last insert time for the first pre-aggregated bucket of the relevant interval | timestamp |
| firstLastPrice | last price of the first pre-aggregated bucket of the specified time interval | float |
| firstLastVolume | last volume of the first pre-aggregated bucket of the specified time interval | long |
| firstMaxPrice | maximum price of the first pre-aggregated bucket of the specified time interval | float |
| firstMaxVolume | maximum volume of the first pre-aggregated bucket of the specified time interval | long |
| firstMinPrice | minimum price of the first pre-aggregated bucket of the specified time interval | float |
| firstMinVolume | minimum volume of the first pre-aggregated bucket of the specified time interval | long |
| firstOpenPrice | day open price | float |
| firstSumPrice | sum of the prices for the first pre-aggregated bucket of the specified time interval | float |
| firstSumVolume | sum of the volume for the first pre-aggregated bucket of the specified time interval | long |
| firstTradeCount | number of trades in the f first pre-aggregated bucket of the specified time interval | long |
| firstTurnover | first turnover of the first pre-aggregated bucket of the specified time interval | float |
| lastClosePrice | day close price | float |
| lastFirstExchangeTime | first exchange time for the last pre-aggregated bucket of the relevant interval | timestamp |
| lastFirstInsertTime | first insert time for the last pre-aggregated bucket of the relevant interval | timestamp |
| lastFirstPrice | first price of the last pre-aggregated bucket of the specified time interval | float |
| lastFirstVolume | first volume of the last pre-aggregated bucket of the specified time interval | long |
| lastLastExchangeTime | last exchange time of the relevant interval | timestamp |
| lastLastInsertTime | last insert time of the relevant interval | timestamp |
| lastLastPrice | last price of the last pre-aggregated bucket of the specified time interval | float |
| lastLastVolume | last volume of the last pre-aggregated bucket of the specified time interval | long |
| lastMaxPrice | maximum price of the last pre-aggregated bucket of the specified time interval | float |
| lastMaxVolume | maximum volume of the last pre-aggregated bucket of the specified time interval | long |
| lastMinPrice | minimum price of the last pre-aggregated bucket of the specified time interval | float |
| lastMinVolume | minimum volume of the last pre-aggregated bucket of the specified time interval | long |
| lastOpenPrice | day open price | float |
| lastSumPrice | sum of the prices for the last pre-aggregated bucket of the specified time interval | float |
| lastSumVolume | sum of the volume for the last pre-aggregated bucket of the specified time interval | long |
| lastTradeCount | number of trades in the last pre-aggregated bucket of the specified time interval | long |
| lastTurnover | first turnover of the last pre-aggregated bucket of the specified time interval | float |
| maxClosePrice | day close price | float |
| maxFirstExchangeTime | first exchange time for the last pre-aggregated bucket of the relevant interval | timestamp |
| maxFirstInsertTime | first insert time for the last pre-aggregated bucket of the relevant interval | timestamp |
| maxFirstPrice | maximum first price of the relevant interval | float |
| maxFirstVolume | maximum first volume of the relevant interval | long |
| maxLastExchangeTime | last exchange time of the relevant interval | timestamp |
| maxLastInsertTime | last insert time of the relevant interval | timestamp |
| maxLastPrice | maximum last price of the relevant interval | float |
| maxLastVolume | maximum last volume of the relevant interval | long |
| maxMaxPrice | maximum maxPrice of the relevant interval | float |
| maxMaxVolume | maximum maxVolume of the relevant interval | long |
| maxMinPrice | maximum minPrice of the relevant interval | float |
| maxMinVolume | maximum minVolume of the relevant interval | long |
| maxOpenPrice | day open price | float |
| maxSumPrice | maximum sum price of the relevant interval | float |
| maxSumVolume | maximum volume price of the relevant interval | long |
| maxTradeCount | maximum number of trades per pre-aggregated bucket of the relevant interval | long |
| maxTurnover | maximum turnover of the relevant interval | float |
| minClosePrice | day close price | float |
| minFirstExchangeTime | first exchange time for the relevant interval | timestamp |
| minFirstInsertTime | first insert time for the relevant interval | timestamp |
| minFirstPrice | minimum first price of the relevant interval | float |
| minFirstVolume | minimum first volume of the relevant interval | long |
| minLastExchangeTime | last exchange time for the first pre-aggregated bucket of the relevant interval | timestamp |
| minLastInsertTime | last insert time for the first pre-aggregated bucket of the relevant interval | timestamp |
| minLastPrice | minimum last price of the relevant interval | float |
| minLastVolume | minimum last volume of the relevant interval | long |
| minMaxPrice | minimum maxPrice of the relevant interval | float |
| minMaxVolume | minimum maxVolume of the relevant interval | long |
| minMinPrice | minimum minPrice of the relevant interval | float |
| minMinVolume | minimum minVolume of the relevant interval | long |
| minOpenPrice | day open price | float |
| minSumPrice | minimum sum price of the relevant interval | float |
| minSumVolume | minimum volume price of the relevant interval | long |
| minTradeCount | minimum number of trades per pre-aggregated bucket of the relevant interval | long |
| minTurnover | minimum turnover of the relevant interval | float |
| return | Returns return of the last price compared to the close price, return = (lastPrice - closePrice)/closePrice | float |
| sumClosePrice | sum of the day close price | float |
| sumFirstPrice | sum of the first prices for the relevant interval | float |
| sumFirstVolume | sum of the first volumes for the relevant interval | long |
| sumLastPrice | sum of the last prices for the relevant interval | float |
| sumLastVolume | sum of the last volumes for the relevant interval | long |
| sumMaxPrice | sum of the max prices for the relevant interval | float |
| sumMaxVolume | sum of the max volumes for the relevant interval | long |
| sumMinPrice | sum of the minimum prices for the relevant interval | float |
| sumMinVolume | sum of the minimum volumes for the relevant interval | long |
| sumOpenPrice | sum of the day open price | float |
| sumSumPrice | sum of the sum prices for the relevant interval | float |
| sumSumVolume | sum of the sum volumes for the relevant interval | long |
| sumTradeCount | number of trades for the relevant interval | long |
| sumTurnover | sum of the turnover for the relevant interval | float |
| TWAP | Time Weighted Average Price for the relevant interval | float |
| VWAP | Volume Weighted Average Price for the relevant interval | float |
Quote analytics¶
| Analytic | Result | Datatype |
|---|---|---|
| avgAskPrice | average ask price of the specified time interval | float |
| avgAskSize | average ask size of the specified time interval | float |
| avgBidPrice | average bid price of the specified time interval | float |
| avgBidSize | average bid size of the specified time interval | float |
| avgMidPrice | average mid price of the specified time interval | float |
| avgSpread | average spread of the specified time interval | float |
| firstFirstAskPrice | first ask price for the first pre-aggregated bucket of the specified time interval | float |
| firstFirstAskSize | first ask size for the first pre-aggregated bucket of the specified time interval | long |
| firstFirstBidPrice | first bid price of the first pre-aggregated bucket of the specified time interval | float |
| firstFirstBidSize | first bid size of the first pre-aggregated bucket of the specified time interval | long |
| firstFirstExchangeTime | first exchange time of the first pre-aggregated bucket of the specified time interval | timestamp |
| firstFirstInsertTime | first insert time of the first pre-aggregated bucket of the specified time interval | timestamp |
| firstFirstMidPrice | first mid price of the first pre-aggregated bucket of the specified time interval | float |
| firstFirstSpread | first spread of the first pre-aggregated bucket of the specified time interval | float |
| firstLastAskPrice | last ask price of the first pre-aggregated bucket of the specified time interval | float |
| firstLastAskSize | last ask size of the first pre-aggregated bucket of the specified time interval | long |
| firstLastBidPrice | last bid price of the first pre-aggregated bucket of the specified time interval | float |
| firstLastBidSize | last bid size of the first pre-aggregated bucket of the specified time interval | long |
| firstLastExchangeTime | last exchange time of the first pre-aggregated bucket of the specified time interval | timestamp |
| firstLastInsertTime | last insert time of the first pre-aggregated bucket of the specified time interval | timestamp |
| firstLastMidPrice | last mid price of the first pre-aggregated bucket of the specified time interval | float |
| firstLastSpread | last spread of the first pre-aggregated bucket of the specified time interval | float |
| firstMaxAskPrice | maximum ask price of the first pre-aggregated bucket of the specified time interval | float |
| firstMaxAskSize | maximum ask size of the first pre-aggregated bucket of the specified time interval | long |
| firstMaxBidPrice | maximum bid price of the first pre-aggregated bucket of the specified time interval | float |
| firstMaxBidSize | maximum bid size of the first pre-aggregated bucket of the specified time interval | long |
| firstMaxMidPrice | max mid price of the first pre-aggregated bucket of the specified time interval | float |
| firstMaxSpread | max spread of the first pre-aggregated bucket of the specified time interval | float |
| firstMinAskPrice | minimum ask price of the first pre-aggregated bucket of the specified time interval | float |
| firstMinAskSize | minimum ask size of the first pre-aggregated bucket of the specified time interval | long |
| firstMinBidPrice | minimum bid price of the first pre-aggregated bucket of the specified time interval | float |
| firstMinBidSize | minimum bid size of the first pre-aggregated bucket of the specified time interval | long |
| firstMinMidPrice | min mid price of the first pre-aggregated bucket of the specified time interval | float |
| firstMinSpread | min spread of the first pre-aggregated bucket of the specified time interval | float |
| firstQuoteCount | quote count of the first pre-aggregated bucket of the specified time interval | long |
| firstSumAskPrice | sum of the ask price of the first pre-aggregated bucket of the specified time interval | float |
| firstSumAskSize | sum of the ask size of the first pre-aggregated bucket of the specified time interval | long |
| firstSumBidPrice | sum of the bid prices for the first pre-aggregated bucket of the specified time interval | float |
| firstSumBidSize | sum of the bid size for the first pre-aggregated bucket of the specified time interval | long |
| firstSumMidPrice | sum mid price of the first pre-aggregated bucket of the specified time interval | float |
| lastFirstAskPrice | first ask price of the last pre-aggregated bucket of the specified time interval | float |
| lastFirstAskSize | first ask size of the last pre-aggregated bucket of the specified time interval | long |
| lastFirstBidPrice | first bid price of the last pre-aggregated bucket of the specified time interval | float |
| lastFirstBidSize | first bid size of the last pre-aggregated bucket of the specified time interval | long |
| lastFirstExchangeTime | first exchange time of the last pre-aggregated bucket of the specified time interval | timestamp |
| lastFirstInsertTime | first insert time of the last pre-aggregated bucket of the specified time interval | timestamp |
| lastFirstMidPrice | first mid price of the last pre-aggregated bucket of the specified time interval | float |
| lastFirstSpread | first spread of the last pre-aggregated bucket of the specified time interval | float |
| lastLastAskPrice | last ask price of the last pre-aggregated bucket of the specified time interval | float |
| lastLastAskSize | last ask size of the last pre-aggregated bucket of the specified time interval | long |
| lastLastBidPrice | last bid price of the last pre-aggregated bucket of the specified time interval | float |
| lastLastBidSize | last bid size of the last pre-aggregated bucket of the specified time interval | long |
| lastLastExchangeTime | last exchange time of the last pre-aggregated bucket of the specified time interval | timestamp |
| lastLastInsertTime | last insert time of the last pre-aggregated bucket of the specified time interval | timestamp |
| lastLastMidPrice | last mid price of the last pre-aggregated bucket of the specified time interval | float |
| lastLastSpread | last spread of the last pre-aggregated bucket of the specified time interval | float |
| lastMaxAskPrice | max ask price of the last pre-aggregated bucket of the specified time interval | float |
| lastMaxAskSize | max ask size of the last pre-aggregated bucket of the specified time interval | long |
| lastMaxBidPrice | max bid price of the last pre-aggregated bucket of the specified time interval | float |
| lastMaxBidSize | max bid size of the last pre-aggregated bucket of the specified time interval | long |
| lastMaxMidPrice | max mid price of the last pre-aggregated bucket of the specified time interval | float |
| lastMaxSpread | max spread of the last pre-aggregated bucket of the specified time interval | float |
| lastMinAskPrice | min ask price of the last pre-aggregated bucket of the specified time interval | float |
| lastMinAskSize | min ask size of the last pre-aggregated bucket of the specified time interval | long |
| lastMinBidPrice | min bid price of the last pre-aggregated bucket of the specified time interval | float |
| lastMinBidSize | min bid size of the last pre-aggregated bucket of the specified time interval | long |
| lastMinMidPrice | min mid price of the last pre-aggregated bucket of the specified time interval | float |
| lastMinSpread | min spread of the last pre-aggregated bucket of the specified time interval | float |
| lastQuoteCount | quote count of the last pre-aggregated bucket of the specified time interval | long |
| lastSumAskPrice | sum ask price of the last pre-aggregated bucket of the specified time interval | float |
| lastSumAskSize | sum ask size of the last pre-aggregated bucket of the specified time interval | long |
| lastSumBidPrice | sum bid price of the last pre-aggregated bucket of the specified time interval | float |
| lastSumBidSize | sum bid size of the last pre-aggregated bucket of the specified time interval | long |
| lastSumMidPrice | sum mid price of the last pre-aggregated bucket of the specified time interval | float |
| maxFirstAskPrice | maximum ask price of the first pre-aggregated bucket of the specified time interval | float |
| maxFirstAskSize | maximum ask size of the first pre-aggregated bucket of the specified time interval | long |
| maxFirstBidPrice | maximum bid price of the first pre-aggregated bucket of the specified time interval | float |
| maxFirstBidSize | maximum bid size of the first pre-aggregated bucket of the specified time interval | long |
| maxFirstExchangeTime | maximum of the first exchange times of each pre-aggregated bucket | timestamp |
| maxFirstInsertTime | maximum of the first insert times of each pre-aggregated bucket | timestamp |
| maxFirstMidPrice | maximum of the first mid prices of each pre-aggregated bucket of the specified time interval | float |
| maxFirstSpread | maximum of the first spreads of each pre-aggregated bucket of the specified time interval | float |
| maxLastAskPrice | maximum ask price of the last pre-aggregated bucket of the specified time interval | float |
| maxLastAskSize | maximum ask size of the last pre-aggregated bucket of the specified time interval | long |
| maxLastBidPrice | maximum bid price of the last pre-aggregated bucket of the specified time interval | float |
| maxLastBidSize | maximum bid size of the last pre-aggregated bucket of the specified time interval | long |
| maxLastExchangeTime | maximum of the last exchange times of each pre-aggregated bucket | timestamp |
| maxLastInsertTime | maximum of the last insert times of each pre-aggregated bucket | timestamp |
| maxLastMidPrice | maximum of the last mid prices of each pre-aggregated bucket of the specified time interval | float |
| maxLastSpread | maximum of the last spreads of each pre-aggregated bucket of the specified time interval | float |
| maxMaxAskPrice | maximum ask price of the specified time interval | float |
| maxMaxAskSize | maximum ask size of the specified time interval | long |
| maxMaxBidPrice | maximum bid price of the specified time interval | float |
| maxMaxBidSize | maximum bid size of the specified time interval | long |
| maxMaxMidPrice | maximum of the mid prices of each pre-aggregated bucket of the specified time interval | float |
| maxMaxSpread | maximum of the spreads of each pre-aggregated bucket of the specified time interval | float |
| maxMinAskPrice | maximum of the minimum of the ask prices of each pre-aggregated bucket of the specified time interval | float |
| maxMinAskSize | maximum of the minimum of the ask sizes of each pre-aggregated bucket of the specified time interval | long |
| maxMinBidPrice | maximum of the of the minimum of the bid prices of each pre-aggregated bucket of the specified time interval | float |
| maxMinBidSize | maximum of the minimum of the bid sizes of each pre-aggregated bucket of the specified time interval | long |
| maxMinMidPrice | maximum of the minimum mid prices of each pre-aggregated bucket of the specified time interval | float |
| maxMinSpread | maximum of the minimum spreads of each pre-aggregated bucket of the specified time interval | float |
| maxQuoteCount | maximum of the number of quotes per pre-aggregated bucket of the specified time interval | long |
| maxSumAskPrice | maximum sum of ask prices of each pre-aggregated bucket of the specified time interval | float |
| maxSumAskSize | maximum sum of ask sizes of each pre-aggregated bucket of the specified time interval | long |
| maxSumBidPrice | maximum sum of bid prices of each pre-aggregated bucket of the specified time interval | float |
| maxSumBidSize | maximum sum of bid sizes of each pre-aggregated bucket of the specified time interval | long |
| maxSumMidPrice | maximum of the sum mid prices of each pre-aggregated bucket of the specified time interval | float |
| minFirstAskPrice | minimum first ask price of each pre-aggregated bucket of the specified time interval | float |
| minFirstAskSize | minimum first ask size of each pre-aggregated bucket of the specified time interval | long |
| minFirstBidPrice | minimum first bid price of each pre-aggregated bucket of the specified time interval | float |
| minFirstBidSize | minimum first bid size of each pre-aggregated bucket of the specified time interval | long |
| minFirstExchangeTime | minimum of the first exchange times of each pre-aggregated bucket | timestamp |
| minFirstInsertTime | minimum of the first insert times of each pre-aggregated bucket | timestamp |
| minFirstMidPrice | minimum of the first mid prices of each pre-aggregated bucket of the specified time interval | float |
| minFirstSpread | minimum first spread of each pre-aggregated bucket of the specified time interval | float |
| minLastAskPrice | minimum last ask price of each pre-aggregated bucket of the specified time interval | float |
| minLastAskSize | minimum last ask size of each pre-aggregated bucket of the specified time interval | long |
| minLastBidPrice | minimum last bid price of each pre-aggregated bucket of the specified time interval | float |
| minLastBidSize | minimum last bid size of each pre-aggregated bucket of the specified time interval | long |
| minLastExchangeTime | minimum of the last exchange times of each pre-aggregated bucket | timestamp |
| minLastInsertTime | minimum of the last insert times of each pre-aggregated bucket | timestamp |
| minLastMidPrice | minimum of the last mid prices of each pre-aggregated bucket of the specified time interval | float |
| minLastSpread | minimum last spread of each pre-aggregated bucket of the specified time interval | float |
| minMaxAskPrice | minimum of the maximum ask prices of each pre-aggregated bucket of the specified time interval | float |
| minMaxAskSize | minimum of the maximum ask sizes of each pre-aggregated bucket of the specified time interval | long |
| minMaxBidPrice | minimum of the maximum bid prices of each pre-aggregated bucket of the specified time interval | float |
| minMaxBidSize | minimum of the maximum bid sizes of each pre-aggregated bucket of the specified time interval | long |
| minMaxMidPrice | minimum of the maximum mid prices of each pre-aggregated bucket of the specified time interval | float |
| minMaxSpread | minimum max spread of each pre-aggregated bucket of the specified time interval | float |
| minMinAskPrice | minimum ask price of the specified time interval | float |
| minMinAskSize | minimum ask size of the specified time interval | long |
| minMinBidPrice | minimum bid price of the specified time interval | float |
| minMinBidSize | minimum bid size of the specified time interval | long |
| minMinMidPrice | minimum of the minimum mid prices of each pre-aggregated bucket of the specified time interval | float |
| minMinSpread | minimum spread of the specified time interval | float |
| minQuoteCount | minimum number of quotes per pre-aggregated bucket of the specified time interval | long |
| minSumAskPrice | minimum sum of ask prices of each pre-aggregated bucket of the specified time interval | float |
| minSumAskSize | minimum sum of ask sizes of each pre-aggregated bucket of the specified time interval | long |
| minSumBidPrice | minimum sum of bid prices of each pre-aggregated bucket of the specified time interval | float |
| minSumBidSize | minimum sum of bid sizes of each pre-aggregated bucket of the specified time interval | long |
| minSumMidPrice | minimum sum of mid prices of each pre-aggregated bucket of the specified time interval | float |
| sumFirstAskPrice | sum of the first of the ask prices of each pre-aggregated bucket of the specified time interval | float |
| sumFirstAskSize | sum of the first of the ask sizes of each pre-aggregated bucket of the specified time interval | long |
| sumFirstBidPrice | sum of the first of the bid prices of each pre-aggregated bucket of the specified time interval | float |
| sumFirstBidSize | sum of the first of the bid sizes of each pre-aggregated bucket of the specified time interval | long |
| sumFirstMidPrice | sum of the first mid prices of each pre-aggregated bucket of the specified time interval | float |
| sumFirstSpread | sum of the first of the spreads of each pre-aggregated bucket of the specified time interval | float |
| sumLastAskPrice | sum of the last of the ask prices of each pre-aggregated bucket of the specified time interval | float |
| sumLastAskSize | sum of the last of the ask sizes of each pre-aggregated bucket of the specified time interval | long |
| sumLastBidPrice | sum of the last of the bid prices of each pre-aggregated bucket of the specified time interval | float |
| sumLastBidSize | sum of the last of the bid sizes of each pre-aggregated bucket of the specified time interval | long |
| sumLastMidPrice | sum of the last mid prices of each pre-aggregated bucket of the specified time interval | float |
| sumLastSpread | sum of the last of the spreads of each pre-aggregated bucket of the specified time interval | float |
| sumMaxAskPrice | sum of the maximum of the ask prices of each pre-aggregated bucket of the specified time interval | float |
| sumMaxAskSize | sum of the maximum of the ask sizes of each pre-aggregated bucket of the specified time interval | long |
| sumMaxBidPrice | sum of the maximum of the bid prices of each pre-aggregated bucket of the specified time interval | float |
| sumMaxBidSize | sum of the maximum of the bid sizes of each pre-aggregated bucket of the specified time interval | long |
| sumMaxMidPrice | sum of the maximum of the mid prices of each pre-aggregated bucket of the specified time interval | float |
| sumMaxSpread | sum of the maximum of the spreads of each pre-aggregated bucket of the specified time interval | float |
| sumMinAskPrice | sum of the minimum of the ask prices of each pre-aggregated bucket of the specified time interval | float |
| sumMinAskSize | sum of the minimum of the ask sizes of each pre-aggregated bucket of the specified time interval | long |
| sumMinBidPrice | sum of the minimum of the bid prices of each pre-aggregated bucket of the specified time interval | float |
| sumMinBidSize | sum of the minimum of the bid sizes of each pre-aggregated bucket of the specified time interval | long |
| sumMinMidPrice | sum of the minimum of the mid prices of each pre-aggregated bucket of the specified time interval | float |
| sumMinSpread | sum of the minimum of the spreads of each pre-aggregated bucket of the specified time interval | float |
| sumQuoteCount | sum of the number of quotes of the specified time interval | long |
| sumSumAskPrice | sum of the sum of the ask prices of each pre-aggregated bucket of the specified time interval | float |
| sumSumAskSize | sum of the sum of the ask sizes of each pre-aggregated bucket of the specified time interval | long |
| sumSumBidPrice | sum of the sum of the bid prices of each pre-aggregated bucket of the specified time interval | float |
| sumSumBidSize | sum of the sum of the bid sizes of each pre-aggregated bucket of the specified time interval | long |
| sumSumMidPrice | sum of the sum of the mid prices of the specified time interval | float |
Bucketing and bars (binning)¶
Key granularity optional Value number of units per bucket as int atom
Example 30
Default 1
Key granularityUnit optional Value granularity unit as a symbol atom Valid tick millisecond second minute hour day
Example `millisecond
Default (none)
The Bars Service is more restrictive with granularity units than the Analytics Service (getStats) as it uses pre-aggregated time bars; however, performance is better.
The getBars function still supports customizable bar sizes, configurable on request.
As with the Analytics Service, you can request one-minute bars, two-minute bars, etc., per query. You can specify the size of bars by setting granularity and the granularity units, e.g. granularity of 3 and a granularity unit of day will give 3-day buckets within the time window.
Maximum timespan¶
There are no recommended maximum timespans for the granularity units, except:
week-
Only a single week can be returned. Weekly bars will go from Sunday to Saturday. If the start date is not a Sunday, it will go back to the previous Sunday from the start date. It will then generate the bar for that entire week. If the end date is not in the same Sunday-Saturday period as the start date, then the query will return an error.
month-
Only a single calendar month can be returned. Monthly bars cannot be generated for more than one month at a time or across two calendar months. If the start and end dates are in different calendar months, the query will return an error. Monthly bars will go from the 1st of the month to the last day of the month. If the start date is not the 1st of the month, it will still return the entire calendar month.
Time zones¶
If you request one-day bars that do not align with the default time zone, it is not possible to convert time zone by setting the timeZone parameter. Alternatively, you can request persisted day by rolling up from minute bars when specifying the timeZone parameter.
Do not validate¶
Key doNotValidate optional Value parameter symbol vector
Example `analytics
Default none
Disables pre-processing parameter validation checks for the specified parameters. For supported parameters, see Parameter Validation
Examples¶
getBars .[!]flip(
(`symList ;`AMZN.OQ`AAPL.OQ);
(`dataType ;`trade);
(`startDate ;2020.03.28);
(`endDate ;2020.03.30);
(`startTime ;15:00:00.000);
(`endTime ;20:59:59.000);
(`timeZone ;`GMT);
(`granularity ;60);
(`granularityUnit;`minute);
(`analytics ;`VWAP);
(`temporality ;`continuous);
(`assetClass ;`equity)
)
Returns VWAP for AMZN.OQ and AAPL.OQ at sixty-minute intervals between 15:00 three days ago and 20:59:59 yesterday in GMT.
getBars .[!]flip(
(`symList ;`AMZN.OQ`AAPL.OQ);
(`dataType ;`trade);
(`startDate ;2020.03.28);
(`endDate ;2020.03.30);
(`startTime ;15:00:00.000);
(`endTime ;20:59:59.000);
(`timeZone ;`GMT);
(`granularity ;30);
(`granularityUnit;`minute);
(`analytics ;`VWAP`sumSumVolume`maxMaxPrice`minMinPrice);
(`temporality ;`slice);
(`assetClass ;`equity)
)
Returns VWAP, sum of the volumes, max price, min price for AMZN.OQ and AAPL.OQ every thirty-minute interval between 15:00 and 20:59:59 each day from three days ago until yesterday.
getBars .[!]flip(
(`symList ;`AMZN.OQ`AAPL.OQ);
(`dataType ;`trade);
(`startDate ;2020.03.21);
(`endDate ;2020.03.30);
(`granularity ;10);
(`granularityUnit;`day);
(`analytics ;`TWAP`avgPrice`maxMaxPrice`minMinPrice);
(`temporality ;`continuous);
(`assetClass ;`equity)
)
Returns TWAP, average price, max price, min price for AMZN.OQ and AAPL.OQ every ten-day interval from ten days ago to yesterday.