Create New Position
Create a new trading position with optional take profit and stop loss orders
Overview
The New Position endpoint allows you to create trading positions with various order types, including market orders, limit orders, stop-market orders, and stop-limit orders. Each position can be configured with optional take profit and stop loss orders.
Request Body
Trading pair ID (number between 1 and 100)
Position direction (true for long, false for short)
Type of order. Must be one of:
market
: Market order at current pricelimit
: Limit order at specified pricestop-market
: Market order triggered at stop pricestop-limit
: Limit order triggered at stop price
Margin amount in base currency
Position size in base currency
Required for market orders. Maximum price willing to accept
Required for market orders. Allowed slippage in basis points (100 = 1%)
Required for limit and stop-limit orders. Price at which to execute
Required for stop-market and stop-limit orders. Price at which to trigger
Optional take profit price in base currency
Optional stop loss price in base currency
Required if takeProfit is set. Percentage to close at take profit (in basis points, 10000 = 100%)
Required if stopLoss is set. Percentage to close at stop loss (in basis points, 10000 = 100%)
Ethereum address of the user creating the position
Optional referral address (defaults to zero address)
Required Parameters by Order Type
Market Orders
maxAcceptablePrice
slippagePercent
margin
size
Limit Orders
limitPrice
margin
size
Stop-Market Orders
stopMarketPrice
margin
size
Stop-Limit Orders
limitPrice
stopMarketPrice
margin
size
Response Fields
Encoded function call data for the transaction
Address of the vault contract
Indicates if user has insufficient balance
Required gas fee for the transaction
Error message if balance is insufficient (only present if there’s an error)
Example Usage
Example Response
Error Responses
The endpoint will return a 400 status code with an error message for:
- Invalid pair value (must be between 1 and 100)
- Invalid or missing isLong boolean value
- Invalid orderType value
- Missing required parameters for the specified order type
- Missing close percentages when take profit or stop loss is specified
A 500 status code will be returned for server-side errors.
Body
Trading pair ID
1 < x < 100
Position direction
Type of order
market
, limit
, stop-market
, stop-limit
Margin amount in base currency
Position size in base currency
Ethereum address of the user
Maximum price willing to accept (for market orders)
Allowed slippage in basis points (for market orders)
Limit price (for limit and stop-limit orders)
Stop price (for stop-market and stop-limit orders)
Take profit price
Stop loss price
Percentage to close at take profit (in basis points)
Percentage to close at stop loss (in basis points)
Optional referral address
Response
Encoded function call data
Address of the vault contract
Required gas fee for the transaction
Indicates if user has insufficient balance
Error message if balance is insufficient