pub struct KrakenSpotRawHttpClient { /* private fields */ }Expand description
Raw HTTP client for low-level Kraken Spot API operations.
This client handles request/response operations with the Kraken Spot API, returning venue-specific response types. It does not parse to Nautilus domain types.
Implementations§
Source§impl KrakenSpotRawHttpClient
impl KrakenSpotRawHttpClient
Sourcepub fn new(
environment: KrakenEnvironment,
base_url_override: Option<String>,
timeout_secs: Option<u64>,
max_retries: Option<u32>,
retry_delay_ms: Option<u64>,
retry_delay_max_ms: Option<u64>,
proxy_url: Option<String>,
max_requests_per_second: Option<u32>,
) -> Result<Self>
pub fn new( environment: KrakenEnvironment, base_url_override: Option<String>, timeout_secs: Option<u64>, max_retries: Option<u32>, retry_delay_ms: Option<u64>, retry_delay_max_ms: Option<u64>, proxy_url: Option<String>, max_requests_per_second: Option<u32>, ) -> Result<Self>
Creates a new KrakenSpotRawHttpClient.
Sourcepub fn with_credentials(
api_key: String,
api_secret: String,
environment: KrakenEnvironment,
base_url_override: Option<String>,
timeout_secs: Option<u64>,
max_retries: Option<u32>,
retry_delay_ms: Option<u64>,
retry_delay_max_ms: Option<u64>,
proxy_url: Option<String>,
max_requests_per_second: Option<u32>,
) -> Result<Self>
pub fn with_credentials( api_key: String, api_secret: String, environment: KrakenEnvironment, base_url_override: Option<String>, timeout_secs: Option<u64>, max_retries: Option<u32>, retry_delay_ms: Option<u64>, retry_delay_max_ms: Option<u64>, proxy_url: Option<String>, max_requests_per_second: Option<u32>, ) -> Result<Self>
Creates a new KrakenSpotRawHttpClient with credentials.
Sourcepub fn credential(&self) -> Option<&KrakenCredential>
pub fn credential(&self) -> Option<&KrakenCredential>
Returns the credential for this client, if set.
Sourcepub fn cancel_all_requests(&self)
pub fn cancel_all_requests(&self)
Cancels all pending HTTP requests.
Sourcepub fn cancellation_token(&self) -> &CancellationToken
pub fn cancellation_token(&self) -> &CancellationToken
Returns the cancellation token for this client.
Sourcepub async fn get_server_time(&self) -> Result<ServerTime, KrakenHttpError>
pub async fn get_server_time(&self) -> Result<ServerTime, KrakenHttpError>
Requests the server time from Kraken.
Sourcepub async fn get_system_status(&self) -> Result<SystemStatus, KrakenHttpError>
pub async fn get_system_status(&self) -> Result<SystemStatus, KrakenHttpError>
Requests the system status from Kraken.
Sourcepub async fn get_asset_pairs(
&self,
pairs: Option<Vec<String>>,
) -> Result<AssetPairsResponse, KrakenHttpError>
pub async fn get_asset_pairs( &self, pairs: Option<Vec<String>>, ) -> Result<AssetPairsResponse, KrakenHttpError>
Requests tradable asset pairs from Kraken.
Sourcepub async fn get_ticker(
&self,
pairs: Vec<String>,
) -> Result<TickerResponse, KrakenHttpError>
pub async fn get_ticker( &self, pairs: Vec<String>, ) -> Result<TickerResponse, KrakenHttpError>
Requests ticker information for asset pairs.
Sourcepub async fn get_ohlc(
&self,
pair: &str,
interval: Option<u32>,
since: Option<i64>,
) -> Result<OhlcResponse, KrakenHttpError>
pub async fn get_ohlc( &self, pair: &str, interval: Option<u32>, since: Option<i64>, ) -> Result<OhlcResponse, KrakenHttpError>
Requests OHLC candlestick data for an asset pair.
Sourcepub async fn get_book_depth(
&self,
pair: &str,
count: Option<u32>,
) -> Result<OrderBookResponse, KrakenHttpError>
pub async fn get_book_depth( &self, pair: &str, count: Option<u32>, ) -> Result<OrderBookResponse, KrakenHttpError>
Requests order book depth for an asset pair.
Sourcepub async fn get_trades(
&self,
pair: &str,
since: Option<String>,
) -> Result<TradesResponse, KrakenHttpError>
pub async fn get_trades( &self, pair: &str, since: Option<String>, ) -> Result<TradesResponse, KrakenHttpError>
Requests recent trades for an asset pair.
Sourcepub async fn get_websockets_token(
&self,
) -> Result<WebSocketToken, KrakenHttpError>
pub async fn get_websockets_token( &self, ) -> Result<WebSocketToken, KrakenHttpError>
Requests an authentication token for WebSocket connections.
Sourcepub async fn get_open_orders(
&self,
trades: Option<bool>,
userref: Option<i64>,
) -> Result<IndexMap<String, SpotOrder>, KrakenHttpError>
pub async fn get_open_orders( &self, trades: Option<bool>, userref: Option<i64>, ) -> Result<IndexMap<String, SpotOrder>, KrakenHttpError>
Requests all open orders (requires authentication).
Sourcepub async fn get_closed_orders(
&self,
trades: Option<bool>,
userref: Option<i64>,
start: Option<i64>,
end: Option<i64>,
ofs: Option<i32>,
closetime: Option<String>,
) -> Result<IndexMap<String, SpotOrder>, KrakenHttpError>
pub async fn get_closed_orders( &self, trades: Option<bool>, userref: Option<i64>, start: Option<i64>, end: Option<i64>, ofs: Option<i32>, closetime: Option<String>, ) -> Result<IndexMap<String, SpotOrder>, KrakenHttpError>
Requests closed orders history (requires authentication).
Sourcepub async fn get_trades_history(
&self,
trade_type: Option<String>,
trades: Option<bool>,
start: Option<i64>,
end: Option<i64>,
ofs: Option<i32>,
) -> Result<IndexMap<String, SpotTrade>, KrakenHttpError>
pub async fn get_trades_history( &self, trade_type: Option<String>, trades: Option<bool>, start: Option<i64>, end: Option<i64>, ofs: Option<i32>, ) -> Result<IndexMap<String, SpotTrade>, KrakenHttpError>
Requests trades history (requires authentication).
Sourcepub async fn add_order(
&self,
params: &KrakenSpotAddOrderParams,
) -> Result<SpotAddOrderResponse, KrakenHttpError>
pub async fn add_order( &self, params: &KrakenSpotAddOrderParams, ) -> Result<SpotAddOrderResponse, KrakenHttpError>
Submits a new order (requires authentication).
Sourcepub async fn cancel_order(
&self,
params: &KrakenSpotCancelOrderParams,
) -> Result<SpotCancelOrderResponse, KrakenHttpError>
pub async fn cancel_order( &self, params: &KrakenSpotCancelOrderParams, ) -> Result<SpotCancelOrderResponse, KrakenHttpError>
Cancels an open order (requires authentication).
Sourcepub async fn cancel_order_batch(
&self,
params: &KrakenSpotCancelOrderBatchParams,
) -> Result<SpotCancelOrderBatchResponse, KrakenHttpError>
pub async fn cancel_order_batch( &self, params: &KrakenSpotCancelOrderBatchParams, ) -> Result<SpotCancelOrderBatchResponse, KrakenHttpError>
Cancels multiple orders in a single batch request (max 50 orders).
Sourcepub async fn cancel_all_orders(
&self,
) -> Result<SpotCancelOrderResponse, KrakenHttpError>
pub async fn cancel_all_orders( &self, ) -> Result<SpotCancelOrderResponse, KrakenHttpError>
Cancels all open orders (requires authentication).
Sourcepub async fn edit_order(
&self,
params: &KrakenSpotEditOrderParams,
) -> Result<SpotEditOrderResponse, KrakenHttpError>
pub async fn edit_order( &self, params: &KrakenSpotEditOrderParams, ) -> Result<SpotEditOrderResponse, KrakenHttpError>
Edits an existing order (cancel and replace).
Sourcepub async fn amend_order(
&self,
params: &KrakenSpotAmendOrderParams,
) -> Result<SpotAmendOrderResponse, KrakenHttpError>
pub async fn amend_order( &self, params: &KrakenSpotAmendOrderParams, ) -> Result<SpotAmendOrderResponse, KrakenHttpError>
Amends an existing order in-place (no cancel/replace).
Sourcepub async fn get_balance(&self) -> Result<BalanceResponse, KrakenHttpError>
pub async fn get_balance(&self) -> Result<BalanceResponse, KrakenHttpError>
Requests account balances (requires authentication).
Trait Implementations§
Source§impl Debug for KrakenSpotRawHttpClient
impl Debug for KrakenSpotRawHttpClient
Auto Trait Implementations§
impl !Freeze for KrakenSpotRawHttpClient
impl !RefUnwindSafe for KrakenSpotRawHttpClient
impl Send for KrakenSpotRawHttpClient
impl Sync for KrakenSpotRawHttpClient
impl Unpin for KrakenSpotRawHttpClient
impl !UnwindSafe for KrakenSpotRawHttpClient
Blanket Implementations§
§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more