Skip to main content

CommissionReport

Struct CommissionReport 

Source
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: String

The Execution::execution_id this commission belongs to. Use it to join the commission to its execution deterministically (see the type-level docs).

§commission: f64

the commissions cost.

§currency: String

the reporting currency.

§realized_pnl: Option<f64>

the realized profit and loss

§yields: Option<f64>

The income return.

§yield_redemption_date: String

date expressed in yyyymmdd format.

Trait Implementations§

Source§

impl Clone for CommissionReport

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl ComposeSchema for CommissionReport

Source§

impl Debug for CommissionReport

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for CommissionReport

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl ToSchema for CommissionReport

Source§

fn name() -> Cow<'static, str>

Return name of the schema. Read more
Source§

fn schemas(schemas: &mut Vec<(String, RefOr<Schema>)>)

Implement reference utoipa::openapi::schema::Schemas for this type. Read more

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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> PartialSchema for T
where T: ComposeSchema + ?Sized,

Source§

fn schema() -> RefOr<Schema>

Return ref or schema of implementing type that can then be used to construct combined schemas.
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

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

Source§

type Error = !

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

fn try_from(value: U) -> Result<T, !>

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.