pub struct CommissionReport {
pub execution_id: String,
pub commission: f64,
pub currency: String,
pub realized_pnl: Option<f64>,
pub yields: Option<f64>,
pub yield_redemption_date: String,
}Expand description
Represents the commission generated by an execution.
§Correlating commissions with executions
A CommissionReport joins to its Execution by
execution_id — the same value carried on
Execution::execution_id. TWS sends the ExecutionData first and the
matching CommissionReport shortly after, with unrelated frames (order
status, open-order updates) possibly in between, so the two are not
adjacent. Both arrive on the same streams
(executions,
place_order, and
order_update_stream); index
commissions by execution_id rather than by position in the stream.
§Examples
use ibapi::orders::{CommissionReport, Execution};
use std::collections::HashMap;
// The execution arrives first: index it by execution_id.
let mut executions: HashMap<String, Execution> = HashMap::new();
let execution = Execution {
execution_id: "0000e1a7.0001.01".to_string(),
shares: 100.0,
..Default::default()
};
executions.insert(execution.execution_id.clone(), execution);
// The commission follows: join it to its execution by execution_id.
let report = CommissionReport {
execution_id: "0000e1a7.0001.01".to_string(),
commission: 1.25,
..Default::default()
};
if let Some(execution) = executions.remove(&report.execution_id) {
println!("{} shares, commission {}", execution.shares, report.commission);
}Fields§
§execution_id: StringThe Execution::execution_id this commission belongs to. Use it to
join the commission to its execution deterministically (see the
type-level docs).
commission: f64the commissions cost.
currency: Stringthe reporting currency.
realized_pnl: Option<f64>the realized profit and loss
yields: Option<f64>The income return.
yield_redemption_date: Stringdate expressed in yyyymmdd format.