Trading

GET Futures Account Balance

Please refer to the official BloFin API Docs for the Required parameters.

https://docs.blofin.com/index.html#get-futures-account-balance

Function Name:

getFuturesAccountBalance()

Usage:

import { createExchange } from "./exchanges/exchange.js";

   let myBlofinExchange  = createExchange({
      exchange: "blofin",
      authenticate: "true",
      key: "myKey",
      secret: "mySecret",
      passphrase: "myPassphrase",
      label: "blofin"
  });

async function getFuturesAccountBalance(exchange, options) {
    try {
        let result = await exchange.getFuturesAccountBalance(options);
        console.log(result);
    } catch (error) {
        console.log(error.message);
    }
}

let result = await getFuturesAccountBalance(myBlofinExchange, 
});

GET Positions

Please refer to the official BloFin API Docs for the Required parameters.

https://docs.blofin.com/index.html#get-positions

Function Name:

getPositions()

Usage:

import { createExchange } from "./exchanges/exchange.js";

   let myBlofinExchange  = createExchange({
      exchange: "blofin",
      authenticate: "true",
      key: "myKey",
      secret: "mySecret",
      passphrase: "myPassphrase",
      label: "blofin"
  });

async function getPositions(exchange, options) {
    try {
        let result = await exchange.getPositions(options);
        console.log(result);
    } catch (error) {
        console.log(error.message);
    }
}

let result = await getPositions(myBlofinExchange, 
});

GET Margin Mode

Please refer to the official BloFin API Docs for the Required parameters.

https://docs.blofin.com/index.html#get-margin-mode

Function Name:

getMarginMode()

Usage:

import { createExchange } from "./exchanges/exchange.js";

   let myBlofinExchange  = createExchange({
      exchange: "blofin",
      authenticate: "true",
      key: "myKey",
      secret: "mySecret",
      passphrase: "myPassphrase",
      label: "blofin"
  });

async function getMarginMode(exchange, options) {
    try {
        let result = await exchange.getMarginMode(options);
        console.log(result);
    } catch (error) {
        console.log(error.message);
    }
}

let result = await getMarginMode(myBlofinExchange, 
});

GET Multiple Leverage

Please refer to the official BloFin API Docs for the Required parameters.

https://docs.blofin.com/index.html#get-multiple-leverage

Function Name:

getMultipleLeverage()

Usage:

import { createExchange } from "./exchanges/exchange.js";

   let myBlofinExchange  = createExchange({
      exchange: "blofin",
      authenticate: "true",
      key: "myKey",
      secret: "mySecret",
      passphrase: "myPassphrase",
      label: "blofin"
  });

async function getMultipleLeverage(exchange, options) {
    try {
        let result = await exchange.getMultipleLeverage(options);
        console.log(result);
    } catch (error) {
        console.log(error.message);
    }
}

let result = await getMultipleLeverage(myBlofinExchange, 
});

Set Leverage

Please refer to the official BloFin API Docs for the Required parameters.

https://docs.blofin.com/index.html#set-leverage

Function Name:

setLeverage()

Usage:

import { createExchange } from "./exchanges/exchange.js";

   let myBlofinExchange  = createExchange({
      exchange: "blofin",
      authenticate: "true",
      key: "myKey",
      secret: "mySecret",
      passphrase: "myPassphrase",
      label: "blofin"
  });

async function setLeverage(exchange, options) {
    try {
        let result = await exchange.setLeverage(options);
        console.log(result);
    } catch (error) {
        console.log(error.message);
    }
}

let result = await setLeverage(myBlofinExchange, 
});

Place Order

Please refer to the official BloFin API Docs for the Required parameters.

https://docs.blofin.com/index.html#place-order

Function Name:

placeOrder()

Usage:

import { createExchange } from "./exchanges/exchange.js";

   let myBlofinExchange  = createExchange({
      exchange: "blofin",
      authenticate: "true",
      key: "myKey",
      secret: "mySecret",
      passphrase: "myPassphrase",
      label: "blofin"
  });

async function placeOrder(exchange, options) {
    try {
        let result = await exchange.placeOrder(options);
        console.log(result);
    } catch (error) {
        console.log(error.message);
    }
}

let result = await placeOrder(myBlofinExchange, {
	instId: "<String>",
	marginMode: "<String>",
	side: "<String>",
	orderType: "<String>",
	price: "<String>",
	size: "<String>"
});

Place Multiple Orders

Please refer to the official BloFin API Docs for the Required parameters.

https://docs.blofin.com/index.html#place-multiple-orders

Function Name:

placeMultipleOrders()

Usage:

import { createExchange } from "./exchanges/exchange.js";

   let myBlofinExchange  = createExchange({
      exchange: "blofin",
      authenticate: "true",
      key: "myKey",
      secret: "mySecret",
      passphrase: "myPassphrase",
      label: "blofin"
  });

async function placeMultipleOrders(exchange, options) {
    try {
        let result = await exchange.placeMultipleOrders(options);
        console.log(result);
    } catch (error) {
        console.log(error.message);
    }
}

let result = await placeMultipleOrders(myBlofinExchange, 
});

Place TPSL Order

Please refer to the official BloFin API Docs for the Required parameters.

https://docs.blofin.com/index.html#place-tpsl-order

Function Name:

placeTPSLOrder()

Usage:

import { createExchange } from "./exchanges/exchange.js";

   let myBlofinExchange  = createExchange({
      exchange: "blofin",
      authenticate: "true",
      key: "myKey",
      secret: "mySecret",
      passphrase: "myPassphrase",
      label: "blofin"
  });

async function placeTPSLOrder(exchange, options) {
    try {
        let result = await exchange.placeTPSLOrder(options);
        console.log(result);
    } catch (error) {
        console.log(error.message);
    }
}

let result = await placeTPSLOrder(myBlofinExchange, {
	instId: "<String>",
	marginMode: "<String>",
	positionSide: "<String>",
	side: "<String>",
	tpTriggerPrice: "<String>"
});

Cancel Order

Please refer to the official BloFin API Docs for the Required parameters.

https://docs.blofin.com/index.html#cancel-order

Function Name:

cancelOrder()

Usage:

import { createExchange } from "./exchanges/exchange.js";

   let myBlofinExchange  = createExchange({
      exchange: "blofin",
      authenticate: "true",
      key: "myKey",
      secret: "mySecret",
      passphrase: "myPassphrase",
      label: "blofin"
  });

async function cancelOrder(exchange, options) {
    try {
        let result = await exchange.cancelOrder(options);
        console.log(result);
    } catch (error) {
        console.log(error.message);
    }
}

let result = await cancelOrder(myBlofinExchange, 
});

Cancel Multiple Orders

Please refer to the official BloFin API Docs for the Required parameters.

https://docs.blofin.com/index.html#cancel-multiple-orders

Function Name:

cancelMultipleOrders()

Usage:

import { createExchange } from "./exchanges/exchange.js";

   let myBlofinExchange  = createExchange({
      exchange: "blofin",
      authenticate: "true",
      key: "myKey",
      secret: "mySecret",
      passphrase: "myPassphrase",
      label: "blofin"
  });

async function cancelMultipleOrders(exchange, options) {
    try {
        let result = await exchange.cancelMultipleOrders(options);
        console.log(result);
    } catch (error) {
        console.log(error.message);
    }
}

let result = await cancelMultipleOrders(myBlofinExchange, 
});

Cancel TPSL Order

Please refer to the official BloFin API Docs for the Required parameters.

https://docs.blofin.com/index.html#cancel-tpsl-order

Function Name:

cancelTPSLOrder()

Usage:

import { createExchange } from "./exchanges/exchange.js";

   let myBlofinExchange  = createExchange({
      exchange: "blofin",
      authenticate: "true",
      key: "myKey",
      secret: "mySecret",
      passphrase: "myPassphrase",
      label: "blofin"
  });

async function cancelTPSLOrder(exchange, options) {
    try {
        let result = await exchange.cancelTPSLOrder(options);
        console.log(result);
    } catch (error) {
        console.log(error.message);
    }
}

let result = await cancelTPSLOrder(myBlofinExchange, 
});

GET Active Orders

Please refer to the official BloFin API Docs for the Required parameters.

https://docs.blofin.com/index.html#get-active-orders

Function Name:

getActiveOrders()

Usage:

import { createExchange } from "./exchanges/exchange.js";

   let myBlofinExchange  = createExchange({
      exchange: "blofin",
      authenticate: "true",
      key: "myKey",
      secret: "mySecret",
      passphrase: "myPassphrase",
      label: "blofin"
  });

async function getActiveOrders(exchange, options) {
    try {
        let result = await exchange.getActiveOrders(options);
        console.log(result);
    } catch (error) {
        console.log(error.message);
    }
}

let result = await getActiveOrders(myBlofinExchange, 
});

GET Active TPSL Orders

Please refer to the official BloFin API Docs for the Required parameters.

https://docs.blofin.com/index.html#get-active-tpsl-orders

Function Name:

getActiveTPSLOrders()

Usage:

import { createExchange } from "./exchanges/exchange.js";

   let myBlofinExchange  = createExchange({
      exchange: "blofin",
      authenticate: "true",
      key: "myKey",
      secret: "mySecret",
      passphrase: "myPassphrase",
      label: "blofin"
  });

async function getActiveTPSLOrders(exchange, options) {
    try {
        let result = await exchange.getActiveTPSLOrders(options);
        console.log(result);
    } catch (error) {
        console.log(error.message);
    }
}

let result = await getActiveTPSLOrders(myBlofinExchange, 
});

Close Positions

Please refer to the official BloFin API Docs for the Required parameters.

https://docs.blofin.com/index.html#close-positions

Function Name:

closePositions()

Usage:

import { createExchange } from "./exchanges/exchange.js";

   let myBlofinExchange  = createExchange({
      exchange: "blofin",
      authenticate: "true",
      key: "myKey",
      secret: "mySecret",
      passphrase: "myPassphrase",
      label: "blofin"
  });

async function closePositions(exchange, options) {
    try {
        let result = await exchange.closePositions(options);
        console.log(result);
    } catch (error) {
        console.log(error.message);
    }
}

let result = await closePositions(myBlofinExchange, {
	instId: "<String>",
	marginMode: "<String>"
});

GET TPSL Order History

Please refer to the official BloFin API Docs for the Required parameters.

https://docs.blofin.com/index.html#get-tpsl-order-history

Function Name:

getTPSLOrderHistory()

Usage:

import { createExchange } from "./exchanges/exchange.js";

   let myBlofinExchange  = createExchange({
      exchange: "blofin",
      authenticate: "true",
      key: "myKey",
      secret: "mySecret",
      passphrase: "myPassphrase",
      label: "blofin"
  });

async function getTPSLOrderHistory(exchange, options) {
    try {
        let result = await exchange.getTPSLOrderHistory(options);
        console.log(result);
    } catch (error) {
        console.log(error.message);
    }
}

let result = await getTPSLOrderHistory(myBlofinExchange, 
});

GET Trade History

Please refer to the official BloFin API Docs for the Required parameters.

https://docs.blofin.com/index.html#get-trade-history

Function Name:

getTradeHistory()

Usage:

import { createExchange } from "./exchanges/exchange.js";

   let myBlofinExchange  = createExchange({
      exchange: "blofin",
      authenticate: "true",
      key: "myKey",
      secret: "mySecret",
      passphrase: "myPassphrase",
      label: "blofin"
  });

async function getTradeHistory(exchange, options) {
    try {
        let result = await exchange.getTradeHistory(options);
        console.log(result);
    } catch (error) {
        console.log(error.message);
    }
}

let result = await getTradeHistory(myBlofinExchange, 
});

Last updated