Skip to content

Commit

Permalink
Remove core instruments margin and fee fields
Browse files Browse the repository at this point in the history
  • Loading branch information
cjdsellers committed Dec 31, 2023
1 parent 58fc043 commit 06a6a7d
Show file tree
Hide file tree
Showing 23 changed files with 19 additions and 372 deletions.
13 changes: 0 additions & 13 deletions nautilus_core/adapters/src/databento/parsing.rs
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@ use nautilus_model::{
},
types::{currency::Currency, price::Price, quantity::Quantity},
};
use rust_decimal_macros::dec;
use ustr::Ustr;

use super::{common::nautilus_instrument_id_from_databento, types::DatabentoPublisher};
Expand Down Expand Up @@ -154,10 +153,6 @@ pub fn parse_equity(
currency,
currency.precision,
parse_min_price_increment(record.min_price_increment, currency)?,
dec!(0), // TBD
dec!(0), // TBD
dec!(0), // TBD
dec!(0), // TBD
Some(Quantity::new(record.min_lot_size_round_lot.into(), 0)?),
None, // TBD
None, // TBD
Expand Down Expand Up @@ -188,10 +183,6 @@ pub fn parse_futures_contract(
currency,
currency.precision,
parse_min_price_increment(record.min_price_increment, currency)?,
dec!(0), // TBD
dec!(0), // TBD
dec!(0), // TBD
dec!(0), // TBD
Quantity::new(record.contract_multiplier.into(), 0)?,
None, // TBD
None, // TBD
Expand Down Expand Up @@ -226,10 +217,6 @@ pub fn parse_options_contract(
currency,
currency.precision,
parse_min_price_increment(record.min_price_increment, currency)?,
dec!(0), // TBD
dec!(0), // TBD
dec!(0), // TBD
dec!(0), // TBD
Some(lot_size),
None, // TBD
None, // TBD
Expand Down
29 changes: 0 additions & 29 deletions nautilus_core/model/src/instruments/crypto_future.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ use std::hash::{Hash, Hasher};
use anyhow::Result;
use nautilus_core::time::UnixNanos;
use pyo3::prelude::*;
use rust_decimal::Decimal;
use serde::{Deserialize, Serialize};

use super::Instrument;
Expand Down Expand Up @@ -46,10 +45,6 @@ pub struct CryptoFuture {
pub size_precision: u8,
pub price_increment: Price,
pub size_increment: Quantity,
pub margin_init: Decimal,
pub margin_maint: Decimal,
pub maker_fee: Decimal,
pub taker_fee: Decimal,
pub lot_size: Option<Quantity>,
pub max_quantity: Option<Quantity>,
pub min_quantity: Option<Quantity>,
Expand All @@ -75,10 +70,6 @@ impl CryptoFuture {
size_precision: u8,
price_increment: Price,
size_increment: Quantity,
margin_init: Decimal,
margin_maint: Decimal,
maker_fee: Decimal,
taker_fee: Decimal,
lot_size: Option<Quantity>,
max_quantity: Option<Quantity>,
min_quantity: Option<Quantity>,
Expand All @@ -101,10 +92,6 @@ impl CryptoFuture {
size_precision,
price_increment,
size_increment,
margin_init,
margin_maint,
maker_fee,
taker_fee,
lot_size,
max_quantity,
min_quantity,
Expand Down Expand Up @@ -206,22 +193,6 @@ impl Instrument for CryptoFuture {
self.min_price
}

fn margin_init(&self) -> Decimal {
self.margin_init
}

fn margin_maint(&self) -> Decimal {
self.margin_maint
}

fn maker_fee(&self) -> Decimal {
self.maker_fee
}

fn taker_fee(&self) -> Decimal {
self.taker_fee
}

fn ts_event(&self) -> UnixNanos {
self.ts_event
}
Expand Down
29 changes: 0 additions & 29 deletions nautilus_core/model/src/instruments/crypto_perpetual.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ use std::hash::{Hash, Hasher};
use anyhow::Result;
use nautilus_core::time::UnixNanos;
use pyo3::prelude::*;
use rust_decimal::Decimal;
use serde::{Deserialize, Serialize};

use crate::{
Expand All @@ -45,10 +44,6 @@ pub struct CryptoPerpetual {
pub size_precision: u8,
pub price_increment: Price,
pub size_increment: Quantity,
pub margin_init: Decimal,
pub margin_maint: Decimal,
pub maker_fee: Decimal,
pub taker_fee: Decimal,
pub lot_size: Option<Quantity>,
pub max_quantity: Option<Quantity>,
pub min_quantity: Option<Quantity>,
Expand All @@ -73,10 +68,6 @@ impl CryptoPerpetual {
size_precision: u8,
price_increment: Price,
size_increment: Quantity,
margin_init: Decimal,
margin_maint: Decimal,
maker_fee: Decimal,
taker_fee: Decimal,
lot_size: Option<Quantity>,
max_quantity: Option<Quantity>,
min_quantity: Option<Quantity>,
Expand All @@ -98,10 +89,6 @@ impl CryptoPerpetual {
size_precision,
price_increment,
size_increment,
margin_init,
margin_maint,
maker_fee,
taker_fee,
lot_size,
max_quantity,
min_quantity,
Expand Down Expand Up @@ -202,22 +189,6 @@ impl Instrument for CryptoPerpetual {
self.min_price
}

fn margin_init(&self) -> Decimal {
self.margin_init
}

fn margin_maint(&self) -> Decimal {
self.margin_maint
}

fn maker_fee(&self) -> Decimal {
self.maker_fee
}

fn taker_fee(&self) -> Decimal {
self.taker_fee
}

fn ts_event(&self) -> UnixNanos {
self.ts_event
}
Expand Down
29 changes: 0 additions & 29 deletions nautilus_core/model/src/instruments/currency_pair.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ use std::hash::{Hash, Hasher};
use anyhow::Result;
use nautilus_core::time::UnixNanos;
use pyo3::prelude::*;
use rust_decimal::Decimal;
use serde::{Deserialize, Serialize};

use super::Instrument;
Expand All @@ -43,10 +42,6 @@ pub struct CurrencyPair {
pub size_precision: u8,
pub price_increment: Price,
pub size_increment: Quantity,
pub margin_init: Decimal,
pub margin_maint: Decimal,
pub maker_fee: Decimal,
pub taker_fee: Decimal,
pub lot_size: Option<Quantity>,
pub max_quantity: Option<Quantity>,
pub min_quantity: Option<Quantity>,
Expand All @@ -67,10 +62,6 @@ impl CurrencyPair {
size_precision: u8,
price_increment: Price,
size_increment: Quantity,
margin_init: Decimal,
margin_maint: Decimal,
maker_fee: Decimal,
taker_fee: Decimal,
lot_size: Option<Quantity>,
max_quantity: Option<Quantity>,
min_quantity: Option<Quantity>,
Expand All @@ -88,10 +79,6 @@ impl CurrencyPair {
size_precision,
price_increment,
size_increment,
margin_init,
margin_maint,
maker_fee,
taker_fee,
lot_size,
max_quantity,
min_quantity,
Expand Down Expand Up @@ -191,22 +178,6 @@ impl Instrument for CurrencyPair {
self.min_price
}

fn margin_init(&self) -> Decimal {
self.margin_init
}

fn margin_maint(&self) -> Decimal {
self.margin_maint
}

fn maker_fee(&self) -> Decimal {
self.maker_fee
}

fn taker_fee(&self) -> Decimal {
self.taker_fee
}

fn ts_event(&self) -> UnixNanos {
self.ts_event
}
Expand Down
29 changes: 0 additions & 29 deletions nautilus_core/model/src/instruments/equity.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ use std::hash::{Hash, Hasher};
use anyhow::Result;
use nautilus_core::time::UnixNanos;
use pyo3::prelude::*;
use rust_decimal::Decimal;
use serde::{Deserialize, Serialize};
use ustr::Ustr;

Expand All @@ -43,10 +42,6 @@ pub struct Equity {
pub currency: Currency,
pub price_precision: u8,
pub price_increment: Price,
pub margin_init: Decimal,
pub margin_maint: Decimal,
pub maker_fee: Decimal,
pub taker_fee: Decimal,
pub lot_size: Option<Quantity>,
pub max_quantity: Option<Quantity>,
pub min_quantity: Option<Quantity>,
Expand All @@ -65,10 +60,6 @@ impl Equity {
currency: Currency,
price_precision: u8,
price_increment: Price,
margin_init: Decimal,
margin_maint: Decimal,
maker_fee: Decimal,
taker_fee: Decimal,
lot_size: Option<Quantity>,
max_quantity: Option<Quantity>,
min_quantity: Option<Quantity>,
Expand All @@ -84,10 +75,6 @@ impl Equity {
currency,
price_precision,
price_increment,
margin_init,
margin_maint,
maker_fee,
taker_fee,
lot_size,
max_quantity,
min_quantity,
Expand Down Expand Up @@ -186,22 +173,6 @@ impl Instrument for Equity {
self.min_price
}

fn margin_init(&self) -> Decimal {
self.margin_init
}

fn margin_maint(&self) -> Decimal {
self.margin_maint
}

fn maker_fee(&self) -> Decimal {
self.maker_fee
}

fn taker_fee(&self) -> Decimal {
self.taker_fee
}

fn ts_event(&self) -> UnixNanos {
self.ts_event
}
Expand Down
29 changes: 0 additions & 29 deletions nautilus_core/model/src/instruments/futures_contract.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ use std::hash::{Hash, Hasher};
use anyhow::Result;
use nautilus_core::time::UnixNanos;
use pyo3::prelude::*;
use rust_decimal::Decimal;
use serde::{Deserialize, Serialize};
use ustr::Ustr;

Expand All @@ -45,10 +44,6 @@ pub struct FuturesContract {
pub currency: Currency,
pub price_precision: u8,
pub price_increment: Price,
pub margin_init: Decimal,
pub margin_maint: Decimal,
pub maker_fee: Decimal,
pub taker_fee: Decimal,
pub multiplier: Quantity,
pub lot_size: Option<Quantity>,
pub max_quantity: Option<Quantity>,
Expand All @@ -71,10 +66,6 @@ impl FuturesContract {
currency: Currency,
price_precision: u8,
price_increment: Price,
margin_init: Decimal,
margin_maint: Decimal,
maker_fee: Decimal,
taker_fee: Decimal,
multiplier: Quantity,
lot_size: Option<Quantity>,
max_quantity: Option<Quantity>,
Expand All @@ -94,10 +85,6 @@ impl FuturesContract {
currency,
price_precision,
price_increment,
margin_init,
margin_maint,
maker_fee,
taker_fee,
multiplier,
lot_size,
max_quantity,
Expand Down Expand Up @@ -197,22 +184,6 @@ impl Instrument for FuturesContract {
self.min_price
}

fn margin_init(&self) -> Decimal {
self.margin_init
}

fn margin_maint(&self) -> Decimal {
self.margin_maint
}

fn maker_fee(&self) -> Decimal {
self.maker_fee
}

fn taker_fee(&self) -> Decimal {
self.taker_fee
}

fn ts_event(&self) -> UnixNanos {
self.ts_event
}
Expand Down
20 changes: 16 additions & 4 deletions nautilus_core/model/src/instruments/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ pub mod stubs;
use anyhow::Result;
use nautilus_core::time::UnixNanos;
use rust_decimal::Decimal;
use rust_decimal_macros::dec;

use crate::{
enums::{AssetClass, InstrumentClass},
Expand Down Expand Up @@ -59,10 +60,21 @@ pub trait Instrument {
fn min_quantity(&self) -> Option<Quantity>;
fn max_price(&self) -> Option<Price>;
fn min_price(&self) -> Option<Price>;
fn margin_init(&self) -> Decimal;
fn margin_maint(&self) -> Decimal;
fn maker_fee(&self) -> Decimal;
fn taker_fee(&self) -> Decimal;
fn margin_init(&self) -> Decimal {
dec!(0) // Temporary until separate fee models
}

fn margin_maint(&self) -> Decimal {
dec!(0) // Temporary until separate fee models
}

fn maker_fee(&self) -> Decimal {
dec!(0) // Temporary until separate fee models
}

fn taker_fee(&self) -> Decimal {
dec!(0) // Temporary until separate fee models
}
fn ts_event(&self) -> UnixNanos;
fn ts_init(&self) -> UnixNanos;

Expand Down
Loading

0 comments on commit 06a6a7d

Please sign in to comment.