bi5
Library and CLI utility for parsing bi5 tick files.
Bi5 is a simple file format for storing tick data (see below). The format is used by the swiss broker dukascopy, for example.
Usage
read_bi5_file reads a single file and returns Vec<Tick> or Error.
use *;
let ticks = read_bi5_file.expect;
assert_eq!;
Bi5 files and directories can also be read using an iterator:
use *;
let bi5 = new;
for in bi5.iter.expect
Bi5 files only contain a time offset. If the base date/time is known it can be passed to the constructor
let bi5 = new;
catbi5 utility
The catbi5 utility dumps a bi5 tick file to stdout.
Usage: catbi5 [OPTIONS] <FILE>
Arguments:
<FILE> Filename
Options:
-d, --date <DATE_TIME> Date in yyyy-mm-ddTHH:MM:SS format
-s, --sep <SEP> Separator [default: "\t"]
-c, --count Count ticks
-h, --help Print help information
-V, --version Print version information
When no date is provided the output is based of 0000-01-01T00:00:00. Otherwise the proper datetime is calculated from from the date input.
When output of catbi5 test/test.bi5 -d2022-12-16T14:00:00 -s, | head -4, for example, looks like this
t,bid,ask,bidsize,asksize
2022-12-16 14:31:00.002,133117,133153,0.02,0.015
2022-12-16 14:31:00.124,133128,133133,0.000043,0.0075
2022-12-16 14:31:00.174,133067,133103,0.02,0.015
bi5 Format
A bi5 file is a lzma encoded sequence of ticks, where each tick is encoded as follows:
| Field | Format | Description |
|---|---|---|
| millisecs | u32 | Milliseconds since epoch start |
| ask | u32 | Ask price |
| bid | u32 | Bid price |
| askvol | f32 | Ask size |
| bidvol | f32 | Bid size |
All fields are big-endian encoded.