API Reference
These docs are for v2.0. Click to read the latest docs for v2.0.1.

/orders

Allows user to place a signed order on the exchange

📘

Order Statuses

If you haven't already, we highly recommend checking out Order Statuses & Best Practices.

📘

Sub Accounts

If trading as a sub account, set the maker field to the address of the parent account. Read more about Sub Accounts here.

📘

Order Expiration

We have implemented a mechanism for actively expiring orders from the orderbook once they have reached their designated expiration time. The current interval for conducting the expiry checks on OPEN orders is 1 second. Additionally, there is an expiry buffer currently configured for 10 seconds. In other words, if your order has 10 seconds or less remaining before it expires, and the expiry check is triggered, your order will be expired.

Client Library

/**
 * Posts an order to exchange. Creates the signed order and places it to exchange,
 * without requiring two separate function calls.
 */

/* eslint-disable no-console */
import {
  MARKET_SYMBOLS,
  ORDER_SIDE,
  ORDER_TYPE,
  BluefinClient, 
  Networks,
} from "@bluefin-exchange/bluefin-v2-client";

async function main() {
  const dummyAccountKey =
    "trigger swim reunion gate hen black real deer light nature trial dust";

  const client = new BluefinClient(
    true,
    Networks.TESTNET_SUI,
    dummyAccountKey,
    "ED25519"
  );
  await client.init();

  // will post a limit order of 0.5 quantity at price 1700
  const response = await client.postOrder({
    symbol: MARKET_SYMBOLS.ETH,
    price: 1700,
    quantity: 0.5,
    side: ORDER_SIDE.BUY,
    orderType: ORDER_TYPE.LIMIT,
    leverage: 3,
  });

  console.log(response.data);
  
   // will post a limit stop order of 0.5 quantity at trigger price 1755
  const response = await client.postOrder({
    symbol: MARKET_SYMBOLS.ETH,
    price: 1700,
    triggerPrice: 1755,
    quantity: 0.5,
    side: ORDER_SIDE.BUY,
    orderType: ORDER_TYPE.STOP_LIMIT,
    leverage: 3,
  });

  console.log(response.data);
}

main().then().catch(console.error);
from config import TEST_ACCT_KEY, TEST_NETWORK
import asyncio
from bluefin_v2_client import (
    BluefinClient,
    Networks,
    MARKET_SYMBOLS,
    ORDER_SIDE,
    ORDER_TYPE,
    OrderSignatureRequest,
)


async def place_limit_order(client: BluefinClient):
    # get default leverage for market
    user_leverage = await client.get_user_leverage(MARKET_SYMBOLS.ETH)

    # creates a LIMIT order to be signed
    signature_request = OrderSignatureRequest(
        symbol=MARKET_SYMBOLS.ETH,  # market symbol
        price=1632.8,  # price at which you want to place order
        quantity=0.01,  # quantity
        side=ORDER_SIDE.BUY,
        orderType=ORDER_TYPE.LIMIT,
        leverage=user_leverage,
        postOnly=False,
    )
    # create signed order
    signed_order = client.create_signed_order(signature_request)

    print("Placing a limit order")
    # place signed order on orderbook
    resp = await client.post_signed_order(signed_order)

    # returned order with PENDING state
    print(resp)

    return

    
 async def place_stop_limit_order(client: BluefinClient):
    # get default leverage for market
    user_leverage = await client.get_user_leverage(MARKET_SYMBOLS.ETH)

    # creates a STOP LIMIT order to be signed
    signature_request = OrderSignatureRequest(
        symbol=MARKET_SYMBOLS.ETH,  # market symbol
        price=1632.8,  # price at which you want to place order
        quantity=0.01,  # quantity
        side=ORDER_SIDE.SELL,
        orderType=ORDER_TYPE.STOP_LIMIT,
        triggerPrice=1633.0,
        leverage=user_leverage,
        postOnly=True,
    )

    # create signed order
    signed_order = client.create_signed_order(signature_request)

    print("Placing a stop limit order")
    # place signed order on orderbook
    resp = await client.post_signed_order(signed_order)

    # returned order with STANDBY_PENDING state
    print(resp)

    return


async def main():
    client = BluefinClient(True, Networks[TEST_NETWORK], TEST_ACCT_KEY)
    await client.init(True)

    await client.init(True)

    await place_limit_order(client)
    await place_stop_limit_order(client)

if __name__ == "__main__":
    loop = asyncio.new_event_loop()
    loop.run_until_complete(main())
    loop.close()

HTTPs

Alternatively, if you have created the order signature (see Order Signature) and obtained your auth token, call the POST /orders endpoint using the integrated editor on the right or locally from any language supporting HTTPs network calls.

Request & Response

Language
Credentials
Bearer
JWT
Click Try It! to start a request and see the response here!