Place a new order

Pre-requisite: You account must have free balances in order to place a new order.

What are locked and free balances?

1

Build a limit order transaction

In the following example, we will be creating a limit order.

To place a new order, you must provide the following:

  • price

  • quantity

  • side

  • symbol

  • type

For an in-depth API reference Build order transaction

curl --location 'https://api-staging.deltadefi.io/order/build' \
--header 'x-api-key: <your_api_key>' \
--header 'Content-Type: application/json' \
--data '{
	"symbol": "ADAUSDX",
    "side": "buy",
    "type": "limit",
    "quantity": 100,
    "price": 0.93    
}'

2

Submit a limit order transaction

After the order transaction is built, you will then need to sign it before submitting it.

To submit:

curl --location 'https://api-staging.deltadefi.io/order/submit' \
--header 'Authorization: eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJleHAiOjE3NDI1Mzk5NDAsInN1YiI6ImFkZHJfdGVzdDFxcXpnZzVwY2FleWVhNjl1cHRsOWRhNWc3ZmFqbTRtMHl2eG5keDlmNGx4cGtlaHFnZXp5MHMwNHJ0ZHdsYzB0bHZ4YWZwZHJmeG5zZzd3dzY4Z2UzajdsMGxuc3pzdzJ3dCJ9.OAchsj0tv06NxD9Br0aj0Zw5XzpG8kUFKBuVPtz5AKA' \
--header 'X-API-KEY: <your_api_key>' \
--header 'Content-Type: application/json' \
--data '{
    "order_id": "<order_id>",
    "signed_tx":"<signed_tx>"
}'

3

Build a market order transaction

In this example we will be creating a market order.

For an in-depth API reference Build order transaction

To place a market order, provide the following:

  • price

  • quantity

  • side

  • symbol

  • type

  • limit_slippage / max_slippage_basis_point (either one)

limit_slippage (bool): If set to false, the market order will allow unlimited slippage until the entire order quantity is filled, where the account's purchasing power allows

max_slippage_basis_points (int): Maximum Slippage is the maximum acceptable deviation between the expected price (market price) and the actual executed price in a market order transaction

curl --location 'https://api-staging.deltadefi.io/order/build' \
--header 'x-api-key: <your_api_key>' \
--header 'Content-Type: application/json' \
--data '{
    "symbol": "ADAUSDX",
    "side": "buy",
    "type": "market",
    "quantity": 100,
    "limit_slippage": true
}'

After the transaction is built, follow step 2 above to submit the transaction.


📖 Get Order Records

After an order is created, you can find your order records with the Order records API

For open orders:

  • Pass the query param open

For closed orders:

  • pass the query param closed

curl --location 'https://api-staging.deltadefi.io/accounts/order-records?status=open' \
--header 'x-api-key: <your_api_key>'


Last updated