Add to an open options or stock trade
https://app.skylit.ai/api/nexus/v1/trades/{id}/addsAlready in a trade and want more? Send an add to the trade's id instead of a second open. A second open on the same contract answers 409 duplicate_position, and its tradeId is the trade to add to.
- It fills like an open: options at the live ask, stocks at the live price. Send
pricefor your own price when it's inside the market, andifOutsidefor what happens when it isn't, same as an open. - Your average, totals and P/L update exactly the way they do when you add in Nexus, and the paper wallet pays. A trade on your agent account pays from the agent wallet and stays private.
- Market orders only. Each add is 1 to 1,000 contracts or 1 to 100,000 shares, and a position can't grow past that through the API (
409 position_size_limit). - Not enough buying power is
422 insufficient_buying_power. A quote older than 15 seconds is503 stale_quote: nothing was added, so try again in a moment. - Send a
clientOrderId. If your bot retries, the add happens once and the repeat answers with the trade andmeta.idempotentReplay: true. - An add to a test trade's id is a test add: checked and priced like a real one, and it only touches your test log.
"test": trueon a real trade adds nothing.
It answers 200 with the trade. meta.fill shows the price, how many you added and where the price came from.
Authorization
Authorization: Bearer <your API key>Required. A missing header returns 401; an invalid, revoked or expired key returns 403.
Path parameters
idstringuuidrequiredThe trade's id, from the open or the list.
Headers
Idempotency-KeystringYour
clientOrderId, as a header instead of a body field. If you send both they must match.
Request body
quantityintegerrequiredHow many more: 1 to 1,000 contracts or 1 to 100,000 shares, and the position can't grow past that.
pricenumberYour own fill price, taken only inside the window around the live quote.
ifOutsidestringWhat happens when
priceis outside the window.rejectmarketorderTypestringAdds are market orders.
marketclientOrderIdstringYour own id for safe retries. A repeat answers the trade with
meta.idempotentReplay: true.testbooleanOptional. The trade decides: an add to a test trade is a test add, and
trueon a real trade adds nothing.
Responses
- 200
The trade after the add, with
meta.fill. - 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 nolimitPrice),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 nostopPrice),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. - 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(withtradeId: 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;orderIdpoints to it). A resting order that can't be covered answersinsufficient_buying_powerwithorderIdtoo: it's recorded as rejected. - 429
Over a rate limit. Wait
Retry-Afterseconds, then retry. Codes:rate_limited, andstream_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-Afterwhen 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
dataobjectAn options or stock trade, as Nexus shows it. Stocks use
directioncallfor long andputfor short, strike 0 and today's date. Nexus may add other fields it shows on a trade (Greeks, P/L, reactions).idstringuuiduserIdstringuuidtickerstringstrikenumberexpirationstringdatedirectionstringcallputassetClassstringoptionsstocksaverageEntryPricenumbercurrentPricenumberThe latest mark.
totalQuantityintegerremainingQuantityintegerstatusstringactiveclosedentryDatestringdate-timeexitDatestringdate-timeexitsobject[]sourcestringapion a trade a key opened.testbooleantrueon a test order.
metaobjectExtra facts about an order. Each field is there only when it applies.
fillobjectThe fill:
price,priceSource(marketorclient), and when you sent a price, thebidandaskit was checked against. On an exit,quantityis how many sold.clientOrderIdstringidempotentReplaybooleanThis answer is a repeat of an earlier order with the same
clientOrderId.testbooleanA test order: nothing was placed.
notCheckedstring[]Futures test orders: what the preview couldn't check, like
account_rules_judgmentorbracket_netting.discordRoutingobjectWhere Nexus routed the trade to Discord, when it did.
nothingToClosebooleanstillOpenstring[]A repeated
closeAll: positions still open.tradeIdstringuuidA resting exit or an options stop: the trade it closes or protects.
triggerOnstringAn options stop:
underlying.underlyingPricenumberAn options stop: the stock's price right now.
marketOpenbooleanAn options stop: whether the market's open for the contract.
firesNowbooleanAn options stop: the stock's already through a level, so it fires on the next check.
firesOnsays which leg.wouldFireNowbooleanA test options stop: what
firesNowwould say.wouldFillNowbooleanA test limit: whether the real one would've filled right away, with
fillPrice.wouldTriggerNowbooleanA test stock stop: the last trade's already through it.
wouldRestBecausestringA test limit: why the real one would rest.
alreadyCancelledbooleanA repeated cancel: it was already cancelled.
Last updated