Processing Bars

Traditional OHLC bars in finance are based on the passage of time, but from individual tick level data, other types of bars can be generated as well, such as tick bars that are sampled when a certain number of trades have completed, or dollar bars that are sampled once a certain amount of money has changed hands. That way, bars can be sampled as new information arrives to the market, instead of simply when the passage of time has occurred.

Feat has support for processing the downloaded ticks into bars to then be fed into further analysis or financial machine learning.

Feat will look for a directory named ticks in the current working directory to locate the tick files to be processed into bars, for instance, ticks/TSLA.

You can also pass a file with suffix .txt with a symbol on each line to process bars for multiple symbols.

Dollar Bars

To process dollar bars:

$ feat bars dollar TSLA

The current threshold to sample a bar is $7mm. This can be configured but support for configuring it hasn’t been added yet.

Time Bars

Feat can also process 15 minute time bars.

$ feat bars time @ES#C

Custom Data Formats

Not every downloaded format conforms exactly to the ones generated by Feat when pulling from IQFeed, for instance, the index of the date/time field might be different, or the file might even be delimited with a different character than commas.

Feat has limited support for processing these files too. You can use these flags for the bars command to instruct Feat how to process them:

  • --timestamp_index - the numeric index of the datetime field

  • --last_index - the numeric index of the price traded for that tick

  • --volume_index - the numeric index of how much volume was traded for that tick

  • --delimiter - the character used for CSV delimiting (default: ,)

e.g., if the individual lines looked like this:

1|65600.0|0.15|2021-11-11 00:00:00.123

then the command would be along these lines:

$ feat bars dollar \
    BTCUSDT \
    --timestamp_index 3 \
    --last_index 1 \
    --volume_index 2 \
    --delimiter "|"