kraken_async_rs::clients::kraken_client

Trait KrakenClient

Source
pub trait KrakenClient: Send + Sync {
Show 57 methods // Required methods fn new( secrets_provider: Box<Arc<Mutex<dyn SecretsProvider>>>, nonce_provider: Box<Arc<Mutex<dyn NonceProvider>>>, ) -> Self; fn new_with_url( secrets_provider: Box<Arc<Mutex<dyn SecretsProvider>>>, nonce_provider: Box<Arc<Mutex<dyn NonceProvider>>>, url: String, ) -> Self; fn new_with_tracing( secrets_provider: Box<Arc<Mutex<dyn SecretsProvider>>>, nonce_provider: Box<Arc<Mutex<dyn NonceProvider>>>, trace_inbound: bool, ) -> Self; fn set_user_agent(&mut self, user_agent: String) -> impl Future<Output = ()>; fn get_server_time( &mut self, ) -> impl Future<Output = Result<ResultErrorResponse<SystemTime>, ClientError>> + Send; fn get_system_status( &mut self, ) -> impl Future<Output = Result<ResultErrorResponse<SystemStatusInfo>, ClientError>>; fn get_asset_info( &mut self, request: &AssetInfoRequest, ) -> impl Future<Output = Result<ResultErrorResponse<HashMap<String, AssetInfo>>, ClientError>>; fn get_tradable_asset_pairs( &mut self, request: &TradableAssetPairsRequest, ) -> impl Future<Output = Result<ResultErrorResponse<HashMap<String, TradableAssetPair>>, ClientError>>; fn get_ticker_information( &mut self, request: &TickerRequest, ) -> impl Future<Output = Result<ResultErrorResponse<HashMap<String, RestTickerInfo>>, ClientError>>; fn get_ohlc( &mut self, request: &OHLCRequest, ) -> impl Future<Output = Result<ResultErrorResponse<OhlcResponse>, ClientError>>; fn get_orderbook( &mut self, request: &OrderbookRequest, ) -> impl Future<Output = Result<ResultErrorResponse<HashMap<String, Orderbook>>, ClientError>>; fn get_recent_trades( &mut self, request: &RecentTradesRequest, ) -> impl Future<Output = Result<ResultErrorResponse<RecentTrades>, ClientError>>; fn get_recent_spreads( &mut self, request: &RecentSpreadsRequest, ) -> impl Future<Output = Result<ResultErrorResponse<RecentSpreads>, ClientError>>; fn get_account_balance( &mut self, ) -> impl Future<Output = Result<ResultErrorResponse<AccountBalances>, ClientError>>; fn get_extended_balances( &mut self, ) -> impl Future<Output = Result<ResultErrorResponse<ExtendedBalances>, ClientError>>; fn get_trade_balances( &mut self, request: &TradeBalanceRequest, ) -> impl Future<Output = Result<ResultErrorResponse<TradeBalances>, ClientError>>; fn get_open_orders( &mut self, request: &OpenOrdersRequest, ) -> impl Future<Output = Result<ResultErrorResponse<OpenOrders>, ClientError>>; fn get_closed_orders( &mut self, request: &ClosedOrdersRequest, ) -> impl Future<Output = Result<ResultErrorResponse<ClosedOrders>, ClientError>>; fn query_orders_info( &mut self, request: &OrderRequest, ) -> impl Future<Output = Result<ResultErrorResponse<HashMap<String, Order>>, ClientError>>; fn get_order_amends( &mut self, request: &OrderAmendsRequest, ) -> impl Future<Output = Result<ResultErrorResponse<OrderAmends>, ClientError>>; fn get_trades_history( &mut self, request: &TradesHistoryRequest, ) -> impl Future<Output = Result<ResultErrorResponse<TradesHistory>, ClientError>>; fn query_trades_info( &mut self, request: &TradeInfoRequest, ) -> impl Future<Output = Result<ResultErrorResponse<TradesInfo>, ClientError>>; fn get_open_positions( &mut self, request: &OpenPositionsRequest, ) -> impl Future<Output = Result<ResultErrorResponse<OpenPositions>, ClientError>>; fn get_ledgers_info( &mut self, request: &LedgersInfoRequest, ) -> impl Future<Output = Result<ResultErrorResponse<LedgerInfo>, ClientError>>; fn query_ledgers( &mut self, request: &QueryLedgerRequest, ) -> impl Future<Output = Result<ResultErrorResponse<QueryLedgerInfo>, ClientError>>; fn get_trade_volume( &mut self, request: &TradeVolumeRequest, ) -> impl Future<Output = Result<ResultErrorResponse<TradeVolume>, ClientError>>; fn request_export_report( &mut self, request: &ExportReportRequest, ) -> impl Future<Output = Result<ResultErrorResponse<ExportReport>, ClientError>>; fn get_export_report_status( &mut self, request: &ExportReportStatusRequest, ) -> impl Future<Output = Result<ResultErrorResponse<Vec<ExportReportStatus>>, ClientError>>; fn retrieve_export_report( &mut self, request: &RetrieveExportReportRequest, ) -> impl Future<Output = Result<Vec<u8>, ClientError>>; fn delete_export_report( &mut self, request: &DeleteExportRequest, ) -> impl Future<Output = Result<ResultErrorResponse<DeleteExportReport>, ClientError>>; fn add_order( &mut self, request: &AddOrderRequest, ) -> impl Future<Output = Result<ResultErrorResponse<AddOrder>, ClientError>>; fn add_order_batch( &mut self, request: &AddBatchedOrderRequest, ) -> impl Future<Output = Result<ResultErrorResponse<AddOrderBatch>, ClientError>>; fn amend_order( &mut self, request: &AmendOrderRequest, ) -> impl Future<Output = Result<ResultErrorResponse<AmendOrder>, ClientError>>; fn edit_order( &mut self, request: &EditOrderRequest, ) -> impl Future<Output = Result<ResultErrorResponse<OrderEdit>, ClientError>>; fn cancel_order( &mut self, request: &CancelOrderRequest, ) -> impl Future<Output = Result<ResultErrorResponse<CancelOrder>, ClientError>>; fn cancel_all_orders( &mut self, ) -> impl Future<Output = Result<ResultErrorResponse<CancelOrder>, ClientError>>; fn cancel_all_orders_after( &mut self, request: &CancelAllOrdersAfterRequest, ) -> impl Future<Output = Result<ResultErrorResponse<CancelAllOrdersAfter>, ClientError>>; fn cancel_order_batch( &mut self, request: &CancelBatchOrdersRequest, ) -> impl Future<Output = Result<ResultErrorResponse<CancelOrder>, ClientError>>; fn get_deposit_methods( &mut self, request: &DepositMethodsRequest, ) -> impl Future<Output = Result<ResultErrorResponse<Vec<DepositMethod>>, ClientError>>; fn get_deposit_addresses( &mut self, request: &DepositAddressesRequest, ) -> impl Future<Output = Result<ResultErrorResponse<Vec<DepositAddress>>, ClientError>>; fn get_status_of_recent_deposits( &mut self, request: &StatusOfDepositWithdrawRequest, ) -> impl Future<Output = Result<ResultErrorResponse<DepositWithdrawResponse>, ClientError>>; fn get_withdrawal_methods( &mut self, request: &WithdrawalMethodsRequest, ) -> impl Future<Output = Result<ResultErrorResponse<Vec<WithdrawMethod>>, ClientError>>; fn get_withdrawal_addresses( &mut self, request: &WithdrawalAddressesRequest, ) -> impl Future<Output = Result<ResultErrorResponse<Vec<WithdrawalAddress>>, ClientError>>; fn get_withdrawal_info( &mut self, request: &WithdrawalInfoRequest, ) -> impl Future<Output = Result<ResultErrorResponse<Withdrawal>, ClientError>>; fn withdraw_funds( &mut self, request: &WithdrawFundsRequest, ) -> impl Future<Output = Result<ResultErrorResponse<ConfirmationRefId>, ClientError>>; fn get_status_of_recent_withdrawals( &mut self, request: &StatusOfDepositWithdrawRequest, ) -> impl Future<Output = Result<ResultErrorResponse<Vec<DepositWithdrawal>>, ClientError>>; fn request_withdrawal_cancellation( &mut self, request: &WithdrawCancelRequest, ) -> impl Future<Output = Result<ResultErrorResponse<bool>, ClientError>>; fn request_wallet_transfer( &mut self, request: &WalletTransferRequest, ) -> impl Future<Output = Result<ResultErrorResponse<ConfirmationRefId>, ClientError>>; fn create_sub_account( &mut self, request: &CreateSubAccountRequest, ) -> impl Future<Output = Result<ResultErrorResponse<bool>, ClientError>>; fn account_transfer( &mut self, request: &AccountTransferRequest, ) -> impl Future<Output = Result<ResultErrorResponse<AccountTransfer>, ClientError>>; fn allocate_earn_funds( &mut self, request: &AllocateEarnFundsRequest, ) -> impl Future<Output = Result<ResultErrorResponse<bool>, ClientError>>; fn deallocate_earn_funds( &mut self, request: &AllocateEarnFundsRequest, ) -> impl Future<Output = Result<ResultErrorResponse<bool>, ClientError>>; fn get_earn_allocation_status( &mut self, request: &EarnAllocationStatusRequest, ) -> impl Future<Output = Result<ResultErrorResponse<AllocationStatus>, ClientError>>; fn get_earn_deallocation_status( &mut self, request: &EarnAllocationStatusRequest, ) -> impl Future<Output = Result<ResultErrorResponse<AllocationStatus>, ClientError>>; fn list_earn_strategies( &mut self, request: &ListEarnStrategiesRequest, ) -> impl Future<Output = Result<ResultErrorResponse<EarnStrategies>, ClientError>>; fn list_earn_allocations( &mut self, request: &ListEarnAllocationsRequest, ) -> impl Future<Output = Result<ResultErrorResponse<EarnAllocations>, ClientError>>; fn get_websockets_token( &mut self, ) -> impl Future<Output = Result<ResultErrorResponse<WebsocketToken>, ClientError>>;
}
Expand description

The common trait shared by implementations like CoreKrakenClient and RateLimitedKrakenClient

Required Methods§

Source

fn new( secrets_provider: Box<Arc<Mutex<dyn SecretsProvider>>>, nonce_provider: Box<Arc<Mutex<dyn NonceProvider>>>, ) -> Self

Creates a new instance with the given SecretsProvider and NonceProvider.

Source

fn new_with_url( secrets_provider: Box<Arc<Mutex<dyn SecretsProvider>>>, nonce_provider: Box<Arc<Mutex<dyn NonceProvider>>>, url: String, ) -> Self

Creates a new instance, allowing a specific URL to be set.

Useful if using a proxy, testing with a mock-server, or if the URL changes from the default used in this library.

Source

fn new_with_tracing( secrets_provider: Box<Arc<Mutex<dyn SecretsProvider>>>, nonce_provider: Box<Arc<Mutex<dyn NonceProvider>>>, trace_inbound: bool, ) -> Self

Creates a new instance with the given SecretsProvider and NonceProvider, optionally enabling tracing for inbound messages.

Source

fn set_user_agent(&mut self, user_agent: String) -> impl Future<Output = ()>

Set the user-agent that will be sent in HTTP headers to Kraken. This is not required to be set.

Source

fn get_server_time( &mut self, ) -> impl Future<Output = Result<ResultErrorResponse<SystemTime>, ClientError>> + Send

Get the server time in two useful formats.

Source

fn get_system_status( &mut self, ) -> impl Future<Output = Result<ResultErrorResponse<SystemStatusInfo>, ClientError>>

Get the status of the system, including the current server time.

Source

fn get_asset_info( &mut self, request: &AssetInfoRequest, ) -> impl Future<Output = Result<ResultErrorResponse<HashMap<String, AssetInfo>>, ClientError>>

Get info about a particular asset, e.g. “XBT” or “ETH”.

Source

fn get_tradable_asset_pairs( &mut self, request: &TradableAssetPairsRequest, ) -> impl Future<Output = Result<ResultErrorResponse<HashMap<String, TradableAssetPair>>, ClientError>>

Get info about tradable asset pairs, such as USDCUSD, BTCUSD, or XETHZUSD.

Returns all the information needed to place correctly formatted order volumes, prices, and pairs.

Source

fn get_ticker_information( &mut self, request: &TickerRequest, ) -> impl Future<Output = Result<ResultErrorResponse<HashMap<String, RestTickerInfo>>, ClientError>>

Return some or all ticker data, including the most recent bid, ask, price, and last-24h stats for each requested pair.

Source

fn get_ohlc( &mut self, request: &OHLCRequest, ) -> impl Future<Output = Result<ResultErrorResponse<OhlcResponse>, ClientError>>

Retrieve up to the last 720 OHLC candlesticks for a given pair and interval.

The since request parameter allows for getting only data since some timestamp (the last response), but does not allow pagination.

Source

fn get_orderbook( &mut self, request: &OrderbookRequest, ) -> impl Future<Output = Result<ResultErrorResponse<HashMap<String, Orderbook>>, ClientError>>

Get a snapshot of the orderbook for the requested pair and depth-of-book.

Source

fn get_recent_trades( &mut self, request: &RecentTradesRequest, ) -> impl Future<Output = Result<ResultErrorResponse<RecentTrades>, ClientError>>

Retrieve up to 1000 trades at a time from the FULL history of Kraken’s exchange for the requested pair.

The since and count parameters allow complete pagination starting from the exchange’s first-ever trade in each pair.

See /examples/live_retrieving_recent_trades.rs for a full example of pagination with rate limiting.

Source

fn get_recent_spreads( &mut self, request: &RecentSpreadsRequest, ) -> impl Future<Output = Result<ResultErrorResponse<RecentSpreads>, ClientError>>

Get the last ~200 spread values for the requested pair.

The since parameter allows getting incremental updates, but does not paginate the request historically.

Source

fn get_account_balance( &mut self, ) -> impl Future<Output = Result<ResultErrorResponse<AccountBalances>, ClientError>>

Get the raw balances for your account, minus any pending withdrawals.

Source

fn get_extended_balances( &mut self, ) -> impl Future<Output = Result<ResultErrorResponse<ExtendedBalances>, ClientError>>

Get the extended balances for your account, which denotes the balance, any balance on hold, and lines of credit (if available on your account).

Source

fn get_trade_balances( &mut self, request: &TradeBalanceRequest, ) -> impl Future<Output = Result<ResultErrorResponse<TradeBalances>, ClientError>>

Get balances relevant for futures and margin trading, including equity and margin levels.

Source

fn get_open_orders( &mut self, request: &OpenOrdersRequest, ) -> impl Future<Output = Result<ResultErrorResponse<OpenOrders>, ClientError>>

Get all open orders for your account.

Source

fn get_closed_orders( &mut self, request: &ClosedOrdersRequest, ) -> impl Future<Output = Result<ResultErrorResponse<ClosedOrders>, ClientError>>

Get closed orders from the full history of your account, up to 50 at a time.

Pagination is done using the start, end, ofs (offset) parameters.

Source

fn query_orders_info( &mut self, request: &OrderRequest, ) -> impl Future<Output = Result<ResultErrorResponse<HashMap<String, Order>>, ClientError>>

Get the information for up to 50 orders at a time.

Source

fn get_order_amends( &mut self, request: &OrderAmendsRequest, ) -> impl Future<Output = Result<ResultErrorResponse<OrderAmends>, ClientError>>

Source

fn get_trades_history( &mut self, request: &TradesHistoryRequest, ) -> impl Future<Output = Result<ResultErrorResponse<TradesHistory>, ClientError>>

Get trades from the full history your account, up to 50 at a time.

Pagination is done using the start, end and ofs (offset) parameters.

Source

fn query_trades_info( &mut self, request: &TradeInfoRequest, ) -> impl Future<Output = Result<ResultErrorResponse<TradesInfo>, ClientError>>

Get trade details for up to 20 specific trades by id at a time.

Source

fn get_open_positions( &mut self, request: &OpenPositionsRequest, ) -> impl Future<Output = Result<ResultErrorResponse<OpenPositions>, ClientError>>

Get information about open margin positions.

Source

fn get_ledgers_info( &mut self, request: &LedgersInfoRequest, ) -> impl Future<Output = Result<ResultErrorResponse<LedgerInfo>, ClientError>>

Get ledger entries for the full history of your account, up to 50 at a time.

Pagination is done using the start, end, ofs (offset) parameters.

Source

fn query_ledgers( &mut self, request: &QueryLedgerRequest, ) -> impl Future<Output = Result<ResultErrorResponse<QueryLedgerInfo>, ClientError>>

Get ledger information for up to 20 ids at a time.

Source

fn get_trade_volume( &mut self, request: &TradeVolumeRequest, ) -> impl Future<Output = Result<ResultErrorResponse<TradeVolume>, ClientError>>

Get the 30-day trading volume for your account, and fee information for any pairs (if requested).

Source

fn request_export_report( &mut self, request: &ExportReportRequest, ) -> impl Future<Output = Result<ResultErrorResponse<ExportReport>, ClientError>>

Request a report for ledgers or trades to be generated asynchronously.

Source

fn get_export_report_status( &mut self, request: &ExportReportStatusRequest, ) -> impl Future<Output = Result<ResultErrorResponse<Vec<ExportReportStatus>>, ClientError>>

Get the status of a report that was requested.

Source

fn retrieve_export_report( &mut self, request: &RetrieveExportReportRequest, ) -> impl Future<Output = Result<Vec<u8>, ClientError>>

Retrieve an export report once generated.

Source

fn delete_export_report( &mut self, request: &DeleteExportRequest, ) -> impl Future<Output = Result<ResultErrorResponse<DeleteExportReport>, ClientError>>

Request for an export report to be deleted.

Source

fn add_order( &mut self, request: &AddOrderRequest, ) -> impl Future<Output = Result<ResultErrorResponse<AddOrder>, ClientError>>

Add an order of any type (market, limit, trailing stop, etc).

Source

fn add_order_batch( &mut self, request: &AddBatchedOrderRequest, ) -> impl Future<Output = Result<ResultErrorResponse<AddOrderBatch>, ClientError>>

Add up to 15 orders for a single pair at once. Orders that fail to place are dropped from processing and will be returned with errors in the response’s Vec.

Source

fn amend_order( &mut self, request: &AmendOrderRequest, ) -> impl Future<Output = Result<ResultErrorResponse<AmendOrder>, ClientError>>

Source

fn edit_order( &mut self, request: &EditOrderRequest, ) -> impl Future<Output = Result<ResultErrorResponse<OrderEdit>, ClientError>>

Edit the volume or price of an existing order, excluding contingent orders like stop/profit orders.

Source

fn cancel_order( &mut self, request: &CancelOrderRequest, ) -> impl Future<Output = Result<ResultErrorResponse<CancelOrder>, ClientError>>

Cancel an existing order by ref-id or user-ref.

Source

fn cancel_all_orders( &mut self, ) -> impl Future<Output = Result<ResultErrorResponse<CancelOrder>, ClientError>>

Cancel all active orders.

Source

fn cancel_all_orders_after( &mut self, request: &CancelAllOrdersAfterRequest, ) -> impl Future<Output = Result<ResultErrorResponse<CancelAllOrdersAfter>, ClientError>>

Submit a “Dead Man’s Switch” that will cancel all orders if not repeatedly updated over time.

Source

fn cancel_order_batch( &mut self, request: &CancelBatchOrdersRequest, ) -> impl Future<Output = Result<ResultErrorResponse<CancelOrder>, ClientError>>

Cancel up to 50 orders in a batch by id or user-ref.

Source

fn get_deposit_methods( &mut self, request: &DepositMethodsRequest, ) -> impl Future<Output = Result<ResultErrorResponse<Vec<DepositMethod>>, ClientError>>

Get all methods of depositing a specific asset.

Source

fn get_deposit_addresses( &mut self, request: &DepositAddressesRequest, ) -> impl Future<Output = Result<ResultErrorResponse<Vec<DepositAddress>>, ClientError>>

Get all available addresses for a given asset and method.

Source

fn get_status_of_recent_deposits( &mut self, request: &StatusOfDepositWithdrawRequest, ) -> impl Future<Output = Result<ResultErrorResponse<DepositWithdrawResponse>, ClientError>>

Get the status of recent deposits.

Pagination is done using the start, end, cursor and limit parameters.

Source

fn get_withdrawal_methods( &mut self, request: &WithdrawalMethodsRequest, ) -> impl Future<Output = Result<ResultErrorResponse<Vec<WithdrawMethod>>, ClientError>>

Get all withdrawal methods, optionally for a given asset.

Source

fn get_withdrawal_addresses( &mut self, request: &WithdrawalAddressesRequest, ) -> impl Future<Output = Result<ResultErrorResponse<Vec<WithdrawalAddress>>, ClientError>>

Get all withdrawal addresses, optionally for a specific asset or method.

Source

fn get_withdrawal_info( &mut self, request: &WithdrawalInfoRequest, ) -> impl Future<Output = Result<ResultErrorResponse<Withdrawal>, ClientError>>

Get details about a particular withdrawal.

Source

fn withdraw_funds( &mut self, request: &WithdrawFundsRequest, ) -> impl Future<Output = Result<ResultErrorResponse<ConfirmationRefId>, ClientError>>

Request a withdrawal for the provided asset and key.

Source

fn get_status_of_recent_withdrawals( &mut self, request: &StatusOfDepositWithdrawRequest, ) -> impl Future<Output = Result<ResultErrorResponse<Vec<DepositWithdrawal>>, ClientError>>

Get the status of recent withdrawals.

Pagination is done using the start, end, cursor and limit parameters.

Source

fn request_withdrawal_cancellation( &mut self, request: &WithdrawCancelRequest, ) -> impl Future<Output = Result<ResultErrorResponse<bool>, ClientError>>

Request to cancel a particular withdrawal if it has not been fully processed.

Source

fn request_wallet_transfer( &mut self, request: &WalletTransferRequest, ) -> impl Future<Output = Result<ResultErrorResponse<ConfirmationRefId>, ClientError>>

Request to transfer from the default Spot wallet to a Futures wallet if available.

Source

fn create_sub_account( &mut self, request: &CreateSubAccountRequest, ) -> impl Future<Output = Result<ResultErrorResponse<bool>, ClientError>>

Create a linked sub-account for the given username and email (Institutional Clients only).

Source

fn account_transfer( &mut self, request: &AccountTransferRequest, ) -> impl Future<Output = Result<ResultErrorResponse<AccountTransfer>, ClientError>>

Request to transfer a given asset between sub-accounts (Institutional Clients only).

Source

fn allocate_earn_funds( &mut self, request: &AllocateEarnFundsRequest, ) -> impl Future<Output = Result<ResultErrorResponse<bool>, ClientError>>

Allocate available funds to a given earn strategy.

Source

fn deallocate_earn_funds( &mut self, request: &AllocateEarnFundsRequest, ) -> impl Future<Output = Result<ResultErrorResponse<bool>, ClientError>>

De-allocate funds from a given earn strategy.

Source

fn get_earn_allocation_status( &mut self, request: &EarnAllocationStatusRequest, ) -> impl Future<Output = Result<ResultErrorResponse<AllocationStatus>, ClientError>>

Get the status for the only pending earn allocation request if there is one.

Source

fn get_earn_deallocation_status( &mut self, request: &EarnAllocationStatusRequest, ) -> impl Future<Output = Result<ResultErrorResponse<AllocationStatus>, ClientError>>

Get the status for the only pending earn de-allocation if there is one.

Source

fn list_earn_strategies( &mut self, request: &ListEarnStrategiesRequest, ) -> impl Future<Output = Result<ResultErrorResponse<EarnStrategies>, ClientError>>

List all earn strategies.

Pagination is supported through the cursor and limit parameters.

Source

fn list_earn_allocations( &mut self, request: &ListEarnAllocationsRequest, ) -> impl Future<Output = Result<ResultErrorResponse<EarnAllocations>, ClientError>>

List all current earn allocations.

Source

fn get_websockets_token( &mut self, ) -> impl Future<Output = Result<ResultErrorResponse<WebsocketToken>, ClientError>>

Get a token for connecting to private websockets.

Tokens are valid for 15 minutes for their first use, but do not require being refreshed once a connection is established.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§