()
| 1 | import ccxt from '../../js/ccxt.js'; |
| 2 | async function example() { |
| 3 | const exchange = new ccxt.bingx({ |
| 4 | 'apiKey': 'MY_API_KEY', |
| 5 | 'secret': 'MY_SECRET', |
| 6 | }); |
| 7 | // exchange.setSandboxMode (true); |
| 8 | // exchange.verbose = true; // uncomment for debugging purposes if necessary |
| 9 | await exchange.loadMarkets(); |
| 10 | const symbol = 'BTC/USDT:USDT'; |
| 11 | const order_type = 'market'; |
| 12 | const side = 'sell'; |
| 13 | const amount = 0.0001; |
| 14 | const price = undefined; |
| 15 | const reduceOnly = true; |
| 16 | const trailingAmount = 100; |
| 17 | // const trailingTriggerPrice = undefined; // not supported on all exchanges |
| 18 | const params = { |
| 19 | 'reduceOnly': reduceOnly, |
| 20 | 'trailingAmount': trailingAmount, |
| 21 | // 'trailingTriggerPrice': trailingTriggerPrice, |
| 22 | }; |
| 23 | try { |
| 24 | const create_order = await exchange.createOrder(symbol, order_type, side, amount, price, params); |
| 25 | // Alternatively use the createTrailingAmountOrder method: |
| 26 | // const create_order = await exchange.createTrailingAmountOrder (symbol, order_type, side, amount, price, trailingAmount, trailingTriggerPrice, { |
| 27 | // 'reduceOnly': reduceOnly, |
| 28 | // }); |
| 29 | console.log(create_order); |
| 30 | } |
| 31 | catch (e) { |
| 32 | console.log(e.toString()); |
| 33 | } |
| 34 | } |
| 35 | await example(); |
no test coverage detected
searching dependent graphs…