mirror of
https://github.com/discountry/ritmex-bot.git
synced 2026-09-10 08:48:07 +00:00
commit
This commit is contained in:
@@ -0,0 +1,36 @@
|
||||
import ccxt from '../../js/ccxt.js';
|
||||
// AUTO-TRANSPILE //
|
||||
async function example() {
|
||||
const exchange = new ccxt.bingx({
|
||||
'apiKey': 'MY_API_KEY',
|
||||
'secret': 'MY_SECRET',
|
||||
});
|
||||
// exchange.setSandboxMode (true);
|
||||
// exchange.verbose = true; // uncomment for debugging purposes if necessary
|
||||
await exchange.loadMarkets();
|
||||
const symbol = 'BTC/USDT:USDT';
|
||||
const order_type = 'market';
|
||||
const side = 'sell';
|
||||
const amount = 0.0001;
|
||||
const price = undefined;
|
||||
const reduceOnly = true;
|
||||
const trailingAmount = 100;
|
||||
// const trailingTriggerPrice = undefined; // not supported on all exchanges
|
||||
const params = {
|
||||
'reduceOnly': reduceOnly,
|
||||
'trailingAmount': trailingAmount,
|
||||
// 'trailingTriggerPrice': trailingTriggerPrice,
|
||||
};
|
||||
try {
|
||||
const create_order = await exchange.createOrder(symbol, order_type, side, amount, price, params);
|
||||
// Alternatively use the createTrailingAmountOrder method:
|
||||
// const create_order = await exchange.createTrailingAmountOrder (symbol, order_type, side, amount, price, trailingAmount, trailingTriggerPrice, {
|
||||
// 'reduceOnly': reduceOnly,
|
||||
// });
|
||||
console.log(create_order);
|
||||
}
|
||||
catch (e) {
|
||||
console.log(e.toString());
|
||||
}
|
||||
}
|
||||
await example();
|
||||
Reference in New Issue
Block a user