()
| 13 | |
| 14 | |
| 15 | async def example(): |
| 16 | exchange = ccxt.bingx({ |
| 17 | 'apiKey': 'MY_API_KEY', |
| 18 | 'secret': 'MY_SECRET', |
| 19 | }) |
| 20 | # exchange.setSandboxMode (true); |
| 21 | # exchange.verbose = true; # uncomment for debugging purposes if necessary |
| 22 | await exchange.load_markets() |
| 23 | symbol = 'BTC/USDT:USDT' |
| 24 | order_type = 'market' |
| 25 | side = 'sell' |
| 26 | amount = 0.0001 |
| 27 | price = None |
| 28 | reduce_only = True |
| 29 | trailing_amount = 100 |
| 30 | # const trailingTriggerPrice = undefined; # not supported on all exchanges |
| 31 | params = { |
| 32 | 'reduceOnly': reduce_only, |
| 33 | 'trailingAmount': trailing_amount, |
| 34 | } |
| 35 | try: |
| 36 | create_order = await exchange.create_order(symbol, order_type, side, amount, price, params) |
| 37 | # Alternatively use the createTrailingAmountOrder method: |
| 38 | # const create_order = await exchange.createTrailingAmountOrder (symbol, order_type, side, amount, price, trailingAmount, trailingTriggerPrice, { |
| 39 | # 'reduceOnly': reduceOnly, |
| 40 | # }); |
| 41 | print(create_order) |
| 42 | except Exception as e: |
| 43 | print(str(e)) |
| 44 | |
| 45 | await exchange.close() |
| 46 | |
| 47 | |
| 48 | asyncio.run(example()) |
no test coverage detected
searching dependent graphs…