pub trait Funding: PublicExchange {
// Required methods
fn fetch_deposit_address<'life0, 'life1, 'async_trait>(
&'life0 self,
code: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<DepositAddress>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
fn fetch_deposit_address_on_network<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
code: &'life1 str,
network: &'life2 str,
) -> Pin<Box<dyn Future<Output = Result<DepositAddress>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait;
fn withdraw<'life0, 'async_trait>(
&'life0 self,
params: WithdrawParams,
) -> Pin<Box<dyn Future<Output = Result<Transaction>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn transfer<'life0, 'async_trait>(
&'life0 self,
params: TransferParams,
) -> Pin<Box<dyn Future<Output = Result<Transfer>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn fetch_deposits<'life0, 'life1, 'async_trait>(
&'life0 self,
code: Option<&'life1 str>,
since: Option<i64>,
limit: Option<u32>,
) -> Pin<Box<dyn Future<Output = Result<Vec<Transaction>>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
fn fetch_withdrawals<'life0, 'life1, 'async_trait>(
&'life0 self,
code: Option<&'life1 str>,
since: Option<i64>,
limit: Option<u32>,
) -> Pin<Box<dyn Future<Output = Result<Vec<Transaction>>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
// Provided methods
fn fetch_deposits_u64<'life0, 'life1, 'async_trait>(
&'life0 self,
code: Option<&'life1 str>,
since: Option<u64>,
limit: Option<u32>,
) -> Pin<Box<dyn Future<Output = Result<Vec<Transaction>>> + Send + 'async_trait>>
where Self: Sync + 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait { ... }
fn fetch_withdrawals_u64<'life0, 'life1, 'async_trait>(
&'life0 self,
code: Option<&'life1 str>,
since: Option<u64>,
limit: Option<u32>,
) -> Pin<Box<dyn Future<Output = Result<Vec<Transaction>>> + Send + 'async_trait>>
where Self: Sync + 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait { ... }
}Expand description
Trait for deposit and withdrawal operations.
This trait provides methods for managing deposits, withdrawals, and inter-account transfers. All methods require authentication and are async.
§Timestamp Format
All timestamp parameters and fields in returned data structures use:
- Type:
i64 - Unit: Milliseconds since Unix epoch (January 1, 1970, 00:00:00 UTC)
- Example:
1609459200000represents January 1, 2021, 00:00:00 UTC
§Supertrait
Requires PublicExchange as a supertrait to access exchange metadata
and capabilities.
§Thread Safety
This trait requires Send + Sync bounds (inherited from PublicExchange)
to ensure safe usage across thread boundaries in async contexts.
Required Methods§
Sourcefn fetch_deposit_address<'life0, 'life1, 'async_trait>(
&'life0 self,
code: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<DepositAddress>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn fetch_deposit_address<'life0, 'life1, 'async_trait>(
&'life0 self,
code: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<DepositAddress>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Sourcefn fetch_deposit_address_on_network<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
code: &'life1 str,
network: &'life2 str,
) -> Pin<Box<dyn Future<Output = Result<DepositAddress>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn fetch_deposit_address_on_network<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
code: &'life1 str,
network: &'life2 str,
) -> Pin<Box<dyn Future<Output = Result<DepositAddress>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Sourcefn withdraw<'life0, 'async_trait>(
&'life0 self,
params: WithdrawParams,
) -> Pin<Box<dyn Future<Output = Result<Transaction>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn withdraw<'life0, 'async_trait>(
&'life0 self,
params: WithdrawParams,
) -> Pin<Box<dyn Future<Output = Result<Transaction>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Withdraw funds to an external address.
§Arguments
params- Withdrawal parameters including currency, amount, address, and optional network
§Example
use ccxt_core::types::params::WithdrawParams;
use rust_decimal_macros::dec;
let tx = exchange.withdraw(
WithdrawParams::new("USDT", dec!(100), "TAddress...")
.network("TRC20")
).await?;
println!("Withdrawal ID: {}", tx.id);Sourcefn transfer<'life0, 'async_trait>(
&'life0 self,
params: TransferParams,
) -> Pin<Box<dyn Future<Output = Result<Transfer>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn transfer<'life0, 'async_trait>(
&'life0 self,
params: TransferParams,
) -> Pin<Box<dyn Future<Output = Result<Transfer>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Transfer funds between accounts.
§Arguments
params- Transfer parameters including currency, amount, source and destination accounts
§Example
use ccxt_core::types::params::TransferParams;
use rust_decimal_macros::dec;
// Transfer USDT from spot to futures
let transfer = exchange.transfer(
TransferParams::spot_to_futures("USDT", dec!(1000))
).await?;Sourcefn fetch_deposits<'life0, 'life1, 'async_trait>(
&'life0 self,
code: Option<&'life1 str>,
since: Option<i64>,
limit: Option<u32>,
) -> Pin<Box<dyn Future<Output = Result<Vec<Transaction>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn fetch_deposits<'life0, 'life1, 'async_trait>(
&'life0 self,
code: Option<&'life1 str>,
since: Option<i64>,
limit: Option<u32>,
) -> Pin<Box<dyn Future<Output = Result<Vec<Transaction>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Fetch deposit history.
§Arguments
code- Optional currency code to filter by (e.g., “USDT”, “BTC”)since- Optional start timestamp in milliseconds (i64) since Unix epochlimit- Optional maximum number of records to return
§Timestamp Format
The since parameter uses i64 milliseconds since Unix epoch:
1609459200000= January 1, 2021, 00:00:00 UTCchrono::Utc::now().timestamp_millis()= Current timechrono::Utc::now().timestamp_millis() - 2592000000= 30 days ago
§Example
// All deposits (no filters)
let deposits = exchange.fetch_deposits(None, None, None).await?;
// USDT deposits from the last 30 days
let since = chrono::Utc::now().timestamp_millis() - 2592000000;
let deposits = exchange.fetch_deposits(Some("USDT"), Some(since), Some(100)).await?;Sourcefn fetch_withdrawals<'life0, 'life1, 'async_trait>(
&'life0 self,
code: Option<&'life1 str>,
since: Option<i64>,
limit: Option<u32>,
) -> Pin<Box<dyn Future<Output = Result<Vec<Transaction>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn fetch_withdrawals<'life0, 'life1, 'async_trait>(
&'life0 self,
code: Option<&'life1 str>,
since: Option<i64>,
limit: Option<u32>,
) -> Pin<Box<dyn Future<Output = Result<Vec<Transaction>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Fetch withdrawal history.
§Arguments
code- Optional currency code to filter by (e.g., “BTC”, “ETH”)since- Optional start timestamp in milliseconds (i64) since Unix epochlimit- Optional maximum number of records to return
§Timestamp Format
The since parameter uses i64 milliseconds since Unix epoch:
1609459200000= January 1, 2021, 00:00:00 UTCchrono::Utc::now().timestamp_millis()= Current timechrono::Utc::now().timestamp_millis() - 604800000= 7 days ago
§Example
// All withdrawals (no filters)
let withdrawals = exchange.fetch_withdrawals(None, None, None).await?;
// Recent BTC withdrawals from the last 7 days
let since = chrono::Utc::now().timestamp_millis() - 604800000;
let withdrawals = exchange.fetch_withdrawals(Some("BTC"), Some(since), Some(50)).await?;Provided Methods§
Sourcefn fetch_deposits_u64<'life0, 'life1, 'async_trait>(
&'life0 self,
code: Option<&'life1 str>,
since: Option<u64>,
limit: Option<u32>,
) -> Pin<Box<dyn Future<Output = Result<Vec<Transaction>>> + Send + 'async_trait>>where
Self: Sync + 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
👎Deprecated since 0.1.0: Use fetch_deposits with i64 timestamps. Convert using TimestampUtils::u64_to_i64()
fn fetch_deposits_u64<'life0, 'life1, 'async_trait>(
&'life0 self,
code: Option<&'life1 str>,
since: Option<u64>,
limit: Option<u32>,
) -> Pin<Box<dyn Future<Output = Result<Vec<Transaction>>> + Send + 'async_trait>>where
Self: Sync + 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Fetch deposit history with u64 timestamp filtering (deprecated).
DEPRECATED: Use fetch_deposits with i64 timestamps instead.
This method is provided for backward compatibility during migration.
§Migration
// Old code (deprecated)
let deposits = exchange.fetch_deposits_u64(Some("USDT"), Some(1609459200000u64), Some(100)).await?;
// New code (recommended)
let deposits = exchange.fetch_deposits(Some("USDT"), Some(1609459200000i64), Some(100)).await?;Sourcefn fetch_withdrawals_u64<'life0, 'life1, 'async_trait>(
&'life0 self,
code: Option<&'life1 str>,
since: Option<u64>,
limit: Option<u32>,
) -> Pin<Box<dyn Future<Output = Result<Vec<Transaction>>> + Send + 'async_trait>>where
Self: Sync + 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
👎Deprecated since 0.1.0: Use fetch_withdrawals with i64 timestamps. Convert using TimestampUtils::u64_to_i64()
fn fetch_withdrawals_u64<'life0, 'life1, 'async_trait>(
&'life0 self,
code: Option<&'life1 str>,
since: Option<u64>,
limit: Option<u32>,
) -> Pin<Box<dyn Future<Output = Result<Vec<Transaction>>> + Send + 'async_trait>>where
Self: Sync + 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Fetch withdrawal history with u64 timestamp filtering (deprecated).
DEPRECATED: Use fetch_withdrawals with i64 timestamps instead.
This method is provided for backward compatibility during migration.
§Migration
// Old code (deprecated)
let withdrawals = exchange.fetch_withdrawals_u64(Some("BTC"), Some(1609459200000u64), Some(50)).await?;
// New code (recommended)
let withdrawals = exchange.fetch_withdrawals(Some("BTC"), Some(1609459200000i64), Some(50)).await?;