Files
bybit-api/examples/apidoc/V5/Trade/place-order.js
2025-01-25 01:10:30 +00:00

41 lines
693 B
JavaScript

const { RestClientV5 } = require('bybit-api');
const client = new RestClientV5({
testnet: true,
key: 'apikey',
secret: 'apisecret',
});
// Submit a market order
client
.submitOrder({
category: 'spot',
symbol: 'BTCUSDT',
side: 'Buy',
orderType: 'Market',
qty: '1',
})
.then((response) => {
console.log(response);
})
.catch((error) => {
console.error(error);
});
// Submit a limit order
client
.submitOrder({
category: 'spot',
symbol: 'BTCUSDT',
side: 'Buy',
orderType: 'Limit',
qty: '1',
price: '55000',
})
.then((response) => {
console.log(response);
})
.catch((error) => {
console.error(error);
});