add new api and extend new apram
This commit is contained in:
parent
ef7e4f3a21
commit
2a796ab74d
|
|
@ -49,9 +49,9 @@ class AccountAPI(OkxClient):
|
|||
|
||||
# Get Bills Details (recent 3 months)
|
||||
def get_account_bills_archive(self, instType='', ccy='', mgnMode='', ctType='', type='', subType='', after='', before='',
|
||||
limit=''):
|
||||
limit='',begin='',end=''):
|
||||
params = {'instType': instType, 'ccy': ccy, 'mgnMode': mgnMode, 'ctType': ctType, 'type': type,
|
||||
'subType': subType, 'after': after, 'before': before, 'limit': limit}
|
||||
'subType': subType, 'after': after, 'before': before, 'limit': limit,'begin':begin,'end':end}
|
||||
return self._request_with_params(GET, BILLS_ARCHIVE, params)
|
||||
|
||||
# Get Account Configuration
|
||||
|
|
@ -88,6 +88,10 @@ class AccountAPI(OkxClient):
|
|||
def get_leverage(self, instId, mgnMode):
|
||||
params = {'instId': instId, 'mgnMode': mgnMode}
|
||||
return self._request_with_params(GET, GET_LEVERAGE, params)
|
||||
# Get instruments
|
||||
def get_instruments(self, instType='', ugly = '',instFamily='',instId=''):
|
||||
params = {'instType': instType, 'ugly': ugly, 'instFamily': instFamily, 'instId': instId}
|
||||
return self._request_with_params(GET,GET_INSTRUMENTS,params)
|
||||
|
||||
# Get the maximum loan of isolated MARGIN
|
||||
def get_max_loan(self, instId, mgnMode, mgnCcy):
|
||||
|
|
|
|||
|
|
@ -86,9 +86,9 @@ class TradeAPI(OkxClient):
|
|||
return self._request_with_params(GET, ORDERS_HISTORY_ARCHIVE, params)
|
||||
|
||||
# Get Transaction Details
|
||||
def get_fills(self, instType='', uly='', instId='', ordId='', after='', before='', limit='', instFamily=''):
|
||||
def get_fills(self, instType='', uly='', instId='', ordId='', after='', before='', limit='', instFamily='',begin='',end=''):
|
||||
params = {'instType': instType, 'uly': uly, 'instId': instId, 'ordId': ordId, 'after': after, 'before': before,
|
||||
'limit': limit, 'instFamily': instFamily}
|
||||
'limit': limit, 'instFamily': instFamily,'begin': begin, 'end' :end}
|
||||
return self._request_with_params(GET, ORDER_FILLS, params)
|
||||
|
||||
# Place Algo Order
|
||||
|
|
|
|||
|
|
@ -2,4 +2,4 @@
|
|||
Python SDK for the OKX API v5
|
||||
|
||||
"""
|
||||
__version__="0.2.9"
|
||||
__version__="0.3.0"
|
||||
|
|
@ -54,6 +54,7 @@ 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'
|
||||
GET_INSTRUMENTS = '/api/v5/account/instruments'
|
||||
|
||||
# funding-complete-testcomplete
|
||||
NON_TRADABLE_ASSETS = '/api/v5/asset/non-tradable-assets'
|
||||
|
|
|
|||
|
|
@ -23,6 +23,10 @@ class AccountTest(unittest.TestCase):
|
|||
# positions-history
|
||||
def test_get_positions_history(self):
|
||||
print(self.AccountAPI.get_positions_history())
|
||||
def test_get_instruments(self):
|
||||
print(self.AccountAPI.get_instruments(instType='SPOT'))
|
||||
def test_get_account_bills_archive(self):
|
||||
print(self.AccountAPI.get_account_bills_archive(begin='1715780962300',end='1716998400000'))
|
||||
# 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'}]
|
||||
|
|
|
|||
|
|
@ -125,8 +125,8 @@ class TradeTest(unittest.TestCase):
|
|||
# print(self.tradeApi.get_orders_history("SPOT"))
|
||||
# def test_get_order_histry_archive(self):
|
||||
# print(self.tradeApi.orders_history_archive("SPOT"))
|
||||
# def test_get_fills(self):
|
||||
# print(self.tradeApi.get_fills("SPOT"))
|
||||
def test_get_fills(self):
|
||||
print(self.tradeApi.get_fills(begin='1717045609000',end='1717045609100'))
|
||||
# def test_get_fills_history(self):
|
||||
# print(self.tradeApi.get_fills_history("SPOT"))
|
||||
# def test_get_order_algo_pending(self):
|
||||
|
|
|
|||
Loading…
Reference in New Issue