pyokx.data_structures
- class pyokx.data_structures.AccountBalanceData(*, adjEq: str, borrowFroz: str, details: List[AccountBalanceDetails], imr: str, isoEq: str, mgnRatio: str, mmr: str, notionalUsd: str, ordFroz: str, totalEq: str, uTime: str)[source]
Bases:
OKXBaseModel
e.g. {‘adjEq’: ‘’, ‘borrowFroz’: ‘’, ‘details’: [{‘availBal’: ‘1’, ‘availEq’: ‘1’, ‘borrowFroz’: ‘’, ‘cashBal’: ‘1’, ‘ccy’: ‘BTC’, ‘crossLiab’: ‘’, ‘disEq’: ‘42219’, ‘eq’: ‘1’, ‘eqUsd’: ‘42219’, ‘fixedBal’: ‘0’, ‘frozenBal’: ‘0’, ‘interest’: ‘’, ‘isoEq’: ‘0’, ‘isoLiab’: ‘’, ‘isoUpl’: ‘0’, ‘liab’: ‘’, ‘maxLoan’: ‘’, ‘mgnRatio’: ‘’, ‘notionalLever’: ‘0’, ‘ordFrozen’: ‘0’, ‘spotInUseAmt’: ‘’, ‘spotIsoBal’: ‘0’, ‘stgyEq’: ‘0’, ‘twap’: ‘0’, ‘uTime’: ‘1703639691142’, ‘upl’: ‘0’, ‘uplLiab’: ‘’}, {‘availBal’: ‘100’, ‘availEq’: ‘100’, ‘borrowFroz’: ‘’, ‘cashBal’: ‘100’, ‘ccy’: ‘OKB’, ‘crossLiab’: ‘’, ‘disEq’: ‘5207.329999999999’, ‘eq’: ‘100’, ‘eqUsd’: ‘5481.4’, ‘fixedBal’: ‘0’, ‘frozenBal’: ‘0’, ‘interest’: ‘’, ‘isoEq’: ‘0’, ‘isoLiab’: ‘’, ‘isoUpl’: ‘0’, ‘liab’: ‘’, ‘maxLoan’: ‘’, ‘mgnRatio’: ‘’, ‘notionalLever’: ‘0’, ‘ordFrozen’: ‘0’, ‘spotInUseAmt’: ‘’, ‘spotIsoBal’: ‘0’, ‘stgyEq’: ‘0’, ‘twap’: ‘0’, ‘uTime’: ‘1703639691152’, ‘upl’: ‘0’, ‘uplLiab’: ‘’}, {‘availBal’: ‘5069.205129833334’, ‘availEq’: ‘5069.205129833334’, ‘borrowFroz’: ‘’, ‘cashBal’: ‘5069.205129833334’, ‘ccy’: ‘USDT’, ‘crossLiab’: ‘’, ‘disEq’: ‘5218.680085966916’, ‘eq’: ‘5217.0627965’, ‘eqUsd’: ‘5218.680085966916’, ‘fixedBal’: ‘0’, ‘frozenBal’: ‘147.85766666666666’, ‘interest’: ‘’, ‘isoEq’: ‘147.85766666666666’, ‘isoLiab’: ‘’, ‘isoUpl’: ‘2.5’, ‘liab’: ‘’, ‘maxLoan’: ‘’, ‘mgnRatio’: ‘’, ‘notionalLever’: ‘0’, ‘ordFrozen’: ‘0’, ‘spotInUseAmt’: ‘’, ‘spotIsoBal’: ‘0’, ‘stgyEq’: ‘0’, ‘twap’: ‘0’, ‘uTime’: ‘1703877105585’, ‘upl’: ‘2.5’, ‘uplLiab’: ‘’}, {‘availBal’: ‘1’, ‘availEq’: ‘1’, ‘borrowFroz’: ‘’, ‘cashBal’: ‘1’, ‘ccy’: ‘ETH’, ‘crossLiab’: ‘’, ‘disEq’: ‘2310.18’, ‘eq’: ‘1’, ‘eqUsd’: ‘2310.18’, ‘fixedBal’: ‘0’, ‘frozenBal’: ‘0’, ‘interest’: ‘’, ‘isoEq’: ‘0’, ‘isoLiab’: ‘’, ‘isoUpl’: ‘0’, ‘liab’: ‘’, ‘maxLoan’: ‘’, ‘mgnRatio’: ‘’, ‘notionalLever’: ‘0’, ‘ordFrozen’: ‘0’, ‘spotInUseAmt’: ‘’, ‘spotIsoBal’: ‘0’, ‘stgyEq’: ‘0’, ‘twap’: ‘0’, ‘uTime’: ‘1703639691162’, ‘upl’: ‘0’, ‘uplLiab’: ‘’}], ‘imr’: ‘’, ‘isoEq’: ‘147.90350254333333’, ‘mgnRatio’: ‘’, ‘mmr’: ‘’, ‘notionalUsd’: ‘’, ‘ordFroz’: ‘’, ‘totalEq’: ‘55229.26008596692’, ‘uTime’: ‘1703884466962’}
- adjEq: str = 'adjEq'
- borrowFroz: str = 'borrowFroz'
- details: List[AccountBalanceDetails] = 'details'
- imr: str = 'imr'
- isoEq: str = 'isoEq'
- mgnRatio: str = 'mgnRatio'
- mmr: str = 'mmr'
- model_config: ClassVar[ConfigDict] = {}
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- model_fields: ClassVar[dict[str, FieldInfo]] = {'adjEq': FieldInfo(annotation=str, required=True), 'borrowFroz': FieldInfo(annotation=str, required=True), 'details': FieldInfo(annotation=List[AccountBalanceDetails], required=True), 'imr': FieldInfo(annotation=str, required=True), 'isoEq': FieldInfo(annotation=str, required=True), 'mgnRatio': FieldInfo(annotation=str, required=True), 'mmr': FieldInfo(annotation=str, required=True), 'notionalUsd': FieldInfo(annotation=str, required=True), 'ordFroz': FieldInfo(annotation=str, required=True), 'totalEq': FieldInfo(annotation=str, required=True), 'uTime': FieldInfo(annotation=str, required=True)}
Metadata about the fields defined on the model, mapping of field names to [FieldInfo][pydantic.fields.FieldInfo].
This replaces Model.__fields__ from Pydantic V1.
- notionalUsd: str = 'notionalUsd'
- ordFroz: str = 'ordFroz'
- totalEq: str = 'totalEq'
- uTime: str = 'uTime'
- class pyokx.data_structures.AccountBalanceDetails(*, availBal: str, availEq: str, borrowFroz: str, cashBal: str, ccy: str, crossLiab: str, disEq: str, eq: str, eqUsd: str, fixedBal: str, frozenBal: str, interest: str, isoEq: str, isoLiab: str, isoUpl: str, liab: str, maxLoan: str, mgnRatio: str, notionalLever: str, ordFrozen: str, spotInUseAmt: str, spotIsoBal: str, stgyEq: str, twap: str, uTime: str, upl: str, uplLiab: str)[source]
Bases:
OKXBaseModel
- e.g. {‘availBal’: ‘1’, ‘availEq’: ‘1’, ‘borrowFroz’: ‘’, ‘cashBal’: ‘1’, ‘ccy’: ‘BTC’, ‘crossLiab’: ‘’, ‘disEq’: ‘42219’,
‘eq’: ‘1’, ‘eqUsd’: ‘42219’, ‘fixedBal’: ‘0’, ‘frozenBal’: ‘0’, ‘interest’: ‘’, ‘isoEq’: ‘0’, ‘isoLiab’: ‘’, ‘isoUpl’: ‘0’, ‘liab’: ‘’, ‘maxLoan’: ‘’, ‘mgnRatio’: ‘’, ‘notionalLever’: ‘0’, ‘ordFrozen’: ‘0’, ‘spotInUseAmt’: ‘’, ‘spotIsoBal’: ‘0’, ‘stgyEq’: ‘0’, ‘twap’: ‘0’, ‘uTime’: ‘1703639691142’, ‘upl’: ‘0’, ‘uplLiab’: ‘’}
- availBal: str = 'availBal'
- availEq: str = 'availEq'
- borrowFroz: str = 'borrowFroz'
- cashBal: str = 'cashBal'
- ccy: str = 'ccy'
- crossLiab: str = 'crossLiab'
- disEq: str = 'disEq'
- eq: str = 'eq'
- eqUsd: str = 'eqUsd'
- fixedBal: str = 'fixedBal'
- frozenBal: str = 'frozenBal'
- interest: str = 'interest'
- isoEq: str = 'isoEq'
- isoLiab: str = 'isoLiab'
- isoUpl: str = 'isoUpl'
- liab: str = 'liab'
- maxLoan: str = 'maxLoan'
- mgnRatio: str = 'mgnRatio'
- model_config: ClassVar[ConfigDict] = {}
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- model_fields: ClassVar[dict[str, FieldInfo]] = {'availBal': FieldInfo(annotation=str, required=True), 'availEq': FieldInfo(annotation=str, required=True), 'borrowFroz': FieldInfo(annotation=str, required=True), 'cashBal': FieldInfo(annotation=str, required=True), 'ccy': FieldInfo(annotation=str, required=True), 'crossLiab': FieldInfo(annotation=str, required=True), 'disEq': FieldInfo(annotation=str, required=True), 'eq': FieldInfo(annotation=str, required=True), 'eqUsd': FieldInfo(annotation=str, required=True), 'fixedBal': FieldInfo(annotation=str, required=True), 'frozenBal': FieldInfo(annotation=str, required=True), 'interest': FieldInfo(annotation=str, required=True), 'isoEq': FieldInfo(annotation=str, required=True), 'isoLiab': FieldInfo(annotation=str, required=True), 'isoUpl': FieldInfo(annotation=str, required=True), 'liab': FieldInfo(annotation=str, required=True), 'maxLoan': FieldInfo(annotation=str, required=True), 'mgnRatio': FieldInfo(annotation=str, required=True), 'notionalLever': FieldInfo(annotation=str, required=True), 'ordFrozen': FieldInfo(annotation=str, required=True), 'spotInUseAmt': FieldInfo(annotation=str, required=True), 'spotIsoBal': FieldInfo(annotation=str, required=True), 'stgyEq': FieldInfo(annotation=str, required=True), 'twap': FieldInfo(annotation=str, required=True), 'uTime': FieldInfo(annotation=str, required=True), 'upl': FieldInfo(annotation=str, required=True), 'uplLiab': FieldInfo(annotation=str, required=True)}
Metadata about the fields defined on the model, mapping of field names to [FieldInfo][pydantic.fields.FieldInfo].
This replaces Model.__fields__ from Pydantic V1.
- notionalLever: str = 'notionalLever'
- ordFrozen: str = 'ordFrozen'
- spotInUseAmt: str = 'spotInUseAmt'
- spotIsoBal: str = 'spotIsoBal'
- stgyEq: str = 'stgyEq'
- twap: str = 'twap'
- uTime: str = 'uTime'
- upl: str = 'upl'
- uplLiab: str = 'uplLiab'
- class pyokx.data_structures.AccountConfigData(*, acctLv: str, autoLoan: bool, ctIsoMode: str, greeksType: str, ip: str, kycLv: str, label: str, level: str, levelTmp: str, liquidationGear: str, mainUid: str, mgnIsoMode: str, opAuth: str, perm: str, posMode: str, roleType: str, spotOffsetType: str, spotRoleType: str, spotTraderInsts: List[str], traderInsts: List[str], uid: str)[source]
Bases:
OKXBaseModel
- acctLv: str = 'acctLv'
- autoLoan: bool = 'autoLoan'
- ctIsoMode: str = 'ctIsoMode'
- greeksType: str = 'greeksType'
- ip: str = 'ip'
- kycLv: str = 'kycLv'
- label: str = 'label'
- level: str = 'level'
- levelTmp: str = 'levelTmp'
- liquidationGear: str = 'liquidationGear'
- mainUid: str = 'mainUid'
- mgnIsoMode: str = 'mgnIsoMode'
- model_config: ClassVar[ConfigDict] = {}
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- model_fields: ClassVar[dict[str, FieldInfo]] = {'acctLv': FieldInfo(annotation=str, required=True), 'autoLoan': FieldInfo(annotation=bool, required=True), 'ctIsoMode': FieldInfo(annotation=str, required=True), 'greeksType': FieldInfo(annotation=str, required=True), 'ip': FieldInfo(annotation=str, required=True), 'kycLv': FieldInfo(annotation=str, required=True), 'label': FieldInfo(annotation=str, required=True), 'level': FieldInfo(annotation=str, required=True), 'levelTmp': FieldInfo(annotation=str, required=True), 'liquidationGear': FieldInfo(annotation=str, required=True), 'mainUid': FieldInfo(annotation=str, required=True), 'mgnIsoMode': FieldInfo(annotation=str, required=True), 'opAuth': FieldInfo(annotation=str, required=True), 'perm': FieldInfo(annotation=str, required=True), 'posMode': FieldInfo(annotation=str, required=True), 'roleType': FieldInfo(annotation=str, required=True), 'spotOffsetType': FieldInfo(annotation=str, required=True), 'spotRoleType': FieldInfo(annotation=str, required=True), 'spotTraderInsts': FieldInfo(annotation=List[str], required=True), 'traderInsts': FieldInfo(annotation=List[str], required=True), 'uid': FieldInfo(annotation=str, required=True)}
Metadata about the fields defined on the model, mapping of field names to [FieldInfo][pydantic.fields.FieldInfo].
This replaces Model.__fields__ from Pydantic V1.
- opAuth: str = 'opAuth'
- perm: str = 'perm'
- posMode: str = 'posMode'
- roleType: str = 'roleType'
- spotOffsetType: str = 'spotOffsetType'
- spotRoleType: str = 'spotRoleType'
- spotTraderInsts: List[str] = 'spotTraderInsts'
- traderInsts: List[str] = 'traderInsts'
- uid: str = 'uid'
- class pyokx.data_structures.AccountStatusReport(*, account_balance: AccountBalanceData, account_config: AccountConfigData, all_positions: List[Position], all_orders: List[Order], all_algo_orders: List[Algo_Order], simplified_balance: Simplified_Balance_Details, timestamp: str = '2024-03-01 22:30:10')[source]
Bases:
OKXBaseModel
- account_balance: AccountBalanceData = 'account_balance'
- account_config: AccountConfigData = 'account_config'
- all_algo_orders: List[Algo_Order] = 'all_algo_orders'
- model_config: ClassVar[ConfigDict] = {}
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- model_fields: ClassVar[dict[str, FieldInfo]] = {'account_balance': FieldInfo(annotation=AccountBalanceData, required=True), 'account_config': FieldInfo(annotation=AccountConfigData, required=True), 'all_algo_orders': FieldInfo(annotation=List[Algo_Order], required=True), 'all_orders': FieldInfo(annotation=List[Order], required=True), 'all_positions': FieldInfo(annotation=List[Position], required=True), 'simplified_balance': FieldInfo(annotation=Simplified_Balance_Details, required=True), 'timestamp': FieldInfo(annotation=str, required=False, default='2024-03-01 22:30:10')}
Metadata about the fields defined on the model, mapping of field names to [FieldInfo][pydantic.fields.FieldInfo].
This replaces Model.__fields__ from Pydantic V1.
- simplified_balance: Simplified_Balance_Details = 'simplified_balance'
- timestamp: str = 'timestamp'
- class pyokx.data_structures.Algo_Order(*, activePx: str, actualPx: str, actualSide: str, actualSz: str, algoClOrdId: str, algoId: str, amendPxOnTriggerType: str, attachAlgoOrds: List[str], cTime: str, callbackRatio: str, callbackSpread: str, ccy: str, clOrdId: str, closeFraction: str, failCode: str, instId: str, instType: str, last: str, lever: str, moveTriggerPx: str, ordId: str, ordIdList: List[str], ordPx: str, ordType: str, posSide: str, pxLimit: str, pxSpread: str, pxVar: str, quickMgnType: str, reduceOnly: str, side: str, slOrdPx: str, slTriggerPx: str, slTriggerPxType: str, state: str, sz: str, szLimit: str, tag: str, tdMode: str, tgtCcy: str, timeInterval: str, tpOrdPx: str, tpTriggerPx: str, tpTriggerPxType: str, triggerPx: str, triggerPxType: str, triggerTime: str)[source]
Bases:
OKXBaseModel
e.g. {‘activePx’: ‘’, ‘actualPx’: ‘’, ‘actualSide’: ‘’, ‘actualSz’: ‘0’, ‘algoClOrdId’: ‘’, ‘algoId’: ‘660707839958183936’, ‘amendPxOnTriggerType’: ‘0’, ‘attachAlgoOrds’: [], ‘cTime’: ‘1703797024404’, ‘callbackRatio’: ‘’, ‘callbackSpread’: ‘’, ‘ccy’: ‘’, ‘clOrdId’: ‘’, ‘closeFraction’: ‘’, ‘failCode’: ‘’, ‘instId’: ‘BTC-USDT-240329’, ‘instType’: ‘FUTURES’, ‘last’: ‘44080’, ‘lever’: ‘3’, ‘moveTriggerPx’: ‘’, ‘ordId’: ‘’, ‘ordIdList’: [], ‘ordPx’: ‘’, ‘ordType’: ‘conditional’, ‘posSide’: ‘net’, ‘pxLimit’: ‘’, ‘pxSpread’: ‘’, ‘pxVar’: ‘’, ‘quickMgnType’: ‘’, ‘reduceOnly’: ‘false’, ‘side’: ‘buy’, ‘slOrdPx’: ‘’, ‘slTriggerPx’: ‘’, ‘slTriggerPxType’: ‘’, ‘state’: ‘live’, ‘sz’: ‘1’, ‘szLimit’: ‘’, ‘tag’: ‘’, ‘tdMode’: ‘isolated’, ‘tgtCcy’: ‘’, ‘timeInterval’: ‘’, ‘tpOrdPx’: ‘-1’, ‘tpTriggerPx’: ‘44075’, ‘tpTriggerPxType’: ‘last’, ‘triggerPx’: ‘’, ‘triggerPxType’: ‘’, ‘triggerTime’: ‘’}, {‘activePx’: ‘’, ‘actualPx’: ‘’, ‘actualSide’: ‘’, ‘actualSz’: ‘0’, ‘algoClOrdId’: ‘’, ‘algoId’: ‘660707810421895170’, ‘amendPxOnTriggerType’: ‘0’, ‘attachAlgoOrds’: [], ‘cTime’: ‘1703797017362’, ‘callbackRatio’: ‘’, ‘callbackSpread’: ‘’, ‘ccy’: ‘’, ‘clOrdId’: ‘’, ‘closeFraction’: ‘’, ‘failCode’: ‘’, ‘instId’: ‘BTC-USDT-240329’, ‘instType’: ‘FUTURES’, ‘last’: ‘44079.5’, ‘lever’: ‘3’, ‘moveTriggerPx’: ‘’, ‘ordId’: ‘’, ‘ordIdList’: [], ‘ordPx’: ‘’, ‘ordType’: ‘conditional’, ‘posSide’: ‘net’, ‘pxLimit’: ‘’, ‘pxSpread’: ‘’, ‘pxVar’: ‘’, ‘quickMgnType’: ‘’, ‘reduceOnly’: ‘false’, ‘side’: ‘buy’, ‘slOrdPx’: ‘’, ‘slTriggerPx’: ‘’, ‘slTriggerPxType’: ‘’, ‘state’: ‘live’, ‘sz’: ‘1’, ‘szLimit’: ‘’, ‘tag’: ‘’, ‘tdMode’: ‘isolated’, ‘tgtCcy’: ‘’, ‘timeInterval’: ‘’, ‘tpOrdPx’: ‘-1’, ‘tpTriggerPx’: ‘44074.5’, ‘tpTriggerPxType’: ‘last’, ‘triggerPx’: ‘’, ‘triggerPxType’: ‘’, ‘triggerTime’: ‘’}
- activePx: str = 'activePx'
- actualPx: str = 'actualPx'
- actualSide: str = 'actualSide'
- actualSz: str = 'actualSz'
- algoClOrdId: str = 'algoClOrdId'
- algoId: str = 'algoId'
- amendPxOnTriggerType: str = 'amendPxOnTriggerType'
- attachAlgoOrds: List[str] = 'attachAlgoOrds'
- cTime: str = 'cTime'
- callbackRatio: str = 'callbackRatio'
- callbackSpread: str = 'callbackSpread'
- ccy: str = 'ccy'
- clOrdId: str = 'clOrdId'
- closeFraction: str = 'closeFraction'
- failCode: str = 'failCode'
- instId: str = 'instId'
- instType: str = 'instType'
- last: str = 'last'
- lever: str = 'lever'
- model_config: ClassVar[ConfigDict] = {}
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- model_fields: ClassVar[dict[str, FieldInfo]] = {'activePx': FieldInfo(annotation=str, required=True), 'actualPx': FieldInfo(annotation=str, required=True), 'actualSide': FieldInfo(annotation=str, required=True), 'actualSz': FieldInfo(annotation=str, required=True), 'algoClOrdId': FieldInfo(annotation=str, required=True), 'algoId': FieldInfo(annotation=str, required=True), 'amendPxOnTriggerType': FieldInfo(annotation=str, required=True), 'attachAlgoOrds': FieldInfo(annotation=List[str], required=True), 'cTime': FieldInfo(annotation=str, required=True), 'callbackRatio': FieldInfo(annotation=str, required=True), 'callbackSpread': FieldInfo(annotation=str, required=True), 'ccy': FieldInfo(annotation=str, required=True), 'clOrdId': FieldInfo(annotation=str, required=True), 'closeFraction': FieldInfo(annotation=str, required=True), 'failCode': FieldInfo(annotation=str, required=True), 'instId': FieldInfo(annotation=str, required=True), 'instType': FieldInfo(annotation=str, required=True), 'last': FieldInfo(annotation=str, required=True), 'lever': FieldInfo(annotation=str, required=True), 'moveTriggerPx': FieldInfo(annotation=str, required=True), 'ordId': FieldInfo(annotation=str, required=True), 'ordIdList': FieldInfo(annotation=List[str], required=True), 'ordPx': FieldInfo(annotation=str, required=True), 'ordType': FieldInfo(annotation=str, required=True), 'posSide': FieldInfo(annotation=str, required=True), 'pxLimit': FieldInfo(annotation=str, required=True), 'pxSpread': FieldInfo(annotation=str, required=True), 'pxVar': FieldInfo(annotation=str, required=True), 'quickMgnType': FieldInfo(annotation=str, required=True), 'reduceOnly': FieldInfo(annotation=str, required=True), 'side': FieldInfo(annotation=str, required=True), 'slOrdPx': FieldInfo(annotation=str, required=True), 'slTriggerPx': FieldInfo(annotation=str, required=True), 'slTriggerPxType': FieldInfo(annotation=str, required=True), 'state': FieldInfo(annotation=str, required=True), 'sz': FieldInfo(annotation=str, required=True), 'szLimit': FieldInfo(annotation=str, required=True), 'tag': FieldInfo(annotation=str, required=True), 'tdMode': FieldInfo(annotation=str, required=True), 'tgtCcy': FieldInfo(annotation=str, required=True), 'timeInterval': FieldInfo(annotation=str, required=True), 'tpOrdPx': FieldInfo(annotation=str, required=True), 'tpTriggerPx': FieldInfo(annotation=str, required=True), 'tpTriggerPxType': FieldInfo(annotation=str, required=True), 'triggerPx': FieldInfo(annotation=str, required=True), 'triggerPxType': FieldInfo(annotation=str, required=True), 'triggerTime': FieldInfo(annotation=str, required=True)}
Metadata about the fields defined on the model, mapping of field names to [FieldInfo][pydantic.fields.FieldInfo].
This replaces Model.__fields__ from Pydantic V1.
- moveTriggerPx: str = 'moveTriggerPx'
- ordId: str = 'ordId'
- ordIdList: List[str] = 'ordIdList'
- ordPx: str = 'ordPx'
- ordType: str = 'ordType'
- posSide: str = 'posSide'
- pxLimit: str = 'pxLimit'
- pxSpread: str = 'pxSpread'
- pxVar: str = 'pxVar'
- quickMgnType: str = 'quickMgnType'
- reduceOnly: str = 'reduceOnly'
- side: str = 'side'
- slOrdPx: str = 'slOrdPx'
- slTriggerPx: str = 'slTriggerPx'
- slTriggerPxType: str = 'slTriggerPxType'
- state: str = 'state'
- sz: str = 'sz'
- szLimit: str = 'szLimit'
- tag: str = 'tag'
- tdMode: str = 'tdMode'
- tgtCcy: str = 'tgtCcy'
- timeInterval: str = 'timeInterval'
- tpOrdPx: str = 'tpOrdPx'
- tpTriggerPx: str = 'tpTriggerPx'
- tpTriggerPxType: str = 'tpTriggerPxType'
- triggerPx: str = 'triggerPx'
- triggerPxType: str = 'triggerPxType'
- triggerTime: str = 'triggerTime'
- class pyokx.data_structures.Algo_Order_Placement_Return(*, algoClOrdId: str, algoId: str, clOrdId: str, sCode: str, sMsg: str, tag: str)[source]
Bases:
OKXBaseModel
e.g. {‘algoClOrdId’: ‘’, ‘algoId’: ‘660710963351515145’, ‘clOrdId’: ‘’, ‘sCode’: ‘0’, ‘sMsg’: ‘’, ‘tag’: ‘’}
- algoClOrdId: str = 'algoClOrdId'
- algoId: str = 'algoId'
- clOrdId: str = 'clOrdId'
- model_config: ClassVar[ConfigDict] = {}
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- model_fields: ClassVar[dict[str, FieldInfo]] = {'algoClOrdId': FieldInfo(annotation=str, required=True), 'algoId': FieldInfo(annotation=str, required=True), 'clOrdId': FieldInfo(annotation=str, required=True), 'sCode': FieldInfo(annotation=str, required=True), 'sMsg': FieldInfo(annotation=str, required=True), 'tag': FieldInfo(annotation=str, required=True)}
Metadata about the fields defined on the model, mapping of field names to [FieldInfo][pydantic.fields.FieldInfo].
This replaces Model.__fields__ from Pydantic V1.
- sCode: str = 'sCode'
- sMsg: str = 'sMsg'
- tag: str = 'tag'
- class pyokx.data_structures.Ask(*, price: str, quantity: str, deprecated_value: str, number_of_orders: str)[source]
Bases:
OKXBaseModel
e.g. ‘43752.4’, ‘156’, ‘0’, ‘1’
- deprecated_value: str = 'deprecated_value'
- model_config: ClassVar[ConfigDict] = {}
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- model_fields: ClassVar[dict[str, FieldInfo]] = {'deprecated_value': FieldInfo(annotation=str, required=True), 'number_of_orders': FieldInfo(annotation=str, required=True), 'price': FieldInfo(annotation=str, required=True), 'quantity': FieldInfo(annotation=str, required=True)}
Metadata about the fields defined on the model, mapping of field names to [FieldInfo][pydantic.fields.FieldInfo].
This replaces Model.__fields__ from Pydantic V1.
- number_of_orders: str = 'number_of_orders'
- price: str = 'price'
- quantity: str = 'quantity'
- class pyokx.data_structures.Bid(*, price: str, quantity: str, deprecated_value: str, number_of_orders: str)[source]
Bases:
OKXBaseModel
e.g. ‘43752.4’, ‘156’, ‘0’, ‘1’
- deprecated_value: str = 'deprecated_value'
- model_config: ClassVar[ConfigDict] = {}
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- model_fields: ClassVar[dict[str, FieldInfo]] = {'deprecated_value': FieldInfo(annotation=str, required=True), 'number_of_orders': FieldInfo(annotation=str, required=True), 'price': FieldInfo(annotation=str, required=True), 'quantity': FieldInfo(annotation=str, required=True)}
Metadata about the fields defined on the model, mapping of field names to [FieldInfo][pydantic.fields.FieldInfo].
This replaces Model.__fields__ from Pydantic V1.
- number_of_orders: str = 'number_of_orders'
- price: str = 'price'
- quantity: str = 'quantity'
- class pyokx.data_structures.Cancelled_Algo_Order(*, algoId: str, sCode: str, sMsg: str, algoClOrdId: str | None = None, clOrdId: str | None = None, tag: str | None = None)[source]
Bases:
OKXBaseModel
e.g. {‘algoClOrdId’: ‘’, ‘algoId’: ‘661126556584251392’, ‘clOrdId’: ‘’, ‘sCode’: ‘0’, ‘sMsg’: ‘’, ‘tag’: ‘’}
- algoClOrdId: str | None = 'algoClOrdId'
- algoId: str = 'algoId'
- clOrdId: str | None = 'clOrdId'
- model_config: ClassVar[ConfigDict] = {}
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- model_fields: ClassVar[dict[str, FieldInfo]] = {'algoClOrdId': FieldInfo(annotation=Union[str, NoneType], required=False), 'algoId': FieldInfo(annotation=str, required=True), 'clOrdId': FieldInfo(annotation=Union[str, NoneType], required=False), 'sCode': FieldInfo(annotation=str, required=True), 'sMsg': FieldInfo(annotation=str, required=True), 'tag': FieldInfo(annotation=Union[str, NoneType], required=False)}
Metadata about the fields defined on the model, mapping of field names to [FieldInfo][pydantic.fields.FieldInfo].
This replaces Model.__fields__ from Pydantic V1.
- sCode: str = 'sCode'
- sMsg: str = 'sMsg'
- tag: str | None = 'tag'
- class pyokx.data_structures.Cancelled_Order(*, clOrdId: str, ordId: str, sCode: str, sMsg: str)[source]
Bases:
OKXBaseModel
- clOrdId: str = 'clOrdId'
- model_config: ClassVar[ConfigDict] = {}
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- model_fields: ClassVar[dict[str, FieldInfo]] = {'clOrdId': FieldInfo(annotation=str, required=True), 'ordId': FieldInfo(annotation=str, required=True), 'sCode': FieldInfo(annotation=str, required=True), 'sMsg': FieldInfo(annotation=str, required=True)}
Metadata about the fields defined on the model, mapping of field names to [FieldInfo][pydantic.fields.FieldInfo].
This replaces Model.__fields__ from Pydantic V1.
- ordId: str = 'ordId'
- sCode: str = 'sCode'
- sMsg: str = 'sMsg'
- class pyokx.data_structures.Closed_Position(*, clOrdId: str, instId: str, posSide: str, tag: str)[source]
Bases:
OKXBaseModel
e.g. {‘clOrdId’: ‘’, ‘instId’: ‘BTC-USDT-240329’, ‘posSide’: ‘net’, ‘tag’: ‘’}
- clOrdId: str = 'clOrdId'
- instId: str = 'instId'
- model_config: ClassVar[ConfigDict] = {}
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- model_fields: ClassVar[dict[str, FieldInfo]] = {'clOrdId': FieldInfo(annotation=str, required=True), 'instId': FieldInfo(annotation=str, required=True), 'posSide': FieldInfo(annotation=str, required=True), 'tag': FieldInfo(annotation=str, required=True)}
Metadata about the fields defined on the model, mapping of field names to [FieldInfo][pydantic.fields.FieldInfo].
This replaces Model.__fields__ from Pydantic V1.
- posSide: str = 'posSide'
- tag: str = 'tag'
- class pyokx.data_structures.DCAInputParameters(*, usd_amount: float, trigger_price_offset: float, order_type: str, order_side: str, execution_price_offset: float | None = 0, tp_trigger_price_type: str | None = '', tp_trigger_price_offset: float | None = 0, tp_execution_price_offset: float | None = 0, sl_trigger_price_type: str | None = '', sl_trigger_price_offset: float | None = 0, sl_execution_price_offset: float | None = 0)[source]
Bases:
OKXBaseModel
- execution_price_offset: float | None = 'execution_price_offset'
- model_config: ClassVar[ConfigDict] = {}
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- model_fields: ClassVar[dict[str, FieldInfo]] = {'execution_price_offset': FieldInfo(annotation=Union[float, NoneType], required=False, default=0), 'order_side': FieldInfo(annotation=str, required=True), 'order_type': FieldInfo(annotation=str, required=True), 'sl_execution_price_offset': FieldInfo(annotation=Union[float, NoneType], required=False, default=0), 'sl_trigger_price_offset': FieldInfo(annotation=Union[float, NoneType], required=False, default=0), 'sl_trigger_price_type': FieldInfo(annotation=Union[str, NoneType], required=False, default=''), 'tp_execution_price_offset': FieldInfo(annotation=Union[float, NoneType], required=False, default=0), 'tp_trigger_price_offset': FieldInfo(annotation=Union[float, NoneType], required=False, default=0), 'tp_trigger_price_type': FieldInfo(annotation=Union[str, NoneType], required=False, default=''), 'trigger_price_offset': FieldInfo(annotation=float, required=True), 'usd_amount': FieldInfo(annotation=float, required=True)}
Metadata about the fields defined on the model, mapping of field names to [FieldInfo][pydantic.fields.FieldInfo].
This replaces Model.__fields__ from Pydantic V1.
- order_side: str = 'order_side'
- order_type: str = 'order_type'
- sl_execution_price_offset: float | None = 'sl_execution_price_offset'
- sl_trigger_price_offset: float | None = 'sl_trigger_price_offset'
- sl_trigger_price_type: str | None = 'sl_trigger_price_type'
- tp_execution_price_offset: float | None = 'tp_execution_price_offset'
- tp_trigger_price_offset: float | None = 'tp_trigger_price_offset'
- tp_trigger_price_type: str | None = 'tp_trigger_price_type'
- trigger_price_offset: float = 'trigger_price_offset'
- usd_amount: float = 'usd_amount'
- class pyokx.data_structures.DCAOrderParameters(*, size: float, trigger_price: float, type: str, side: str, execution_price: float | None, tp_trigger_price_type: str | None = '', tp_trigger_price_offset: float | None = 0, tp_execution_price_offset: float | None = 0, sl_trigger_price_type: str | None = '', sl_trigger_price_offset: float | None = 0, sl_execution_price_offset: float | None = 0)[source]
Bases:
OKXBaseModel
- execution_price: float | None = 'execution_price'
- model_config: ClassVar[ConfigDict] = {}
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- model_fields: ClassVar[dict[str, FieldInfo]] = {'execution_price': FieldInfo(annotation=Union[float, NoneType], required=True), 'side': FieldInfo(annotation=str, required=True), 'size': FieldInfo(annotation=float, required=True), 'sl_execution_price_offset': FieldInfo(annotation=Union[float, NoneType], required=False, default=0), 'sl_trigger_price_offset': FieldInfo(annotation=Union[float, NoneType], required=False, default=0), 'sl_trigger_price_type': FieldInfo(annotation=Union[str, NoneType], required=False, default=''), 'tp_execution_price_offset': FieldInfo(annotation=Union[float, NoneType], required=False, default=0), 'tp_trigger_price_offset': FieldInfo(annotation=Union[float, NoneType], required=False, default=0), 'tp_trigger_price_type': FieldInfo(annotation=Union[str, NoneType], required=False, default=''), 'trigger_price': FieldInfo(annotation=float, required=True), 'type': FieldInfo(annotation=str, required=True)}
Metadata about the fields defined on the model, mapping of field names to [FieldInfo][pydantic.fields.FieldInfo].
This replaces Model.__fields__ from Pydantic V1.
- side: str = 'side'
- size: float = 'size'
- sl_execution_price_offset: float | None = 'sl_execution_price_offset'
- sl_trigger_price_offset: float | None = 'sl_trigger_price_offset'
- sl_trigger_price_type: str | None = 'sl_trigger_price_type'
- tp_execution_price_offset: float | None = 'tp_execution_price_offset'
- tp_trigger_price_offset: float | None = 'tp_trigger_price_offset'
- tp_trigger_price_type: str | None = 'tp_trigger_price_type'
- trigger_price: float = 'trigger_price'
- type: str = 'type'
- class pyokx.data_structures.FillEntry(*, side: str, fillSz: str, fillPx: str, fee: str, fillPnl: str, ordId: str, instType: str, instId: str, clOrdId: str, posSide: str, billId: str, fillTime: str, execType: str, tradeId: str, feeCcy: str, ts: str, fillPxVol: str | None = None, fillFwdPx: str | None = None, fillPxUsd: str | None = None, fillMarkVol: str | None = None, tag: str | None = None, fillIdxPx: str | None = None, fillMarkPx: str | None = None)[source]
Bases:
OKXBaseModel
- billId: str = 'billId'
- clOrdId: str = 'clOrdId'
- execType: str = 'execType'
- fee: str = 'fee'
- feeCcy: str = 'feeCcy'
- fillFwdPx: str | None = 'fillFwdPx'
- fillIdxPx: str | None = 'fillIdxPx'
- fillMarkPx: str | None = 'fillMarkPx'
- fillMarkVol: str | None = 'fillMarkVol'
- fillPnl: str = 'fillPnl'
- fillPx: str = 'fillPx'
- fillPxUsd: str | None = 'fillPxUsd'
- fillPxVol: str | None = 'fillPxVol'
- fillSz: str = 'fillSz'
- fillTime: str = 'fillTime'
- instId: str = 'instId'
- instType: str = 'instType'
- model_config: ClassVar[ConfigDict] = {}
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- model_fields: ClassVar[dict[str, FieldInfo]] = {'billId': FieldInfo(annotation=str, required=True), 'clOrdId': FieldInfo(annotation=str, required=True), 'execType': FieldInfo(annotation=str, required=True), 'fee': FieldInfo(annotation=str, required=True), 'feeCcy': FieldInfo(annotation=str, required=True), 'fillFwdPx': FieldInfo(annotation=Union[str, NoneType], required=False), 'fillIdxPx': FieldInfo(annotation=Union[str, NoneType], required=False), 'fillMarkPx': FieldInfo(annotation=Union[str, NoneType], required=False), 'fillMarkVol': FieldInfo(annotation=Union[str, NoneType], required=False), 'fillPnl': FieldInfo(annotation=str, required=True), 'fillPx': FieldInfo(annotation=str, required=True), 'fillPxUsd': FieldInfo(annotation=Union[str, NoneType], required=False), 'fillPxVol': FieldInfo(annotation=Union[str, NoneType], required=False), 'fillSz': FieldInfo(annotation=str, required=True), 'fillTime': FieldInfo(annotation=str, required=True), 'instId': FieldInfo(annotation=str, required=True), 'instType': FieldInfo(annotation=str, required=True), 'ordId': FieldInfo(annotation=str, required=True), 'posSide': FieldInfo(annotation=str, required=True), 'side': FieldInfo(annotation=str, required=True), 'tag': FieldInfo(annotation=Union[str, NoneType], required=False), 'tradeId': FieldInfo(annotation=str, required=True), 'ts': FieldInfo(annotation=str, required=True)}
Metadata about the fields defined on the model, mapping of field names to [FieldInfo][pydantic.fields.FieldInfo].
This replaces Model.__fields__ from Pydantic V1.
- ordId: str = 'ordId'
- posSide: str = 'posSide'
- side: str = 'side'
- tag: str | None = 'tag'
- tradeId: str = 'tradeId'
- ts: str = 'ts'
- class pyokx.data_structures.FillHistoricalMetrics(*, ONE_DAY: List[FillHistoricalMetricsEntry], ONE_WEEK: List[FillHistoricalMetricsEntry], ONE_MONTH: List[FillHistoricalMetricsEntry], THREE_MONTHS: List[FillHistoricalMetricsEntry])[source]
Bases:
OKXBaseModel
- ONE_DAY: List[FillHistoricalMetricsEntry] = 'ONE_DAY'
- ONE_MONTH: List[FillHistoricalMetricsEntry] = 'ONE_MONTH'
- ONE_WEEK: List[FillHistoricalMetricsEntry] = 'ONE_WEEK'
- THREE_MONTHS: List[FillHistoricalMetricsEntry] = 'THREE_MONTHS'
- model_config: ClassVar[ConfigDict] = {}
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- model_fields: ClassVar[dict[str, FieldInfo]] = {'ONE_DAY': FieldInfo(annotation=List[FillHistoricalMetricsEntry], required=True), 'ONE_MONTH': FieldInfo(annotation=List[FillHistoricalMetricsEntry], required=True), 'ONE_WEEK': FieldInfo(annotation=List[FillHistoricalMetricsEntry], required=True), 'THREE_MONTHS': FieldInfo(annotation=List[FillHistoricalMetricsEntry], required=True)}
Metadata about the fields defined on the model, mapping of field names to [FieldInfo][pydantic.fields.FieldInfo].
This replaces Model.__fields__ from Pydantic V1.
- class pyokx.data_structures.FillHistoricalMetricsEntry(*, instrument_id: str, volume_traded: float, average_fill_price: float, profit_loss: float, fees_paid: float, profitable_trades: int, loss_making_trades: int, best_trade: float, worst_trade: float, avg_fill_pnl: float)[source]
Bases:
OKXBaseModel
- average_fill_price: float = 'average_fill_price'
- avg_fill_pnl: float = 'avg_fill_pnl'
- best_trade: float = 'best_trade'
- fees_paid: float = 'fees_paid'
- instrument_id: str = 'instrument_id'
- loss_making_trades: int = 'loss_making_trades'
- model_config: ClassVar[ConfigDict] = {}
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- model_fields: ClassVar[dict[str, FieldInfo]] = {'average_fill_price': FieldInfo(annotation=float, required=True), 'avg_fill_pnl': FieldInfo(annotation=float, required=True), 'best_trade': FieldInfo(annotation=float, required=True), 'fees_paid': FieldInfo(annotation=float, required=True), 'instrument_id': FieldInfo(annotation=str, required=True), 'loss_making_trades': FieldInfo(annotation=int, required=True), 'profit_loss': FieldInfo(annotation=float, required=True), 'profitable_trades': FieldInfo(annotation=int, required=True), 'volume_traded': FieldInfo(annotation=float, required=True), 'worst_trade': FieldInfo(annotation=float, required=True)}
Metadata about the fields defined on the model, mapping of field names to [FieldInfo][pydantic.fields.FieldInfo].
This replaces Model.__fields__ from Pydantic V1.
- profit_loss: float = 'profit_loss'
- profitable_trades: int = 'profitable_trades'
- volume_traded: float = 'volume_traded'
- worst_trade: float = 'worst_trade'
- class pyokx.data_structures.InstIdSignalRequestForm(*, InstIdAPIKey: str, OKXSignalInput: OKXSignalInput)[source]
Bases:
OKXBaseModel
- InstIdAPIKey: str = 'InstIdAPIKey'
- OKXSignalInput: OKXSignalInput = 'OKXSignalInput'
- model_config: ClassVar[ConfigDict] = {}
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- model_fields: ClassVar[dict[str, FieldInfo]] = {'InstIdAPIKey': FieldInfo(annotation=str, required=True), 'OKXSignalInput': FieldInfo(annotation=OKXSignalInput, required=True)}
Metadata about the fields defined on the model, mapping of field names to [FieldInfo][pydantic.fields.FieldInfo].
This replaces Model.__fields__ from Pydantic V1.
- class pyokx.data_structures.Instrument(*, alias: str, baseCcy: str, category: str, ctMult: str, ctType: str, ctVal: str, ctValCcy: str, expTime: str, instFamily: str, instId: str, instType: str, lever: str, listTime: str, lotSz: str, maxIcebergSz: str, maxLmtAmt: str, maxLmtSz: str, maxMktAmt: str, maxMktSz: str, maxStopSz: str, maxTriggerSz: str, maxTwapSz: str, minSz: str, optType: str, quoteCcy: str, settleCcy: str, state: str, stk: str, tickSz: str, uly: str)[source]
Bases:
OKXBaseModel
- e.g. {‘alias’: ‘next_month’, ‘baseCcy’: ‘’, ‘category’: ‘1’, ‘ctMult’: ‘1’, ‘ctType’: ‘inverse’, ‘ctVal’: ‘100’,
‘ctValCcy’: ‘USD’, ‘expTime’: ‘1708675200000’, ‘instFamily’: ‘BTC-USD’, ‘instId’: ‘BTC-USD-240223’, ‘instType’: ‘FUTURES’, ‘lever’: ‘100’, ‘listTime’: ‘1702627800062’, ‘lotSz’: ‘1’, ‘maxIcebergSz’: ‘1000000.0000000000000000’, ‘maxLmtAmt’: ‘1000000’, ‘maxLmtSz’: ‘1000000’, ‘maxMktAmt’: ‘’, ‘maxMktSz’: ‘10000’, ‘maxStopSz’: ‘10000’, ‘maxTriggerSz’: ‘1000000.0000000000000000’, ‘maxTwapSz’: ‘1000000.0000000000000000’, ‘minSz’: ‘1’, ‘optType’: ‘’, ‘quoteCcy’: ‘’, ‘settleCcy’: ‘BTC’, ‘state’: ‘live’, ‘stk’: ‘’, ‘tickSz’: ‘0.01’, ‘uly’: ‘BTC-USD’}
- alias: str = 'alias'
- baseCcy: str = 'baseCcy'
- category: str = 'category'
- ctMult: str = 'ctMult'
- ctType: str = 'ctType'
- ctVal: str = 'ctVal'
- ctValCcy: str = 'ctValCcy'
- expTime: str = 'expTime'
- instFamily: str = 'instFamily'
- instId: str = 'instId'
- instType: str = 'instType'
- lever: str = 'lever'
- listTime: str = 'listTime'
- lotSz: str = 'lotSz'
- maxIcebergSz: str = 'maxIcebergSz'
- maxLmtAmt: str = 'maxLmtAmt'
- maxLmtSz: str = 'maxLmtSz'
- maxMktAmt: str = 'maxMktAmt'
- maxMktSz: str = 'maxMktSz'
- maxStopSz: str = 'maxStopSz'
- maxTriggerSz: str = 'maxTriggerSz'
- maxTwapSz: str = 'maxTwapSz'
- minSz: str = 'minSz'
- model_config: ClassVar[ConfigDict] = {}
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- model_fields: ClassVar[dict[str, FieldInfo]] = {'alias': FieldInfo(annotation=str, required=True), 'baseCcy': FieldInfo(annotation=str, required=True), 'category': FieldInfo(annotation=str, required=True), 'ctMult': FieldInfo(annotation=str, required=True), 'ctType': FieldInfo(annotation=str, required=True), 'ctVal': FieldInfo(annotation=str, required=True), 'ctValCcy': FieldInfo(annotation=str, required=True), 'expTime': FieldInfo(annotation=str, required=True), 'instFamily': FieldInfo(annotation=str, required=True), 'instId': FieldInfo(annotation=str, required=True), 'instType': FieldInfo(annotation=str, required=True), 'lever': FieldInfo(annotation=str, required=True), 'listTime': FieldInfo(annotation=str, required=True), 'lotSz': FieldInfo(annotation=str, required=True), 'maxIcebergSz': FieldInfo(annotation=str, required=True), 'maxLmtAmt': FieldInfo(annotation=str, required=True), 'maxLmtSz': FieldInfo(annotation=str, required=True), 'maxMktAmt': FieldInfo(annotation=str, required=True), 'maxMktSz': FieldInfo(annotation=str, required=True), 'maxStopSz': FieldInfo(annotation=str, required=True), 'maxTriggerSz': FieldInfo(annotation=str, required=True), 'maxTwapSz': FieldInfo(annotation=str, required=True), 'minSz': FieldInfo(annotation=str, required=True), 'optType': FieldInfo(annotation=str, required=True), 'quoteCcy': FieldInfo(annotation=str, required=True), 'settleCcy': FieldInfo(annotation=str, required=True), 'state': FieldInfo(annotation=str, required=True), 'stk': FieldInfo(annotation=str, required=True), 'tickSz': FieldInfo(annotation=str, required=True), 'uly': FieldInfo(annotation=str, required=True)}
Metadata about the fields defined on the model, mapping of field names to [FieldInfo][pydantic.fields.FieldInfo].
This replaces Model.__fields__ from Pydantic V1.
- optType: str = 'optType'
- quoteCcy: str = 'quoteCcy'
- settleCcy: str = 'settleCcy'
- state: str = 'state'
- stk: str = 'stk'
- tickSz: str = 'tickSz'
- uly: str = 'uly'
- class pyokx.data_structures.MaxAvailSizeData(*, availBuy: str, availSell: str, instId: str)[source]
Bases:
OKXBaseModel
- availBuy: str = 'availBuy'
- availSell: str = 'availSell'
- instId: str = 'instId'
- model_config: ClassVar[ConfigDict] = {}
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- model_fields: ClassVar[dict[str, FieldInfo]] = {'availBuy': FieldInfo(annotation=str, required=True), 'availSell': FieldInfo(annotation=str, required=True), 'instId': FieldInfo(annotation=str, required=True)}
Metadata about the fields defined on the model, mapping of field names to [FieldInfo][pydantic.fields.FieldInfo].
This replaces Model.__fields__ from Pydantic V1.
- class pyokx.data_structures.MaxOrderSizeData(*, ccy: str, instId: str, maxBuy: str, maxSell: str)[source]
Bases:
OKXBaseModel
- ccy: str = 'ccy'
- instId: str = 'instId'
- maxBuy: str = 'maxBuy'
- maxSell: str = 'maxSell'
- model_config: ClassVar[ConfigDict] = {}
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- model_fields: ClassVar[dict[str, FieldInfo]] = {'ccy': FieldInfo(annotation=str, required=True), 'instId': FieldInfo(annotation=str, required=True), 'maxBuy': FieldInfo(annotation=str, required=True), 'maxSell': FieldInfo(annotation=str, required=True)}
Metadata about the fields defined on the model, mapping of field names to [FieldInfo][pydantic.fields.FieldInfo].
This replaces Model.__fields__ from Pydantic V1.
- class pyokx.data_structures.OKXBaseModel[source]
Bases:
BaseModel
- model_config: ClassVar[ConfigDict] = {}
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- model_fields: ClassVar[dict[str, FieldInfo]] = {}
Metadata about the fields defined on the model, mapping of field names to [FieldInfo][pydantic.fields.FieldInfo].
This replaces Model.__fields__ from Pydantic V1.
- class pyokx.data_structures.OKXBaseModelModelMeta(cls_name: str, bases: tuple[type[Any], ...], namespace: dict[str, Any], __pydantic_generic_metadata__: PydanticGenericMetadata | None = None, __pydantic_reset_parent_namespace__: bool = True, _create_model_module: str | None = None, **kwargs: Any)[source]
Bases:
ModelMetaclass
- class pyokx.data_structures.OKXPremiumIndicatorSignalRequestForm(*, InstIdAPIKey: str, OKXSignalInput: OKXSignalInput, PremiumIndicatorSignals: PremiumIndicatorSignals)[source]
Bases:
OKXBaseModel
- InstIdAPIKey: str = 'InstIdAPIKey'
- OKXSignalInput: OKXSignalInput = 'OKXSignalInput'
- PremiumIndicatorSignals: PremiumIndicatorSignals = 'PremiumIndicatorSignals'
- model_config: ClassVar[ConfigDict] = {}
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- model_fields: ClassVar[dict[str, FieldInfo]] = {'InstIdAPIKey': FieldInfo(annotation=str, required=True), 'OKXSignalInput': FieldInfo(annotation=OKXSignalInput, required=True), 'PremiumIndicatorSignals': FieldInfo(annotation=PremiumIndicatorSignals, required=True)}
Metadata about the fields defined on the model, mapping of field names to [FieldInfo][pydantic.fields.FieldInfo].
This replaces Model.__fields__ from Pydantic V1.
- class pyokx.data_structures.OKXSignalInput(*, instID: str | None = '', usd_order_size: float | None = 0, leverage: int | None = 0, order_side: str | None = '', order_type: str | None = '', max_orderbook_limit_price_offset: float | None = 0, min_orderbook_limit_price_offset: float | None = 0, flip_position_if_opposite_side: bool | None = False, clear_prior_to_new_order: bool | None = False, red_button: bool | None = False, tp_trigger_price_type: str | None = '', tp_trigger_price_offset: float | None = 0, tp_execution_price_offset: float | None = 0, sl_trigger_price_type: str | None = '', sl_trigger_price_offset: float | None = 0, sl_execution_price_offset: float | None = 0, trailing_stop_activation_price_offset: float | None = 0, trailing_stop_callback_offset: float | None = 0, dca_parameters: List[DCAInputParameters] | None = [])[source]
Bases:
OKXBaseModel
- clear_prior_to_new_order: bool | None = 'clear_prior_to_new_order'
- dca_parameters: List[DCAInputParameters] | None = 'dca_parameters'
- flip_position_if_opposite_side: bool | None = 'flip_position_if_opposite_side'
- instID: str | None = 'instID'
- leverage: int | None = 'leverage'
- max_orderbook_limit_price_offset: float | None = 'max_orderbook_limit_price_offset'
- min_orderbook_limit_price_offset: float | None = 'min_orderbook_limit_price_offset'
- model_config: ClassVar[ConfigDict] = {}
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- model_fields: ClassVar[dict[str, FieldInfo]] = {'clear_prior_to_new_order': FieldInfo(annotation=Union[bool, NoneType], required=False, default=False), 'dca_parameters': FieldInfo(annotation=Union[List[DCAInputParameters], NoneType], required=False, default=[]), 'flip_position_if_opposite_side': FieldInfo(annotation=Union[bool, NoneType], required=False, default=False), 'instID': FieldInfo(annotation=Union[str, NoneType], required=False, default=''), 'leverage': FieldInfo(annotation=Union[int, NoneType], required=False, default=0), 'max_orderbook_limit_price_offset': FieldInfo(annotation=Union[float, NoneType], required=False, default=0), 'min_orderbook_limit_price_offset': FieldInfo(annotation=Union[float, NoneType], required=False, default=0), 'order_side': FieldInfo(annotation=Union[str, NoneType], required=False, default=''), 'order_type': FieldInfo(annotation=Union[str, NoneType], required=False, default=''), 'red_button': FieldInfo(annotation=Union[bool, NoneType], required=False, default=False), 'sl_execution_price_offset': FieldInfo(annotation=Union[float, NoneType], required=False, default=0), 'sl_trigger_price_offset': FieldInfo(annotation=Union[float, NoneType], required=False, default=0), 'sl_trigger_price_type': FieldInfo(annotation=Union[str, NoneType], required=False, default=''), 'tp_execution_price_offset': FieldInfo(annotation=Union[float, NoneType], required=False, default=0), 'tp_trigger_price_offset': FieldInfo(annotation=Union[float, NoneType], required=False, default=0), 'tp_trigger_price_type': FieldInfo(annotation=Union[str, NoneType], required=False, default=''), 'trailing_stop_activation_price_offset': FieldInfo(annotation=Union[float, NoneType], required=False, default=0), 'trailing_stop_callback_offset': FieldInfo(annotation=Union[float, NoneType], required=False, default=0), 'usd_order_size': FieldInfo(annotation=Union[float, NoneType], required=False, default=0)}
Metadata about the fields defined on the model, mapping of field names to [FieldInfo][pydantic.fields.FieldInfo].
This replaces Model.__fields__ from Pydantic V1.
- order_side: str | None = 'order_side'
- order_type: str | None = 'order_type'
- red_button: bool | None = 'red_button'
- sl_execution_price_offset: float | None = 'sl_execution_price_offset'
- sl_trigger_price_offset: float | None = 'sl_trigger_price_offset'
- sl_trigger_price_type: str | None = 'sl_trigger_price_type'
- tp_execution_price_offset: float | None = 'tp_execution_price_offset'
- tp_trigger_price_offset: float | None = 'tp_trigger_price_offset'
- tp_trigger_price_type: str | None = 'tp_trigger_price_type'
- trailing_stop_activation_price_offset: float | None = 'trailing_stop_activation_price_offset'
- trailing_stop_callback_offset: float | None = 'trailing_stop_callback_offset'
- usd_order_size: float | None = 'usd_order_size'
- class pyokx.data_structures.Order(*, accFillSz: str, algoClOrdId: str, algoId: str, attachAlgoClOrdId: str, attachAlgoOrds: List[str], avgPx: str, cTime: str, cancelSource: str, cancelSourceReason: str, category: str, ccy: str, clOrdId: str, fee: str, feeCcy: str, fillPx: str, fillSz: str, fillTime: str, instId: str, instType: str, lever: str, ordId: str, ordType: str, pnl: str, posSide: str, px: str, pxType: str, pxUsd: str, pxVol: str, quickMgnType: str, rebate: str, rebateCcy: str, reduceOnly: str, side: str, slOrdPx: str, slTriggerPx: str, slTriggerPxType: str, source: str, state: str, stpId: str, stpMode: str, sz: str, tag: str, tdMode: str, tgtCcy: str, tpOrdPx: str, tpTriggerPx: str, tpTriggerPxType: str, tradeId: str, uTime: str)[source]
Bases:
OKXBaseModel
- accFillSz: str = 'accFillSz'
- algoClOrdId: str = 'algoClOrdId'
- algoId: str = 'algoId'
- attachAlgoClOrdId: str = 'attachAlgoClOrdId'
- attachAlgoOrds: List[str] = 'attachAlgoOrds'
- avgPx: str = 'avgPx'
- cTime: str = 'cTime'
- cancelSource: str = 'cancelSource'
- cancelSourceReason: str = 'cancelSourceReason'
- category: str = 'category'
- ccy: str = 'ccy'
- clOrdId: str = 'clOrdId'
- fee: str = 'fee'
- feeCcy: str = 'feeCcy'
- fillPx: str = 'fillPx'
- fillSz: str = 'fillSz'
- fillTime: str = 'fillTime'
- instId: str = 'instId'
- instType: str = 'instType'
- lever: str = 'lever'
- model_config: ClassVar[ConfigDict] = {}
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- model_fields: ClassVar[dict[str, FieldInfo]] = {'accFillSz': FieldInfo(annotation=str, required=True), 'algoClOrdId': FieldInfo(annotation=str, required=True), 'algoId': FieldInfo(annotation=str, required=True), 'attachAlgoClOrdId': FieldInfo(annotation=str, required=True), 'attachAlgoOrds': FieldInfo(annotation=List[str], required=True), 'avgPx': FieldInfo(annotation=str, required=True), 'cTime': FieldInfo(annotation=str, required=True), 'cancelSource': FieldInfo(annotation=str, required=True), 'cancelSourceReason': FieldInfo(annotation=str, required=True), 'category': FieldInfo(annotation=str, required=True), 'ccy': FieldInfo(annotation=str, required=True), 'clOrdId': FieldInfo(annotation=str, required=True), 'fee': FieldInfo(annotation=str, required=True), 'feeCcy': FieldInfo(annotation=str, required=True), 'fillPx': FieldInfo(annotation=str, required=True), 'fillSz': FieldInfo(annotation=str, required=True), 'fillTime': FieldInfo(annotation=str, required=True), 'instId': FieldInfo(annotation=str, required=True), 'instType': FieldInfo(annotation=str, required=True), 'lever': FieldInfo(annotation=str, required=True), 'ordId': FieldInfo(annotation=str, required=True), 'ordType': FieldInfo(annotation=str, required=True), 'pnl': FieldInfo(annotation=str, required=True), 'posSide': FieldInfo(annotation=str, required=True), 'px': FieldInfo(annotation=str, required=True), 'pxType': FieldInfo(annotation=str, required=True), 'pxUsd': FieldInfo(annotation=str, required=True), 'pxVol': FieldInfo(annotation=str, required=True), 'quickMgnType': FieldInfo(annotation=str, required=True), 'rebate': FieldInfo(annotation=str, required=True), 'rebateCcy': FieldInfo(annotation=str, required=True), 'reduceOnly': FieldInfo(annotation=str, required=True), 'side': FieldInfo(annotation=str, required=True), 'slOrdPx': FieldInfo(annotation=str, required=True), 'slTriggerPx': FieldInfo(annotation=str, required=True), 'slTriggerPxType': FieldInfo(annotation=str, required=True), 'source': FieldInfo(annotation=str, required=True), 'state': FieldInfo(annotation=str, required=True), 'stpId': FieldInfo(annotation=str, required=True), 'stpMode': FieldInfo(annotation=str, required=True), 'sz': FieldInfo(annotation=str, required=True), 'tag': FieldInfo(annotation=str, required=True), 'tdMode': FieldInfo(annotation=str, required=True), 'tgtCcy': FieldInfo(annotation=str, required=True), 'tpOrdPx': FieldInfo(annotation=str, required=True), 'tpTriggerPx': FieldInfo(annotation=str, required=True), 'tpTriggerPxType': FieldInfo(annotation=str, required=True), 'tradeId': FieldInfo(annotation=str, required=True), 'uTime': FieldInfo(annotation=str, required=True)}
Metadata about the fields defined on the model, mapping of field names to [FieldInfo][pydantic.fields.FieldInfo].
This replaces Model.__fields__ from Pydantic V1.
- ordId: str = 'ordId'
- ordType: str = 'ordType'
- pnl: str = 'pnl'
- posSide: str = 'posSide'
- px: str = 'px'
- pxType: str = 'pxType'
- pxUsd: str = 'pxUsd'
- pxVol: str = 'pxVol'
- quickMgnType: str = 'quickMgnType'
- rebate: str = 'rebate'
- rebateCcy: str = 'rebateCcy'
- reduceOnly: str = 'reduceOnly'
- side: str = 'side'
- slOrdPx: str = 'slOrdPx'
- slTriggerPx: str = 'slTriggerPx'
- slTriggerPxType: str = 'slTriggerPxType'
- source: str = 'source'
- state: str = 'state'
- stpId: str = 'stpId'
- stpMode: str = 'stpMode'
- sz: str = 'sz'
- tag: str = 'tag'
- tdMode: str = 'tdMode'
- tgtCcy: str = 'tgtCcy'
- tpOrdPx: str = 'tpOrdPx'
- tpTriggerPx: str = 'tpTriggerPx'
- tpTriggerPxType: str = 'tpTriggerPxType'
- tradeId: str = 'tradeId'
- uTime: str = 'uTime'
- class pyokx.data_structures.Order_Placement_Return(*, clOrdId: str, ordId: str, sCode: str, sMsg: str, tag: str)[source]
Bases:
OKXBaseModel
e.g. {‘clOrdId’: ‘’, ‘ordId’: ‘660478634888654848’, ‘sCode’: ‘0’, ‘sMsg’: ‘Order placed’, ‘tag’: ‘’}
- clOrdId: str = 'clOrdId'
- model_config: ClassVar[ConfigDict] = {}
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- model_fields: ClassVar[dict[str, FieldInfo]] = {'clOrdId': FieldInfo(annotation=str, required=True), 'ordId': FieldInfo(annotation=str, required=True), 'sCode': FieldInfo(annotation=str, required=True), 'sMsg': FieldInfo(annotation=str, required=True), 'tag': FieldInfo(annotation=str, required=True)}
Metadata about the fields defined on the model, mapping of field names to [FieldInfo][pydantic.fields.FieldInfo].
This replaces Model.__fields__ from Pydantic V1.
- ordId: str = 'ordId'
- sCode: str = 'sCode'
- sMsg: str = 'sMsg'
- tag: str = 'tag'
- class pyokx.data_structures.Orderbook_Snapshot(*, instId: str, depth: str, asks: List[Ask], bids: List[Bid], ts: str)[source]
Bases:
OKXBaseModel
- e.g. {‘asks’: [[‘43746.5’, ‘106’, ‘0’, ‘1’], [‘43751.1’, ‘171’, ‘0’, ‘1’], [‘43751.2’, ‘118’, ‘0’, ‘1’],
[‘43752.4’, ‘156’, ‘0’, ‘1’], [‘43753.5’, ‘151’, ‘0’, ‘1’], [‘43753.7’, ‘126’, ‘0’, ‘1’], [‘43754.7’, ‘121’, ‘0’, ‘1’], [‘43754.8’, ‘158’, ‘0’, ‘1’], [‘43755.4’, ‘307’, ‘0’, ‘2’], [‘43755.7’, ‘179’, ‘0’, ‘1’], [‘43756.4’, ‘134’, ‘0’, ‘1’], [‘43757’, ‘179’, ‘0’, ‘1’], [‘43757.2’, ‘154’, ‘0’, ‘1’], [‘43757.3’, ‘171’, ‘0’, ‘1’], [‘43758.1’, ‘165’, ‘0’, ‘1’], [‘43759.1’, ‘159’, ‘0’, ‘1’], [‘43759.2’, ‘128’, ‘0’, ‘1’], [‘43759.4’, ‘125’, ‘0’, ‘1’], [‘43760.3’, ‘169’, ‘0’, ‘1’], [‘43922.5’, ‘1’, ‘0’, ‘1’]],
- ‘bids’: [[‘43746.4’, ‘136’, ‘0’, ‘1’], [‘43746.3’, ‘151’, ‘0’, ‘1’], [‘43740.7’, ‘153’, ‘0’, ‘1’],
[‘43739.6’, ‘163’, ‘0’, ‘1’], [‘43739.3’, ‘143’, ‘0’, ‘1’], [‘43737.9’, ‘133’, ‘0’, ‘1’], [‘43736.8’, ‘163’, ‘0’, ‘1’], [‘43735.1’, ‘168’, ‘0’, ‘1’], [‘43735’, ‘165’, ‘0’, ‘1’], [‘43734.9’, ‘168’, ‘0’, ‘1’], [‘43733.8’, ‘171’, ‘0’, ‘1’], [‘43733.1’, ‘296’, ‘0’, ‘2’], [‘43732.7’, ‘131’, ‘0’, ‘1’], [‘43732.6’, ‘127’, ‘0’, ‘1’], [‘43731.6’, ‘314’, ‘0’, ‘2’], [‘43729’, ‘298’, ‘0’, ‘2’], [‘43728.8’, ‘180’, ‘0’, ‘1’], [‘43514’, ‘1’, ‘0’, ‘1’], [‘43311.2’, ‘1’, ‘0’, ‘1’], [‘43109.3’, ‘1’, ‘0’, ‘1’]], ‘ts’: ‘1703914467407’}
- depth: str = 'depth'
- instId: str = 'instId'
- model_config: ClassVar[ConfigDict] = {}
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- model_fields: ClassVar[dict[str, FieldInfo]] = {'asks': FieldInfo(annotation=List[Ask], required=True), 'bids': FieldInfo(annotation=List[Bid], required=True), 'depth': FieldInfo(annotation=str, required=True), 'instId': FieldInfo(annotation=str, required=True), 'ts': FieldInfo(annotation=str, required=True)}
Metadata about the fields defined on the model, mapping of field names to [FieldInfo][pydantic.fields.FieldInfo].
This replaces Model.__fields__ from Pydantic V1.
- ts: str = 'ts'
- class pyokx.data_structures.Position(*, adl: str, availPos: str, avgPx: str, baseBal: str, baseBorrowed: str, baseInterest: str, bePx: str, bizRefId: str, bizRefType: str, cTime: str, ccy: str, closeOrderAlgo: List[dict], deltaBS: str, deltaPA: str, fee: str, fundingFee: str, gammaBS: str, gammaPA: str, idxPx: str, imr: str, instId: str, instType: str, interest: str, last: str, lever: str, liab: str, liabCcy: str, liqPenalty: str, liqPx: str, margin: str, markPx: str, mgnMode: str, mgnRatio: str, mmr: str, notionalUsd: str, optVal: str, pendingCloseOrdLiabVal: str, pnl: str, pos: str, posCcy: str, posId: str, posSide: str, quoteBal: str, quoteBorrowed: str, quoteInterest: str, realizedPnl: str, spotInUseAmt: str, spotInUseCcy: str, thetaBS: str, thetaPA: str, tradeId: str, uTime: str, upl: str, uplLastPx: str, uplRatio: str, uplRatioLastPx: str, usdPx: str, vegaBS: str, vegaPA: str)[source]
Bases:
OKXBaseModel
e.g. {‘adl’: ‘1’, ‘availPos’: ‘’, ‘avgPx’: ‘45075.3000000000000001’, ‘baseBal’: ‘’, ‘baseBorrowed’: ‘’, ‘baseInterest’: ‘’, ‘bePx’: ‘45120.39784892446’, ‘bizRefId’: ‘’, ‘bizRefType’: ‘’, ‘cTime’: ‘1703728631744’, ‘ccy’: ‘USDT’, ‘closeOrderAlgo’: [], ‘deltaBS’: ‘’, ‘deltaPA’: ‘’, ‘fee’: ‘-0.901506’, ‘fundingFee’: ‘0’, ‘gammaBS’: ‘’, ‘gammaPA’: ‘’, ‘idxPx’: ‘43474.0’, ‘imr’: ‘’, ‘instId’: ‘BTC-USDT-240329’, ‘instType’: ‘FUTURES’, ‘interest’: ‘’, ‘last’: ‘45070.1’, ‘lever’: ‘3’, ‘liab’: ‘’, ‘liabCcy’: ‘’, ‘liqPenalty’: ‘0’, ‘liqPx’: ‘30186.137167252637’, ‘margin’: ‘601.004’, ‘markPx’: ‘45068’, ‘mgnMode’: ‘isolated’, ‘mgnRatio’: ‘74.05007741388319’, ‘mmr’: ‘7.21088’, ‘notionalUsd’: ‘1804.4145568’, ‘optVal’: ‘’, ‘pendingCloseOrdLiabVal’: ‘’, ‘pnl’: ‘0’, ‘pos’: ‘4’, ‘posCcy’: ‘’, ‘posId’: ‘660420980350771429’, ‘posSide’: ‘net’, ‘quoteBal’: ‘’, ‘quoteBorrowed’: ‘’, ‘quoteInterest’: ‘’, ‘realizedPnl’: ‘-0.901506’, ‘spotInUseAmt’: ‘’, ‘spotInUseCcy’: ‘’, ‘thetaBS’: ‘’, ‘thetaPA’: ‘’, ‘tradeId’: ‘3014208’, ‘uTime’: ‘1703728655219’, ‘upl’: ‘-0.2920000000001164’, ‘uplLastPx’: ‘-0.2080000000001746’, ‘uplRatio’: ‘-0.0004858536715233’, ‘uplRatioLastPx’: ‘-0.0003460875468385’, ‘usdPx’: ‘’, ‘vegaBS’: ‘’, ‘vegaPA’: ‘’}
- adl: str = 'adl'
- availPos: str = 'availPos'
- avgPx: str = 'avgPx'
- baseBal: str = 'baseBal'
- baseBorrowed: str = 'baseBorrowed'
- baseInterest: str = 'baseInterest'
- bePx: str = 'bePx'
- bizRefId: str = 'bizRefId'
- bizRefType: str = 'bizRefType'
- cTime: str = 'cTime'
- ccy: str = 'ccy'
- closeOrderAlgo: List[dict] = 'closeOrderAlgo'
- deltaBS: str = 'deltaBS'
- deltaPA: str = 'deltaPA'
- fee: str = 'fee'
- fundingFee: str = 'fundingFee'
- gammaBS: str = 'gammaBS'
- gammaPA: str = 'gammaPA'
- idxPx: str = 'idxPx'
- imr: str = 'imr'
- instId: str = 'instId'
- instType: str = 'instType'
- interest: str = 'interest'
- last: str = 'last'
- lever: str = 'lever'
- liab: str = 'liab'
- liabCcy: str = 'liabCcy'
- liqPenalty: str = 'liqPenalty'
- liqPx: str = 'liqPx'
- margin: str = 'margin'
- markPx: str = 'markPx'
- mgnMode: str = 'mgnMode'
- mgnRatio: str = 'mgnRatio'
- mmr: str = 'mmr'
- model_config: ClassVar[ConfigDict] = {}
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- model_fields: ClassVar[dict[str, FieldInfo]] = {'adl': FieldInfo(annotation=str, required=True), 'availPos': FieldInfo(annotation=str, required=True), 'avgPx': FieldInfo(annotation=str, required=True), 'baseBal': FieldInfo(annotation=str, required=True), 'baseBorrowed': FieldInfo(annotation=str, required=True), 'baseInterest': FieldInfo(annotation=str, required=True), 'bePx': FieldInfo(annotation=str, required=True), 'bizRefId': FieldInfo(annotation=str, required=True), 'bizRefType': FieldInfo(annotation=str, required=True), 'cTime': FieldInfo(annotation=str, required=True), 'ccy': FieldInfo(annotation=str, required=True), 'closeOrderAlgo': FieldInfo(annotation=List[dict], required=True), 'deltaBS': FieldInfo(annotation=str, required=True), 'deltaPA': FieldInfo(annotation=str, required=True), 'fee': FieldInfo(annotation=str, required=True), 'fundingFee': FieldInfo(annotation=str, required=True), 'gammaBS': FieldInfo(annotation=str, required=True), 'gammaPA': FieldInfo(annotation=str, required=True), 'idxPx': FieldInfo(annotation=str, required=True), 'imr': FieldInfo(annotation=str, required=True), 'instId': FieldInfo(annotation=str, required=True), 'instType': FieldInfo(annotation=str, required=True), 'interest': FieldInfo(annotation=str, required=True), 'last': FieldInfo(annotation=str, required=True), 'lever': FieldInfo(annotation=str, required=True), 'liab': FieldInfo(annotation=str, required=True), 'liabCcy': FieldInfo(annotation=str, required=True), 'liqPenalty': FieldInfo(annotation=str, required=True), 'liqPx': FieldInfo(annotation=str, required=True), 'margin': FieldInfo(annotation=str, required=True), 'markPx': FieldInfo(annotation=str, required=True), 'mgnMode': FieldInfo(annotation=str, required=True), 'mgnRatio': FieldInfo(annotation=str, required=True), 'mmr': FieldInfo(annotation=str, required=True), 'notionalUsd': FieldInfo(annotation=str, required=True), 'optVal': FieldInfo(annotation=str, required=True), 'pendingCloseOrdLiabVal': FieldInfo(annotation=str, required=True), 'pnl': FieldInfo(annotation=str, required=True), 'pos': FieldInfo(annotation=str, required=True), 'posCcy': FieldInfo(annotation=str, required=True), 'posId': FieldInfo(annotation=str, required=True), 'posSide': FieldInfo(annotation=str, required=True), 'quoteBal': FieldInfo(annotation=str, required=True), 'quoteBorrowed': FieldInfo(annotation=str, required=True), 'quoteInterest': FieldInfo(annotation=str, required=True), 'realizedPnl': FieldInfo(annotation=str, required=True), 'spotInUseAmt': FieldInfo(annotation=str, required=True), 'spotInUseCcy': FieldInfo(annotation=str, required=True), 'thetaBS': FieldInfo(annotation=str, required=True), 'thetaPA': FieldInfo(annotation=str, required=True), 'tradeId': FieldInfo(annotation=str, required=True), 'uTime': FieldInfo(annotation=str, required=True), 'upl': FieldInfo(annotation=str, required=True), 'uplLastPx': FieldInfo(annotation=str, required=True), 'uplRatio': FieldInfo(annotation=str, required=True), 'uplRatioLastPx': FieldInfo(annotation=str, required=True), 'usdPx': FieldInfo(annotation=str, required=True), 'vegaBS': FieldInfo(annotation=str, required=True), 'vegaPA': FieldInfo(annotation=str, required=True)}
Metadata about the fields defined on the model, mapping of field names to [FieldInfo][pydantic.fields.FieldInfo].
This replaces Model.__fields__ from Pydantic V1.
- notionalUsd: str = 'notionalUsd'
- optVal: str = 'optVal'
- pendingCloseOrdLiabVal: str = 'pendingCloseOrdLiabVal'
- pnl: str = 'pnl'
- pos: str = 'pos'
- posCcy: str = 'posCcy'
- posId: str = 'posId'
- posSide: str = 'posSide'
- quoteBal: str = 'quoteBal'
- quoteBorrowed: str = 'quoteBorrowed'
- quoteInterest: str = 'quoteInterest'
- realizedPnl: str = 'realizedPnl'
- spotInUseAmt: str = 'spotInUseAmt'
- spotInUseCcy: str = 'spotInUseCcy'
- thetaBS: str = 'thetaBS'
- thetaPA: str = 'thetaPA'
- tradeId: str = 'tradeId'
- uTime: str = 'uTime'
- upl: str = 'upl'
- uplLastPx: str = 'uplLastPx'
- uplRatio: str = 'uplRatio'
- uplRatioLastPx: str = 'uplRatioLastPx'
- usdPx: str = 'usdPx'
- vegaBS: str = 'vegaBS'
- vegaPA: str = 'vegaPA'
- class pyokx.data_structures.PositionHistory(*, instType: InstType, instId: str, mgnMode: MgnMode, type: int, cTime: int, uTime: int, openAvgPx: float, closeAvgPx: float, posId: str, openMaxPos: float, closeTotalPos: float, realizedPnl: float, fee: float, fundingFee: float, liqPenalty: float, pnl: float, pnlRatio: float, lever: float, direction: PosSide, uly: str, ccy: str, triggerPx: float | None = None)[source]
Bases:
OKXBaseModel
- cTime: int = 'cTime'
- ccy: str = 'ccy'
- closeAvgPx: float = 'closeAvgPx'
- closeTotalPos: float = 'closeTotalPos'
- fee: float = 'fee'
- fundingFee: float = 'fundingFee'
- instId: str = 'instId'
- lever: float = 'lever'
- liqPenalty: float = 'liqPenalty'
- model_config: ClassVar[ConfigDict] = {'use_enum_values': True}
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- model_fields: ClassVar[dict[str, FieldInfo]] = {'cTime': FieldInfo(annotation=int, required=True), 'ccy': FieldInfo(annotation=str, required=True), 'closeAvgPx': FieldInfo(annotation=float, required=True), 'closeTotalPos': FieldInfo(annotation=float, required=True), 'direction': FieldInfo(annotation=PosSide, required=True), 'fee': FieldInfo(annotation=float, required=True), 'fundingFee': FieldInfo(annotation=float, required=True), 'instId': FieldInfo(annotation=str, required=True), 'instType': FieldInfo(annotation=InstType, required=True), 'lever': FieldInfo(annotation=float, required=True), 'liqPenalty': FieldInfo(annotation=float, required=True), 'mgnMode': FieldInfo(annotation=MgnMode, required=True), 'openAvgPx': FieldInfo(annotation=float, required=True), 'openMaxPos': FieldInfo(annotation=float, required=True), 'pnl': FieldInfo(annotation=float, required=True), 'pnlRatio': FieldInfo(annotation=float, required=True), 'posId': FieldInfo(annotation=str, required=True), 'realizedPnl': FieldInfo(annotation=float, required=True), 'triggerPx': FieldInfo(annotation=Union[float, NoneType], required=False), 'type': FieldInfo(annotation=int, required=True), 'uTime': FieldInfo(annotation=int, required=True), 'uly': FieldInfo(annotation=str, required=True)}
Metadata about the fields defined on the model, mapping of field names to [FieldInfo][pydantic.fields.FieldInfo].
This replaces Model.__fields__ from Pydantic V1.
- openAvgPx: float = 'openAvgPx'
- openMaxPos: float = 'openMaxPos'
- pnl: float = 'pnl'
- pnlRatio: float = 'pnlRatio'
- posId: str = 'posId'
- realizedPnl: float = 'realizedPnl'
- triggerPx: float | None = 'triggerPx'
- type: int = 'type'
- uTime: int = 'uTime'
- uly: str = 'uly'
- class pyokx.data_structures.PremiumIndicatorSignals(*, Bullish: str | int | None, Bearish: str | int | None, Bullish_plus: str | int | None, Bearish_plus: str | int | None, Bullish_Exit: str | int | None, Bearish_Exit: str | int | None)[source]
Bases:
OKXBaseModel
- Bearish: str | int | None = 'Bearish'
- Bearish_Exit: str | int | None = 'Bearish_Exit'
- Bearish_plus: str | int | None = 'Bearish_plus'
- Bullish: str | int | None = 'Bullish'
- Bullish_Exit: str | int | None = 'Bullish_Exit'
- Bullish_plus: str | int | None = 'Bullish_plus'
- model_config: ClassVar[ConfigDict] = {}
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- model_fields: ClassVar[dict[str, FieldInfo]] = {'Bearish': FieldInfo(annotation=Union[str, int, NoneType], required=True), 'Bearish_Exit': FieldInfo(annotation=Union[str, int, NoneType], required=True), 'Bearish_plus': FieldInfo(annotation=Union[str, int, NoneType], required=True), 'Bullish': FieldInfo(annotation=Union[str, int, NoneType], required=True), 'Bullish_Exit': FieldInfo(annotation=Union[str, int, NoneType], required=True), 'Bullish_plus': FieldInfo(annotation=Union[str, int, NoneType], required=True)}
Metadata about the fields defined on the model, mapping of field names to [FieldInfo][pydantic.fields.FieldInfo].
This replaces Model.__fields__ from Pydantic V1.
- class pyokx.data_structures.Simplified_Balance_Details(*, Currency: str, Available_Balance: str, Equity: str, Equity_in_USD: str, Frozen_Balance: str)[source]
Bases:
OKXBaseModel
- Available_Balance: str = 'Available_Balance'
- Currency: str = 'Currency'
- Equity: str = 'Equity'
- Equity_in_USD: str = 'Equity_in_USD'
- Frozen_Balance: str = 'Frozen_Balance'
- model_config: ClassVar[ConfigDict] = {}
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- model_fields: ClassVar[dict[str, FieldInfo]] = {'Available_Balance': FieldInfo(annotation=str, required=True), 'Currency': FieldInfo(annotation=str, required=True), 'Equity': FieldInfo(annotation=str, required=True), 'Equity_in_USD': FieldInfo(annotation=str, required=True), 'Frozen_Balance': FieldInfo(annotation=str, required=True)}
Metadata about the fields defined on the model, mapping of field names to [FieldInfo][pydantic.fields.FieldInfo].
This replaces Model.__fields__ from Pydantic V1.
- class pyokx.data_structures.Ticker(*, instType: str, instId: str, last: str, lastSz: str, askPx: str, askSz: str, bidPx: str, bidSz: str, open24h: str, high24h: str, low24h: str, volCcy24h: str, vol24h: str, ts: str, sodUtc0: str, sodUtc8: str)[source]
Bases:
OKXBaseModel
e.g {‘instType’: ‘FUTURES’, ‘instId’: ‘BTC-USDT-240329’, ‘last’: ‘44725.3’, ‘lastSz’: ‘11’, ‘askPx’: ‘44727’, ‘askSz’: ‘147’, ‘bidPx’: ‘44724.5’, ‘bidSz’: ‘170’, ‘open24h’: ‘43854.9’, ‘high24h’: ‘45406.2’, ‘low24h’: ‘38196.8’, ‘volCcy24h’: ‘14025.4’, ‘vol24h’: ‘1402540’, ‘ts’: ‘1703741214308’, ‘sodUtc0’: ‘44977.8’, ‘sodUtc8’: ‘44452.3’}]}
- askPx: str = 'askPx'
- askSz: str = 'askSz'
- bidPx: str = 'bidPx'
- bidSz: str = 'bidSz'
- high24h: str = 'high24h'
- instId: str = 'instId'
- instType: str = 'instType'
- last: str = 'last'
- lastSz: str = 'lastSz'
- low24h: str = 'low24h'
- model_config: ClassVar[ConfigDict] = {}
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- model_fields: ClassVar[dict[str, FieldInfo]] = {'askPx': FieldInfo(annotation=str, required=True), 'askSz': FieldInfo(annotation=str, required=True), 'bidPx': FieldInfo(annotation=str, required=True), 'bidSz': FieldInfo(annotation=str, required=True), 'high24h': FieldInfo(annotation=str, required=True), 'instId': FieldInfo(annotation=str, required=True), 'instType': FieldInfo(annotation=str, required=True), 'last': FieldInfo(annotation=str, required=True), 'lastSz': FieldInfo(annotation=str, required=True), 'low24h': FieldInfo(annotation=str, required=True), 'open24h': FieldInfo(annotation=str, required=True), 'sodUtc0': FieldInfo(annotation=str, required=True), 'sodUtc8': FieldInfo(annotation=str, required=True), 'ts': FieldInfo(annotation=str, required=True), 'vol24h': FieldInfo(annotation=str, required=True), 'volCcy24h': FieldInfo(annotation=str, required=True)}
Metadata about the fields defined on the model, mapping of field names to [FieldInfo][pydantic.fields.FieldInfo].
This replaces Model.__fields__ from Pydantic V1.
- open24h: str = 'open24h'
- sodUtc0: str = 'sodUtc0'
- sodUtc8: str = 'sodUtc8'
- ts: str = 'ts'
- vol24h: str = 'vol24h'
- volCcy24h: str = 'volCcy24h'
