Table of Contents

Method CancelOrderAsync

Namespace
WhalesSecret.TradeScriptLib.API.TradingV1
Assembly
WhalesSecret.TradeScriptLib.dll

CancelOrderAsync(ILiveOrder, CancellationToken)

Sends a new cancel order request to an exchange.

Task CancelOrderAsync(ILiveOrder order, CancellationToken cancellationToken = default)

Parameters

order ILiveOrder

Order to cancel.

cancellationToken CancellationToken

Cancellation token that allows the caller to cancel the operation.

Returns

Task

A Task representing the asynchronous operation.

Remarks

Note that if the operation is canceled, the order might or might not be canceled on the exchange.

Exceptions

NotConnectedException

Thrown if the request could not be sent to the exchange.

NotFoundException

: Thrown if the order does not exist.

ExchangeResponseTimeoutException

Thrown if the exchange does not respond in timely manner.

InvalidExchangeResponseException

Thrown if the exchange responded with invalid response.

ExchangeIsUnderMaintenanceException

Thrown if the exchange is in the maintenance mode and does not accept new requests.

ApiRequestLimitReachedException

Thrown if the exchange rejected to cancel the order to an API rate limit.

MalfunctionException

Thrown if an internal unexpected error occurred.

InvalidArgumentException

Thrown if the order is null, or if the order has a different exchange market than the client.

OperationCanceledException

Thrown if the operation was cancelled, including cancellation during the shutdown.

NotConnectedTimeoutException

Thrown if the connection strategy associated with this instance is BlockUntilReconnectedOrTimeout with non-infinite timeout value and this timeout expired while the connection to the exchange is interrupted. That is, this exception does not limit the request itself, it rather limits the period of time that allows the client to recover from the interruption of the connection to the exchange.

OperationFailedException

Thrown if the request failed for an unknown reason with an unknown outcome.