From d66d2cddc7bcfd9fb3d89e5242e97f6928cd7361 Mon Sep 17 00:00:00 2001 From: Jarry Xiao <61092285+jarry-xiao@users.noreply.github.com> Date: Tue, 14 Feb 2023 14:08:54 -0500 Subject: [PATCH] Phoenix v1/add getter for fee rate (#9) Changes: - Create traits for getting tick size and taker fee bps - Implement traits for FIFOMarket --- Cargo.lock | 2 +- Cargo.toml | 2 +- src/state/markets/fifo.rs | 8 ++++++++ src/state/markets/market_traits.rs | 2 ++ 4 files changed, 12 insertions(+), 2 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 4b646ea..634ebbe 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2544,7 +2544,7 @@ dependencies = [ [[package]] name = "phoenix-v1" -version = "0.1.0" +version = "0.1.1" dependencies = [ "borsh 0.9.3", "bytemuck", diff --git a/Cargo.toml b/Cargo.toml index c829cff..866aa6d 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "phoenix-v1" -version = "0.1.0" +version = "0.1.1" edition = "2021" resolver = "2" repository = "https://github.com/Ellipsis-Labs/phoenix-v1" diff --git a/src/state/markets/fifo.rs b/src/state/markets/fifo.rs index 7075d80..4978901 100644 --- a/src/state/markets/fifo.rs +++ b/src/state/markets/fifo.rs @@ -252,6 +252,14 @@ impl< std::mem::size_of::() } + fn get_taker_fee_bps(&self) -> u64 { + self.taker_fee_bps + } + + fn get_tick_size(&self) -> QuoteLotsPerBaseUnitPerTick { + self.tick_size_in_quote_lots_per_base_unit + } + fn get_base_lots_per_base_unit(&self) -> BaseLotsPerBaseUnit { self.base_lots_per_base_unit } diff --git a/src/state/markets/market_traits.rs b/src/state/markets/market_traits.rs index c78507c..ad8842f 100644 --- a/src/state/markets/market_traits.rs +++ b/src/state/markets/market_traits.rs @@ -110,6 +110,8 @@ pub trait Market< TypedLadder { bids, asks } } + fn get_taker_fee_bps(&self) -> u64; + fn get_tick_size(&self) -> QuoteLotsPerBaseUnitPerTick; fn get_base_lots_per_base_unit(&self) -> BaseLotsPerBaseUnit; fn get_sequence_number(&self) -> u64; fn get_registered_traders(&self) -> &dyn OrderedNodeAllocatorMap;