feat: supported position builder
This commit is contained in:
parent
422ee7ec8b
commit
7d43159161
|
|
@ -26,6 +26,20 @@ class AccountAPI(OkxClient):
|
|||
params = {'instType': instType, 'instId': instId}
|
||||
return self._request_with_params(GET, POSITION_INFO, params)
|
||||
|
||||
def position_builder(self,inclRealPosAndEq=False, spotOffsetType=None, greeksType=None, simPos=None, simAsset=None):
|
||||
params = {}
|
||||
if inclRealPosAndEq is not None:
|
||||
params['inclRealPosAndEq'] = inclRealPosAndEq
|
||||
if spotOffsetType is not None:
|
||||
params['spotOffsetType'] = spotOffsetType
|
||||
if greeksType is not None:
|
||||
params['greksType'] = greeksType
|
||||
if simPos is not None:
|
||||
params['simPos'] = simPos
|
||||
if simAsset is not None:
|
||||
params['simAsset'] = simAsset
|
||||
return self._request_with_params(POST, POSITION_BUILDER, params)
|
||||
|
||||
# Get Bills Details (recent 7 days)
|
||||
def get_account_bills(self, instType='', ccy='', mgnMode='', ctType='', type='', subType='', after='', before='',
|
||||
limit=''):
|
||||
|
|
|
|||
|
|
@ -2,4 +2,4 @@
|
|||
Python SDK for the OKX API v5
|
||||
|
||||
"""
|
||||
__version__="0.2.7"
|
||||
__version__="0.2.8"
|
||||
|
|
@ -53,6 +53,7 @@ GET_VIP_LOAN_ORDER_DETAIL= '/api/v5/account/vip-loan-order-detail'
|
|||
SET_RISK_OFFSET_TYPE = '/api/v5/account/set-riskOffset-type'
|
||||
SET_AUTO_LOAN = '/api/v5/account/set-auto-loan'
|
||||
ACTIVSTE_OPTION = '/api/v5/account/activate-option'
|
||||
POSITION_BUILDER = '/api/v5/account/position-builder'
|
||||
|
||||
# funding-complete-testcomplete
|
||||
DEPOSIT_ADDRESS = '/api/v5/asset/deposit-address'
|
||||
|
|
|
|||
|
|
@ -21,8 +21,21 @@ class AccountTest(unittest.TestCase):
|
|||
# def test_get_pm_limit(self):
|
||||
# print(self.AccountAPI.get_pm_limit("SWAP","BTC-USDT"))
|
||||
# positions-history
|
||||
def test_get_positions_history(self):
|
||||
print(self.AccountAPI.get_positions_history())
|
||||
# def test_get_positions_history(self):
|
||||
# print(self.AccountAPI.get_positions_history())
|
||||
# def test_positions_builder(self):
|
||||
# print("Both real and virtual positions and assets are calculated")
|
||||
# sim_pos = [{'instId': 'BTC-USDT-SWAP', 'pos': '10'}, {'instId': 'BTC-USDT-SWAP', 'pos': '10'}]
|
||||
# sim_asset = [{'ccy': 'USDT', 'amt': '100'}]
|
||||
# print(self.AccountAPI.position_builder(inclRealPosAndEq=False, spotOffsetType='1', greeksType='CASH',
|
||||
# simPos=sim_pos, simAsset=sim_asset))
|
||||
#
|
||||
# print("Only existing real positions are calculated")
|
||||
# print(self.AccountAPI.position_builder(inclRealPosAndEq=True, greeksType='CASH'))
|
||||
#
|
||||
# print("Only virtual positions are calculated")
|
||||
# print(self.AccountAPI.position_builder(inclRealPosAndEq=False, simPos=sim_pos))
|
||||
|
||||
# def test_get_user_config(self):
|
||||
# print(self.AccountAPI.get_account_config())
|
||||
# def test_get_positions(self):
|
||||
|
|
|
|||
Loading…
Reference in New Issue