API Reference

/orders

Allows user to place a signed order on the exchange

Log in to see full request history

📘

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

Body Params
string

User-passed string or client identifier

string
required

Market for which to create order

string
required

Defaults to address of the account placing order,
optionally specify parent account if trading as a subaccount

string
required

Type of the order

string
required

Price at which to place an order. Will be zero for a market order

string
required

Side of the order

boolean
required

Order should only reduce a position, default False

string
required

Quantity or size of order

string
required

Leverage must be an integer value and match the user-set market leverage

double
required

A random number for uniqueness of order. Generated randomly if not provided

double
required

Unix timestamp at which order will expire. Defaults to 1 month for LIMIT orders if not provided. On v1 this is in seconds, on v2 (Sui) this is in milliseconds.

string
required

Specify order execution, and by default, all orders are GTT. V2 on Sui does not support FOK.

string
required

Signature of the order

boolean

If set to TRUE, the order can only be a maker order

boolean

Pass true if you wish for your order never to be re-queued

string

Address of the user that created the order signature (maybe a whitelisted subaccount)

string

Trigger price for stop orders

double

If specified, this indicates the maker's institution

boolean

Orders submitted to the API must set value to true. Set to false if you want to trade trade directly with contracts. Defaults to True.

Headers
string
Responses

400
409

Order already exists

503
Language
Credentials
Click Try It! to start a request and see the response here! Or choose an example:
application/json