- https://doc.rust-lang.org/std/collections/vec_deque/struct.VecDeque.html#
- https://doc.rust-lang.org/std/collections/vec_deque/struct.VecDeque.html#method.pop_front
- Vec deque
- libs
- New order handling (matching func)
- Check top book refresh on order handling
- Timestamp
- Study web API
- Add partial flag to resting order
- IMPORTANT: The matched info from the limit order are wrong
- A general check of the matches vector
- Test tot order handling
- Event: new market order when rest size is insufficient
- Add market order in IO
- the
new_order_handlingfunction panics when there is no best bid aor ask at the moment thathread 'main' panicked at src/order_book_mod.rs:226:75: calledOption::unwrap()on aNonevalue- Create the code safe if there are no orders on the book (even just on one side)
- It is better an exception handling or a simple
ifoption?
- Match incoming Order
- Engine return a list of match struct for flexibility
- Testing engine
- Add Best BA to the orderbook struct
- Put in the Order Book struct all the functions to avoid complicating the code with Ownership
- Add a general check in the OrderBook to see if there are some problems
- Orderbook functionalities: insert, remove quotes, best b/a
- book visual for debug
- Matching engine
- Market data export
- Json based messages to be globally compatible
- Local participant (co-location)
- remote connection (http).
- Account manager (unsafe for testing)
- Market Maker : Liquidity provvider, spread can be influenced by volatility
- Retail: Source of noice, small orders, bias against news
- Shorters: bias agaist market
- Big inverstors: Block trading during the day
- Profesionals: Complicated trades
- with python
- create subjects (retail, big institutions, market maker) with bias and peculiarities (volume, long short etc)
- news
- bull or bear market
It will be usefull to use a sql (possible MySQL) database to keep all tidy all the inforamtion not only for the normal operations but also to summarize an entire session to study.
- Create the graph
- Study how to insert it in the program
- To send the market data first it needs to be made in a format transladable to JSON. Check the best AB funtion or make a new one
- Check for wash trading (needs a list of all active orders)
- Check margin
-
fn incoming_orders_processor: Should be used to route Ordes to the Lim_O handling or market_O handling. -
incoming orders
-
Check if the new order ID is in the list of processed orders
-
Need a vector with struct to keep all matches containing:
- ask/bid gen info
- partial fil volume
- who was the resting order
- time stamp
-
for partial fills ad a letter to the end of ID
/// - resting:
/// - true = bid was the resting order
/// - false = ask was the resting order
pub struct Match{
id_b:,
id_a:,
volume_filled:u32,
price:u32,
time_stamp:,
resting: bool
}- Limit ✅
- Market ✅
- Hidden ❌
Rules:
The ID is created with in the Clearence house
123456789-55555-11-22
- Order code
- Partecipant
- Modification
- Partial fill
An Order should have multiple timestamps for:
- Arriving at the Exchange
- Been inserted to the Book
- Full or partial fill
- Modifications
- Cancelations
This multiple possibilities require a flexible array, a good one can be a simple Queue that preserves the order of the events. This struct is for internal use ONLY.
pub struct Order {
pub id: u8,
pub size: u32,
pub price: f64,
pub side: bool,
pub o_type: u8
pub time: VecDeque<TimeStamp> // to do
}
pub struct TimeStamp {
pub event: u8
pub time: Timestamp
}Order types
- 0: Market
- 1: Limit
Side
- true -> Bid
- false -> Ask

