Skip to main content

Mt5Client

Struct Mt5Client 

Source
pub struct Mt5Client { /* private fields */ }

Implementations§

Source§

impl Mt5Client

Source

pub fn new() -> Self

Source

pub fn initialize(&mut self, pipe_name: Option<&str>) -> Result<()>

Source

pub fn shutdown(&mut self)

Source

pub fn login(&self, login: i64, password: &str, server: &str) -> Result<()>

Source

pub fn account_info(&self) -> Result<AccountInfo>

Source

pub fn terminal_info(&self) -> Result<TerminalInfo>

Source

pub fn version(&self) -> Result<VersionInfo>

Source

pub fn symbols_total(&self) -> Result<i64>

Source

pub fn symbols_get(&self) -> Result<Vec<SymbolInfo>>

Source

pub fn symbol_info(&self, symbol: &str) -> Result<Option<SymbolInfo>>

Source

pub fn symbol_info_tick(&self, symbol: &str) -> Result<Option<Tick>>

Source

pub fn symbol_select(&self, symbol: &str, enable: bool) -> Result<bool>

Source

pub fn positions_total(&self) -> Result<i64>

Source

pub fn orders_total(&self) -> Result<i64>

Source

pub fn positions_get(&self, symbol: Option<&str>) -> Result<Vec<TradePosition>>

Source

pub fn orders_get(&self, symbol: Option<&str>) -> Result<Vec<TradeOrder>>

Source

pub fn send_raw_command(&self, cmd: u32, data: &[u8]) -> Result<Vec<u8>>

Source

pub fn copy_rates_from_pos( &self, symbol: &str, timeframe: i32, start_pos: i64, count: i32, ) -> Result<Vec<Rate>>

Source

pub fn copy_rates_from( &self, symbol: &str, timeframe: i32, date_from: i64, count: i32, ) -> Result<Vec<Rate>>

Source

pub fn copy_rates_range( &self, symbol: &str, timeframe: i32, date_from: i64, date_to: i64, ) -> Result<Vec<Rate>>

Source

pub fn copy_ticks_from( &self, symbol: &str, from: i64, count: i32, flags: i32, ) -> Result<Vec<Tick>>

Source

pub fn copy_ticks_range( &self, symbol: &str, from: i64, to: i64, flags: i32, ) -> Result<Vec<Tick>>

Source

pub fn history_deals_total(&self, from: i64, to: i64) -> Result<i64>

Source

pub fn history_deals_get(&self, from: i64, to: i64) -> Result<Vec<TradeDeal>>

Source

pub fn history_orders_total(&self, from: i64, to: i64) -> Result<i64>

Source

pub fn history_orders_get(&self, from: i64, to: i64) -> Result<Vec<TradeOrder>>

Source

pub fn market_book_add(&self, symbol: &str) -> Result<bool>

Source

pub fn market_book_get(&self, symbol: &str) -> Result<Vec<BookInfo>>

Source

pub fn market_book_release(&self, symbol: &str) -> Result<bool>

Source

pub fn order_calc_margin( &self, _action: i32, symbol: &str, volume: f64, price: f64, ) -> Result<f64>

计算订单所需保证金(本地计算,不使用IPC) 根据Python测试验证的公式:margin = volume × price × margin_initial / 4

Source

pub fn order_calc_profit( &self, _action: i32, symbol: &str, volume: f64, price_open: f64, price_close: f64, ) -> Result<f64>

计算订单预期利润(本地计算,不使用IPC) 公式:profit = volume × (price_close - price_open) × contract_size

Source

pub fn last_error(&self) -> Result<(i32, String)>

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.