How to Use Raw Real Time Stock Data to Make 1 Hour Data

In its rawest form, stock price data comes as a series of "bid" and "ask" quotations-prices at which traders are willing to buy or sell a stock-and a series of "last" or "trade" values indicating prices at which a stock actually changed hands. Many trading strategies require the analysis of price over longer time frames, such as one minute, one hour or one day bars, or even longer. We are usually mainly interested in the "last"/"trade" values when constructing longer-term bars. It is relatively simple to convert the raw data into longer duration bars for further analysis.

Things You'll Need

  • Raw stock data
  • Analytic tool, such as an Excel spreadsheet or a programming language
Show More

Instructions

    • 1

      Decide what analytic tool you are most comfortable with. For many, this might be an Excel spreadsheet. Mathematicians might use MATLAB. Experienced programmers might prefer to write a small Visual Basic or Ruby program. Calculations will be relatively basic, so the exact tool you choose is not as important as your familiarity with it.

    • 2

      Load your data. If you're using a spreadsheet, open your raw data file. If you're writing a program, load the data from disk into memory.

    • 3

      Divide the data into hour-long blocks. For example, group all data points whose timestamp is between 9 a.m. and 9:59:59 a.m. together into one unit. Repeat this step for each hour in your dataset.

    • 4

      Pull out the interesting values from each block. When constructing hour bars for historical analysis, you are typically most interested in four values for each hour, the so called "OHLC": open, high, low, and close values. Open and close represent the price at the beginning and end of the hour. High and low are the highest and lowest prices during the period. This is straightforward once the data has been divided into blocks by hour: the open and close are simply the first and last trade data points in the block, and the high and low are simply the maximum and minimum trade prices in the block.

Tips & Warnings

  • A program can gather this data on a rolling basis as the data is loaded, to avoid rescanning the same data twice or using unnecessary memory.

Related Searches:

References

Comments

You May Also Like

Related Ads

Featured