Skip to content

Instantly share code, notes, and snippets.

@tiagosiebler
Last active February 14, 2023 19:32
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tiagosiebler/2dff5419f79024e9d9e3fbd410e8dbbd to your computer and use it in GitHub Desktop.
Save tiagosiebler/2dff5419f79024e9d9e3fbd410e8dbbd to your computer and use it in GitHub Desktop.
Open a short position in node.js using binance APIs, on binance USDM futures
const client = new USDMClient({
api_key: 'apikeyhere',
api_secret: 'apisecrethere',
beautifyResponses: true,
});
async function start() {
try {
// if you don't have a position yet, and your account is set to one-way mode, just place a sell order to open a short position
const result = await client.submitNewOrder({
side: 'SELL',
symbol: 'BTCUSDT',
type: 'MARKET',
quantity: 0.001,
});
console.log('market sell result: ', result);
} catch (e) {
console.error('market sell failed: ', e);
}
}
start();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment