Skip to content

Quickstart

Create an API key on the exchange (see Authentication), save its private key as ~/.stx/stx-key.pem, and add a profile to ~/.stx/credentials:

[default]
region = us
env = demo
key_id = your-key-id
key_file = ~/.stx/stx-key.pem
dotnet new console -n StxQuickstart
cd StxQuickstart
dotnet add package STX.Sdk
using System.Globalization;
using STX.Sdk;
using STX.Sdk.Models;
using var client = new STXClient();
// 1. Who is this key?
var me = await client.GetMeAsync();
Console.WriteLine($"Key {me.KeyId} belongs to user {me.UserId} (scope {me.Scope})");
// 2. Markets: amounts are strings, exactly as the API sends them.
foreach (var m in await client.GetMarketsAsync(status: ["open"], trading: true, limit: 3))
Console.WriteLine($" {m.Symbol} bid {m.Bids?.FirstOrDefault()?.Price ?? "-"} offer {m.Offers?.LastOrDefault()?.Price ?? "-"}");
// 3. Balance.
var balance = await client.GetBalanceAsync();
Console.WriteLine($"Available balance: {balance.AvailableBalance}");
// 4. A 1-cent limit buy on a market whose event has not started, then cancel it.
Market? market = null;
await foreach (var m in client.GetAllMarketsAsync(status: ["open"], trading: true, sortBy: "event_start", sortDirection: "desc"))
{
if (m.EventStatus == "scheduled") { market = m; break; }
}
if (market is not null)
{
var order = await client.PlaceOrderAsync(market.MarketId!, STXOrderAction.Buy, STXOrderType.Limit, quantity: "1", price: "0.01");
Console.WriteLine($"Placed {order.Id} on {market.Symbol}: {order.Status} {order.Quantity} @ {order.Price}");
var cancelled = await client.CancelOrderAsync(order.Id!);
Console.WriteLine($"Cancelled: {cancelled.Status}");
}
dotnet run
Key e3f958aaee8d84e7de93053a2bc60f29 belongs to user bc2d4b34-5d21-4a2a-8af6-d1ad3846ac3f (scope read_write)
STXNHL-26OCT221900FLAPIT-GAMEFLA bid 0.4600 offer 0.5100
STXNBA-26OCT221900CLEPHI-GAMEPHI bid 0.4800 offer 0.5200
STXNCAAF-26OCT221900LIBKENN-GAMEKENN bid 0.4800 offer 0.5200
Available balance: 10019994.0700
Placed 49c15a69-791c-4480-8719-9b222e4e0a5a on STXNCAAF-26OCT272000SHSUMOST-GAMEMOST: accepted 1.00 @ 0.0100
Cancelled: cancelled

The example apps do the same and also stream the order book and your account.

STX is operated by XV Exchange, LLC, a Designated Contract Market regulated by the U.S. Commodity Futures Trading Commission (CFTC). Contracts traded on STX are cleared by XV Clearing, LLC, a CFTC-registered Derivatives Clearing Organization. Trading involves substantial risk of loss and may not be appropriate for everyone. Members risk losing the cost to enter any transaction, including fees. Consider whether trading is appropriate for you in light of your experience and financial resources. Nothing on this site is investment advice or a recommendation to trade. Past performance is not indicative of future results.

© 2026 STX. All rights reserved.llms.txtllms-full.txtView as Markdown
Docs version v1.10.5