python-okx 0.2.8__tar.gz → 0.3.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {python-okx-0.2.8 → python-okx-0.3.0}/PKG-INFO +1 -1
- {python-okx-0.2.8 → python-okx-0.3.0}/okx/Account.py +7 -3
- {python-okx-0.2.8 → python-okx-0.3.0}/okx/BlockTrading.py +1 -1
- {python-okx-0.2.8 → python-okx-0.3.0}/okx/Convert.py +1 -1
- {python-okx-0.2.8 → python-okx-0.3.0}/okx/Earning.py +1 -1
- {python-okx-0.2.8 → python-okx-0.3.0}/okx/FDBroker.py +1 -1
- {python-okx-0.2.8 → python-okx-0.3.0}/okx/Funding.py +8 -3
- {python-okx-0.2.8 → python-okx-0.3.0}/okx/Grid.py +1 -1
- {python-okx-0.2.8 → python-okx-0.3.0}/okx/MarketData.py +1 -1
- {python-okx-0.2.8 → python-okx-0.3.0}/okx/NDBroker.py +1 -1
- {python-okx-0.2.8 → python-okx-0.3.0}/okx/PublicData.py +1 -1
- {python-okx-0.2.8 → python-okx-0.3.0}/okx/SpreadTrading.py +1 -1
- {python-okx-0.2.8 → python-okx-0.3.0}/okx/Status.py +1 -1
- {python-okx-0.2.8 → python-okx-0.3.0}/okx/SubAccount.py +1 -1
- {python-okx-0.2.8 → python-okx-0.3.0}/okx/Trade.py +5 -5
- {python-okx-0.2.8 → python-okx-0.3.0}/okx/TradingData.py +1 -1
- {python-okx-0.2.8 → python-okx-0.3.0}/okx/__init__.py +1 -1
- {python-okx-0.2.8 → python-okx-0.3.0}/okx/consts.py +5 -3
- {python-okx-0.2.8 → python-okx-0.3.0}/okx/okxclient.py +9 -3
- {python-okx-0.2.8 → python-okx-0.3.0}/python_okx.egg-info/PKG-INFO +1 -1
- {python-okx-0.2.8 → python-okx-0.3.0}/README.md +0 -0
- {python-okx-0.2.8 → python-okx-0.3.0}/okx/CopyTrading.py +0 -0
- {python-okx-0.2.8 → python-okx-0.3.0}/okx/exceptions.py +0 -0
- {python-okx-0.2.8 → python-okx-0.3.0}/okx/utils.py +0 -0
- {python-okx-0.2.8 → python-okx-0.3.0}/okx/websocket/WebSocketFactory.py +0 -0
- {python-okx-0.2.8 → python-okx-0.3.0}/okx/websocket/WsPrivateAsync.py +0 -0
- {python-okx-0.2.8 → python-okx-0.3.0}/okx/websocket/WsPublicAsync.py +0 -0
- {python-okx-0.2.8 → python-okx-0.3.0}/okx/websocket/WsUtils.py +0 -0
- {python-okx-0.2.8 → python-okx-0.3.0}/okx/websocket/__init__.py +0 -0
- {python-okx-0.2.8 → python-okx-0.3.0}/python_okx.egg-info/SOURCES.txt +0 -0
- {python-okx-0.2.8 → python-okx-0.3.0}/python_okx.egg-info/dependency_links.txt +0 -0
- {python-okx-0.2.8 → python-okx-0.3.0}/python_okx.egg-info/requires.txt +0 -0
- {python-okx-0.2.8 → python-okx-0.3.0}/python_okx.egg-info/top_level.txt +0 -0
- {python-okx-0.2.8 → python-okx-0.3.0}/setup.cfg +0 -0
- {python-okx-0.2.8 → python-okx-0.3.0}/setup.py +0 -0
|
@@ -4,7 +4,7 @@ from .consts import *
|
|
|
4
4
|
|
|
5
5
|
class AccountAPI(OkxClient):
|
|
6
6
|
|
|
7
|
-
def __init__(self, api_key='-1', api_secret_key='-1', passphrase='-1', use_server_time=
|
|
7
|
+
def __init__(self, api_key='-1', api_secret_key='-1', passphrase='-1', use_server_time=None, flag='1', domain = 'https://www.okx.com',debug = True,proxy = None):
|
|
8
8
|
OkxClient.__init__(self, api_key, api_secret_key, passphrase, use_server_time, flag, domain, debug, proxy)
|
|
9
9
|
|
|
10
10
|
# Get Positions
|
|
@@ -49,9 +49,9 @@ class AccountAPI(OkxClient):
|
|
|
49
49
|
|
|
50
50
|
# Get Bills Details (recent 3 months)
|
|
51
51
|
def get_account_bills_archive(self, instType='', ccy='', mgnMode='', ctType='', type='', subType='', after='', before='',
|
|
52
|
-
limit=''):
|
|
52
|
+
limit='',begin='',end=''):
|
|
53
53
|
params = {'instType': instType, 'ccy': ccy, 'mgnMode': mgnMode, 'ctType': ctType, 'type': type,
|
|
54
|
-
'subType': subType, 'after': after, 'before': before, 'limit': limit}
|
|
54
|
+
'subType': subType, 'after': after, 'before': before, 'limit': limit,'begin':begin,'end':end}
|
|
55
55
|
return self._request_with_params(GET, BILLS_ARCHIVE, params)
|
|
56
56
|
|
|
57
57
|
# Get Account Configuration
|
|
@@ -88,6 +88,10 @@ class AccountAPI(OkxClient):
|
|
|
88
88
|
def get_leverage(self, instId, mgnMode):
|
|
89
89
|
params = {'instId': instId, 'mgnMode': mgnMode}
|
|
90
90
|
return self._request_with_params(GET, GET_LEVERAGE, params)
|
|
91
|
+
# Get instruments
|
|
92
|
+
def get_instruments(self, instType='', ugly = '',instFamily='',instId=''):
|
|
93
|
+
params = {'instType': instType, 'ugly': ugly, 'instFamily': instFamily, 'instId': instId}
|
|
94
|
+
return self._request_with_params(GET,GET_INSTRUMENTS,params)
|
|
91
95
|
|
|
92
96
|
# Get the maximum loan of isolated MARGIN
|
|
93
97
|
def get_max_loan(self, instId, mgnMode, mgnCcy):
|
|
@@ -3,7 +3,7 @@ from .consts import *
|
|
|
3
3
|
|
|
4
4
|
|
|
5
5
|
class BlockTradingAPI(OkxClient):
|
|
6
|
-
def __init__(self, api_key='-1', api_secret_key='-1', passphrase='-1', use_server_time=
|
|
6
|
+
def __init__(self, api_key='-1', api_secret_key='-1', passphrase='-1', use_server_time=None, flag='1', domain = 'https://www.okx.com',debug = True, proxy=None):
|
|
7
7
|
OkxClient.__init__(self, api_key, api_secret_key, passphrase, use_server_time, flag, domain, debug, proxy)
|
|
8
8
|
|
|
9
9
|
def counterparties(self):
|
|
@@ -3,7 +3,7 @@ from .consts import *
|
|
|
3
3
|
|
|
4
4
|
|
|
5
5
|
class ConvertAPI(OkxClient):
|
|
6
|
-
def __init__(self, api_key='-1', api_secret_key='-1', passphrase='-1', use_server_time=
|
|
6
|
+
def __init__(self, api_key='-1', api_secret_key='-1', passphrase='-1', use_server_time=None, flag='1', domain = 'https://www.okx.com',debug = True,proxy = None):
|
|
7
7
|
OkxClient.__init__(self, api_key, api_secret_key, passphrase, use_server_time, flag, domain, debug, proxy)
|
|
8
8
|
|
|
9
9
|
def get_currencies(self):
|
|
@@ -3,7 +3,7 @@ from .consts import *
|
|
|
3
3
|
|
|
4
4
|
|
|
5
5
|
class EarningAPI(OkxClient):
|
|
6
|
-
def __init__(self, api_key='-1', api_secret_key='-1', passphrase='-1', use_server_time=
|
|
6
|
+
def __init__(self, api_key='-1', api_secret_key='-1', passphrase='-1', use_server_time=None, flag='1', domain = 'https://www.okx.com',debug = True, proxy=None):
|
|
7
7
|
OkxClient.__init__(self, api_key, api_secret_key, passphrase, use_server_time, flag, domain, debug, proxy)
|
|
8
8
|
|
|
9
9
|
def get_offers(self,productId = '',protocolType = '',ccy = ''):
|
|
@@ -3,7 +3,7 @@ from .consts import *
|
|
|
3
3
|
|
|
4
4
|
|
|
5
5
|
class FDBrokerAPI(OkxClient):
|
|
6
|
-
def __init__(self, api_key='-1', api_secret_key='-1', passphrase='-1', use_server_time=
|
|
6
|
+
def __init__(self, api_key='-1', api_secret_key='-1', passphrase='-1', use_server_time=None, flag='1', domain = 'https://www.okx.com',debug = True, proxy=None):
|
|
7
7
|
OkxClient.__init__(self, api_key, api_secret_key, passphrase, use_server_time, flag, domain, debug, proxy)
|
|
8
8
|
|
|
9
9
|
def generate_rebate_details_download_link(self, begin ='', end = ''):
|
|
@@ -5,9 +5,14 @@ from .consts import *
|
|
|
5
5
|
class FundingAPI(OkxClient):
|
|
6
6
|
|
|
7
7
|
|
|
8
|
-
def __init__(self, api_key='-1', api_secret_key='-1', passphrase='-1', use_server_time=
|
|
8
|
+
def __init__(self, api_key='-1', api_secret_key='-1', passphrase='-1', use_server_time=None, flag='1', domain = 'https://www.okx.com',debug = True, proxy=None):
|
|
9
9
|
OkxClient.__init__(self, api_key, api_secret_key, passphrase, use_server_time, flag, domain, debug, proxy)
|
|
10
10
|
|
|
11
|
+
# Get Non Tradable Assets
|
|
12
|
+
def get_non_tradable_assets(self, ccy: str = ''):
|
|
13
|
+
params = {'ccy': ccy}
|
|
14
|
+
return self._request_with_params(GET, NON_TRADABLE_ASSETS, params)
|
|
15
|
+
|
|
11
16
|
# Get Deposit Address
|
|
12
17
|
def get_deposit_address(self, ccy):
|
|
13
18
|
params = {'ccy': ccy}
|
|
@@ -39,12 +44,12 @@ class FundingAPI(OkxClient):
|
|
|
39
44
|
def get_deposit_history(self, ccy='', state='', after='', before='', limit='', txId='', depId='', fromWdId=''):
|
|
40
45
|
params = {'ccy': ccy, 'state': state, 'after': after, 'before': before, 'limit': limit, 'txId': txId,
|
|
41
46
|
'depId': depId, 'fromWdId': fromWdId}
|
|
42
|
-
return self._request_with_params(GET,
|
|
47
|
+
return self._request_with_params(GET, DEPOSIT_HISTORY, params)
|
|
43
48
|
|
|
44
49
|
# Get Withdrawal History
|
|
45
50
|
def get_withdrawal_history(self, ccy='', wdId='', state='', after='', before='', limit='',txId=''):
|
|
46
51
|
params = {'ccy': ccy, 'wdId': wdId, 'state': state, 'after': after, 'before': before, 'limit': limit,'txId':txId}
|
|
47
|
-
return self._request_with_params(GET,
|
|
52
|
+
return self._request_with_params(GET, WITHDRAWAL_HISTORY, params)
|
|
48
53
|
|
|
49
54
|
# Get Currencies
|
|
50
55
|
def get_currencies(self, ccy=''):
|
|
@@ -3,7 +3,7 @@ from .consts import *
|
|
|
3
3
|
|
|
4
4
|
|
|
5
5
|
class GridAPI(OkxClient):
|
|
6
|
-
def __init__(self, api_key='-1', api_secret_key='-1', passphrase='-1', use_server_time=
|
|
6
|
+
def __init__(self, api_key='-1', api_secret_key='-1', passphrase='-1', use_server_time=None, flag='1', domain = 'https://www.okx.com',debug = True, proxy=None):
|
|
7
7
|
OkxClient.__init__(self, api_key, api_secret_key, passphrase, use_server_time, flag, domain, debug, proxy)
|
|
8
8
|
|
|
9
9
|
def grid_order_algo(self, instId='', algoOrdType='', maxPx='', minPx='', gridNum='', runType='', tpTriggerPx='',
|
|
@@ -4,7 +4,7 @@ from .consts import *
|
|
|
4
4
|
|
|
5
5
|
class MarketAPI(OkxClient):
|
|
6
6
|
|
|
7
|
-
def __init__(self, api_key='-1', api_secret_key='-1', passphrase='-1', use_server_time=
|
|
7
|
+
def __init__(self, api_key='-1', api_secret_key='-1', passphrase='-1', use_server_time=None, flag='1', domain = 'https://www.okx.com',debug = True, proxy=None):
|
|
8
8
|
OkxClient.__init__(self, api_key, api_secret_key, passphrase, use_server_time, flag, domain, debug, proxy)
|
|
9
9
|
|
|
10
10
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
from .okxclient import OkxClient
|
|
2
2
|
from .consts import *
|
|
3
3
|
class NDBrokerAPI(OkxClient):
|
|
4
|
-
def __init__(self, api_key='-1', api_secret_key='-1', passphrase='-1', use_server_time=
|
|
4
|
+
def __init__(self, api_key='-1', api_secret_key='-1', passphrase='-1', use_server_time=None, flag='1', domain = 'https://www.okx.com',debug = True, proxy=None):
|
|
5
5
|
OkxClient.__init__(self, api_key, api_secret_key, passphrase, use_server_time, flag, domain, debug, proxy)
|
|
6
6
|
|
|
7
7
|
#GET /api/v5/broker/nd/info
|
|
@@ -4,7 +4,7 @@ from .consts import *
|
|
|
4
4
|
|
|
5
5
|
class PublicAPI(OkxClient):
|
|
6
6
|
|
|
7
|
-
def __init__(self, api_key='-1', api_secret_key='-1', passphrase='-1', use_server_time=
|
|
7
|
+
def __init__(self, api_key='-1', api_secret_key='-1', passphrase='-1', use_server_time=None, flag='1', domain = 'https://www.okx.com',debug = True, proxy=None):
|
|
8
8
|
OkxClient.__init__(self, api_key, api_secret_key, passphrase, use_server_time, flag, domain, debug, proxy)
|
|
9
9
|
|
|
10
10
|
# Get Instruments
|
|
@@ -4,7 +4,7 @@ from .consts import *
|
|
|
4
4
|
|
|
5
5
|
class SpreadTradingAPI(OkxClient):
|
|
6
6
|
|
|
7
|
-
def __init__(self, api_key='-1', api_secret_key='-1', passphrase='-1', use_server_time=
|
|
7
|
+
def __init__(self, api_key='-1', api_secret_key='-1', passphrase='-1', use_server_time=None, flag='1', domain = 'https://www.okx.com',debug = True, proxy=None):
|
|
8
8
|
OkxClient.__init__(self, api_key, api_secret_key, passphrase, use_server_time, flag, domain, debug, proxy)
|
|
9
9
|
|
|
10
10
|
# Place Order
|
|
@@ -3,7 +3,7 @@ from .consts import *
|
|
|
3
3
|
|
|
4
4
|
|
|
5
5
|
class StatusAPI(OkxClient):
|
|
6
|
-
def __init__(self, api_key='-1', api_secret_key='-1', passphrase='-1', use_server_time=
|
|
6
|
+
def __init__(self, api_key='-1', api_secret_key='-1', passphrase='-1', use_server_time=None, flag='1', domain = 'https://www.okx.com',debug = True, proxy=None):
|
|
7
7
|
OkxClient.__init__(self, api_key, api_secret_key, passphrase, use_server_time, flag, domain, debug, proxy)
|
|
8
8
|
|
|
9
9
|
def status(self, state=''):
|
|
@@ -3,7 +3,7 @@ from .consts import *
|
|
|
3
3
|
|
|
4
4
|
|
|
5
5
|
class SubAccountAPI(OkxClient):
|
|
6
|
-
def __init__(self, api_key='-1', api_secret_key='-1', passphrase='-1', use_server_time=
|
|
6
|
+
def __init__(self, api_key='-1', api_secret_key='-1', passphrase='-1', use_server_time=None, flag='1', domain = 'https://www.okx.com',debug = True, proxy=None):
|
|
7
7
|
OkxClient.__init__(self, api_key, api_secret_key, passphrase, use_server_time, flag, domain, debug, proxy)
|
|
8
8
|
|
|
9
9
|
def get_account_balance(self, subAcct):
|
|
@@ -6,7 +6,7 @@ from .consts import *
|
|
|
6
6
|
|
|
7
7
|
class TradeAPI(OkxClient):
|
|
8
8
|
|
|
9
|
-
def __init__(self, api_key='-1', api_secret_key='-1', passphrase='-1', use_server_time=
|
|
9
|
+
def __init__(self, api_key='-1', api_secret_key='-1', passphrase='-1', use_server_time=None, flag='1',
|
|
10
10
|
domain='https://www.okx.com', debug=True, proxy=None):
|
|
11
11
|
OkxClient.__init__(self, api_key, api_secret_key, passphrase, use_server_time, flag, domain, debug, proxy)
|
|
12
12
|
|
|
@@ -40,7 +40,7 @@ class TradeAPI(OkxClient):
|
|
|
40
40
|
def amend_order(self, instId, cxlOnFail='', ordId='', clOrdId='', reqId='', newSz='', newPx='', newTpTriggerPx='',
|
|
41
41
|
newTpOrdPx='', newSlTriggerPx='', newSlOrdPx='', newTpTriggerPxType='', newSlTriggerPxType='',
|
|
42
42
|
attachAlgoOrds=''):
|
|
43
|
-
params = {'instId': instId, '
|
|
43
|
+
params = {'instId': instId, 'cxlOnFail': cxlOnFail, 'ordId': ordId, 'clOrdId': clOrdId, 'reqId': reqId,
|
|
44
44
|
'newSz': newSz, 'newPx': newPx, 'newTpTriggerPx': newTpTriggerPx, 'newTpOrdPx': newTpOrdPx,
|
|
45
45
|
'newSlTriggerPx': newSlTriggerPx, 'newSlOrdPx': newSlOrdPx, 'newTpTriggerPxType': newTpTriggerPxType,
|
|
46
46
|
'newSlTriggerPxType': newSlTriggerPxType}
|
|
@@ -86,9 +86,9 @@ class TradeAPI(OkxClient):
|
|
|
86
86
|
return self._request_with_params(GET, ORDERS_HISTORY_ARCHIVE, params)
|
|
87
87
|
|
|
88
88
|
# Get Transaction Details
|
|
89
|
-
def get_fills(self, instType='', uly='', instId='', ordId='', after='', before='', limit='', instFamily=''):
|
|
89
|
+
def get_fills(self, instType='', uly='', instId='', ordId='', after='', before='', limit='', instFamily='',begin='',end=''):
|
|
90
90
|
params = {'instType': instType, 'uly': uly, 'instId': instId, 'ordId': ordId, 'after': after, 'before': before,
|
|
91
|
-
'limit': limit, 'instFamily': instFamily}
|
|
91
|
+
'limit': limit, 'instFamily': instFamily,'begin': begin, 'end' :end}
|
|
92
92
|
return self._request_with_params(GET, ORDER_FILLS, params)
|
|
93
93
|
|
|
94
94
|
# Place Algo Order
|
|
@@ -124,7 +124,7 @@ class TradeAPI(OkxClient):
|
|
|
124
124
|
algoClOrdId=''):
|
|
125
125
|
params = {'ordType': ordType, 'algoId': algoId, 'instType': instType, 'instId': instId, 'after': after,
|
|
126
126
|
'before': before, 'limit': limit, 'algoClOrdId': algoClOrdId}
|
|
127
|
-
return self._request_with_params(GET,
|
|
127
|
+
return self._request_with_params(GET, ORDERS_ALGO_PENDING, params)
|
|
128
128
|
|
|
129
129
|
# Get Algo Order History
|
|
130
130
|
def order_algos_history(self, ordType, state='', algoId='', instType='', instId='', after='', before='', limit=''):
|
|
@@ -4,7 +4,7 @@ from .consts import *
|
|
|
4
4
|
|
|
5
5
|
class TradingDataAPI(OkxClient):
|
|
6
6
|
|
|
7
|
-
def __init__(self, api_key='-1', api_secret_key='-1', passphrase='-1', use_server_time=
|
|
7
|
+
def __init__(self, api_key='-1', api_secret_key='-1', passphrase='-1', use_server_time=None, flag='1', domain = 'https://www.okx.com',debug = True, proxy=None):
|
|
8
8
|
OkxClient.__init__(self, api_key, api_secret_key, passphrase, use_server_time, flag, domain, debug, proxy)
|
|
9
9
|
|
|
10
10
|
|
|
@@ -54,21 +54,23 @@ SET_RISK_OFFSET_TYPE = '/api/v5/account/set-riskOffset-type'
|
|
|
54
54
|
SET_AUTO_LOAN = '/api/v5/account/set-auto-loan'
|
|
55
55
|
ACTIVSTE_OPTION = '/api/v5/account/activate-option'
|
|
56
56
|
POSITION_BUILDER = '/api/v5/account/position-builder'
|
|
57
|
+
GET_INSTRUMENTS = '/api/v5/account/instruments'
|
|
57
58
|
|
|
58
59
|
# funding-complete-testcomplete
|
|
60
|
+
NON_TRADABLE_ASSETS = '/api/v5/asset/non-tradable-assets'
|
|
59
61
|
DEPOSIT_ADDRESS = '/api/v5/asset/deposit-address'
|
|
60
62
|
GET_BALANCES = '/api/v5/asset/balances'
|
|
61
63
|
FUNDS_TRANSFER = '/api/v5/asset/transfer'
|
|
62
64
|
TRANSFER_STATE = '/api/v5/asset/transfer-state'
|
|
63
65
|
WITHDRAWAL_COIN = '/api/v5/asset/withdrawal'
|
|
64
|
-
|
|
66
|
+
DEPOSIT_HISTORY = '/api/v5/asset/deposit-history'
|
|
65
67
|
CURRENCY_INFO = '/api/v5/asset/currencies'
|
|
66
68
|
PURCHASE_REDEMPT = '/api/v5/asset/purchase_redempt'
|
|
67
69
|
BILLS_INFO = '/api/v5/asset/bills'
|
|
68
70
|
DEPOSIT_LIGHTNING = '/api/v5/asset/deposit-lightning'
|
|
69
71
|
WITHDRAWAL_LIGHTNING = '/api/v5/asset/withdrawal-lightning'
|
|
70
72
|
CANCEL_WITHDRAWAL = '/api/v5/asset/cancel-withdrawal' #need add
|
|
71
|
-
|
|
73
|
+
WITHDRAWAL_HISTORY = '/api/v5/asset/withdrawal-history'
|
|
72
74
|
CONVERT_DUST_ASSETS = '/api/v5/asset/convert-dust-assets' #need add
|
|
73
75
|
ASSET_VALUATION = '/api/v5/asset/asset-valuation' #need add
|
|
74
76
|
SET_LENDING_RATE = '/api/v5/asset/set-lending-rate'
|
|
@@ -153,7 +155,7 @@ ORDERS_FILLS_HISTORY = '/api/v5/trade/fills-history'
|
|
|
153
155
|
PLACE_ALGO_ORDER = '/api/v5/trade/order-algo'
|
|
154
156
|
CANCEL_ALGOS = '/api/v5/trade/cancel-algos'
|
|
155
157
|
Cancel_Advance_Algos = '/api/v5/trade/cancel-advance-algos'
|
|
156
|
-
|
|
158
|
+
ORDERS_ALGO_PENDING = '/api/v5/trade/orders-algo-pending'
|
|
157
159
|
ORDERS_ALGO_HISTORY = '/api/v5/trade/orders-algo-history'
|
|
158
160
|
GET_ALGO_ORDER_DETAILS = '/api/v5/trade/order-algo'
|
|
159
161
|
AMEND_ALGO_ORDER = '/api/v5/trade/amend-algos'
|
|
@@ -1,22 +1,27 @@
|
|
|
1
1
|
import json
|
|
2
|
+
import warnings
|
|
3
|
+
from datetime import datetime, timezone
|
|
2
4
|
|
|
3
5
|
import httpx
|
|
4
6
|
from httpx import Client
|
|
7
|
+
from datetime import datetime, timezone
|
|
5
8
|
|
|
6
9
|
from . import consts as c, utils, exceptions
|
|
7
10
|
|
|
8
11
|
|
|
9
12
|
class OkxClient(Client):
|
|
10
13
|
|
|
11
|
-
def __init__(self, api_key='-1', api_secret_key='-1', passphrase='-1', use_server_time=
|
|
14
|
+
def __init__(self, api_key='-1', api_secret_key='-1', passphrase='-1', use_server_time=None, flag='1',base_api=c.API_URL, debug='True', proxy=None):
|
|
12
15
|
super().__init__(base_url=base_api, http2=True, proxy=proxy)
|
|
13
16
|
self.API_KEY = api_key
|
|
14
17
|
self.API_SECRET_KEY = api_secret_key
|
|
15
18
|
self.PASSPHRASE = passphrase
|
|
16
|
-
self.use_server_time =
|
|
19
|
+
self.use_server_time = False
|
|
17
20
|
self.flag = flag
|
|
18
21
|
self.domain = base_api
|
|
19
22
|
self.debug = debug
|
|
23
|
+
if use_server_time is not None:
|
|
24
|
+
warnings.warn("use_server_time parameter is deprecated. Please remove it.", DeprecationWarning)
|
|
20
25
|
|
|
21
26
|
def _request(self, method, request_path, params):
|
|
22
27
|
if method == c.GET:
|
|
@@ -50,6 +55,7 @@ class OkxClient(Client):
|
|
|
50
55
|
request_path = c.API_URL + c.SERVER_TIMESTAMP_URL
|
|
51
56
|
response = self.get(request_path)
|
|
52
57
|
if response.status_code == 200:
|
|
53
|
-
|
|
58
|
+
ts = datetime.fromtimestamp(int(response.json()['data'][0]['ts']) / 1000.0, tz=timezone.utc)
|
|
59
|
+
return ts.isoformat(timespec='milliseconds').replace('+00:00', 'Z')
|
|
54
60
|
else:
|
|
55
61
|
return ""
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|