pub trait TradingFormatter: Send + Sync {
// Provided methods
fn price(&self, _symbol: &str, _price: f64) -> Option<String> { ... }
fn quantity(&self, _symbol: &str, _quantity: f64) -> Option<String> { ... }
fn spread(&self, _symbol: &str, _spread: f64) -> Option<String> { ... }
fn pip_value(&self, _symbol: &str, _value: f64) -> Option<String> { ... }
}Expand description
Host text for the numbers of the order ticket, the depth ladder and the account tables.
Every method receives the symbol the number belongs to, so differently formatted instruments
keep their own text. Return None to keep the built-in text: the symbol’s price decimals for
prices, spreads and pip values, and the decimals of the quantity step for quantities.
Install it with Trading::set_formatter.
Provided Methods§
Sourcefn price(&self, _symbol: &str, _price: f64) -> Option<String>
fn price(&self, _symbol: &str, _price: f64) -> Option<String>
A price, such as a limit price, a bid or an average price.
Sourcefn quantity(&self, _symbol: &str, _quantity: f64) -> Option<String>
fn quantity(&self, _symbol: &str, _quantity: f64) -> Option<String>
A quantity, in the symbol’s trading units.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".