Skip to content

Price History Component

Alex Kay edited this page Sep 23, 2020 · 1 revision

Price History Component

Prices for instruments are downloaded from third party APIs and are handled via PriceProvider and PriceAdapter interfaces. Currently Yahoo Stock Market Price API is used to download historical prices in the Open High Low Close Volume (OHLCV) format. Implementation of PriceProvider interface is concerned with provision of all necessary price download and storage functions. Implementation of PriceAdapter interface translates responses from a third-party price provider class, which in turn interacts with an individual Price API like Yahoo, Google, CQG, etc. to this application's Price Provider. In this way implementation of PriceAdapter interface insures standardized data for use in this application. Responses from third-party price API's are handled via PriceProvider.

Price Interface

Price History may be stored in different formats. Most widely used format is OHLCV format, which is represented graphically as candlesticks. There is a dedicated data entity class that stores Price History.

Entity Price History:

id instrument timeinterval timestamp provider open high low close volume
Int int varchar datetime varchar dobule double double double int

OHLCV price history is stored without timezone in database. Time zone component is assumed to be in the time zone of the exchange. Timestamps dated with midnight are historical prices and represent the closing price for a trading day. Prices with times other than midnight represent quotes and are not the final closing prices.

As of the time of this writing there is no generic Price entity, which would store tape data (timestamp, instrument, price, provider). In theory all candlestick records could be formulated from it. For this application tape data will is condsidered to be introduced as a separate entity later. Tape data is available to professional subscribers and needs further processing. In other words, candlestick prices are readily available and widely utilized in price analysis. They do not require any further processing and therefore warrant to be stored in their own entity.

Price Quotes have their own dedicated Entity for the OHLCV domain. They store spot price for a given period: daily, weekly, monthly, yearly etc.

Clone this wiki locally