Nexus/API Reference/Options and stocks resting orders

Change a resting options or stock order

POSThttps://app.skylit.ai/api/nexus/v1/trading/wallets/{book}/orders/{orderId}/modify

Change a resting order in place. It keeps the same id.

  • A limit: price is the new limit, quantity the new size (up to 1,000 contracts or 100,000 shares), or both. A bigger buy has to fit your buying power or nothing changes (422 insufficient_buying_power). Move a buy above the ask and it fills right away, at the ask.
  • A stock stop: price is the new stop.
  • An options stop: stopLoss, takeProfit (stock prices), quantity, or price when it has only one level.

An order that's filled, expired or rejected answers 409 order_not_working, and a stop that's already been set off answers 409 stop_triggered. A test order can't be modified (400 test_modify_unavailable): cancel it and send a new one.

Authorization

Authorization: Bearer <your API key>

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

Path parameters

  • bookstringrequired

    main is your own paper wallet, agent is your bot's.

    mainagent
  • orderIdstringuuidrequired

    The order's id, from the open, the working list or the history.

Request body

  • pricenumber

    The new limit, or the new stop on a stock stop or a one-level options stop. In cents.

  • quantityinteger

    The new size: up to 1,000 contracts or 100,000 shares.

  • stopLossnumber

    Options stops: the new stock price the stop fires at.

  • takeProfitnumber

    Options stops: the new stock price the target fires at.

  • testboolean

    Test orders can't be modified, so true is always refused.

Responses

  • 200

    The order, changed.

  • 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.

  • 404

    Not on your account. Codes: trade_not_found, account_not_found, order_not_found.

  • 409

    The order clashes with what you hold or sent before. Codes: duplicate_position (with tradeId: add to it instead), trade_closed, open_position_limit (open positions plus resting opens through the API are at 50), working_order_limit (50 options and stock orders already resting through the API), position_size_limit (an add would take the position past 1,000 contracts or 100,000 shares), client_order_id_used, request_in_progress, account_locked, account_busy, account_ended, order_not_working (it already filled, expired, or was cancelled or rejected), stop_triggered (a stop that's been set off is filling now, so it can't be cancelled or changed).

  • 422

    Read fine, but the market or the account says no. Codes: market_closed, contract_expired, contract_not_offered, price_outside_market, insufficient_buying_power, account_not_tradable, account_ambiguous, reduce_only_would_open, order_refused, order_rejected (a resting order that tried to fill right away and couldn't; orderId points to it). A resting order that can't be covered answers insufficient_buying_power with orderId too: it's recorded as rejected.

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

  • 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

  • dataobject

    A resting options or stock order: a limit, a stock stop, or an options stop-loss and target. It's not a Trade: when it fills, tradeId is the trade it went to.

    • idstringuuid
    • assetClassstring
      optionsstocks
    • sourcestring

      api when a key placed it. Left out on an order placed on the Options Desk in Nexus.

    • bookstring
      mainagent
    • clientOrderIdstring
    • tickerstring
    • strikenumber

      Options only.

    • directionstring

      call or put on an option. long or short on a stock: the side of the position it opens or closes.

    • expirationstringdate

      Options only.

    • sidestring
      buysell
    • positionEffectstring
      openclose
    • quantityinteger
    • filledQuantityinteger
    • orderTypestring

      stop, take_profit and bracket on an option are options stops. A trailing stop set on the Options Desk shows as trailing_stop (with triggerOn premium when it trails the option's own bid), and a desk market order as market, on the main wallet's list.

      limitstoptake_profitbrackettrailing_stopmarket
    • timeInForcestring
      daygtc
    • statusstring
      workingfilledcancelledrejectedexpired
    • statusReasonstring

      Why, when there's a reason.

    • limitPricenumber
    • stopPricenumber

      A stock stop's level.

    • stopLossnumber

      An options stop: the stock price the stop fires at.

    • takeProfitnumber

      An options stop: the stock price the target fires at.

    • triggerOnstring

      underlying on an options stop: its levels are the stock's price.

      underlyingpremium
    • underlyingstring

      The stock an options stop watches.

    • firedLegstring

      Which leg of an options stop fired.

      stop_losstake_profit
    • triggeredAtstringdate-time

      When a stop was set off. It can't be cancelled or changed after that.

    • triggerPricenumber

      The trade (or for an options stop, the stock price) that set it off.

    • fillOrderIdstringuuid

      An options stop that fired: the sell it sent.

    • fillPricenumber

      The average fill: the ask a buy paid, the bid a sell got, or a stock's trade price.

    • tradeIdstringuuid

      The trade the fill went to, or the trade an options stop protects.

    • reservedCentsinteger

      Buying power a resting open holds back. 0 once it stops resting, and on a close.

    • placedAtstringdate-time
    • filledAtstringdate-time
    • expiresAtstringdate-time
    • testboolean

      true on a test order. It never fills.

Last updated

Was this page helpful?