pyokx.low_rest_api.Trade
- class pyokx.low_rest_api.Trade.TradeAPI(api_key='-1', api_secret_key='-1', passphrase='-1', use_server_time=False, flag='1', domain='https://www.okx.com', debug=True)[source]
Bases:
Client
- amend_algo_order(instId='', algoId='', algoClOrdId='', cxlOnFail='', reqId='', newSz='', newTpTriggerPx='', newTpOrdPx='', newSlTriggerPx='', newSlOrdPx='', newTpTriggerPxType='', newSlTriggerPxType='')[source]
- amend_order(instId, cxlOnFail='', ordId='', clOrdId='', reqId='', newSz='', newPx='', newTpTriggerPx='', newTpOrdPx='', newSlTriggerPx='', newSlOrdPx='', newTpTriggerPxType='', newSlTriggerPxType='')[source]
- async close_positions(instId, mgnMode, posSide='', ccy='', autoCxl='', clOrdId='', tag='')[source]
Closes a position based on the given parameters.
- Parameters:
instId (str) – The instrument ID for the position to be closed.
mgnMode (str) – The margin mode for the position (e.g., ‘isolated’, ‘cross’).
posSide (str, optional) – The position side (e.g., ‘long’, ‘short’). Defaults to an empty string.
ccy (str, optional) – The currency used for the position. Defaults to an empty string.
autoCxl (str, optional) – Automatically cancel the position. Defaults to an empty string.
clOrdId (str, optional) – The client order ID. Defaults to an empty string.
tag (str, optional) – A tag for the position. Defaults to an empty string.
- Returns:
The response from the position close request.
- get_fills(instType='', uly='', instId='', ordId='', after='', before='', limit='', instFamily='', begin='', end='')[source]
- get_fills_history(instType, uly='', instId='', ordId='', after='', before='', limit='', instFamily='', begin='', end='')[source]
- get_order_list(instType='', uly='', instId='', ordType='', state='', after='', before='', limit='', instFamily='')[source]
- get_orders_history(instType, uly='', instId='', ordType='', state='', after='', before='', begin='', end='', limit='', instFamily='')[source]
- get_orders_history_archive(instType, uly='', instId='', ordType='', state='', after='', before='', begin='', end='', limit='', instFamily='')[source]
- order_algos_history(ordType, state='', algoId='', instType='', instId='', after='', before='', limit='')[source]
- order_algos_list(ordType='', algoId='', instType='', instId='', after='', before='', limit='', algoClOrdId='')[source]
- place_algo_order(instId='', tdMode='', side='', ordType='', sz='', ccy='', posSide='', reduceOnly='', tpTriggerPx='', tpOrdPx='', slTriggerPx='', slOrdPx='', triggerPx='', orderPx='', tgtCcy='', pxVar='', pxSpread='', szLimit='', pxLimit='', timeInterval='', tpTriggerPxType='', slTriggerPxType='', callbackRatio='', callbackSpread='', activePx='', tag='', triggerPxType='', closeFraction='', quickMgnType='', algoClOrdId='', cxlOnClosePos='')[source]
