# What this key can trade right now

`GET https://app.skylit.ai/api/nexus/v1/trading/capabilities`

API: Nexus.

The asset classes, order types, futures contracts and futures accounts this key can trade right now, plus your per-key limits. Call it when your bot starts, so it asks instead of guessing.

- `assetClasses` lists each asset class's order types. Options list `limit` when resting orders are on and `stop` when options stops are on. Stocks list `limit` and `stop` when stock resting orders are on.
- `optionsOrders` and `stocksOrders` describe the resting orders: time in force, what can be modified, the order routes and `maxWorkingOrders`. `optionsOrders.stops` describes options stop-losses.
- `adds` describes adding to a position. `agentAccount` and `wallets` describe your bot's agent account and the wallet read.

The futures block is there only when your account has futures paper trading. When it doesn't, the futures entry under `assetClasses` says why. The first call creates your futures practice account if you don't have one yet, as Nexus does when you open the futures ticket.

## Authentication

Send your Skylit API key as a bearer token: `Authorization: Bearer <key>`. No other header is accepted.

## Example request

```bash
curl "https://app.skylit.ai/api/nexus/v1/trading/capabilities" \
  -H "Authorization: Bearer $SKYLIT_API_KEY"
```

## Responses

### 200

What you can trade.

A member with futures, the market open, a practice account and one evaluation.:

```json
{
  "data": {
    "assetClasses": [
      {
        "assetClass": "options",
        "available": true,
        "orderTypes": [
          "market",
          "limit",
          "stop"
        ]
      },
      {
        "assetClass": "stocks",
        "available": true,
        "orderTypes": [
          "market",
          "limit",
          "stop"
        ]
      },
      {
        "assetClass": "futures",
        "available": true,
        "orderTypes": [
          "market",
          "limit",
          "stop",
          "stop_limit"
        ]
      }
    ],
    "orderTypes": [
      "market"
    ],
    "testOrders": true,
    "futures": {
      "marketOpen": true,
      "maxOrderQuantity": 100,
      "orderTypes": [
        "market",
        "limit",
        "stop",
        "stop_limit"
      ],
      "bracket": [
        "stopLoss",
        "takeProfit",
        "trailingStop"
      ],
      "modify": [
        "price",
        "quantity",
        "stopPrice"
      ],
      "list": "GET /api/nexus/v1/trades?assetClass=futures&account={account}",
      "contracts": [
        {
          "root": "NQ",
          "name": "E-mini Nasdaq-100",
          "symbol": "NQZ26",
          "tickSize": 0.25,
          "tickValueCents": 500,
          "pointValueCents": 2000,
          "commissionPerSideCents": 214,
          "livePrice": true
        },
        {
          "root": "MNQ",
          "name": "Micro E-mini Nasdaq-100",
          "symbol": "MNQZ26",
          "tickSize": 0.25,
          "tickValueCents": 50,
          "pointValueCents": 200,
          "commissionPerSideCents": 62,
          "livePrice": true
        }
      ],
      "accounts": [
        {
          "id": "3c2b1a90-5e4d-4f3a-8b2c-1d0e9f8a7b6c",
          "kind": "practice",
          "name": "Paper",
          "status": "active",
          "balanceCents": 5000000,
          "tradable": true,
          "allowed": [
            "read",
            "open",
            "reduce",
            "close",
            "limit",
            "stop",
            "stop_limit",
            "bracket",
            "cancel",
            "modify"
          ]
        },
        {
          "id": "8d7c6b5a-4e3f-4a2b-9c1d-0e1f2a3b4c5d",
          "kind": "evaluation",
          "name": "50K Evaluation",
          "status": "active",
          "balanceCents": 5012500,
          "tradable": true,
          "allowed": [
            "read",
            "open",
            "reduce",
            "close",
            "limit",
            "stop",
            "stop_limit",
            "bracket",
            "cancel",
            "modify"
          ]
        }
      ]
    },
    "limits": {
      "writesPerMinute": 30,
      "readsPerMinute": 120
    },
    "agentAccount": {
      "account": "agent",
      "assetClasses": [
        "options",
        "stocks",
        "futures"
      ],
      "public": false,
      "description": "Your bot's practice account. It trades on the same engine and rules as your simulated account, with its own simulated money (the same starting balance as yours), so your own account never moves. Nothing on it ever counts: no leaderboards, ranks, seasons, Guild Wars, profile stats, feed, copy trading, Discord, challenges or evaluations. Only you can see it.",
      "reads": [
        "GET /api/nexus/v1/trades?account=agent",
        "GET /api/nexus/v1/trading/wallets/agent",
        "GET /api/nexus/v1/trading/wallets/agent/orders/working",
        "GET /api/nexus/v1/trading/accounts/agent",
        "GET /api/nexus/v1/trades?assetClass=futures&account=agent"
      ],
      "futuresNote": "Your bot's futures account is made by its first futures order with \"account\": \"agent\". The futures reads answer after the first agent order; before it they answer 404 account_not_found."
    },
    "wallets": {
      "read": "GET /api/nexus/v1/trading/wallets/{book}",
      "books": [
        "main",
        "agent"
      ]
    },
    "quotes": {
      "read": "GET /api/nexus/v1/trading/quotes?symbols={OCC symbol},...",
      "symbolFormat": "OCC, like SPXW261016C07800000 (root, YYMMDD, C or P, strike x 1000 in 8 digits)",
      "maxSymbols": 20,
      "maxQuoteAgeSeconds": 15,
      "marks": "GET /api/nexus/v1/trades?status=open: each open trade carries mark (live price, bid, ask and P&L) and currentPrice"
    },
    "optionsOrders": {
      "orderTypes": [
        "limit"
      ],
      "timeInForce": [
        "day",
        "gtc"
      ],
      "open": "POST /api/nexus/v1/trades with \"orderType\": \"limit\" and limitPrice",
      "exit": "POST /api/nexus/v1/trades/{id}/exits with \"orderType\": \"limit\" and limitPrice",
      "modify": [
        "price",
        "quantity"
      ],
      "orders": [
        "GET /api/nexus/v1/trading/wallets/{book}/orders/working",
        "GET /api/nexus/v1/trading/wallets/{book}/orders/{orderId}",
        "POST /api/nexus/v1/trading/wallets/{book}/orders/{orderId}/cancel",
        "POST /api/nexus/v1/trading/wallets/{book}/orders/{orderId}/modify",
        "POST /api/nexus/v1/trading/wallets/{book}/orders/cancel"
      ],
      "maxWorkingOrders": 50,
      "stops": {
        "triggerOn": "underlying",
        "exit": "POST /api/nexus/v1/trades/{id}/exits with stopLoss and/or takeProfit (stock prices), or \"orderType\": \"stop\" and stopPrice",
        "fields": [
          "stopLoss",
          "takeProfit",
          "stopPrice",
          "quantity",
          "closeAll",
          "clientOrderId",
          "test"
        ],
        "fill": "a fired leg sells the covered contracts at the market, at the contract's live bid (quotes over 15 s old never fill; it retries)",
        "onEntry": false,
        "modify": [
          "price",
          "stopLoss",
          "takeProfit",
          "quantity"
        ],
        "expires": "it stays armed until it fires, you cancel it, or the contract expires"
      }
    },
    "stocksOrders": {
      "orderTypes": [
        "limit",
        "stop"
      ],
      "timeInForce": [
        "day",
        "gtc"
      ],
      "gtcDays": 90,
      "open": "POST /api/nexus/v1/trades with \"assetClass\": \"stocks\", \"orderType\": \"limit\" and limitPrice, or \"orderType\": \"stop\" and stopPrice",
      "exit": "POST /api/nexus/v1/trades/{id}/exits with \"orderType\": \"limit\" and limitPrice, or \"orderType\": \"stop\" and stopPrice",
      "shorts": true,
      "priceSource": "lastTrade",
      "fill": {
        "limit": "a buy fills when a trade prints at or under the limit, a sell at or over it, at that print",
        "stop": "a print through the stop triggers it; it fills at the next print after that one"
      },
      "maxQuoteAgeSeconds": 15,
      "modify": [
        "price",
        "quantity"
      ],
      "orders": [
        "GET /api/nexus/v1/trading/wallets/{book}/orders/working",
        "GET /api/nexus/v1/trading/wallets/{book}/orders/{orderId}",
        "POST /api/nexus/v1/trading/wallets/{book}/orders/{orderId}/cancel",
        "POST /api/nexus/v1/trading/wallets/{book}/orders/{orderId}/modify",
        "POST /api/nexus/v1/trading/wallets/{book}/orders/cancel"
      ],
      "maxWorkingOrders": 50,
      "stops": {
        "triggerOn": "lastTrade",
        "exit": "POST /api/nexus/v1/trades/{id}/exits with stopLoss and/or takeProfit (the stock's own last trade), or \"orderType\": \"stop\" and stopPrice",
        "fields": [
          "stopLoss",
          "takeProfit",
          "stopPrice",
          "quantity",
          "closeAll",
          "clientOrderId",
          "test"
        ],
        "fill": "a print through a level sets it off; it fills at the next print after that one",
        "onEntry": false,
        "modify": [
          "price",
          "stopLoss",
          "takeProfit",
          "quantity"
        ],
        "expires": "it stays armed until it fires or you cancel it"
      }
    },
    "adds": {
      "route": "POST /api/nexus/v1/trades/{id}/adds",
      "assetClasses": [
        "options",
        "stocks"
      ],
      "orderTypes": [
        "market"
      ],
      "maxPosition": {
        "options": 1000,
        "stocks": 100000
      },
      "price": "the live ask (options) or the live stock price, or your price when it's inside the market (price, ifOutside), as an open",
      "test": true
    },
    "expiryDayCutoff": {
      "multiLegOpen": "15:00",
      "singleLegOpen": "15:40",
      "timeZone": "America/New_York",
      "covers": "Your main account and every extra port. Never the agent account.",
      "code": "expiry_day_cutoff"
    }
  }
}
```

### 401

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

No key sent.:

```json
{
  "error": {
    "code": "missing_api_key",
    "message": "Send your Skylit API key in the Authorization header: Authorization: Bearer YOUR_SKYLIT_API_KEY."
  }
}
```

### 403

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

The account doesn't include Nexus.:

```json
{
  "error": {
    "code": "nexus_access_denied",
    "message": "This Skylit account doesn't include Nexus, so it can't place Nexus trades."
  }
}
```

### 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).

Headers: `Retry-After`, `X-RateLimit-Limit`, `X-RateLimit-Remaining`.

Too many writes from this key.:

```json
{
  "error": {
    "code": "rate_limited",
    "message": "Too many requests (limit 30). Slow down and retry in 12 seconds."
  }
}
```

### 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).

Headers: `Retry-After`.

No live price right now.:

```json
{
  "error": {
    "code": "no_live_price",
    "message": "There's no live price for this contract right now, so nothing was filled. Try again in a moment."
  }
}
```
