diff --git a/okx/Account.py b/okx/Account.py index 10fd1ff..6474c02 100644 --- a/okx/Account.py +++ b/okx/Account.py @@ -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): diff --git a/okx/Trade.py b/okx/Trade.py index 8e52b05..80f5fa9 100644 --- a/okx/Trade.py +++ b/okx/Trade.py @@ -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 diff --git a/okx/__init__.py b/okx/__init__.py index daad9a1..152ea2e 100644 --- a/okx/__init__.py +++ b/okx/__init__.py @@ -2,4 +2,4 @@ Python SDK for the OKX API v5 """ -__version__="0.2.9" \ No newline at end of file +__version__="0.3.0" \ No newline at end of file diff --git a/okx/consts.py b/okx/consts.py index 76ac660..f312757 100644 --- a/okx/consts.py +++ b/okx/consts.py @@ -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' diff --git a/test/AccountTest.py b/test/AccountTest.py index 74e8395..22f81be 100644 --- a/test/AccountTest.py +++ b/test/AccountTest.py @@ -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'}] diff --git a/test/TradeTest.py b/test/TradeTest.py index c221f50..b1be0d1 100644 --- a/test/TradeTest.py +++ b/test/TradeTest.py @@ -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):