Nexus/API Reference/Account and capabilities

A live stream of your own fills, orders, trades and accounts

GEThttps://app.skylit.ai/api/nexus/v1/trading/stream

Open one stream and Nexus pushes your own changes the moment they happen, so your bot stops asking "did it fill yet?". It's Server-Sent Events (text/event-stream): one long response with an event per change. Run it from your bot: a browser's EventSource can't send your key in a header, and your key shouldn't be in a browser anyway.

  • Same key, same checks as every route. Opening it counts as one read. Events and heartbeats don't.
  • Only yours. Nobody else's trades ever show up. Your agent account's events come only to you. Test orders never show up: they aren't trades. Futures events only come if your account has futures.
  • No market data. Quotes aren't in it.
EventWhendata
connectedOnce, first (no id)account, resumed, futures, heartbeatSeconds
resyncFirst thing on a new connection, and any time the server lost track{reason}. Re-read your state with the REST routes
tradeAn options or stock trade was opened, added to, trimmed, closed or expiredchange, book, at, fill (quantity, price; id only when known, left out today), trade (as GET /api/nexus/v1/trades/{id} returns it)
orderA resting order changedchange, assetClass, book, order (as the order read returns it)
walletYour options and stocks cash or buying power movedbook, wallet (as the wallet read returns it)
accountA futures account changedbook, account (as the account read returns it)
heartbeatEvery 15 seconds (no id){at}
closedWe ended the stream. Fix the reason before you reconnect{reason}: invalid_api_key, account_suspended, nexus_access_denied or trades_api_disabled
reconnectThe server is restarting{reason: "server_restart"}. Reconnect right away

An order's change is working, held (a futures stop or target waiting for its entry), modified, triggered (a stop went off), partial_fill, filled, cancelled, rejected or expired. A trade's change is opened, added, trimmed, closed or expired. Orders you placed in Nexus show up too.

Dropped connections. Every data event has an id. Reconnect with the last one as Last-Event-ID. If the server you land on still has what you missed (your last 128 events, for 2 minutes after you drop), you get them and connected says "resumed": true. If not, the first event after connected is resync. So on resync, read your open trades, working orders, wallet and futures accounts again, then keep going.

Limits. 3 streams per key and 6 per account at once, past that 429 stream_limit_reached with Retry-After. A heartbeat comes every 15 seconds: hear nothing for 45 and the connection's dead, so reconnect. A revoked key's stream ends within about 2 minutes. capabilities has a stream block with these numbers.

Authorization

Authorization: Bearer <your API key>

Required. A missing header returns 401; an invalid, revoked or expired key returns 403.

Query parameters

  • accountstring

    main for your own trades and accounts, agent for your bot's. Leave it out (or send all) for both. Every event says which book it's on.

    mainagentall
  • lastEventIdstring

    The same as Last-Event-ID, for clients that can't set the header. The header wins if both are sent.

Headers

  • Last-Event-IDstring

    The id of the last event you got, to pick up where you left off after a drop.

Responses

  • 200

    The stream. It stays open until you close it or the server sends closed or reconnect.

  • 400

    The request was refused before anything was traded. Codes: bad_request, bad_contract, invalid_quantity, invalid_price, unsupported_asset_class, unsupported_order_type, only_market_orders, limit_price_required (a limit with no limitPrice), invalid_limit_price (not in cents, or outside 0.01 to 99,999.99 for options or 999,999.99 for stocks), stop_price_required (a stop with no stopPrice), invalid_stop_price (not in cents, or outside 0.01 to 999,999.99), invalid_take_profit, test_orders_unavailable, test_modify_unavailable.

  • 401

    No key, or a key that isn't valid. Codes: missing_api_key, invalid_api_key.

  • 403

    The key works but the account can't do this. Codes: account_suspended, nexus_access_denied, futures_access_denied.

  • 429

    Over a rate limit. Wait Retry-After seconds, then retry. Codes: rate_limited, and stream_limit_reached (too many live streams open: 3 per key, 6 per account).

  • 500

    Something went wrong on our side. If you sent a clientOrderId, retry with the same one. Code: internal_error.

  • 503

    Try again in a moment (honour Retry-After when it's sent). Codes: stale_quote (the quote, or a stock's last trade, is more than 15 seconds old, so nothing filled), no_live_price, rules_pending, unavailable, auth_unavailable, access_check_unavailable, api_keys_unavailable, trades_api_disabled, stream_unavailable (the live stream isn't on, or the server is restarting: try again shortly, or poll the reads).

Response fields

Returns string.

Last updated

Was this page helpful?