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

/orders/hash

Allows user to submit cancellation request for order(s) on the exchange
The cancellation signature must first be generated as a pre-requisite to this method

📘

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

Client Library

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);
  await client.init();

  // open multiple limit orders
  await client.postOrder({
    symbol: MARKET_SYMBOLS.ETH,
    price: 50,
    quantity: 0.5,
    side: ORDER_SIDE.BUY,
    orderType: ORDER_TYPE.LIMIT,
    leverage: 3,
  });

  await client.postOrder({
    symbol: MARKET_SYMBOLS.ETH,
    price: 50,
    quantity: 0.5,
    side: ORDER_SIDE.BUY,
    orderType: ORDER_TYPE.LIMIT,
    leverage: 3,
  });

  // cancels all open order
  await client.cancelAllOpenOrders(MARKET_SYMBOLS.ETH);
}

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


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

    signature_request = OrderSignatureRequest(
        symbol=MARKET_SYMBOLS.BTC,
        price=0,
        quantity=1,
        leverage=await client.get_user_leverage(MARKET_SYMBOLS.ETH),
        side=ORDER_SIDE.BUY,
        reduceOnly=False,
        postOnly=False,
        orderbookOnly=True,
        orderType=ORDER_TYPE.MARKET,
    )
    signed_order = client.create_signed_order(signature_request)
    resp = await client.post_signed_order(signed_order)

    # sign order for cancellation using order hash
    # you can pass a list of hashes to be signed for cancellation, good to be used when multiple orders are to be cancelled
    cancellation_request = client.create_signed_cancel_orders(
        MARKET_SYMBOLS.ETH, order_hash=[resp["hash"]]
    )
    pprint(cancellation_request)

    # # or sign the order for cancellation using order data
    cancellation_request = client.create_signed_cancel_order(signature_request)
    pprint(cancellation_request)  # same as above cancellation request

    # post order to exchange for cancellation
    resp = await client.post_cancel_order(cancellation_request)

    pprint(resp)


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

HTTPs

Alternatively, if you have created the order cancellation signature (see Cancel Order Signature) and obtained your auth token, call the DELETE /orders/hash 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!