Last active
February 14, 2023 19:32
-
-
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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