package obook

Build not yet checked
  1. Overview
  2. Docs
Zero-allocation L3 limit order book and streaming HFT math in pure OCaml

Install

dune-project
 Dependency

Authors

Maintainers

Sources

v1.0.0.tar.gz
sha256=059c1cd865ee1364e685dd57b1be0f8dd8b6feaa129c62e25f4673cbb8b2ab15
sha512=830508c1acfb828b30367715cd3e531e08a2404b7163f8da9b4347dc35a326321c1cc3bb05ee5c5e7f723064c68b00257b2dc551d1014d15e3ff03ed5a3a8e5c

doc/obook/Obook/Fixed/index.html

Module Obook.FixedSource

Fixed-point 64-bit arithmetic scaled by 10^8 (1 satoshi / 1 pipette). Uses 128-bit intermediate math so multiplying $100k by 1,000 BTC doesn't vaporize your portfolio in an int64 overflow.

Sourcetype t = private int64
Sourcetype round =
  1. | Down
  2. | Up
  3. | Zero
  4. | Half_even
Sourcetype err = [
  1. | `Overflow
  2. | `Div_by_zero
  3. | `Parse_err of string
]
Sourceval scale : int64
Sourceval zero : t
Sourceval one : t
Sourceval neg_one : t
Sourceval max_val : t
Sourceval min_val : t
Sourceval of_raw : int64 -> t
Sourceval to_raw : t -> int64
Sourceval of_int : int -> (t, [> `Overflow ]) result
Sourceval of_int_exn : int -> t
Sourceval of_f : ?round:round -> float -> (t, [> `Overflow ]) result
Sourceval of_f_exn : ?round:round -> float -> t
Sourceval to_f : t -> float
Sourceval of_str : string -> (t, [> err ]) result
Sourceval of_str_exn : string -> t
Sourceval to_str : ?dec:int -> t -> string
Sourceval neg : t -> (t, [> `Overflow ]) result
Sourceval abs : t -> (t, [> `Overflow ]) result
Sourceval add : t -> t -> (t, [> `Overflow ]) result
Sourceval sub : t -> t -> (t, [> `Overflow ]) result
Sourceval mul : ?round:round -> t -> t -> (t, [> `Overflow ]) result
Sourceval div : ?round:round -> t -> t -> (t, [> `Overflow | `Div_by_zero ]) result
Sourceval add_exn : t -> t -> t
Sourceval sub_exn : t -> t -> t
Sourceval mul_exn : ?round:round -> t -> t -> t
Sourceval div_exn : ?round:round -> t -> t -> t
Sourceval cmp : t -> t -> int
Sourceval eq : t -> t -> bool
Sourceval min : t -> t -> t
Sourceval max : t -> t -> t
Sourceval is_zero : t -> bool
Sourceval is_pos : t -> bool
Sourceval is_neg : t -> bool
Sourceval sign : t -> int
Sourceval midpoint : t -> t -> t
Sourceval wmid : bid_px:t -> bid_sz:t -> ask_px:t -> ask_sz:t -> (t, [> `Overflow | `Div_by_zero ]) result
Sourcemodule O : sig ... end