mirror of
https://github.com/discountry/ritmex-bot.git
synced 2026-09-11 01:08:07 +00:00
commit
This commit is contained in:
@@ -0,0 +1,45 @@
|
||||
- [Binance Margin Stop Order](./examples/js/)
|
||||
|
||||
|
||||
```javascript
|
||||
|
||||
|
||||
import ccxt from '../../js/ccxt.js';
|
||||
|
||||
console.log ('CCXT Version:', ccxt.version)
|
||||
|
||||
async function main () {
|
||||
|
||||
const exchange = new ccxt.binance({
|
||||
'apiKey': 'YOUR_API_KEY',
|
||||
'secret': 'YOUR_API_SECRET',
|
||||
'options': {
|
||||
'defaultType': 'margin',
|
||||
},
|
||||
})
|
||||
|
||||
const markets = await exchange.loadMarkets ()
|
||||
|
||||
exchange.verbose = true // uncomment for debugging purposes if necessary
|
||||
|
||||
const symbol = 'BTC/USDT'
|
||||
const type = 'STOP_LOSS_LIMIT'
|
||||
const side = 'buy'
|
||||
const amount = YOUR_AMOUNT_HERE
|
||||
const price = YOUR_PRICE_HERE
|
||||
const params = {
|
||||
'stopPrice': YOUR_STOP_PRICE_HERE,
|
||||
'timeInForce': 'GTC',
|
||||
}
|
||||
|
||||
try {
|
||||
const order = await exchange.createOrder (symbol, type, side, amount, price, params)
|
||||
console.log (order)
|
||||
} catch (e) {
|
||||
console.log (e.constructor.name, e.message)
|
||||
}
|
||||
}
|
||||
|
||||
main ()
|
||||
|
||||
```
|
||||
Reference in New Issue
Block a user