Initialize reader.
You should call load
before using any other methods or properties.
Parameters:
Specific implementation of _readTick
will be determined during load
.
Load ticks file.
It will return error to callback if file doesn't exist, has invalid format or some other problem occured.
After this method is complete, you can call nextTick
and/or getBuffer
.
Returns tick at a given position (starting with 0).
Parameters:
Reads adn returns next tick. Returns null if there is no more ticks.
Returns raw buffer of ticks.
Method may be useful if you, for example, want to pass all ticks to native addon.
It's plain array of tick structures, each of which has following format:
All multibyte numbers are little-endian.
All prices (price, bid, ask) are multiplied by 10000 (e.g. $0.01 will be 100, $1 will be 10000).
Returns a Buffer
(buffer of ticks)
Read tick from old storage (version 1)
Parameters:
_ticksBuffer
where tick data is located.)Read tick from new storage (version 2)
Loads old storage file (version 1)
Creates and fills _tickBuffer
.
Fills length
property.
Parameters:
fd must be a Number.
(file descriptor to read from.)
stats must be an Object.
(file stats returned by fs.stats)
headerValues must be an Object.
(values read from file header)
callback must be a Function.
Load new storage file (version 2)
Arguments are the same as for _loadV1
Every storage file has a fixed-sized (common.HEADER_SIZE) header. It contains storage version and can contain other metadata in future.
Tick database reader