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.
Rust
use bi5::*;
let ticks = read_bi5("test/test.bi5").expect("Read failed");
assert_eq!(
ticks.first(),
Some(&Tick { millisecs: 1860002, ask: 133153, bid: 133117, askvol: 0.015, bidvol: 0.02 })
);
The catbi5
utility dumps a bi5
file to stdout.
```markdown
Usage: catbi5 [OPTIONS]
Arguments:
Options:
-d, --date
When no date is provided the output shows the milliseconds. Otherwise the proper datetime is calculated and shown.
When output of catbi5 test/test.bi5 -d2022-12-15T14:00:00 -s, | head -4
, for example, looks like this
markdown
t,bid,ask,bidvol,askvol
2022-12-15 14:31:00.002,133117,133153,0.02,0.015
2022-12-15 14:31:00.124,133128,133133,0.000043,0.0075
2022-12-15 14:31:00.174,133067,133103,0.02,0.015
2022-12-15 14:31:00.265,133078,133102,0.00036,0.015
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.