Expand description
Stream of the execution events of an account.
The server sends the events of every authorised account by itself; nothing is subscribed
to. The stream also delivers the events that answer the requests of this client, such as
the acceptance OpenApiClient::place_order returns, so the life of an order is read from
one place and in the order the server reported it.
use ctrader_connector::common::config::ConfigurationOpenApi;
use ctrader_connector::open_api::client::OpenApiClient;
use ctrader_connector::open_api::executions::TradeEvent;
let client = OpenApiClient::connect(ConfigurationOpenApi::from_env()?).await?;
client.authorise_application().await?;
let account = client.accounts().await?[0].id;
client.authorise_account(account).await?;
let mut executions = client.executions(account);
loop {
match executions.next().await? {
TradeEvent::Execution(execution) => println!("{:?}", execution.kind),
TradeEvent::OrderError(error) => println!("refused: {}", error.code),
_ => {}
}
}Structs§
- Execution
Stream - Execution events and order error events of one account, in the order the server sent them.
- Order
Error - Refusal of a request that trades, as the server reports it in an order error event.
Enums§
- Trade
Event - One event of the trading of an account.