pub struct TradingSettings {Show 15 fields
pub instrument: String,
pub minimum_profit_steps: u32,
pub minimum_market_order_size_to_buy: u64,
pub minimum_market_order_size_to_sell: u64,
pub minimum_market_order_size_to_change_buy_price: u64,
pub minimum_market_order_size_to_change_sell_price: u64,
pub market_order_book_depth: usize,
pub max_position_lots: u64,
pub lot_size: u64,
pub minimum_time_to_buy: Option<NaiveTime>,
pub maximum_time_to_buy: Option<NaiveTime>,
pub early_sell_owned_lots_delta: Option<u32>,
pub early_sell_owned_lots_multiplier: Option<Decimal>,
pub price_step: Decimal,
pub enabled: bool,
}Expand description
Configuration settings for trading strategies.
Fields§
§instrument: StringThe instrument to trade.
minimum_profit_steps: u32Minimum profit in price steps before considering a sell.
minimum_market_order_size_to_buy: u64Minimum market order size (in lots) to consider buying.
minimum_market_order_size_to_sell: u64Minimum market order size (in lots) to consider selling.
minimum_market_order_size_to_change_buy_price: u64Minimum market order size to change buy price.
minimum_market_order_size_to_change_sell_price: u64Minimum market order size to change sell price.
market_order_book_depth: usizeOrder book depth to analyze.
max_position_lots: u64Maximum number of lots to hold.
lot_size: u64Lot size for orders.
minimum_time_to_buy: Option<NaiveTime>Earliest time to start buying.
maximum_time_to_buy: Option<NaiveTime>Latest time to buy.
early_sell_owned_lots_delta: Option<u32>Delta for early sell (sell if price drops by this many steps).
early_sell_owned_lots_multiplier: Option<Decimal>Multiplier for early sell.
price_step: DecimalPrice step for the instrument (tick size).
enabled: boolWhether trading is enabled.
Implementations§
Source§impl TradingSettings
impl TradingSettings
Sourcepub fn new(instrument: impl Into<String>) -> Self
pub fn new(instrument: impl Into<String>) -> Self
Creates new trading settings for an instrument.
Sourcepub fn with_minimum_profit_steps(self, steps: u32) -> Self
pub fn with_minimum_profit_steps(self, steps: u32) -> Self
Builder method to set minimum profit steps.
Sourcepub fn with_price_step(self, step: Decimal) -> Self
pub fn with_price_step(self, step: Decimal) -> Self
Builder method to set price step.
Sourcepub fn with_lot_size(self, size: u64) -> Self
pub fn with_lot_size(self, size: u64) -> Self
Builder method to set lot size.
Sourcepub fn with_max_position(self, lots: u64) -> Self
pub fn with_max_position(self, lots: u64) -> Self
Builder method to set max position.
Sourcepub fn with_order_book_depth(self, depth: usize) -> Self
pub fn with_order_book_depth(self, depth: usize) -> Self
Builder method to set order book depth.
Sourcepub fn with_min_order_size_to_buy(self, size: u64) -> Self
pub fn with_min_order_size_to_buy(self, size: u64) -> Self
Builder method to set minimum market order size to buy.
Sourcepub fn with_min_order_size_to_sell(self, size: u64) -> Self
pub fn with_min_order_size_to_sell(self, size: u64) -> Self
Builder method to set minimum market order size to sell.
Sourcepub fn with_trading_hours(self, start: NaiveTime, end: NaiveTime) -> Self
pub fn with_trading_hours(self, start: NaiveTime, end: NaiveTime) -> Self
Builder method to set trading time window.
Sourcepub fn with_enabled(self, enabled: bool) -> Self
pub fn with_enabled(self, enabled: bool) -> Self
Builder method to enable/disable trading.
Sourcepub fn minimum_profit(&self) -> Decimal
pub fn minimum_profit(&self) -> Decimal
Returns the minimum profit amount.
Sourcepub fn is_trading_time(&self, time: NaiveTime) -> bool
pub fn is_trading_time(&self, time: NaiveTime) -> bool
Checks if trading is allowed at the given time.