import { createExchange } from "./exchanges/exchange.js";
let myBingxExchange = createExchange({
exchange: "bingx",
authenticate: "true",
key: "myKey",
secret: "mySecret",
label: "bingx"
});
async function getTradersCurrentOrder(exchange, options) {
try {
let result = await exchange.getTradersCurrentOrder(options);
console.log(result);
} catch (error) {
console.log(error.message);
}
}
let result = await getTradersCurrentOrder(myBingxExchange);
Traders close positions according to the order number
tradersClosePositionsByOrderNumber()
import { createExchange } from "./exchanges/exchange.js";
let myBingxExchange = createExchange({
exchange: "bingx",
authenticate: "true",
key: "myKey",
secret: "mySecret",
label: "bingx"
});
async function tradersClosePositionsByOrderNumber(exchange, options) {
try {
let result = await exchange.tradersClosePositionsByOrderNumber(options);
console.log(result);
} catch (error) {
console.log(error.message);
}
}
let result = await tradersClosePositionsByOrderNumber(myBingxExchange, {
positionId: "<int64>",
recvWindow: "<int64>"
});
Traders set take profit and stop loss based on order numbers
tradersSetTPSLByOrderNumber()
import { createExchange } from "./exchanges/exchange.js";
let myBingxExchange = createExchange({
exchange: "bingx",
authenticate: "true",
key: "myKey",
secret: "mySecret",
label: "bingx"
});
async function tradersSetTPSLByOrderNumber(exchange, options) {
try {
let result = await exchange.tradersSetTPSLByOrderNumber(options);
console.log(result);
} catch (error) {
console.log(error.message);
}
}
let result = await tradersSetTPSLByOrderNumber(myBingxExchange, {
positionId: "<int64>",
takeProfitMarkPrice: "<float64>",
stopLossMarkPrice: "<float64>",
recvWindow: "<int64>"
});
Trader sells spot assets based on buy order number
traderSellsSpotAssetsBasedOnBuyOrder()
import { createExchange } from "./exchanges/exchange.js";
let myBingxExchange = createExchange({
exchange: "bingx",
authenticate: "true",
key: "myKey",
secret: "mySecret",
label: "bingx"
});
async function traderSellsSpotAssetsBasedOnBuyOrder(exchange, options) {
try {
let result = await exchange.traderSellsSpotAssetsBasedOnBuyOrder(options);
console.log(result);
} catch (error) {
console.log(error.message);
}
}
let result = await traderSellsSpotAssetsBasedOnBuyOrder(myBingxExchange, {
orderId: "<int64>"
});