Binance TypeScript SDK example: rest-usdm-order.ts
Binance REST Futures REST usdm order example for the Siebly Binance SDK, with TypeScript source for exchange REST API and WebSocket integration, setup, and production SDK docs.
What This Example Covers
- Binance REST API example in TypeScript.
- Uses the Siebly Binance SDK package
binanceinstead of hand-written HTTP request plumbing. - Source path:
Binance/Rest/Futures/rest-usdm-order.ts. - Example category: REST Futures.
- Imports SDK symbols including
USDMClient. - Calls SDK methods such as
submitNewOrder().
How To Use This Example
- Start here for the specific request or stream pattern, then check the matching SDK guide for install, credentials, and operational notes.
- Open the repository source when you need the latest committed version: GitHub source file.
Example Path
Binance/Rest/Futures/rest-usdm-order.ts
Source Link
Repository source: https://github.com/sieblyio/crypto-api-examples/blob/master/examples/Binance/Rest/Futures/rest-usdm-order.ts
Related SDK Docs
Example Source
import { USDMClient } from 'binance';
const key = process.env.API_KEY_COM || 'APIKEY';
const secret = process.env.API_SECRET_COM || 'APISECRET';
const client = new USDMClient({
api_secret: secret,
api_key: key,
beautifyResponses: true,
});
async function start() {
try {
// To open a short position - 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,
// newOrderRespType: 'FULL',
});
console.log('market sell result: ', result);
} catch (e) {
console.error('market sell failed: ', e);
}
}
start();