Stock Minute Bars
Minute bar data includes open, high, low, close price, volume, vwap, and number of trades. These data are calculated from trade data.
How does Alpaca calculate minute bars for market data?
Minute bar data includes open, high, low, close price, volume, vwap, and number of trades. These data are calculated from trade data (ie trade price and volume). The calculations are done in three steps. Trades are 1) aggregated by the time the trade was executed, 2) filtered by ‘trade condition’, then 3) have the appropriate function applied (sum, minimum, maximum, etc).
1) Aggregate by the time the trade was executed. Trade data is placed into minute ‘buckets’ based upon the trade execution, or ‘participant’, timestamp. The interval is closed left and open right. It includes the lower limit but excludes the upper ( Tstart <= trade < Tend). The bars are labeled with the start time so, for example, the bar with trades between 9:31-9:32 is labeled 9:31.
2) Filter by ‘trade condition’. Only certain trade types are used in the bar calculations. Each field, such as Open, Close, or Volume, filters by different conditions. The Close price for example, considers only a limited number of ‘typical’ trades while Volume includes almost all trades. Alpaca follows the guidance given by the Securities Information Providers (SIPs) in determining which trades to exclude from calculations. That guidance is on page 64 of the Consolidated Tape System (CTS) Specification and page 43 of the UTP Specification. Below is a summary of trade conditions which exclude a trade from a close price.
3) Apply appropriate function. Once the trades are filtered, the specific fields are determined using the following functions :
Bars are calculated, and available, 1 second after the close of each minute (eg the 9:31 bar is calculated at 9:32:01). Because trade data can be delivered up to 10 seconds after the actual execution, the bar is then recalculated after 30 seconds (eg the 9:31 bar is re-calculated at 9:32:30) and will include any trades received after the initial calculation.
Please note that this article is for general informational purposes only. All examples are for illustrative purposes only. Alpaca does not recommend any specific securities, cryptocurrencies or investment strategies.
All investments involve risk and the past performance of a security, or financial product does not guarantee future results or returns.There is no guarantee that any investment strategy will be successful in achieving its investment objectives. Diversification does not ensure a profit or protection against a loss. There is always the potential of losing money when you invest in securities, or other financial products. Investors should consider their investment objectives and risks carefully before investing.
Brokerage services are provided by Alpaca Securities LLC ("Alpaca Securities"), member FINRA/SIPC, a wholly-owned subsidiary of AlpacaDB, Inc. Technology and services are offered by AlpacaDB, Inc.