Connecting Venues
Sequence is non-custodial — every order carries the user's own venue API credentials. Storing creds is POST /v1/credentials/{venue}; the plaintext key never touches Sequence storage past the initial encryption call (HMAC-SHA256 with CREDENTIAL_ENCRYPTION_KEY pepper).
This guide covers connecting, listing, and disconnecting venues. For per-venue specifics (auth shape, RSA keypairs, EIP-712 signers), see the venue tables below.
Connect a venue
use sequence_sdk::VenueCredentials;
seq.connect_venue("binance", VenueCredentials {
api_key: "AK…".into(),
api_secret: "SK…".into(),
passphrase: None,
extra_json: None,
}).await?;VenueCredentials:
pub struct VenueCredentials {
pub api_key: String,
pub api_secret: String,
pub passphrase: Option<String>, // OKX, Coinbase Advanced, Crypto.com, Bitget
pub extra_json: Option<serde_json::Value>, // Polymarket signer, Hyperliquid vault, …
}Idempotent — subsequent calls overwrite. Returns Ok(()) on success, Err(SequenceError) on invalid credentials.
Per-venue auth shape
Most CEX venues take just api_key + api_secret. The tricky ones:
| Venue | api_key | api_secret | passphrase | extra_json |
|---|---|---|---|---|
| Binance, Coinbase legacy, Kraken, Bybit | key | secret | — | — |
| OKX, Coinbase Advanced, Crypto.com, Bitget | key | secret | passphrase | — |
| Kalshi | key ID (UUID) | full RSA PEM | — | — |
| Polymarket | "" | "" | — | {signer_private_key, proxy_address?, builder?} |
| Hyperliquid | agent-wallet address | agent-wallet private-key hex | vault address (optional) | — |
Kalshi — RSA keypair
PKCS#1 or PKCS#8 PEMs both work. Pass the full multiline PEM as api_secret.
seq.connect_venue("kalshi", VenueCredentials {
api_key: "dc9d0cd5-076a-4ea8-b406-1847279dac4b".into(),
api_secret: "-----BEGIN RSA PRIVATE KEY-----\nMIIE...\n-----END RSA PRIVATE KEY-----".into(),
passphrase: None,
extra_json: None,
}).await?;Polymarket — EIP-712 signer
Polymarket auth is not an API key — it's an EIP-712 signer. Pass empty strings for api_key/api_secret and put the signer key in extra_json. CLOB L2 credentials are auto-derived on first order.
seq.connect_venue("polymarket", VenueCredentials {
api_key: String::new(),
api_secret: String::new(),
passphrase: None,
extra_json: Some(serde_json::json!({
"signer_private_key": "0xabc…", // required
"proxy_address": "0xdef…", // optional
"builder": "0x…", // optional builder-code recipient
})),
}).await?;List connected venues
let venues = seq.venues().await?;
for v in venues {
println!("{:10} {}", v.venue, if v.connected { "✓" } else { "✗" });
}Returns Vec<ConnectedVenue { venue: String, connected: bool }>.
Disconnect a venue
Deletes stored credentials. The live edge keeps its existing WS subscriptions until the next reconnect — call this before rotating keys, not mid-session.
seq.disconnect_venue("kraken").await?;Edge connectivity status
If venues() shows a venue as connected: false, check whether the edge itself is reachable from CC:
let edges = seq.edges().await?; // free-form JSON