View as Markdown
BitMEX icon

BitMEX ACTION

Create Order

Submit a new trading order in your BitMEX account. See the documentation
  • Action
  • Writes data
  • Destructive
  • API key
  • SDK
  • MCP

IMPLEMENTATION

Call this tool

Connect a user's BitMEX account once, then configure and run Create Order from your backend or agent.

import { PipedreamClient } from "@pipedream/sdk"

const pd = new PipedreamClient({
  projectId: process.env.PIPEDREAM_PROJECT_ID!,
  clientId: process.env.PIPEDREAM_CLIENT_ID!,
  clientSecret: process.env.PIPEDREAM_CLIENT_SECRET!,
  projectEnvironment: "production",
})

const result = await pd.actions.run({
  id: "bitmex-create-order",
  externalUserId: "{external_user_id}", // any stable ID for this user in your system
  configuredProps: {
    bitmex: { authProvisionId: "apn_xxxxxxx" },
    symbol: "Symbol",
    strategy: "Strategy",
  },
})

console.log(result)

SCHEMA

Inputs

Pipedream supplies the connected account. Your application provides the operation-specific values below. Dynamic inputs are resolved against that user's account.

Create Order inputs
Property Type Description
symbol Symbol string
Instrument symbol. Send a bare series (e.g. XBT) to get data for the nearest expiring contract in that series. You can also send a timeframe, e.g. XBT:quarterly. Timeframes are nearest, daily, weekly, monthly, quarterly, biquarterly, and perpetual. Symbols are case-insensitive.
Required Dynamic
strategy Strategy string
Order strategy. e.g. 'OneWay', 'Long', 'Short'
Optional
side Side string
Order side. Valid options: Buy, Sell. Defaults to 'Buy' unless orderQty is negative
Optional
orderQty Order Quantity integer
Order quantity in units of the instrument (i.e. contracts, for spot it is base currency in minor currency for spot (e.g. XBt quantity for XBT))
Optional
price Price string
Optional limit price for 'Limit', 'StopLimit', and 'LimitIfTouched' orders
Optional
displayQty Display Quantity integer
Optional quantity to display in the book. Use 0 for a fully hidden order.
Optional
stopPx Stop Price string
Optional trigger price for 'Stop', 'StopLimit', 'MarketIfTouched', and 'LimitIfTouched' orders. Use a price below the current price for stop-sell orders and buy-if-touched orders. Use execInst of 'MarkPrice' or 'LastPrice' to define the current price used for triggering.
Optional
clOrdID Client Order ID string
Optional Client Order ID. This clOrdID will come back on the order and any related executions.
Optional
clOrdLinkID Client Order Link ID string
Optional Client Order Link ID for contingent orders
Optional
pegOffsetValue Peg Offset Value string
Optional trailing offset from the current price for 'Stop', 'StopLimit', 'MarketIfTouched', and 'LimitIfTouched' orders; use a negative offset for stop-sell orders and buy-if-touched orders. Optional offset from the peg price for 'Pegged' orders.
Optional
pegPriceType Peg Price Type string
Optional peg price type. Valid options: MarketPeg, PrimaryPeg, TrailingStopPeg
Optional
ordType Order Type string
Order type. Valid options: Market, Limit, Stop, StopLimit, MarketIfTouched, LimitIfTouched, Pegged. Defaults to 'Limit' when price is specified. Defaults to 'Stop' when stopPx is specified. Defaults to 'StopLimit' when price and stopPx are specified.
Optional
timeInForce Time In Force string
Time in force. Valid options: Day, GoodTillCancel, ImmediateOrCancel, FillOrKill. Defaults to 'GoodTillCancel' for 'Limit', 'StopLimit', and 'LimitIfTouched' orders.
Optional
execInst Execution Instructions string
Optional execution instructions. Valid options: ParticipateDoNotInitiate, AllOrNone, MarkPrice, IndexPrice, LastPrice, Close, ReduceOnly, Fixed, LastWithinMark. 'AllOrNone' instruction requires displayQty to be 0. 'MarkPrice', 'IndexPrice' or 'LastPrice' instruction valid for 'Stop', 'StopLimit', 'MarketIfTouched', and 'LimitIfTouched' orders. 'LastWithinMark' instruction valid for 'Stop' and 'StopLimit' with instruction 'LastPrice'. IndexPrice, LastWithMark, Close and ReduceOnly are not applicable to spot trading symbols.
Optional
contingencyType Contingency Type string
Optional contingency type for use with clOrdLinkID. Valid options: OneCancelsTheOther, OneTriggersTheOther.
Optional
text Text string
Optional order annotation. e.g. 'Take profit'
Optional

REFERENCE

Tool details

Behavior hints are published with the component in the Pipedream registry and surface as MCP tool annotations, so an agent can reason about a tool before it calls it.

Registry key
bitmex-create-order
Version
0.0.2
App
BitMEX
Authentication
API key
Read-only
No
Destructive
Yes
Open world
No