From d95d1aea74e336fd178289b5e4d3bf5168334368 Mon Sep 17 00:00:00 2001 From: alexcore-starlabs Date: Tue, 23 May 2023 12:02:33 +0200 Subject: [PATCH 1/5] update Funding non_tradable_assets --- okx/Funding.py | 5 +++++ okx/consts.py | 1 + 2 files changed, 6 insertions(+) diff --git a/okx/Funding.py b/okx/Funding.py index 4f2e905..f504133 100644 --- a/okx/Funding.py +++ b/okx/Funding.py @@ -8,6 +8,11 @@ class FundingAPI(OkxClient): def __init__(self, api_key='-1', api_secret_key='-1', passphrase='-1', use_server_time=False, flag='1', domain = 'https://www.okx.com',debug = True, proxy=None): OkxClient.__init__(self, api_key, api_secret_key, passphrase, use_server_time, flag, domain, debug, proxy) + # Get Non Tradable Assets + def get_non_tradable_assets(self, ccy: str = ''): + params = {'ccy': ccy} + return self._request_with_params(GET, NON_TRADABLE_ASSETS, params) + # Get Deposit Address def get_deposit_address(self, ccy): params = {'ccy': ccy} diff --git a/okx/consts.py b/okx/consts.py index 8551bea..7d40594 100644 --- a/okx/consts.py +++ b/okx/consts.py @@ -56,6 +56,7 @@ ACTIVSTE_OPTION = '/api/v5/account/activate-option' POSITION_BUILDER = '/api/v5/account/position-builder' # funding-complete-testcomplete +NON_TRADABLE_ASSETS = '/api/v5/asset/non-tradable-assets' DEPOSIT_ADDRESS = '/api/v5/asset/deposit-address' GET_BALANCES = '/api/v5/asset/balances' FUNDS_TRANSFER = '/api/v5/asset/transfer' From c4e7a98b0e1cab5beeea75d199e7cd6a53c9834f Mon Sep 17 00:00:00 2001 From: WoL <45914900+WoLeo-Z@users.noreply.github.com> Date: Fri, 25 Aug 2023 20:31:18 +0800 Subject: [PATCH 2/5] Rename ORDERS_ALGO_OENDING to ORDERS_ALGO_PENDING MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 强迫症 --- okx/Trade.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/okx/Trade.py b/okx/Trade.py index 504b463..0377822 100644 --- a/okx/Trade.py +++ b/okx/Trade.py @@ -124,7 +124,7 @@ class TradeAPI(OkxClient): algoClOrdId=''): params = {'ordType': ordType, 'algoId': algoId, 'instType': instType, 'instId': instId, 'after': after, 'before': before, 'limit': limit, 'algoClOrdId': algoClOrdId} - return self._request_with_params(GET, ORDERS_ALGO_OENDING, params) + return self._request_with_params(GET, ORDERS_ALGO_PENDING, params) # Get Algo Order History def order_algos_history(self, ordType, state='', algoId='', instType='', instId='', after='', before='', limit=''): From a10a7f1145c9bdeb352c2a9d3d1a9e5eb43f8f65 Mon Sep 17 00:00:00 2001 From: WoL <45914900+WoLeo-Z@users.noreply.github.com> Date: Fri, 25 Aug 2023 20:32:56 +0800 Subject: [PATCH 3/5] Rename ORDERS_ALGO_OENDING to ORDERS_ALGO_PENDING MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 强迫症 --- okx/consts.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/okx/consts.py b/okx/consts.py index 7d40594..ee1e96b 100644 --- a/okx/consts.py +++ b/okx/consts.py @@ -154,7 +154,7 @@ ORDERS_FILLS_HISTORY = '/api/v5/trade/fills-history' PLACE_ALGO_ORDER = '/api/v5/trade/order-algo' CANCEL_ALGOS = '/api/v5/trade/cancel-algos' Cancel_Advance_Algos = '/api/v5/trade/cancel-advance-algos' -ORDERS_ALGO_OENDING = '/api/v5/trade/orders-algo-pending' +ORDERS_ALGO_PENDING = '/api/v5/trade/orders-algo-pending' ORDERS_ALGO_HISTORY = '/api/v5/trade/orders-algo-history' GET_ALGO_ORDER_DETAILS = '/api/v5/trade/order-algo' AMEND_ALGO_ORDER = '/api/v5/trade/amend-algos' From e2e7b4f8af382a937797350ea4338f3b2659a16e Mon Sep 17 00:00:00 2001 From: Dalton Date: Wed, 15 Nov 2023 17:20:11 +0000 Subject: [PATCH 4/5] updated typo in constant and reference --- okx/Funding.py | 4 ++-- okx/consts.py | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/okx/Funding.py b/okx/Funding.py index f504133..6fb9a22 100644 --- a/okx/Funding.py +++ b/okx/Funding.py @@ -44,12 +44,12 @@ class FundingAPI(OkxClient): def get_deposit_history(self, ccy='', state='', after='', before='', limit='', txId='', depId='', fromWdId=''): params = {'ccy': ccy, 'state': state, 'after': after, 'before': before, 'limit': limit, 'txId': txId, 'depId': depId, 'fromWdId': fromWdId} - return self._request_with_params(GET, DEPOSIT_HISTORIY, params) + return self._request_with_params(GET, DEPOSIT_HISTORY, params) # Get Withdrawal History def get_withdrawal_history(self, ccy='', wdId='', state='', after='', before='', limit='',txId=''): params = {'ccy': ccy, 'wdId': wdId, 'state': state, 'after': after, 'before': before, 'limit': limit,'txId':txId} - return self._request_with_params(GET, WITHDRAWAL_HISTORIY, params) + return self._request_with_params(GET, WITHDRAWAL_HISTORY, params) # Get Currencies def get_currencies(self, ccy=''): diff --git a/okx/consts.py b/okx/consts.py index ee1e96b..76ac660 100644 --- a/okx/consts.py +++ b/okx/consts.py @@ -62,14 +62,14 @@ GET_BALANCES = '/api/v5/asset/balances' FUNDS_TRANSFER = '/api/v5/asset/transfer' TRANSFER_STATE = '/api/v5/asset/transfer-state' WITHDRAWAL_COIN = '/api/v5/asset/withdrawal' -DEPOSIT_HISTORIY = '/api/v5/asset/deposit-history' +DEPOSIT_HISTORY = '/api/v5/asset/deposit-history' CURRENCY_INFO = '/api/v5/asset/currencies' PURCHASE_REDEMPT = '/api/v5/asset/purchase_redempt' BILLS_INFO = '/api/v5/asset/bills' DEPOSIT_LIGHTNING = '/api/v5/asset/deposit-lightning' WITHDRAWAL_LIGHTNING = '/api/v5/asset/withdrawal-lightning' CANCEL_WITHDRAWAL = '/api/v5/asset/cancel-withdrawal' #need add -WITHDRAWAL_HISTORIY = '/api/v5/asset/withdrawal-history' +WITHDRAWAL_HISTORY = '/api/v5/asset/withdrawal-history' CONVERT_DUST_ASSETS = '/api/v5/asset/convert-dust-assets' #need add ASSET_VALUATION = '/api/v5/asset/asset-valuation' #need add SET_LENDING_RATE = '/api/v5/asset/set-lending-rate' From 26956b9b5eff392298a84107678a897661463259 Mon Sep 17 00:00:00 2001 From: grzhan Date: Sun, 17 Mar 2024 22:43:57 +0800 Subject: [PATCH 5/5] fix: #55 incorrect timestamp format in 'OK-ACCESS-TIMESTAMP' header when use_server_time=True is used --- okx/okxclient.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/okx/okxclient.py b/okx/okxclient.py index ae8d6d9..f799b22 100644 --- a/okx/okxclient.py +++ b/okx/okxclient.py @@ -1,4 +1,5 @@ import json +from datetime import datetime, timezone import httpx from httpx import Client @@ -50,6 +51,7 @@ class OkxClient(Client): request_path = c.API_URL + c.SERVER_TIMESTAMP_URL response = self.get(request_path) if response.status_code == 200: - return response.json()['data'][0]['ts'] + ts = datetime.fromtimestamp(int(response.json()['data'][0]['ts']) / 1000.0, tz=timezone.utc) + return ts.isoformat(timespec='milliseconds').replace('+00:00', 'Z') else: return ""