python-okx 0.3.0__tar.gz → 0.3.1__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.3.0 → python-okx-0.3.1}/PKG-INFO +1 -1
- {python-okx-0.3.0 → python-okx-0.3.1}/okx/Trade.py +8 -5
- python-okx-0.3.1/okx/TradingData.py +113 -0
- {python-okx-0.3.0 → python-okx-0.3.1}/okx/__init__.py +1 -1
- {python-okx-0.3.0 → python-okx-0.3.1}/okx/consts.py +7 -1
- {python-okx-0.3.0 → python-okx-0.3.1}/python_okx.egg-info/PKG-INFO +1 -1
- python-okx-0.3.0/okx/TradingData.py +0 -55
- {python-okx-0.3.0 → python-okx-0.3.1}/README.md +0 -0
- {python-okx-0.3.0 → python-okx-0.3.1}/okx/Account.py +0 -0
- {python-okx-0.3.0 → python-okx-0.3.1}/okx/BlockTrading.py +0 -0
- {python-okx-0.3.0 → python-okx-0.3.1}/okx/Convert.py +0 -0
- {python-okx-0.3.0 → python-okx-0.3.1}/okx/CopyTrading.py +0 -0
- {python-okx-0.3.0 → python-okx-0.3.1}/okx/Earning.py +0 -0
- {python-okx-0.3.0 → python-okx-0.3.1}/okx/FDBroker.py +0 -0
- {python-okx-0.3.0 → python-okx-0.3.1}/okx/Funding.py +0 -0
- {python-okx-0.3.0 → python-okx-0.3.1}/okx/Grid.py +0 -0
- {python-okx-0.3.0 → python-okx-0.3.1}/okx/MarketData.py +0 -0
- {python-okx-0.3.0 → python-okx-0.3.1}/okx/NDBroker.py +0 -0
- {python-okx-0.3.0 → python-okx-0.3.1}/okx/PublicData.py +0 -0
- {python-okx-0.3.0 → python-okx-0.3.1}/okx/SpreadTrading.py +0 -0
- {python-okx-0.3.0 → python-okx-0.3.1}/okx/Status.py +0 -0
- {python-okx-0.3.0 → python-okx-0.3.1}/okx/SubAccount.py +0 -0
- {python-okx-0.3.0 → python-okx-0.3.1}/okx/exceptions.py +0 -0
- {python-okx-0.3.0 → python-okx-0.3.1}/okx/okxclient.py +0 -0
- {python-okx-0.3.0 → python-okx-0.3.1}/okx/utils.py +0 -0
- {python-okx-0.3.0 → python-okx-0.3.1}/okx/websocket/WebSocketFactory.py +0 -0
- {python-okx-0.3.0 → python-okx-0.3.1}/okx/websocket/WsPrivateAsync.py +0 -0
- {python-okx-0.3.0 → python-okx-0.3.1}/okx/websocket/WsPublicAsync.py +0 -0
- {python-okx-0.3.0 → python-okx-0.3.1}/okx/websocket/WsUtils.py +0 -0
- {python-okx-0.3.0 → python-okx-0.3.1}/okx/websocket/__init__.py +0 -0
- {python-okx-0.3.0 → python-okx-0.3.1}/python_okx.egg-info/SOURCES.txt +0 -0
- {python-okx-0.3.0 → python-okx-0.3.1}/python_okx.egg-info/dependency_links.txt +0 -0
- {python-okx-0.3.0 → python-okx-0.3.1}/python_okx.egg-info/requires.txt +0 -0
- {python-okx-0.3.0 → python-okx-0.3.1}/python_okx.egg-info/top_level.txt +0 -0
- {python-okx-0.3.0 → python-okx-0.3.1}/setup.cfg +0 -0
- {python-okx-0.3.0 → python-okx-0.3.1}/setup.py +0 -0
|
@@ -1,7 +1,5 @@
|
|
|
1
|
-
import json
|
|
2
|
-
|
|
3
|
-
from .okxclient import OkxClient
|
|
4
1
|
from .consts import *
|
|
2
|
+
from .okxclient import OkxClient
|
|
5
3
|
|
|
6
4
|
|
|
7
5
|
class TradeAPI(OkxClient):
|
|
@@ -86,9 +84,10 @@ class TradeAPI(OkxClient):
|
|
|
86
84
|
return self._request_with_params(GET, ORDERS_HISTORY_ARCHIVE, params)
|
|
87
85
|
|
|
88
86
|
# Get Transaction Details
|
|
89
|
-
def get_fills(self, instType='', uly='', instId='', ordId='', after='', before='', limit='', instFamily='',
|
|
87
|
+
def get_fills(self, instType='', uly='', instId='', ordId='', after='', before='', limit='', instFamily='',
|
|
88
|
+
begin='', end=''):
|
|
90
89
|
params = {'instType': instType, 'uly': uly, 'instId': instId, 'ordId': ordId, 'after': after, 'before': before,
|
|
91
|
-
'limit': limit, 'instFamily': instFamily,'begin': begin, 'end'
|
|
90
|
+
'limit': limit, 'instFamily': instFamily, 'begin': begin, 'end': end}
|
|
92
91
|
return self._request_with_params(GET, ORDER_FILLS, params)
|
|
93
92
|
|
|
94
93
|
# Place Algo Order
|
|
@@ -191,3 +190,7 @@ class TradeAPI(OkxClient):
|
|
|
191
190
|
'newSlTriggerPx': newSlTriggerPx, 'newSlOrdPx': newSlOrdPx,
|
|
192
191
|
'newTpTriggerPxType': newTpTriggerPxType, 'newSlTriggerPxType': newSlTriggerPxType}
|
|
193
192
|
return self._request_with_params(POST, AMEND_ALGO_ORDER, params)
|
|
193
|
+
|
|
194
|
+
def cancel_all_after(self, timeOut='', tag=''):
|
|
195
|
+
params = {'timeOut': timeOut, 'tag': tag}
|
|
196
|
+
return self._request_with_params(POST, CANCEL_ALL_AFTER, params)
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
from .consts import *
|
|
2
|
+
from .okxclient import OkxClient
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
class TradingDataAPI(OkxClient):
|
|
6
|
+
|
|
7
|
+
def __init__(self, api_key='-1', api_secret_key='-1', passphrase='-1', use_server_time=None, flag='1',
|
|
8
|
+
domain='https://www.okx.com', debug=True, proxy=None):
|
|
9
|
+
OkxClient.__init__(self, api_key, api_secret_key, passphrase, use_server_time, flag, domain, debug, proxy)
|
|
10
|
+
|
|
11
|
+
def get_support_coin(self):
|
|
12
|
+
return self._request_without_params(GET, SUPPORT_COIN)
|
|
13
|
+
|
|
14
|
+
def get_taker_volume(self, ccy, instType, begin='', end='', period=''):
|
|
15
|
+
params = {'ccy': ccy, 'instType': instType, 'begin': begin, 'end': end, 'period': period}
|
|
16
|
+
return self._request_with_params(GET, TAKER_VOLUME, params)
|
|
17
|
+
|
|
18
|
+
def get_margin_lending_ratio(self, ccy, begin='', end='', period=''):
|
|
19
|
+
params = {'ccy': ccy, 'begin': begin, 'end': end, 'period': period}
|
|
20
|
+
return self._request_with_params(GET, MARGIN_LENDING_RATIO, params)
|
|
21
|
+
|
|
22
|
+
def get_long_short_ratio(self, ccy, begin='', end='', period=''):
|
|
23
|
+
params = {'ccy': ccy, 'begin': begin, 'end': end, 'period': period}
|
|
24
|
+
return self._request_with_params(GET, LONG_SHORT_RATIO, params)
|
|
25
|
+
|
|
26
|
+
def get_contracts_interest_volume(self, ccy, begin='', end='', period=''):
|
|
27
|
+
params = {'ccy': ccy, 'begin': begin, 'end': end, 'period': period}
|
|
28
|
+
return self._request_with_params(GET, CONTRACTS_INTEREST_VOLUME, params)
|
|
29
|
+
|
|
30
|
+
def get_options_interest_volume(self, ccy, period=''):
|
|
31
|
+
params = {'ccy': ccy, 'period': period}
|
|
32
|
+
return self._request_with_params(GET, OPTIONS_INTEREST_VOLUME, params)
|
|
33
|
+
|
|
34
|
+
def get_put_call_ratio(self, ccy, period=''):
|
|
35
|
+
params = {'ccy': ccy, 'period': period}
|
|
36
|
+
return self._request_with_params(GET, PUT_CALL_RATIO, params)
|
|
37
|
+
|
|
38
|
+
def get_interest_volume_expiry(self, ccy, period=''):
|
|
39
|
+
params = {'ccy': ccy, 'period': period}
|
|
40
|
+
return self._request_with_params(GET, OPEN_INTEREST_VOLUME_EXPIRY, params)
|
|
41
|
+
|
|
42
|
+
def get_interest_volume_strike(self, ccy, expTime, period=''):
|
|
43
|
+
params = {'ccy': ccy, 'expTime': expTime, 'period': period}
|
|
44
|
+
return self._request_with_params(GET, INTEREST_VOLUME_STRIKE, params)
|
|
45
|
+
|
|
46
|
+
def get_taker_block_volume(self, ccy, period=''):
|
|
47
|
+
params = {'ccy': ccy, 'period': period}
|
|
48
|
+
return self._request_with_params(GET, TAKER_FLOW, params)
|
|
49
|
+
|
|
50
|
+
def get_open_interest_history(self, instId='', period=None, end=None, begin=None, limit=None):
|
|
51
|
+
params = {'instId': instId}
|
|
52
|
+
if period is not None:
|
|
53
|
+
params['period'] = period
|
|
54
|
+
if end is not None:
|
|
55
|
+
params['end'] = end
|
|
56
|
+
if begin is not None:
|
|
57
|
+
params['begin'] = begin
|
|
58
|
+
if limit is not None:
|
|
59
|
+
params['limit'] = limit
|
|
60
|
+
return self._request_with_params(GET, OPEN_INTEREST_HISTORY, params)
|
|
61
|
+
|
|
62
|
+
def get_top_trader_long_short_account_ratio(self, instId='', period=None, end=None, begin=None,
|
|
63
|
+
limit=None):
|
|
64
|
+
params = {'instId': instId}
|
|
65
|
+
if period is not None:
|
|
66
|
+
params['period'] = period
|
|
67
|
+
if end is not None:
|
|
68
|
+
params['end'] = end
|
|
69
|
+
if begin is not None:
|
|
70
|
+
params['begin'] = begin
|
|
71
|
+
if limit is not None:
|
|
72
|
+
params['limit'] = limit
|
|
73
|
+
return self._request_with_params(GET, LONG_SHORT_ACCOUNT_RATIO_CONTRACT_TOP_TRADER, params)
|
|
74
|
+
|
|
75
|
+
def get_top_trader_long_short_position_ratio(self, instId='', period=None, end=None, begin=None,
|
|
76
|
+
limit=None):
|
|
77
|
+
params = {'instId': instId}
|
|
78
|
+
if period is not None:
|
|
79
|
+
params['period'] = period
|
|
80
|
+
if end is not None:
|
|
81
|
+
params['end'] = end
|
|
82
|
+
if begin is not None:
|
|
83
|
+
params['begin'] = begin
|
|
84
|
+
if limit is not None:
|
|
85
|
+
params['limit'] = limit
|
|
86
|
+
return self._request_with_params(GET, LONG_SHORT_POSITION_RATIO_CONTRACT_TOP_TRADER, params)
|
|
87
|
+
|
|
88
|
+
def get_contract_long_short_ratio(self, instId='', period=None, end=None, begin=None,
|
|
89
|
+
limit=None):
|
|
90
|
+
params = {'instId': instId}
|
|
91
|
+
if period is not None:
|
|
92
|
+
params['period'] = period
|
|
93
|
+
if end is not None:
|
|
94
|
+
params['end'] = end
|
|
95
|
+
if begin is not None:
|
|
96
|
+
params['begin'] = begin
|
|
97
|
+
if limit is not None:
|
|
98
|
+
params['limit'] = limit
|
|
99
|
+
return self._request_with_params(GET, LONG_SHORT_ACCOUNT_RATIO_CONTRACT, params)
|
|
100
|
+
|
|
101
|
+
def get_contract_taker_volume(self, instId='', period=None, unit=None, end=None, begin=None, limit=None):
|
|
102
|
+
params = {'instId': instId}
|
|
103
|
+
if period is not None:
|
|
104
|
+
params['period'] = period
|
|
105
|
+
if end is not None:
|
|
106
|
+
params['end'] = end
|
|
107
|
+
if begin is not None:
|
|
108
|
+
params['begin'] = begin
|
|
109
|
+
if limit is not None:
|
|
110
|
+
params['limit'] = limit
|
|
111
|
+
if unit is not None:
|
|
112
|
+
params['unit'] = unit
|
|
113
|
+
return self._request_with_params(GET, TAKER_VOLUME_CONTRACT, params)
|
|
@@ -137,6 +137,12 @@ PUT_CALL_RATIO = '/api/v5/rubik/stat/option/open-interest-volume-ratio'
|
|
|
137
137
|
OPEN_INTEREST_VOLUME_EXPIRY = '/api/v5/rubik/stat/option/open-interest-volume-expiry'
|
|
138
138
|
INTEREST_VOLUME_STRIKE = '/api/v5/rubik/stat/option/open-interest-volume-strike'
|
|
139
139
|
TAKER_FLOW = '/api/v5/rubik/stat/option/taker-block-volume'
|
|
140
|
+
OPEN_INTEREST_HISTORY = '/api/v5/rubik/stat/contracts/open-interest-history'
|
|
141
|
+
LONG_SHORT_ACCOUNT_RATIO_CONTRACT_TOP_TRADER = '/api/v5/rubik/stat/contracts/long-short-account-ratio-contract-top-trader'
|
|
142
|
+
LONG_SHORT_POSITION_RATIO_CONTRACT_TOP_TRADER = '/api/v5/rubik/stat/contracts/long-short-position-ratio-contract-top-trader'
|
|
143
|
+
LONG_SHORT_ACCOUNT_RATIO_CONTRACT = '/api/v5/rubik/stat/contracts/long-short-account-ratio-contract'
|
|
144
|
+
TAKER_VOLUME_CONTRACT = '/api/v5/rubik/stat/taker-volume-contract'
|
|
145
|
+
|
|
140
146
|
|
|
141
147
|
# TRADE-Complete
|
|
142
148
|
PLACR_ORDER = '/api/v5/trade/order'
|
|
@@ -166,7 +172,7 @@ CONVERT_EASY_HISTORY = '/api/v5/trade/easy-convert-history'
|
|
|
166
172
|
ONE_CLICK_REPAY_SUPPORT = '/api/v5/trade/one-click-repay-currency-list'
|
|
167
173
|
ONE_CLICK_REPAY = '/api/v5/trade/one-click-repay'
|
|
168
174
|
ONE_CLICK_REPAY_HISTORY = '/api/v5/trade/one-click-repay-history'
|
|
169
|
-
|
|
175
|
+
CANCEL_ALL_AFTER = '/api/v5/trade/cancel-all-after'
|
|
170
176
|
|
|
171
177
|
# SubAccount-complete-testwriteComplete
|
|
172
178
|
BALANCE = '/api/v5/account/subaccount/balances'
|
|
@@ -1,55 +0,0 @@
|
|
|
1
|
-
from .okxclient import OkxClient
|
|
2
|
-
from .consts import *
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
class TradingDataAPI(OkxClient):
|
|
6
|
-
|
|
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
|
-
OkxClient.__init__(self, api_key, api_secret_key, passphrase, use_server_time, flag, domain, debug, proxy)
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
def get_support_coin(self):
|
|
12
|
-
return self._request_without_params(GET, SUPPORT_COIN)
|
|
13
|
-
|
|
14
|
-
def get_taker_volume(self, ccy, instType, begin='', end='', period=''):
|
|
15
|
-
params = {'ccy': ccy, 'instType': instType, 'begin': begin, 'end': end, 'period': period}
|
|
16
|
-
return self._request_with_params(GET, TAKER_VOLUME, params)
|
|
17
|
-
|
|
18
|
-
def get_margin_lending_ratio(self, ccy, begin='', end='', period=''):
|
|
19
|
-
params = {'ccy': ccy, 'begin': begin, 'end': end, 'period': period}
|
|
20
|
-
return self._request_with_params(GET, MARGIN_LENDING_RATIO, params)
|
|
21
|
-
|
|
22
|
-
def get_long_short_ratio(self, ccy, begin='', end='', period=''):
|
|
23
|
-
params = {'ccy': ccy, 'begin': begin, 'end': end, 'period': period}
|
|
24
|
-
return self._request_with_params(GET, LONG_SHORT_RATIO, params)
|
|
25
|
-
|
|
26
|
-
def get_contracts_interest_volume(self, ccy, begin='', end='', period=''):
|
|
27
|
-
params = {'ccy': ccy, 'begin': begin, 'end': end, 'period': period}
|
|
28
|
-
return self._request_with_params(GET, CONTRACTS_INTEREST_VOLUME, params)
|
|
29
|
-
|
|
30
|
-
def get_options_interest_volume(self, ccy, period=''):
|
|
31
|
-
params = {'ccy': ccy, 'period': period}
|
|
32
|
-
return self._request_with_params(GET, OPTIONS_INTEREST_VOLUME, params)
|
|
33
|
-
|
|
34
|
-
def get_put_call_ratio(self, ccy, period=''):
|
|
35
|
-
params = {'ccy': ccy, 'period': period}
|
|
36
|
-
return self._request_with_params(GET, PUT_CALL_RATIO, params)
|
|
37
|
-
|
|
38
|
-
def get_interest_volume_expiry(self, ccy, period=''):
|
|
39
|
-
params = {'ccy': ccy, 'period': period}
|
|
40
|
-
return self._request_with_params(GET, OPEN_INTEREST_VOLUME_EXPIRY, params)
|
|
41
|
-
|
|
42
|
-
def get_interest_volume_strike(self, ccy, expTime, period=''):
|
|
43
|
-
params = {'ccy': ccy, 'expTime': expTime, 'period': period}
|
|
44
|
-
return self._request_with_params(GET, INTEREST_VOLUME_STRIKE, params)
|
|
45
|
-
|
|
46
|
-
def get_taker_block_volume(self, ccy, period=''):
|
|
47
|
-
params = {'ccy': ccy, 'period': period}
|
|
48
|
-
return self._request_with_params(GET, TAKER_FLOW, params)
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
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
|
|
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
|