pub struct Exchange<A> { /* private fields */ }
Expand description

The main leveraged futures exchange for simulated trading

Implementations

Create a new Exchange with the desired config and whether to use candles as infomation source

Return a reference to current exchange config

Return the bid price

Return the ask price

Return the current time step

Return a reference to Account

Return a mutable reference to Account

Set the account, use carefully

Update the exchange state with new information

Parameters

bid: bid price ask: ask price timestamp: timestamp usually in milliseconds high: highest price over last period, use when feeding in candle info, otherwise set high == ask low: lowest price over last period, use when feeding in candle info, otherwise set low == bid ### Returns executed orders true if position has been liquidated

Submit a new order to the exchange. Returns the order with timestamp and id filled in or OrderError

Trait Implementations

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Formats the value using the given formatter. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

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

The resulting type after obtaining ownership.

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

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

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.