MCPcopy Create free account
hub / github.com/ccxt/ccxt / closePosition

Method closePosition

js/src/gate.js:8078–8087  ·  view source on GitHub ↗

* @method * @name gate#closePosition * @description closes open positions for a market * @see https://www.gate.com/docs/developers/apiv4/en/#place-futures-order * @see https://www.gate.com/docs/developers/apiv4/en/#place-futures-order-2 * @see https://www.gate.com/docs/devel

(symbol, side = undefined, params = {})

Source from the content-addressed store, hash-verified

8076 * @returns {object[]} [A list of position structures]{@link https://docs.ccxt.com/?id=position-structure}
8077 */
8078 async closePosition(symbol, side = undefined, params = {}) {
8079 const request = {
8080 'close': true,
8081 };
8082 params = this.extend(request, params);
8083 if (side === undefined) {
8084 side = ''; // side is not used but needs to be present, otherwise crashes in php
8085 }
8086 return await this.createOrder(symbol, 'market', side, 0, undefined, params);
8087 }
8088 /**
8089 * @method
8090 * @name gate#fetchLeverage

Callers

nothing calls this directly

Calls 2

createOrderMethod · 0.95
extendMethod · 0.45

Tested by

no test coverage detected