Instruments file
Key instruments/{exchange}/{yyyy-MM-dd}.{sha12}.csv
Columns
The instrument columns after removed: what an instrument is and how it trades, as refdata stated them in the record that began the row’s version. A row holds from its valid_from until the instrument’s next row, and a change to any term is a new row, as a change of name is. Rows that share a valid_from, and a row and a fact that share an instant, are ordered by global_sequence, the stream’s own order: a fact’s terms are those of the instrument’s last row whose global_sequence is not above the fact’s. A removed row repeats the terms of the row before it. Each column names the contract version it is written since: an instruments file holds the columns up to its day manifest’s contract_version, in instrument_columns order. A column marked always_stated is one refdata states on every record: its type is optional only because its cell is empty in the one case encoding.decimal names, a scale no cell can state.
Naming
Use the last known live name at hour start, or first known name in the hour for a new id. Removal preserves identity for later facts; only never-named facts are skipped. Never borrow future names.
Instrument terms
The day’s instruments file, instruments/{exchange}/{yyyy-MM-dd}.{sha12}.csv, is plain CSV
with a row for each version of each instrument the day knows: the last version from before the
day, and every version that began inside it. After the name columns come the terms the
instrument trades on, as refdata stated them in the record that began the version:
instrument_type:spot,futures,inverse_futures,quanto_futures,perpetual_swap,inverse_perpetual_swap,quanto_perpetual_swap,option,inverse_optionorindex. It isunknownwhere refdata does not say, and for a type this publisher does not recognise.tick_size: the price increment, an exact decimal withdisplay_price_scalefractional digits.step_size: the quantity increment in the instrument’s own size unit, withdisplay_qty_scalefractional digits.contract_multiplier: units of the underlying per contract, with eight fractional digits. Empty where refdata states none, which is not 1: a spot instrument’s quantities are already amounts of its base asset, whether its cell is empty or1.00000000; an inverse instrument is sized bycontract_valueinstead; and on any other instrument an empty cell means the size of a contract is not known.contract_value: the notional of one contract in the quote asset, for inverse and quanto instruments, withdisplay_price_scalefractional digits. Empty where refdata states none.underlying_instrument_id: theinstrument_idof a derivative’s underlying. Empty where there is none.expires_atandsettles_at: the expiry and the settlement instant of a dated instrument, in epoch nanoseconds. Empty for a perpetual and for spot.
A row holds from its valid_from until the instrument’s next row, so a fact’s terms are those
of the instrument’s last row at or before the fact’s timestamp. Two rows of an instrument can
share a valid_from, and a row can share it with a fact’s timestamp. global_sequence is the
stream’s own order and settles both: the exact rule is the instrument’s last row whose
global_sequence is not above the fact’s. A change to any term is a new row, as a change of
name is: a tick size that moves leaves the old row and adds one. A removed row repeats the
terms of the row before it.
The terms are what a quantity in contracts needs. open_interest is in the instrument’s own
size unit: times contract_multiplier it is an amount of the underlying, where a multiplier is
stated, and times contract_value it is quote notional, where a contract value is.
display_price_scale and display_qty_scale are the scales of this row’s own tick_size,
contract_value and step_size, and of nothing else: every price and amount in a data file
states its own. tick_size and step_size are always stated, with one exception that holds for
contract_value too: a row whose scale lies outside 0 to 18, which no decimal cell can state,
leaves the cell empty, and the scale column beside it says so. That one case is why the contract
types the two as optional, and it marks them always_stated so that a checker still refuses an
empty one anywhere else.
A day manifest’s contract_version says which of these columns its instruments file has: all
eight from 2.3.0, none before. The contract states that per column, as each term’s since.