Skip to main content

Account

Struct Account 

Source
pub struct Account {
    pub client: Client,
    pub recv_window: u64,
}

Fields§

§client: Client§recv_window: u64

Implementations§

Source§

impl Account

Source

pub fn get_account(&self) -> Result<AccountInformation>

Source

pub fn get_balance<S>(&self, asset: S) -> Result<Balance>
where S: Into<String>,

Source

pub fn get_open_orders<S>(&self, symbol: S) -> Result<Vec<Order>>
where S: Into<String>,

Source

pub fn get_all_open_orders(&self) -> Result<Vec<Order>>

Source

pub fn cancel_all_open_orders<S>(&self, symbol: S) -> Result<Vec<OrderCanceled>>
where S: Into<String>,

Source

pub fn order_status<S>(&self, symbol: S, order_id: u64) -> Result<Order>
where S: Into<String>,

Source

pub fn test_order_status<S>(&self, symbol: S, order_id: u64) -> Result<()>
where S: Into<String>,

Place a test status order

This order is sandboxed: it is validated, but not sent to the matching engine.

Source

pub fn limit_buy<S, F>( &self, symbol: S, qty: F, price: f64, ) -> Result<Transaction>
where S: Into<String>, F: Into<f64>,

Source

pub fn test_limit_buy<S, F>(&self, symbol: S, qty: F, price: f64) -> Result<()>
where S: Into<String>, F: Into<f64>,

Place a test limit order - BUY

This order is sandboxed: it is validated, but not sent to the matching engine.

Source

pub fn limit_sell<S, F>( &self, symbol: S, qty: F, price: f64, ) -> Result<Transaction>
where S: Into<String>, F: Into<f64>,

Source

pub fn test_limit_sell<S, F>(&self, symbol: S, qty: F, price: f64) -> Result<()>
where S: Into<String>, F: Into<f64>,

Place a test LIMIT order - SELL

This order is sandboxed: it is validated, but not sent to the matching engine.

Source

pub fn market_buy<S, F>(&self, symbol: S, qty: F) -> Result<Transaction>
where S: Into<String>, F: Into<f64>,

Source

pub fn test_market_buy<S, F>(&self, symbol: S, qty: F) -> Result<()>
where S: Into<String>, F: Into<f64>,

Place a test MARKET order - BUY

This order is sandboxed: it is validated, but not sent to the matching engine.

Source

pub fn market_buy_using_quote_quantity<S, F>( &self, symbol: S, quote_order_qty: F, ) -> Result<Transaction>
where S: Into<String>, F: Into<f64>,

Source

pub fn test_market_buy_using_quote_quantity<S, F>( &self, symbol: S, quote_order_qty: F, ) -> Result<()>
where S: Into<String>, F: Into<f64>,

Place a test MARKET order with quote quantity - BUY

This order is sandboxed: it is validated, but not sent to the matching engine.

Source

pub fn market_sell<S, F>(&self, symbol: S, qty: F) -> Result<Transaction>
where S: Into<String>, F: Into<f64>,

Source

pub fn test_market_sell<S, F>(&self, symbol: S, qty: F) -> Result<()>
where S: Into<String>, F: Into<f64>,

Place a test MARKET order - SELL

This order is sandboxed: it is validated, but not sent to the matching engine.

Source

pub fn market_sell_using_quote_quantity<S, F>( &self, symbol: S, quote_order_qty: F, ) -> Result<Transaction>
where S: Into<String>, F: Into<f64>,

Source

pub fn test_market_sell_using_quote_quantity<S, F>( &self, symbol: S, quote_order_qty: F, ) -> Result<()>
where S: Into<String>, F: Into<f64>,

Place a test MARKET order with quote quantity - SELL

This order is sandboxed: it is validated, but not sent to the matching engine.

Source

pub fn stop_limit_buy_order<S, F>( &self, symbol: S, qty: F, price: f64, stop_price: f64, time_in_force: TimeInForce, ) -> Result<Transaction>
where S: Into<String>, F: Into<f64>,

Create a stop limit buy order for the given symbol, price and stop price. Returning a Transaction value with the same parameters sent on the order.

 use binance::api::Binance;
 use binance::account::*;

 fn main() {
     let api_key = Some("api_key".into());
     let secret_key = Some("secret_key".into());
     let account: Account = Binance::new(api_key, secret_key);
     let result = account.stop_limit_buy_order("LTCBTC", 1, 0.1, 0.09, TimeInForce::GTC);
 }
Source

pub fn test_stop_limit_buy_order<S, F>( &self, symbol: S, qty: F, price: f64, stop_price: f64, time_in_force: TimeInForce, ) -> Result<()>
where S: Into<String>, F: Into<f64>,

Create a stop limit buy test order for the given symbol, price and stop price. Returning a Transaction value with the same parameters sent on the order.

This order is sandboxed: it is validated, but not sent to the matching engine.

 use binance::api::Binance;
 use binance::account::*;

 fn main() {
     let api_key = Some("api_key".into());
     let secret_key = Some("secret_key".into());
     let account: Account = Binance::new(api_key, secret_key);
     let result = account.test_stop_limit_buy_order("LTCBTC", 1, 0.1, 0.09, TimeInForce::GTC);
 }
Source

pub fn stop_limit_sell_order<S, F>( &self, symbol: S, qty: F, price: f64, stop_price: f64, time_in_force: TimeInForce, ) -> Result<Transaction>
where S: Into<String>, F: Into<f64>,

Create a stop limit sell order for the given symbol, price and stop price. Returning a Transaction value with the same parameters sent on the order.

 use binance::api::Binance;
 use binance::account::*;

 fn main() {
     let api_key = Some("api_key".into());
     let secret_key = Some("secret_key".into());
     let account: Account = Binance::new(api_key, secret_key);
     let result = account.stop_limit_sell_order("LTCBTC", 1, 0.1, 0.09, TimeInForce::GTC);
 }
Source

pub fn test_stop_limit_sell_order<S, F>( &self, symbol: S, qty: F, price: f64, stop_price: f64, time_in_force: TimeInForce, ) -> Result<()>
where S: Into<String>, F: Into<f64>,

Create a stop limit sell order for the given symbol, price and stop price. Returning a Transaction value with the same parameters sent on the order.

This order is sandboxed: it is validated, but not sent to the matching engine.

 use binance::api::Binance;
 use binance::account::*;

 fn main() {
     let api_key = Some("api_key".into());
     let secret_key = Some("secret_key".into());
     let account: Account = Binance::new(api_key, secret_key);
     let result = account.test_stop_limit_sell_order("LTCBTC", 1, 0.1, 0.09, TimeInForce::GTC);
 }
Source

pub fn custom_order<S, F>( &self, symbol: S, qty: F, price: f64, stop_price: Option<f64>, order_side: OrderSide, order_type: OrderType, time_in_force: TimeInForce, new_client_order_id: Option<String>, ) -> Result<Transaction>
where S: Into<String>, F: Into<f64>,

Place a custom order

Source

pub fn test_custom_order<S, F>( &self, symbol: S, qty: F, price: f64, stop_price: Option<f64>, order_side: OrderSide, order_type: OrderType, time_in_force: TimeInForce, new_client_order_id: Option<String>, ) -> Result<()>
where S: Into<String>, F: Into<f64>,

Place a test custom order

This order is sandboxed: it is validated, but not sent to the matching engine.

Source

pub fn cancel_order<S>(&self, symbol: S, order_id: u64) -> Result<OrderCanceled>
where S: Into<String>,

Source

pub fn cancel_order_with_client_id<S>( &self, symbol: S, orig_client_order_id: String, ) -> Result<OrderCanceled>
where S: Into<String>,

Source

pub fn cancel_order_with_client_id_rs<S>()

Source

pub fn test_cancel_order<S>(&self, symbol: S, order_id: u64) -> Result<()>
where S: Into<String>,

Place a test cancel order

This order is sandboxed: it is validated, but not sent to the matching engine.

Source

pub fn trade_history<S>(&self, symbol: S) -> Result<Vec<TradeHistory>>
where S: Into<String>,

Source

pub fn trade_history_from<S>( &self, symbol: S, start_time: u64, ) -> Result<Vec<TradeHistory>>
where S: Into<String>,

Source

pub fn trade_history_from_to<S>( &self, symbol: S, start_time: u64, end_time: u64, ) -> Result<Vec<TradeHistory>>
where S: Into<String>,

Trait Implementations§

Source§

impl Binance for Account

Source§

fn new(api_key: Option<String>, secret_key: Option<String>) -> Account

Source§

fn new_with_config( api_key: Option<String>, secret_key: Option<String>, config: &Config, ) -> Account

Source§

impl Clone for Account

Source§

fn clone(&self) -> Account

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

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> ErasedDestructor for T
where T: 'static,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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> Same for T

Source§

type Output = T

Should always be Self
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 = Infallible

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

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

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.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more