Skip to main content

TradingFormatter

Trait TradingFormatter 

Source
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§

Source

fn price(&self, _symbol: &str, _price: f64) -> Option<String>

A price, such as a limit price, a bid or an average price.

Source

fn quantity(&self, _symbol: &str, _quantity: f64) -> Option<String>

A quantity, in the symbol’s trading units.

Source

fn spread(&self, _symbol: &str, _spread: f64) -> Option<String>

The difference between the ask and the bid, in price units.

Source

fn pip_value(&self, _symbol: &str, _value: f64) -> Option<String>

The value of one pip of the order in the account’s currency.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§