#trading #definition #depth #building-block #price #amount #order

trading-types

trading-types provides type definitions (and some utils) as building blocks for type-safe trading

2 releases

new 0.1.1 Jan 15, 2025
0.1.0 Jan 14, 2025

#466 in Text processing

Download history 116/week @ 2025-01-10

116 downloads per month
Used in trading-enhancers

MIT license

33KB
961 lines

TRADING TYPES

Defines convenient types for trading (mostly focused on spread-processing based trading):

Price
Amount (base currency quantity)
Worth = price * amount
Liq (liquidity) of price, amount and worth as main brick of calculations
Side from bid/buy or ask/sell
Depth (order book) as vec of Liq
Spread in Depth between bids and asks
OrderToPlace with neccesary data to place limit order
OrderPlaced with corresponding id etc.

Provides extra funcs:

depth_util::liqs_l2
depth_util::drop_worth
depth_util::worst_execution_price

See those descriptions in the code

These types are battle-tested as building blocks for type-safe definitions of trading strategies.

So, the first step when received market data is to align with these types and then go on.

There are some trading "enhansers" based on these types which are parts of trading strategies. Probably, the most generic will be open sourced).

Dependencies

~1.6–2.8MB
~52K SLoC