Data model
Streams, candles, trades and query points.
- class mirexa.StreamID(exchange: str, symbol: str, timeframe: str)
A stream: an exchange, a symbol and a timeframe.
Each component is 1-64 bytes of
[0-9A-Za-z._-]and never.or..; they become directory names on the server. The timeframe must parse (1m,4h,1d…).- validate() None
Raise
ValueErrorif the server would refuse this stream id.
- property interval_ns: int
The candle interval in nanoseconds.
- class mirexa.Candle(timestamp: int, open: float, high: float, low: float, close: float, volume: float)
One OHLCV bar.
timestampis the bar’s open, in Unix nanoseconds.- validate() None
Raise
ValueErrornaming the first rule the server would refuse.
- class mirexa.Tick(timestamp: int, price: float, volume: float)
One trade. A negative price is legal: it happens (WTI, 2020-04-20).
- validate() None
Raise
ValueErrornaming the first rule the server would refuse.
- class mirexa.CandlePoint(candle: Candle, is_gap: bool = False, status: GapStatus = GapStatus.OPEN, reason: GapReason = GapReason.UNKNOWN)
One interval slot of a query answer: a candle, or a gap marker.
A gap marker carries the slot’s timestamp and zero prices, and
statusandreasonclassify it. A candle’s are zero, except on a derived bar whose source had a hole under it: that bar carries an INCOMPLETE mark (incomplete), with status OPEN, FILLING or ACCEPTED.- property incomplete: bool
Whether this is a bar carrying an INCOMPLETE mark (an ACCEPTED one too).
- mirexa.parse_timeframe(timeframe: str) int
The interval a timeframe names, in nanoseconds (
"1m"→ 60e9).Accepts
<positive integer><s|m|h|d|w>, exactly as the server does.
- mirexa.FIXED_POINT_SCALE = 10000
int([x]) -> integer int(x, base=10) -> integer
Convert a number or string to an integer, or return 0 if no arguments are given. If x is a number, return x.__int__(). For floating point numbers, this truncates towards zero.
If x is not a number or if base is given, then x must be a string, bytes, or bytearray instance representing an integer literal in the given base. The literal can be preceded by ‘+’ or ‘-’ and be surrounded by whitespace. The base defaults to 10. Valid bases are 0 and 2-36. Base 0 means to interpret the base from the string as an integer literal. >>> int(‘0b100’, base=0) 4