MCPcopy Create free account
hub / github.com/ccxt/node-binance-api / futuresAlgoOrder

Method futuresAlgoOrder

src/node-binance-api.ts:1270–1296  ·  view source on GitHub ↗

* @see https://developers.binance.com/docs/derivatives/usds-margined-futures/trade/rest-api/New-Algo-Order * @param type * @param side * @param symbol symbol if the market * @param quantity * @param price * @param params extra parameters to be sent in the request *

(type: OrderType, side: string, symbol: string, quantity: number, price?: number, params: Dict = {})

Source from the content-addressed store, hash-verified

1268 * @returns
1269 */
1270 async futuresAlgoOrder(type: OrderType, side: string, symbol: string, quantity: number, price?: number, params: Dict = {}): Promise<FuturesAlgoOrder> {
1271 params.symbol = symbol;
1272 params.side = side;
1273 params.type = type;
1274 if (quantity) params.quantity = quantity;
1275 // if in the binance futures setting Hedged mode is active, positionSide parameter is mandatory
1276 if (!params.positionSide && this.Options.hedgeMode) {
1277 params.positionSide = side === 'BUY' ? 'LONG' : 'SHORT';
1278 }
1279 // LIMIT STOP MARKET STOP_MARKET TAKE_PROFIT TAKE_PROFIT_MARKET
1280 // reduceOnly stopPrice
1281 if (price) {
1282 params.price = price;
1283 }
1284 if (!params.timeInForce && (params.type.includes('LIMIT') || params.type === 'STOP' || params.type === 'TAKE_PROFIT')) {
1285 params.timeInForce = 'GTX'; // Post only by default. Use GTC for limit orders.
1286 }
1287
1288 if (!params.clientAlgoId) {
1289 params.clientAlgoId = this.CONTRACT_PREFIX + this.uuid22();
1290 }
1291
1292 if (!params.algoType) {
1293 params.algoType = 'CONDITIONAL';
1294 }
1295 return await this.privateFuturesRequest('v1/algoOrder', params, 'POST');
1296 }
1297
1298 /**
1299 * @see https://developers.binance.com/docs/derivatives/option/trade/New-Order

Callers 1

Calls 2

uuid22Method · 0.95
privateFuturesRequestMethod · 0.95

Tested by

no test coverage detected