Bitget

Struct Bitget 

Source
pub struct Bitget { /* private fields */ }
Expand description

Bitget exchange structure.

Implementations§

Source§

impl Bitget

Source

pub fn get_auth(&self) -> Result<BitgetAuth, Error>

Get the authentication instance if credentials are configured.

Source

pub fn check_required_credentials(&self) -> Result<(), Error>

Check that required credentials are configured.

Source

pub async fn fetch_markets( &self, ) -> Result<Arc<HashMap<String, Arc<Market>>>, Error>

Fetch all trading markets.

§Returns

Returns a vector of Market structures containing market information.

§Errors

Returns an error if the API request fails or response parsing fails.

§Example
let bitget = Bitget::builder().build()?;
let markets = bitget.fetch_markets().await?;
println!("Found {} markets", markets.len());
Source

pub async fn load_markets( &self, reload: bool, ) -> Result<Arc<HashMap<String, Arc<Market>>>, Error>

Load and cache market data.

If markets are already loaded and reload is false, returns cached data.

§Arguments
  • reload - Whether to force reload market data from the API.
§Returns

Returns a HashMap containing all market data, keyed by symbol (e.g., “BTC/USDT”).

§Errors

Returns an error if the API request fails or response parsing fails.

§Example
let bitget = Bitget::builder().build()?;

// Load markets for the first time
let markets = bitget.load_markets(false).await?;
println!("Loaded {} markets", markets.len());

// Subsequent calls use cache (no API request)
let markets = bitget.load_markets(false).await?;

// Force reload
let markets = bitget.load_markets(true).await?;
Source

pub async fn fetch_ticker(&self, symbol: &str) -> Result<Ticker, Error>

Fetch ticker for a single trading pair.

§Arguments
  • symbol - Trading pair symbol (e.g., “BTC/USDT”).
§Returns

Returns Ticker data for the specified symbol.

§Errors

Returns an error if the market is not found or the API request fails.

§Example
let bitget = Bitget::builder().build()?;
bitget.load_markets(false).await?;
let ticker = bitget.fetch_ticker("BTC/USDT").await?;
println!("BTC/USDT last price: {:?}", ticker.last);
Source

pub async fn fetch_tickers( &self, symbols: Option<Vec<String>>, ) -> Result<Vec<Ticker>, Error>

Fetch tickers for multiple trading pairs.

§Arguments
  • symbols - Optional list of trading pair symbols; fetches all if None.
§Returns

Returns a vector of Ticker structures.

§Errors

Returns an error if markets are not loaded or the API request fails.

§Example
let bitget = Bitget::builder().build()?;
bitget.load_markets(false).await?;

// Fetch all tickers
let all_tickers = bitget.fetch_tickers(None).await?;

// Fetch specific tickers
let tickers = bitget.fetch_tickers(Some(vec!["BTC/USDT".to_string(), "ETH/USDT".to_string()])).await?;
Source

pub async fn fetch_order_book( &self, symbol: &str, limit: Option<u32>, ) -> Result<OrderBook, Error>

Fetch order book for a trading pair.

§Arguments
  • symbol - Trading pair symbol.
  • limit - Optional depth limit (valid values: 1, 5, 15, 50, 100; default: 100).
§Returns

Returns OrderBook data containing bids and asks.

§Errors

Returns an error if the market is not found or the API request fails.

§Example
let bitget = Bitget::builder().build()?;
bitget.load_markets(false).await?;
let orderbook = bitget.fetch_order_book("BTC/USDT", Some(50)).await?;
println!("Best bid: {:?}", orderbook.bids.first());
println!("Best ask: {:?}", orderbook.asks.first());
Source

pub async fn fetch_trades( &self, symbol: &str, limit: Option<u32>, ) -> Result<Vec<Trade>, Error>

Fetch recent public trades.

§Arguments
  • symbol - Trading pair symbol.
  • limit - Optional limit on number of trades (maximum: 500).
§Returns

Returns a vector of Trade structures, sorted by timestamp in descending order.

§Errors

Returns an error if the market is not found or the API request fails.

§Example
let bitget = Bitget::builder().build()?;
bitget.load_markets(false).await?;
let trades = bitget.fetch_trades("BTC/USDT", Some(100)).await?;
for trade in trades.iter().take(5) {
    println!("Trade: {:?} @ {:?}", trade.amount, trade.price);
}
Source

pub async fn fetch_ohlcv_v2( &self, request: OhlcvRequest, ) -> Result<Vec<OHLCV>, Error>

Fetch OHLCV (candlestick) data.

§Arguments
  • symbol - Trading pair symbol.
  • timeframe - Candlestick timeframe (e.g., “1m”, “5m”, “1h”, “1d”).
  • since - Optional start timestamp in milliseconds.
  • limit - Optional limit on number of candles (maximum: 1000).
§Returns

Returns a vector of OHLCV structures.

§Errors

Returns an error if the market is not found or the API request fails.

§Example
let bitget = Bitget::builder().build()?;
bitget.load_markets(false).await?;
let ohlcv = bitget.fetch_ohlcv("BTC/USDT", "1h", None, Some(100)).await?;
for candle in ohlcv.iter().take(5) {
    println!("Open: {}, Close: {}", candle.open, candle.close);
}

Requirements: 2.3, 2.6

Source

pub async fn fetch_ohlcv( &self, symbol: &str, timeframe: &str, since: Option<i64>, limit: Option<u32>, ) -> Result<Vec<OHLCV>, Error>

👎Deprecated since 0.2.0: Use fetch_ohlcv_v2 with OhlcvRequest::builder() instead

Fetch OHLCV (candlestick) data (deprecated).

§Deprecated

This method is deprecated. Use fetch_ohlcv_v2 with OhlcvRequest::builder() instead for a more ergonomic API.

§Arguments
  • symbol - Trading pair symbol.
  • timeframe - Candlestick timeframe (e.g., “1m”, “5m”, “1h”, “1d”).
  • since - Optional start timestamp in milliseconds.
  • limit - Optional limit on number of candles (maximum: 1000).
§Returns

Returns a vector of OHLCV structures.

§Example
let bitget = Bitget::builder().build()?;
bitget.load_markets(false).await?;
let ohlcv = bitget.fetch_ohlcv("BTC/USDT", "1h", None, Some(100)).await?;
for candle in ohlcv.iter().take(5) {
    println!("Open: {}, Close: {}", candle.open, candle.close);
}
Source

pub async fn fetch_balance(&self) -> Result<Balance, Error>

Fetch account balances.

§Returns

Returns a Balance structure with all currency balances.

§Errors

Returns an error if authentication fails or the API request fails.

§Example
let bitget = Bitget::builder()
    .api_key("your-api-key")
    .secret("your-secret")
    .passphrase("your-passphrase")
    .build()?;
let balance = bitget.fetch_balance().await?;
if let Some(btc) = balance.get("BTC") {
    println!("BTC balance: free={}, used={}, total={}", btc.free, btc.used, btc.total);
}
Source

pub async fn fetch_my_trades( &self, symbol: &str, since: Option<i64>, limit: Option<u32>, ) -> Result<Vec<Trade>, Error>

Fetch user’s trade history.

§Arguments
  • symbol - Trading pair symbol.
  • since - Optional start timestamp in milliseconds.
  • limit - Optional limit on number of trades (maximum: 500).
§Returns

Returns a vector of Trade structures representing user’s trade history.

§Errors

Returns an error if authentication fails or the API request fails.

§Example
let bitget = Bitget::builder()
    .api_key("your-api-key")
    .secret("your-secret")
    .passphrase("your-passphrase")
    .build()?;
bitget.load_markets(false).await?;
let my_trades = bitget.fetch_my_trades("BTC/USDT", None, Some(50)).await?;
Source

pub async fn create_order_v2( &self, request: OrderRequest, ) -> Result<Order, Error>

Create a new order.

§Arguments
  • symbol - Trading pair symbol.
  • order_type - Order type (Market, Limit).
  • side - Order side (Buy or Sell).
  • amount - Order quantity as Amount type.
  • price - Optional price as Price type (required for limit orders).
§Returns

Returns the created Order structure with order details.

§Errors

Returns an error if authentication fails, market is not found, or the API request fails.

§Example
let bitget = Bitget::builder()
    .api_key("your-api-key")
    .secret("your-secret")
    .passphrase("your-passphrase")
    .build()?;
bitget.load_markets(false).await?;

// Create a limit buy order
let order = bitget.create_order(
    "BTC/USDT",
    OrderType::Limit,
    OrderSide::Buy,
    Amount::new(dec!(0.001)),
    Some(Price::new(dec!(50000.0))),
).await?;
println!("Order created: {}", order.id);

Requirements: 2.2, 2.6

Source

pub async fn create_order( &self, symbol: &str, order_type: OrderType, side: OrderSide, amount: Amount, price: Option<Price>, ) -> Result<Order, Error>

👎Deprecated since 0.2.0: Use create_order_v2 with OrderRequest::builder() instead

Create a new order (deprecated).

§Deprecated

This method is deprecated. Use create_order_v2 with OrderRequest::builder() instead for a more ergonomic API.

§Arguments
  • symbol - Trading pair symbol.
  • order_type - Order type (Market, Limit).
  • side - Order side (Buy or Sell).
  • amount - Order quantity as Amount type.
  • price - Optional price as Price type (required for limit orders).
§Returns

Returns the created Order structure with order details.

§Errors

Returns an error if authentication fails or the API request fails.

§Example
let bitget = Bitget::builder()
    .api_key("your-api-key")
    .secret("your-secret")
    .passphrase("your-passphrase")
    .build()?;
bitget.load_markets(false).await?;

// Create a limit buy order
let order = bitget.create_order(
    "BTC/USDT",
    OrderType::Limit,
    OrderSide::Buy,
    Amount::new(dec!(0.001)),
    Some(Price::new(dec!(50000.0))),
).await?;
println!("Order created: {}", order.id);
Source

pub async fn cancel_order(&self, id: &str, symbol: &str) -> Result<Order, Error>

Cancel an existing order.

§Arguments
  • id - Order ID to cancel.
  • symbol - Trading pair symbol.
§Returns

Returns the canceled Order structure.

§Errors

Returns an error if authentication fails or the API request fails.

§Example
let bitget = Bitget::builder()
    .api_key("your-api-key")
    .secret("your-secret")
    .passphrase("your-passphrase")
    .build()?;
bitget.load_markets(false).await?;
let order = bitget.cancel_order("123456789", "BTC/USDT").await?;
Source

pub async fn fetch_order(&self, id: &str, symbol: &str) -> Result<Order, Error>

Fetch a single order by ID.

§Arguments
  • id - Order ID to fetch.
  • symbol - Trading pair symbol.
§Returns

Returns the Order structure with current status.

§Errors

Returns an error if authentication fails or the API request fails.

§Example
let bitget = Bitget::builder()
    .api_key("your-api-key")
    .secret("your-secret")
    .passphrase("your-passphrase")
    .build()?;
bitget.load_markets(false).await?;
let order = bitget.fetch_order("123456789", "BTC/USDT").await?;
println!("Order status: {:?}", order.status);
Source

pub async fn fetch_open_orders( &self, symbol: Option<&str>, since: Option<i64>, limit: Option<u32>, ) -> Result<Vec<Order>, Error>

Fetch open orders.

§Arguments
  • symbol - Optional trading pair symbol. If None, fetches all open orders.
  • since - Optional start timestamp in milliseconds.
  • limit - Optional limit on number of orders (maximum: 500).
§Returns

Returns a vector of open Order structures.

§Errors

Returns an error if authentication fails or the API request fails.

§Example
let bitget = Bitget::builder()
    .api_key("your-api-key")
    .secret("your-secret")
    .passphrase("your-passphrase")
    .build()?;
bitget.load_markets(false).await?;

// Fetch all open orders
let all_open = bitget.fetch_open_orders(None, None, None).await?;

// Fetch open orders for specific symbol
let btc_open = bitget.fetch_open_orders(Some("BTC/USDT"), None, Some(50)).await?;
Source

pub async fn fetch_closed_orders( &self, symbol: Option<&str>, since: Option<i64>, limit: Option<u32>, ) -> Result<Vec<Order>, Error>

Fetch closed orders.

§Arguments
  • symbol - Optional trading pair symbol. If None, fetches all closed orders.
  • since - Optional start timestamp in milliseconds.
  • limit - Optional limit on number of orders (maximum: 500).
§Returns

Returns a vector of closed Order structures.

§Errors

Returns an error if authentication fails or the API request fails.

§Example
let bitget = Bitget::builder()
    .api_key("your-api-key")
    .secret("your-secret")
    .passphrase("your-passphrase")
    .build()?;
bitget.load_markets(false).await?;

// Fetch closed orders for specific symbol
let closed = bitget.fetch_closed_orders(Some("BTC/USDT"), None, Some(50)).await?;
Source§

impl Bitget

Source

pub fn builder() -> BitgetBuilder

Creates a new Bitget instance using the builder pattern.

This is the recommended way to create a Bitget instance.

§Example
use ccxt_exchanges::bitget::Bitget;

let bitget = Bitget::builder()
    .api_key("your-api-key")
    .secret("your-secret")
    .passphrase("your-passphrase")
    .sandbox(true)
    .build()
    .unwrap();
Source

pub fn new(config: ExchangeConfig) -> Result<Bitget, Error>

Creates a new Bitget instance.

§Arguments
  • config - Exchange configuration.
Source

pub fn new_with_options( config: ExchangeConfig, options: BitgetOptions, ) -> Result<Bitget, Error>

Creates a new Bitget instance with custom options.

This is used internally by the builder pattern.

§Arguments
  • config - Exchange configuration.
  • options - Bitget-specific options.
Source

pub fn base(&self) -> &BaseExchange

Returns a reference to the base exchange.

Source

pub fn base_mut(&mut self) -> &mut BaseExchange

Returns a mutable reference to the base exchange.

Source

pub fn options(&self) -> &BitgetOptions

Returns the Bitget options.

Source

pub fn set_options(&mut self, options: BitgetOptions)

Sets the Bitget options.

Source

pub fn id(&self) -> &'static str

Returns the exchange ID.

Source

pub fn name(&self) -> &'static str

Returns the exchange name.

Source

pub fn version(&self) -> &'static str

Returns the API version.

Source

pub fn certified(&self) -> bool

Returns true if the exchange is CCXT-certified.

Source

pub fn pro(&self) -> bool

Returns true if Pro version (WebSocket) is supported.

Source

pub fn rate_limit(&self) -> u32

Returns the rate limit in requests per second.

Source

pub fn is_sandbox(&self) -> bool

Returns true if sandbox/testnet mode is enabled.

Sandbox mode is enabled when either:

  • config.sandbox is set to true
  • options.testnet is set to true
§Returns

true if sandbox mode is enabled, false otherwise.

§Example
use ccxt_exchanges::bitget::Bitget;
use ccxt_core::ExchangeConfig;

let config = ExchangeConfig {
    sandbox: true,
    ..Default::default()
};
let bitget = Bitget::new(config).unwrap();
assert!(bitget.is_sandbox());
Source

pub fn timeframes(&self) -> HashMap<String, String>

Returns the supported timeframes.

Source

pub fn urls(&self) -> BitgetUrls

Returns the API URLs.

Returns testnet URLs when sandbox mode is enabled (via config.sandbox or options.testnet), otherwise returns production URLs.

§Returns
  • BitgetUrls::testnet() when sandbox mode is enabled
  • BitgetUrls::production() when sandbox mode is disabled
Source

pub fn create_ws(&self) -> BitgetWs

Creates a public WebSocket client.

§Returns

Returns a BitgetWs instance for public data streams.

§Example
use ccxt_exchanges::bitget::Bitget;
use ccxt_core::ExchangeConfig;

let bitget = Bitget::new(ExchangeConfig::default())?;
let ws = bitget.create_ws();
ws.connect().await?;
Source

pub fn signed_request( &self, endpoint: impl Into<String>, ) -> BitgetSignedRequestBuilder<'_>

Creates a signed request builder for authenticated API requests.

§Arguments
  • endpoint - API endpoint path (e.g., “/api/v2/spot/account/assets”)
§Returns

Returns a BitgetSignedRequestBuilder for fluent API construction.

§Example
use ccxt_exchanges::bitget::Bitget;
use ccxt_exchanges::bitget::signed_request::HttpMethod;
use ccxt_core::ExchangeConfig;

let bitget = Bitget::new(ExchangeConfig::default())?;

let data = bitget.signed_request("/api/v2/spot/account/assets")
    .execute()
    .await?;

Trait Implementations§

Source§

impl BitgetEndpointRouter for Bitget

Source§

fn rest_endpoint(&self) -> &'static str

Returns the REST API endpoint. Read more
Source§

fn ws_endpoint(&self, endpoint_type: EndpointType) -> &str

Returns the WebSocket endpoint for a specific endpoint type. Read more
Source§

impl Debug for Bitget

Source§

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

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

impl Exchange for Bitget

Source§

fn id(&self) -> &'static str

Returns the exchange identifier (e.g., “binance”, “coinbase”) Read more
Source§

fn name(&self) -> &'static str

Returns the human-readable exchange name (e.g., “Binance”, “Coinbase”)
Source§

fn version(&self) -> &'static str

Returns the API version string
Source§

fn certified(&self) -> bool

Returns whether this exchange is CCXT certified Read more
Source§

fn has_websocket(&self) -> bool

Returns whether this exchange supports WebSocket (pro features)
Source§

fn capabilities(&self) -> ExchangeCapabilities

Returns the exchange capabilities Read more
Source§

fn timeframes(&self) -> Vec<Timeframe>

Returns supported timeframes for OHLCV data
Source§

fn rate_limit(&self) -> u32

Returns the rate limit (requests per second)
Source§

fn fetch_markets<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<Vec<Market>, Error>> + Send + 'async_trait>>
where 'life0: 'async_trait, Bitget: 'async_trait,

Fetch all available markets Read more
Source§

fn load_markets<'life0, 'async_trait>( &'life0 self, reload: bool, ) -> Pin<Box<dyn Future<Output = Result<Arc<HashMap<String, Arc<Market>>>, Error>> + Send + 'async_trait>>
where 'life0: 'async_trait, Bitget: 'async_trait,

Load markets and cache them Read more
Source§

fn fetch_ticker<'life0, 'life1, 'async_trait>( &'life0 self, symbol: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<Ticker, Error>> + Send + 'async_trait>>
where 'life0: 'async_trait, 'life1: 'async_trait, Bitget: 'async_trait,

Fetch ticker for a single symbol Read more
Source§

fn fetch_tickers<'life0, 'life1, 'async_trait>( &'life0 self, symbols: Option<&'life1 [String]>, ) -> Pin<Box<dyn Future<Output = Result<Vec<Ticker>, Error>> + Send + 'async_trait>>
where 'life0: 'async_trait, 'life1: 'async_trait, Bitget: 'async_trait,

Fetch tickers for multiple symbols (or all if None) Read more
Source§

fn fetch_order_book<'life0, 'life1, 'async_trait>( &'life0 self, symbol: &'life1 str, limit: Option<u32>, ) -> Pin<Box<dyn Future<Output = Result<OrderBook, Error>> + Send + 'async_trait>>
where 'life0: 'async_trait, 'life1: 'async_trait, Bitget: 'async_trait,

Fetch order book for a symbol Read more
Source§

fn fetch_trades<'life0, 'life1, 'async_trait>( &'life0 self, symbol: &'life1 str, limit: Option<u32>, ) -> Pin<Box<dyn Future<Output = Result<Vec<Trade>, Error>> + Send + 'async_trait>>
where 'life0: 'async_trait, 'life1: 'async_trait, Bitget: 'async_trait,

Fetch recent public trades Read more
Source§

fn fetch_ohlcv<'life0, 'life1, 'async_trait>( &'life0 self, symbol: &'life1 str, timeframe: Timeframe, since: Option<i64>, limit: Option<u32>, ) -> Pin<Box<dyn Future<Output = Result<Vec<Ohlcv>, Error>> + Send + 'async_trait>>
where 'life0: 'async_trait, 'life1: 'async_trait, Bitget: 'async_trait,

Fetch OHLCV candlestick data Read more
Source§

fn create_order<'life0, 'life1, 'async_trait>( &'life0 self, symbol: &'life1 str, order_type: OrderType, side: OrderSide, amount: Amount, price: Option<Price>, ) -> Pin<Box<dyn Future<Output = Result<Order, Error>> + Send + 'async_trait>>
where 'life0: 'async_trait, 'life1: 'async_trait, Bitget: 'async_trait,

Create a new order Read more
Source§

fn cancel_order<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, id: &'life1 str, symbol: Option<&'life2 str>, ) -> Pin<Box<dyn Future<Output = Result<Order, Error>> + Send + 'async_trait>>
where 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, Bitget: 'async_trait,

Cancel an existing order Read more
Source§

fn cancel_all_orders<'life0, 'life1, 'async_trait>( &'life0 self, _symbol: Option<&'life1 str>, ) -> Pin<Box<dyn Future<Output = Result<Vec<Order>, Error>> + Send + 'async_trait>>
where 'life0: 'async_trait, 'life1: 'async_trait, Bitget: 'async_trait,

Cancel all orders (optionally for a specific symbol) Read more
Source§

fn fetch_order<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, id: &'life1 str, symbol: Option<&'life2 str>, ) -> Pin<Box<dyn Future<Output = Result<Order, Error>> + Send + 'async_trait>>
where 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, Bitget: 'async_trait,

Fetch a specific order by ID Read more
Source§

fn fetch_open_orders<'life0, 'life1, 'async_trait>( &'life0 self, symbol: Option<&'life1 str>, since: Option<i64>, limit: Option<u32>, ) -> Pin<Box<dyn Future<Output = Result<Vec<Order>, Error>> + Send + 'async_trait>>
where 'life0: 'async_trait, 'life1: 'async_trait, Bitget: 'async_trait,

Fetch all open orders Read more
Source§

fn fetch_closed_orders<'life0, 'life1, 'async_trait>( &'life0 self, symbol: Option<&'life1 str>, since: Option<i64>, limit: Option<u32>, ) -> Pin<Box<dyn Future<Output = Result<Vec<Order>, Error>> + Send + 'async_trait>>
where 'life0: 'async_trait, 'life1: 'async_trait, Bitget: 'async_trait,

Fetch closed orders Read more
Source§

fn fetch_balance<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<Balance, Error>> + Send + 'async_trait>>
where 'life0: 'async_trait, Bitget: 'async_trait,

Fetch account balance Read more
Source§

fn fetch_my_trades<'life0, 'life1, 'async_trait>( &'life0 self, symbol: Option<&'life1 str>, since: Option<i64>, limit: Option<u32>, ) -> Pin<Box<dyn Future<Output = Result<Vec<Trade>, Error>> + Send + 'async_trait>>
where 'life0: 'async_trait, 'life1: 'async_trait, Bitget: 'async_trait,

Fetch user’s trade history Read more
Source§

fn market<'life0, 'life1, 'async_trait>( &'life0 self, symbol: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<Arc<Market>, Error>> + Send + 'async_trait>>
where 'life0: 'async_trait, 'life1: 'async_trait, Bitget: 'async_trait,

Get a specific market by symbol Read more
Source§

fn markets<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Arc<HashMap<String, Arc<Market>>>> + Send + 'async_trait>>
where 'life0: 'async_trait, Bitget: 'async_trait,

Get all cached markets Read more
Source§

fn is_symbol_active<'life0, 'life1, 'async_trait>( &'life0 self, symbol: &'life1 str, ) -> Pin<Box<dyn Future<Output = bool> + Send + 'async_trait>>
where 'life0: 'async_trait, 'life1: 'async_trait, Self: 'async_trait,

Check if a symbol is valid and active Read more
Source§

impl WsExchange for Bitget

Source§

fn ws_connect<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>
where 'life0: 'async_trait, Bitget: 'async_trait,

Connect to the WebSocket server Read more
Source§

fn ws_disconnect<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>
where 'life0: 'async_trait, Bitget: 'async_trait,

Disconnect from the WebSocket server Read more
Source§

fn ws_is_connected(&self) -> bool

Check if WebSocket is connected Read more
Source§

fn ws_state(&self) -> WsConnectionState

Get WebSocket connection state Read more
Source§

fn watch_ticker<'life0, 'life1, 'async_trait>( &'life0 self, symbol: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<Pin<Box<dyn Stream<Item = Result<Ticker, Error>> + Send>>, Error>> + Send + 'async_trait>>
where 'life0: 'async_trait, 'life1: 'async_trait, Bitget: 'async_trait,

Watch ticker updates for a symbol Read more
Source§

fn watch_tickers<'life0, 'life1, 'async_trait>( &'life0 self, _symbols: &'life1 [String], ) -> Pin<Box<dyn Future<Output = Result<Pin<Box<dyn Stream<Item = Result<Vec<Ticker>, Error>> + Send>>, Error>> + Send + 'async_trait>>
where 'life0: 'async_trait, 'life1: 'async_trait, Bitget: 'async_trait,

Watch tickers for multiple symbols Read more
Source§

fn watch_order_book<'life0, 'life1, 'async_trait>( &'life0 self, symbol: &'life1 str, limit: Option<u32>, ) -> Pin<Box<dyn Future<Output = Result<Pin<Box<dyn Stream<Item = Result<OrderBook, Error>> + Send>>, Error>> + Send + 'async_trait>>
where 'life0: 'async_trait, 'life1: 'async_trait, Bitget: 'async_trait,

Watch order book updates Read more
Source§

fn watch_trades<'life0, 'life1, 'async_trait>( &'life0 self, symbol: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<Pin<Box<dyn Stream<Item = Result<Vec<Trade>, Error>> + Send>>, Error>> + Send + 'async_trait>>
where 'life0: 'async_trait, 'life1: 'async_trait, Bitget: 'async_trait,

Watch public trades Read more
Source§

fn watch_ohlcv<'life0, 'life1, 'async_trait>( &'life0 self, _symbol: &'life1 str, _timeframe: Timeframe, ) -> Pin<Box<dyn Future<Output = Result<Pin<Box<dyn Stream<Item = Result<Ohlcv, Error>> + Send>>, Error>> + Send + 'async_trait>>
where 'life0: 'async_trait, 'life1: 'async_trait, Bitget: 'async_trait,

Watch OHLCV candlestick updates Read more
Source§

fn watch_balance<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<Pin<Box<dyn Stream<Item = Result<Balance, Error>> + Send>>, Error>> + Send + 'async_trait>>
where 'life0: 'async_trait, Bitget: 'async_trait,

Watch account balance updates Read more
Source§

fn watch_orders<'life0, 'life1, 'async_trait>( &'life0 self, _symbol: Option<&'life1 str>, ) -> Pin<Box<dyn Future<Output = Result<Pin<Box<dyn Stream<Item = Result<Order, Error>> + Send>>, Error>> + Send + 'async_trait>>
where 'life0: 'async_trait, 'life1: 'async_trait, Bitget: 'async_trait,

Watch order updates Read more
Source§

fn watch_my_trades<'life0, 'life1, 'async_trait>( &'life0 self, _symbol: Option<&'life1 str>, ) -> Pin<Box<dyn Future<Output = Result<Pin<Box<dyn Stream<Item = Result<Trade, Error>> + Send>>, Error>> + Send + 'async_trait>>
where 'life0: 'async_trait, 'life1: 'async_trait, Bitget: 'async_trait,

Watch user trade updates Read more
Source§

fn subscribe<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, _channel: &'life1 str, _symbol: Option<&'life2 str>, ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>
where 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, Bitget: 'async_trait,

Subscribe to a channel Read more
Source§

fn unsubscribe<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, _channel: &'life1 str, _symbol: Option<&'life2 str>, ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>
where 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, Bitget: 'async_trait,

Unsubscribe from a channel Read more
Source§

fn subscriptions(&self) -> Vec<String>

Get list of active subscriptions Read more

Auto Trait Implementations§

§

impl Freeze for Bitget

§

impl !RefUnwindSafe for Bitget

§

impl Send for Bitget

§

impl Sync for Bitget

§

impl Unpin for Bitget

§

impl !UnwindSafe for Bitget

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> ExchangeExt for T
where T: Exchange + ?Sized,

Source§

fn supports_market_data(&self) -> bool

Check if this exchange implements the MarketData trait. Read more
Source§

fn supports_trading(&self) -> bool

Check if this exchange implements the Trading trait. Read more
Source§

fn supports_account(&self) -> bool

Check if this exchange implements the Account trait. Read more
Source§

fn supports_margin(&self) -> bool

Check if this exchange implements the Margin trait. Read more
Source§

fn supports_funding(&self) -> bool

Check if this exchange implements the Funding trait. Read more
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> PolicyExt for T
where T: ?Sized,

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
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
Source§

impl<T> FullExchange for T
where T: Exchange + WsExchange,