python-okx 0.2.8__tar.gz → 0.2.9__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.2.9}/PKG-INFO +1 -1
- {python-okx-0.2.8 → python-okx-0.2.9}/okx/Account.py +1 -1
- {python-okx-0.2.8 → python-okx-0.2.9}/okx/BlockTrading.py +1 -1
- {python-okx-0.2.8 → python-okx-0.2.9}/okx/Convert.py +1 -1
- {python-okx-0.2.8 → python-okx-0.2.9}/okx/Earning.py +1 -1
- {python-okx-0.2.8 → python-okx-0.2.9}/okx/FDBroker.py +1 -1
- {python-okx-0.2.8 → python-okx-0.2.9}/okx/Funding.py +8 -3
- {python-okx-0.2.8 → python-okx-0.2.9}/okx/Grid.py +1 -1
- {python-okx-0.2.8 → python-okx-0.2.9}/okx/MarketData.py +1 -1
- {python-okx-0.2.8 → python-okx-0.2.9}/okx/NDBroker.py +1 -1
- {python-okx-0.2.8 → python-okx-0.2.9}/okx/PublicData.py +1 -1
- {python-okx-0.2.8 → python-okx-0.2.9}/okx/SpreadTrading.py +1 -1
- {python-okx-0.2.8 → python-okx-0.2.9}/okx/Status.py +1 -1
- {python-okx-0.2.8 → python-okx-0.2.9}/okx/SubAccount.py +1 -1
- {python-okx-0.2.8 → python-okx-0.2.9}/okx/Trade.py +3 -3
- {python-okx-0.2.8 → python-okx-0.2.9}/okx/TradingData.py +1 -1
- {python-okx-0.2.8 → python-okx-0.2.9}/okx/__init__.py +1 -1
- {python-okx-0.2.8 → python-okx-0.2.9}/okx/consts.py +4 -3
- {python-okx-0.2.8 → python-okx-0.2.9}/okx/okxclient.py +9 -3
- {python-okx-0.2.8 → python-okx-0.2.9}/python_okx.egg-info/PKG-INFO +1 -1
- {python-okx-0.2.8 → python-okx-0.2.9}/README.md +0 -0
- {python-okx-0.2.8 → python-okx-0.2.9}/okx/CopyTrading.py +0 -0
- {python-okx-0.2.8 → python-okx-0.2.9}/okx/exceptions.py +0 -0
- {python-okx-0.2.8 → python-okx-0.2.9}/okx/utils.py +0 -0
- {python-okx-0.2.8 → python-okx-0.2.9}/okx/websocket/WebSocketFactory.py +0 -0
- {python-okx-0.2.8 → python-okx-0.2.9}/okx/websocket/WsPrivateAsync.py +0 -0
- {python-okx-0.2.8 → python-okx-0.2.9}/okx/websocket/WsPublicAsync.py +0 -0
- {python-okx-0.2.8 → python-okx-0.2.9}/okx/websocket/WsUtils.py +0 -0
- {python-okx-0.2.8 → python-okx-0.2.9}/okx/websocket/__init__.py +0 -0
- {python-okx-0.2.8 → python-okx-0.2.9}/python_okx.egg-info/SOURCES.txt +0 -0
- {python-okx-0.2.8 → python-okx-0.2.9}/python_okx.egg-info/dependency_links.txt +0 -0
- {python-okx-0.2.8 → python-okx-0.2.9}/python_okx.egg-info/requires.txt +0 -0
- {python-okx-0.2.8 → python-okx-0.2.9}/python_okx.egg-info/top_level.txt +0 -0
- {python-okx-0.2.8 → python-okx-0.2.9}/setup.cfg +0 -0
- {python-okx-0.2.8 → python-okx-0.2.9}/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
|
|
@@ -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}
|
|
@@ -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
|
|
|
@@ -56,19 +56,20 @@ ACTIVSTE_OPTION = '/api/v5/account/activate-option'
|
|
|
56
56
|
POSITION_BUILDER = '/api/v5/account/position-builder'
|
|
57
57
|
|
|
58
58
|
# funding-complete-testcomplete
|
|
59
|
+
NON_TRADABLE_ASSETS = '/api/v5/asset/non-tradable-assets'
|
|
59
60
|
DEPOSIT_ADDRESS = '/api/v5/asset/deposit-address'
|
|
60
61
|
GET_BALANCES = '/api/v5/asset/balances'
|
|
61
62
|
FUNDS_TRANSFER = '/api/v5/asset/transfer'
|
|
62
63
|
TRANSFER_STATE = '/api/v5/asset/transfer-state'
|
|
63
64
|
WITHDRAWAL_COIN = '/api/v5/asset/withdrawal'
|
|
64
|
-
|
|
65
|
+
DEPOSIT_HISTORY = '/api/v5/asset/deposit-history'
|
|
65
66
|
CURRENCY_INFO = '/api/v5/asset/currencies'
|
|
66
67
|
PURCHASE_REDEMPT = '/api/v5/asset/purchase_redempt'
|
|
67
68
|
BILLS_INFO = '/api/v5/asset/bills'
|
|
68
69
|
DEPOSIT_LIGHTNING = '/api/v5/asset/deposit-lightning'
|
|
69
70
|
WITHDRAWAL_LIGHTNING = '/api/v5/asset/withdrawal-lightning'
|
|
70
71
|
CANCEL_WITHDRAWAL = '/api/v5/asset/cancel-withdrawal' #need add
|
|
71
|
-
|
|
72
|
+
WITHDRAWAL_HISTORY = '/api/v5/asset/withdrawal-history'
|
|
72
73
|
CONVERT_DUST_ASSETS = '/api/v5/asset/convert-dust-assets' #need add
|
|
73
74
|
ASSET_VALUATION = '/api/v5/asset/asset-valuation' #need add
|
|
74
75
|
SET_LENDING_RATE = '/api/v5/asset/set-lending-rate'
|
|
@@ -153,7 +154,7 @@ ORDERS_FILLS_HISTORY = '/api/v5/trade/fills-history'
|
|
|
153
154
|
PLACE_ALGO_ORDER = '/api/v5/trade/order-algo'
|
|
154
155
|
CANCEL_ALGOS = '/api/v5/trade/cancel-algos'
|
|
155
156
|
Cancel_Advance_Algos = '/api/v5/trade/cancel-advance-algos'
|
|
156
|
-
|
|
157
|
+
ORDERS_ALGO_PENDING = '/api/v5/trade/orders-algo-pending'
|
|
157
158
|
ORDERS_ALGO_HISTORY = '/api/v5/trade/orders-algo-history'
|
|
158
159
|
GET_ALGO_ORDER_DETAILS = '/api/v5/trade/order-algo'
|
|
159
160
|
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
|