This commit is contained in:
discountry
2025-10-03 15:28:16 +08:00
parent d5c4b04746
commit fcb83bd16b
925 changed files with 165721 additions and 4 deletions
@@ -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 ()
```