Skip to content

Trading

public class STXOrderService
{
// Place a single order
Task<STXConfirmedOrder> ConfirmOrderAsync(
int price,
int quantity,
string marketId,
STXOrderAction action,
STXOrderType orderType,
string clientOrderId = null,
bool cancelOnDisconnect = true);
// Place many orders
Task<List<STXConfirmedOrder>> ConfirmOrdersAsync(
IEnumerable<STXConfirmOrderParams> confirmOrderParams);
// Cancel
Task<string> CancelOrderAsync(string orderId);
Task<List<STXCancelOrder>> CancelOrdersAsync(IEnumerable<string> orderIds);
Task<List<STXCancelOrder>> CancelAllOrdersAsync();
// History
Task<STXMyOrderHistory> GetMyOrdersAsync(
IEnumerable<STXOrderStatus> statusFilter = null,
IEnumerable<string> marketIds = null,
int? limit = null,
int? offset = null,
STXOrdersSortByField? sortBy = null,
STXSortOrder? sortOrder = null);
}

For the batch variant:

public class STXConfirmOrderParams
{
public int Price { get; set; }
public int Quantity { get; set; }
public string MarketId { get; set; }
public STXOrderAction Action { get; set; }
public STXOrderType OrderType { get; set; }
public string ClientOrderId { get; set; }
public bool CancelOnDisconnect { get; set; } = true;
public STXOrderExpiration? Expiration { get; set; }
public long? ExpirationTime { get; set; } // UNIX microseconds for GOOD_TILL_TIME
}
Enum Values
STXOrderAction buy, sell
STXOrderType limit, market
STXOrderStatus created, requested, accepted, open, filled, cancelled, rejected, partially_cancelled, delayed
STXOrderExpiration GOOD_TILL_START, GOOD_TILL_TIME
STXOrdersSortByField insertedAt, price, quantity, marketId, …
STXSortOrder asc, desc
public class STXTradeService
{
Task<STXMyTradeHistory> GetMyTradesAsync(
IEnumerable<string> marketIds = null,
int? limit = null,
int? offset = null,
STXTradesSortByField? sortBy = null,
STXSortOrder? sortOrder = null);
Task<List<STXTrade>> GetMyTradesForOrderAsync(string orderId);
}
Channel Events
STXActiveOrdersChannel SetOnReceiveAction fires on every order state transition. IsChannelConnectedAndUseCancelOnDisconnect reports whether ConfirmOrderAsync(cancelOnDisconnect: true) is allowed.
STXActiveTradesChannel OnTrade: fires on every new fill
_activeOrders.SetOnReceiveAction(update =>
{
foreach (var order in update.Orders)
{
// order.Id, order.Status, order.Filled, order.AvgPrice, ...
}
});
await _activeOrders.StartAsync();
  • STXCancelOnDisconnectNotEnabledException: thrown by ConfirmOrderAsync / ConfirmOrdersAsync if cancelOnDisconnect: true and the active orders channel isn’t joined.
  • STXTokenExpiredException: refresh the token, then retry.

Full list: Errors & retries.

Task-oriented examples: Trading.

v1.5.9Changelogllms.txtllms-full.txt