pub trait BorrowCapacityClient: ExecutionClient {
// Required method
fn fetch_borrow_capacity(
&self,
instrument: &InstrumentNameExchange,
side: Side,
) -> impl Future<Output = Result<BorrowCapacity, UnindexedClientError>> + Send;
}Expand description
Extension trait for clients that can say how much more this account can borrow.
Where ShortabilityClient says what the venue has to lend, this says how much of it this
account could take now, given its collateral, its limit and what it has already borrowed. The
two are separate types because they are different facts; see BorrowCapacity.
§Type-Level Capability
A supertrait of ExecutionClient, for the reason BracketOrderClient is one. Only a venue
that lends against an account’s collateral and reports what is left of it implements it.
Required Methods§
Sourcefn fetch_borrow_capacity(
&self,
instrument: &InstrumentNameExchange,
side: Side,
) -> impl Future<Output = Result<BorrowCapacity, UnindexedClientError>> + Send
fn fetch_borrow_capacity( &self, instrument: &InstrumentNameExchange, side: Side, ) -> impl Future<Output = Result<BorrowCapacity, UnindexedClientError>> + Send
How much this account can borrow now for an order on instrument on side.
A sell borrows the instrument’s base asset, which is a short; a buy borrows its quote asset, which is a leveraged long. The result names that asset, and its amounts are in its units.
§Contract
Advisory, as BorrowCapacity says: the amounts are not reserved, so an order sized to
them must still handle ApiError::BorrowRejected.
§Errors
ApiError::InstrumentInvalid for an instrument
the client cannot borrow against, such as a pair the venue does not trade on margin.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".