Module lfest::prelude

source ·
Expand description

Exports common types

Re-exports§

Macros§

  • Macro used to convert a number literal into a Decimal.
  • Allows the quick construction of BaseCurrency
  • Creates the Bba struct used as a MarketUpdate.
  • Allows the quick construction of Fee
  • Allows the quick construction of Leverage
  • Allows the quick construction of QuoteCurrency

Structs§

  • Relevant information about the traders account.
  • The markets BASE currency, e.g.: BTCUSD -> BTC is the BASE currency
  • An update to the best bid and ask has occured. For now we don’t handle the quantity a these price levels. This will change in future versions.
  • A new candle has been created. Here we can use the high and low prices to see if our simulated resting orders have been executed over the last period as a proxy in absence of actual Trade flow.
  • Define the Exchange configuration
  • Specifies the details of the futures contract
  • Represents a decimal number as a coefficient (i128) combined with a value (u8) specifying the number of fractional decimal digits.
  • The main leveraged futures exchange for simulated trading
  • Additional data about the order filled in by the exchange.
  • Fee as a fraction
  • The order has been fully filled. The executed order quantity is stored elsewhere.
  • Keeps track of transaction in memory.
  • Leverage
  • Defines a limit order. Is generic over: S: The order size aka quantity which is denoted in either base or quote currency. UserOrderId: The type of user order id to use. Set to () if you don’t need one.
  • LnReturnsDeprecated
    Natural Logarithmic Returns newtype wrapping a borrowed slice of generic floats.
  • Defines an market order aka taker order. Is generic over: S: The order size aka quantity which is denoted in either base or quote currency. UserOrderId: The type of user order id to use.
  • Some information regarding the state of the market.
  • A new order has not been received by the exchange and has thus some pieces of information not available. This also means the various filters (e.g PriceFilter and QuantityFilter) have not been checked.
  • The type for the global order id sequence number used by the exchange.
  • The order is pending execution, but it already has additional information filled in by the exchange.
  • Describes the position information of the account. It assumes isolated margining mechanism, because the margin is directly associated with the position.
  • The PriceFilter defines the price rules for a symbol
  • The SizeFilter defines the quantity rules that each order needs to follow The generic currency S is always the PairedCurrency of the margin currency
  • The markets QUOTE currency, e.g.: BTCUSD -> USD is the quote currency
  • The type of a timestamp that is measured in nanoseconds.
  • A taker trade that consumes liquidity in the book.
  • A transaction involves two parties.
  • The user balances.

Enums§

  • An error with the configuration.
  • Describes possible Errors that may occur when calling methods in this crate
  • The two types of fees in the maker-taker model.
  • Contains the filled order quantity along with the average fill price.
  • An error related to market filters PriceFilter and QuantityFilter.
  • Contains the possible updates to limit orders.
  • Which price to use in mark-to-market calculations
  • Defines the possible order errors that can occur when submitting a new order
  • A futures position can be one of three variants.
  • When the limit order is priced at marketable prices (e.g a buy at or above the ask price), decide what to do.
  • The error that the RiskEngine outputs, if any.
  • Side of the order

Constants§

Traits§

  • Every unit of account must implement this trait
  • Each Currency that is used as margin has to implement this trait. The margin currency of an account defines which type of futures contract is traded. Here is how the margin Currency maps to the futures type: QuoteCurrency: linear futures. BaseCurrency: inverse futures.
  • The interface of what a market update must be able to do.
  • The trait for settling transactions.

Type Aliases§