python-okx 0.3.7__tar.gz → 0.3.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.3.7 → python_okx-0.3.9}/PKG-INFO +1 -1
- python_okx-0.3.9/okx/Finance/FlexibleLoan.py +65 -0
- {python_okx-0.3.7 → python_okx-0.3.9}/okx/Funding.py +0 -28
- {python_okx-0.3.7 → python_okx-0.3.9}/okx/SubAccount.py +0 -7
- {python_okx-0.3.7 → python_okx-0.3.9}/okx/Trade.py +22 -9
- {python_okx-0.3.7 → python_okx-0.3.9}/okx/__init__.py +1 -1
- {python_okx-0.3.7 → python_okx-0.3.9}/okx/consts.py +47 -51
- {python_okx-0.3.7 → python_okx-0.3.9}/python_okx.egg-info/PKG-INFO +1 -1
- {python_okx-0.3.7 → python_okx-0.3.9}/python_okx.egg-info/SOURCES.txt +1 -1
- python_okx-0.3.7/okx/SimpleEarnFixed.py +0 -91
- {python_okx-0.3.7 → python_okx-0.3.9}/README.md +0 -0
- {python_okx-0.3.7 → python_okx-0.3.9}/okx/Account.py +0 -0
- {python_okx-0.3.7 → python_okx-0.3.9}/okx/BlockTrading.py +0 -0
- {python_okx-0.3.7 → python_okx-0.3.9}/okx/Convert.py +0 -0
- {python_okx-0.3.7 → python_okx-0.3.9}/okx/CopyTrading.py +0 -0
- {python_okx-0.3.7 → python_okx-0.3.9}/okx/FDBroker.py +0 -0
- {python_okx-0.3.7 → python_okx-0.3.9}/okx/Finance/EthStaking.py +0 -0
- {python_okx-0.3.7 → python_okx-0.3.9}/okx/Finance/Savings.py +0 -0
- {python_okx-0.3.7 → python_okx-0.3.9}/okx/Finance/SolStaking.py +0 -0
- {python_okx-0.3.7 → python_okx-0.3.9}/okx/Finance/StakingDefi.py +0 -0
- {python_okx-0.3.7 → python_okx-0.3.9}/okx/Finance/__init__.py +0 -0
- {python_okx-0.3.7 → python_okx-0.3.9}/okx/Grid.py +0 -0
- {python_okx-0.3.7 → python_okx-0.3.9}/okx/MarketData.py +0 -0
- {python_okx-0.3.7 → python_okx-0.3.9}/okx/PublicData.py +0 -0
- {python_okx-0.3.7 → python_okx-0.3.9}/okx/SpreadTrading.py +0 -0
- {python_okx-0.3.7 → python_okx-0.3.9}/okx/Status.py +0 -0
- {python_okx-0.3.7 → python_okx-0.3.9}/okx/TradingData.py +0 -0
- {python_okx-0.3.7 → python_okx-0.3.9}/okx/exceptions.py +0 -0
- {python_okx-0.3.7 → python_okx-0.3.9}/okx/okxclient.py +0 -0
- {python_okx-0.3.7 → python_okx-0.3.9}/okx/utils.py +0 -0
- {python_okx-0.3.7 → python_okx-0.3.9}/okx/websocket/WebSocketFactory.py +0 -0
- {python_okx-0.3.7 → python_okx-0.3.9}/okx/websocket/WsPrivateAsync.py +0 -0
- {python_okx-0.3.7 → python_okx-0.3.9}/okx/websocket/WsPublicAsync.py +0 -0
- {python_okx-0.3.7 → python_okx-0.3.9}/okx/websocket/WsUtils.py +0 -0
- {python_okx-0.3.7 → python_okx-0.3.9}/okx/websocket/__init__.py +0 -0
- {python_okx-0.3.7 → python_okx-0.3.9}/python_okx.egg-info/dependency_links.txt +0 -0
- {python_okx-0.3.7 → python_okx-0.3.9}/python_okx.egg-info/requires.txt +0 -0
- {python_okx-0.3.7 → python_okx-0.3.9}/python_okx.egg-info/top_level.txt +0 -0
- {python_okx-0.3.7 → python_okx-0.3.9}/setup.cfg +0 -0
- {python_okx-0.3.7 → python_okx-0.3.9}/setup.py +0 -0
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
from okx.okxclient import OkxClient
|
|
2
|
+
from okx.consts import *
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
class FlexibleLoanAPI(OkxClient):
|
|
6
|
+
def __init__(self, api_key='-1', api_secret_key='-1', passphrase='-1', use_server_time=None, flag='1',
|
|
7
|
+
domain='https://www.okx.com', debug=False, proxy=None):
|
|
8
|
+
OkxClient.__init__(self, api_key, api_secret_key, passphrase, use_server_time, flag, domain, debug, proxy)
|
|
9
|
+
|
|
10
|
+
def borrow_currencies(self):
|
|
11
|
+
return self._request_without_params(GET, FINANCE_BORROW_CURRENCIES)
|
|
12
|
+
|
|
13
|
+
def collateral_assets(self, ccy=''):
|
|
14
|
+
params = {}
|
|
15
|
+
if ccy != '':
|
|
16
|
+
params['ccy'] = ccy
|
|
17
|
+
return self._request_with_params(GET, FINANCE_COLLATERAL_ASSETS, params)
|
|
18
|
+
|
|
19
|
+
def max_loan(self, borrowCcy='', supCollateral=[]):
|
|
20
|
+
params = {
|
|
21
|
+
'borrowCcy': borrowCcy,
|
|
22
|
+
'supCollateral': supCollateral,
|
|
23
|
+
}
|
|
24
|
+
return self._request_with_params(POST, FINANCE_MAX_LOAN, params)
|
|
25
|
+
|
|
26
|
+
def max_collateral_redeem_amount(self, ccy=''):
|
|
27
|
+
params = {}
|
|
28
|
+
if ccy != '':
|
|
29
|
+
params['ccy'] = ccy
|
|
30
|
+
return self._request_with_params(GET, FINANCE_MAX_REDEEM, params)
|
|
31
|
+
|
|
32
|
+
def adjust_collateral(self, type='', collateralCcy='', collateralAmt=''):
|
|
33
|
+
params = {
|
|
34
|
+
'type': type,
|
|
35
|
+
'collateralCcy': collateralCcy,
|
|
36
|
+
'collateralAmt': collateralAmt,
|
|
37
|
+
}
|
|
38
|
+
return self._request_with_params(POST, FINANCE_ADJUST_COLLATERAL, params)
|
|
39
|
+
|
|
40
|
+
def loan_info(self):
|
|
41
|
+
return self._request_without_params(GET, FINANCE_LOAN_INFO)
|
|
42
|
+
|
|
43
|
+
def loan_history(self, type='', after='', before='', limit=''):
|
|
44
|
+
params = {}
|
|
45
|
+
if type != '':
|
|
46
|
+
params['type'] = type
|
|
47
|
+
if after != '':
|
|
48
|
+
params['after'] = after
|
|
49
|
+
if before != '':
|
|
50
|
+
params['before'] = before
|
|
51
|
+
if limit != '':
|
|
52
|
+
params['limit'] = limit
|
|
53
|
+
return self._request_with_params(GET, FINANCE_LOAN_HISTORY, params)
|
|
54
|
+
|
|
55
|
+
def interest_accrued(self, ccy='', after='', before='', limit=''):
|
|
56
|
+
params = {}
|
|
57
|
+
if ccy != '':
|
|
58
|
+
params['ccy'] = ccy
|
|
59
|
+
if after != '':
|
|
60
|
+
params['after'] = after
|
|
61
|
+
if before != '':
|
|
62
|
+
params['before'] = before
|
|
63
|
+
if limit != '':
|
|
64
|
+
params['limit'] = limit
|
|
65
|
+
return self._request_with_params(GET, FINANCE_INTEREST_ACCRUED, params)
|
|
@@ -79,27 +79,6 @@ class FundingAPI(OkxClient):
|
|
|
79
79
|
params = {'ccy':ccy, 'invoice':invoice, 'memo':memo}
|
|
80
80
|
return self._request_with_params(POST, WITHDRAWAL_LIGHTNING, params)
|
|
81
81
|
|
|
82
|
-
# POST SET LENDING RATE
|
|
83
|
-
def set_lending_rate(self, ccy, rate):
|
|
84
|
-
params = {'ccy': ccy, 'rate': rate}
|
|
85
|
-
return self._request_with_params(POST, SET_LENDING_RATE, params)
|
|
86
|
-
|
|
87
|
-
# GET LENDING HISTORY
|
|
88
|
-
def get_lending_history(self, ccy='', before='', after='', limit='' ):
|
|
89
|
-
params = {'ccy': ccy, 'after': after, 'before': before, 'limit': limit }
|
|
90
|
-
return self._request_with_params(GET, LENDING_HISTORY, params)
|
|
91
|
-
|
|
92
|
-
# GET LENDING RATE HISTORY
|
|
93
|
-
def get_lending_rate_history(self, ccy='',after = '',before = '',limit = '' ):
|
|
94
|
-
params = {'ccy': ccy,'after':after,'before':before,'limit':limit}
|
|
95
|
-
return self._request_with_params(GET, LENDING_RATE_HISTORY, params)
|
|
96
|
-
|
|
97
|
-
# GET LENDING RATE SUMMARY
|
|
98
|
-
def get_lending_rate_summary(self, ccy=''):
|
|
99
|
-
params = {'ccy': ccy}
|
|
100
|
-
return self._request_with_params(GET, LENDING_RATE_SUMMARY, params)
|
|
101
|
-
|
|
102
|
-
|
|
103
82
|
#POST /api/v5/asset/cancel-withdrawal
|
|
104
83
|
def cancel_withdrawal(self,wdId = ''):
|
|
105
84
|
params = {
|
|
@@ -121,13 +100,6 @@ class FundingAPI(OkxClient):
|
|
|
121
100
|
}
|
|
122
101
|
return self._request_with_params(GET, ASSET_VALUATION, params)
|
|
123
102
|
|
|
124
|
-
#GET / api / v5 / asset / saving - balance
|
|
125
|
-
def get_saving_balance(self,ccy = ''):
|
|
126
|
-
params = {
|
|
127
|
-
'ccy':ccy
|
|
128
|
-
}
|
|
129
|
-
return self._request_with_params(GET, GET_SAVING_BALANCE, params)
|
|
130
|
-
|
|
131
103
|
#Get non-tradable assets
|
|
132
104
|
def get_non_tradable_assets(self, ccy=''):
|
|
133
105
|
params = {
|
|
@@ -59,13 +59,6 @@ class SubAccountAPI(OkxClient):
|
|
|
59
59
|
}
|
|
60
60
|
return self._request_with_params(GET, GET_ASSET_SUBACCOUNT_BALANCE, params)
|
|
61
61
|
|
|
62
|
-
# - Get the user's affiliate rebate information
|
|
63
|
-
def get_the_user_affiliate_rebate_information(self, apiKey=''):
|
|
64
|
-
params = {
|
|
65
|
-
'apiKey': apiKey
|
|
66
|
-
}
|
|
67
|
-
return self._request_with_params(GET, GET_THE_USER_AFFILIATE_REBATE, params)
|
|
68
|
-
|
|
69
62
|
# - Set sub_accounts VIP loan%
|
|
70
63
|
def set_sub_accounts_VIP_loan(self, enable='', alloc=[]):
|
|
71
64
|
params = {
|
|
@@ -12,14 +12,10 @@ class TradeAPI(OkxClient):
|
|
|
12
12
|
|
|
13
13
|
# Place Order
|
|
14
14
|
def place_order(self, instId, tdMode, side, ordType, sz, ccy='', clOrdId='', tag='', posSide='', px='',
|
|
15
|
-
reduceOnly='', tgtCcy='',
|
|
16
|
-
tpTriggerPxType='', slTriggerPxType='', quickMgnType='', stpId='', stpMode='',
|
|
17
|
-
attachAlgoOrds=None):
|
|
15
|
+
reduceOnly='', tgtCcy='', stpMode='', attachAlgoOrds=None, pxUsd='', pxVol='', banAmend=''):
|
|
18
16
|
params = {'instId': instId, 'tdMode': tdMode, 'side': side, 'ordType': ordType, 'sz': sz, 'ccy': ccy,
|
|
19
17
|
'clOrdId': clOrdId, 'tag': tag, 'posSide': posSide, 'px': px, 'reduceOnly': reduceOnly,
|
|
20
|
-
'tgtCcy': tgtCcy, '
|
|
21
|
-
'slOrdPx': slOrdPx, 'tpTriggerPxType': tpTriggerPxType, 'slTriggerPxType': slTriggerPxType,
|
|
22
|
-
'quickMgnType': quickMgnType, 'stpId': stpId, 'stpMode': stpMode}
|
|
18
|
+
'tgtCcy': tgtCcy, 'stpMode': stpMode, 'pxUsd': pxUsd, 'pxVol': pxVol, 'banAmend': banAmend}
|
|
23
19
|
params['attachAlgoOrds'] = attachAlgoOrds
|
|
24
20
|
return self._request_with_params(POST, PLACR_ORDER, params)
|
|
25
21
|
|
|
@@ -116,10 +112,9 @@ class TradeAPI(OkxClient):
|
|
|
116
112
|
return self._request_with_params(POST, CANCEL_ALGOS, params)
|
|
117
113
|
|
|
118
114
|
# Get Algo Order List
|
|
119
|
-
def order_algos_list(self, ordType='', algoId='', instType='', instId='', after='', before='', limit=''
|
|
120
|
-
algoClOrdId=''):
|
|
115
|
+
def order_algos_list(self, ordType='', algoId='', instType='', instId='', after='', before='', limit=''):
|
|
121
116
|
params = {'ordType': ordType, 'algoId': algoId, 'instType': instType, 'instId': instId, 'after': after,
|
|
122
|
-
'before': before, 'limit': limit
|
|
117
|
+
'before': before, 'limit': limit}
|
|
123
118
|
return self._request_with_params(GET, ORDERS_ALGO_PENDING, params)
|
|
124
119
|
|
|
125
120
|
# Get Algo Order History
|
|
@@ -187,3 +182,21 @@ class TradeAPI(OkxClient):
|
|
|
187
182
|
'newSlTriggerPx': newSlTriggerPx, 'newSlOrdPx': newSlOrdPx,
|
|
188
183
|
'newTpTriggerPxType': newTpTriggerPxType, 'newSlTriggerPxType': newSlTriggerPxType}
|
|
189
184
|
return self._request_with_params(POST, AMEND_ALGO_ORDER, params)
|
|
185
|
+
|
|
186
|
+
def get_oneclick_repay_list_v2(self):
|
|
187
|
+
return self._request_without_params(GET, ONE_CLICK_REPAY_SUPPORT_V2)
|
|
188
|
+
|
|
189
|
+
def oneclick_repay_v2(self, debtCcy='', repayCcyList=[]):
|
|
190
|
+
params = {
|
|
191
|
+
'debtCcy': debtCcy,
|
|
192
|
+
'repayCcyList': repayCcyList
|
|
193
|
+
}
|
|
194
|
+
return self._request_with_params(POST, ONE_CLICK_REPAY_V2, params)
|
|
195
|
+
|
|
196
|
+
def oneclick_repay_history_v2(self, after='', before='', limit=''):
|
|
197
|
+
params = {
|
|
198
|
+
'after': after,
|
|
199
|
+
'before': before,
|
|
200
|
+
'limit': limit
|
|
201
|
+
}
|
|
202
|
+
return self._request_with_params(GET, ONE_CLICK_REPAY_HISTORY_V2, params)
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
#
|
|
1
|
+
# Http header
|
|
2
2
|
API_URL = 'https://www.okx.com'
|
|
3
3
|
|
|
4
4
|
CONTENT_TYPE = 'Content-Type'
|
|
@@ -18,7 +18,7 @@ POST = "POST"
|
|
|
18
18
|
|
|
19
19
|
SERVER_TIMESTAMP_URL = '/api/v5/public/time'
|
|
20
20
|
|
|
21
|
-
#
|
|
21
|
+
# Account
|
|
22
22
|
POSITION_RISK='/api/v5/account/account-position-risk'
|
|
23
23
|
ACCOUNT_INFO = '/api/v5/account/balance'
|
|
24
24
|
POSITION_INFO = '/api/v5/account/positions'
|
|
@@ -44,8 +44,8 @@ BORROW_REPAY_HISTORY = '/api/v5/account/borrow-repay-history'
|
|
|
44
44
|
INTEREST_LIMITS = '/api/v5/account/interest-limits'
|
|
45
45
|
SIMULATED_MARGIN = '/api/v5/account/simulated_margin'
|
|
46
46
|
GREEKS = '/api/v5/account/greeks'
|
|
47
|
-
POSITIONS_HISTORY = '/api/v5/account/positions-history'
|
|
48
|
-
GET_PM_LIMIT = '/api/v5/account/position-tiers'
|
|
47
|
+
POSITIONS_HISTORY = '/api/v5/account/positions-history'
|
|
48
|
+
GET_PM_LIMIT = '/api/v5/account/position-tiers'
|
|
49
49
|
GET_VIP_INTEREST_ACCRUED_DATA = '/api/v5/account/vip-interest-accrued'
|
|
50
50
|
GET_VIP_INTEREST_DEDUCTED_DATA = '/api/v5/account/vip-interest-deducted'
|
|
51
51
|
GET_VIP_LOAN_ORDER_LIST= '/api/v5/account/vip-loan-order-list'
|
|
@@ -67,7 +67,7 @@ MANUAL_REBORROW_REPAY = '/api/v5/account/spot-manual-borrow-repay'
|
|
|
67
67
|
SET_AUTO_REPAY='/api/v5/account/set-auto-repay'
|
|
68
68
|
GET_BORROW_REPAY_HISTORY='/api/v5/account/spot-borrow-repay-history'
|
|
69
69
|
|
|
70
|
-
#
|
|
70
|
+
# Funding
|
|
71
71
|
NON_TRADABLE_ASSETS = '/api/v5/asset/non-tradable-assets'
|
|
72
72
|
DEPOSIT_ADDRESS = '/api/v5/asset/deposit-address'
|
|
73
73
|
GET_BALANCES = '/api/v5/asset/balances'
|
|
@@ -80,21 +80,16 @@ PURCHASE_REDEMPT = '/api/v5/asset/purchase_redempt'
|
|
|
80
80
|
BILLS_INFO = '/api/v5/asset/bills'
|
|
81
81
|
DEPOSIT_LIGHTNING = '/api/v5/asset/deposit-lightning'
|
|
82
82
|
WITHDRAWAL_LIGHTNING = '/api/v5/asset/withdrawal-lightning'
|
|
83
|
-
CANCEL_WITHDRAWAL = '/api/v5/asset/cancel-withdrawal'
|
|
83
|
+
CANCEL_WITHDRAWAL = '/api/v5/asset/cancel-withdrawal'
|
|
84
84
|
WITHDRAWAL_HISTORY = '/api/v5/asset/withdrawal-history'
|
|
85
|
-
CONVERT_DUST_ASSETS = '/api/v5/asset/convert-dust-assets'
|
|
86
|
-
ASSET_VALUATION = '/api/v5/asset/asset-valuation'
|
|
87
|
-
SET_LENDING_RATE = '/api/v5/asset/set-lending-rate'
|
|
88
|
-
LENDING_HISTORY = '/api/v5/asset/lending-history'
|
|
89
|
-
LENDING_RATE_HISTORY = '/api/v5/asset/lending-rate-history'
|
|
90
|
-
LENDING_RATE_SUMMARY = '/api/v5/asset/lending-rate-summary'
|
|
91
|
-
GET_SAVING_BALANCE = '/api/v5/asset/saving-balance' #need to add
|
|
85
|
+
CONVERT_DUST_ASSETS = '/api/v5/asset/convert-dust-assets'
|
|
86
|
+
ASSET_VALUATION = '/api/v5/asset/asset-valuation'
|
|
92
87
|
GET_WITHDRAWAL_HISTORY = '/api/v5/asset/withdrawal-history'
|
|
93
88
|
GET_NON_TRADABLE_ASSETS = '/api/v5/asset/non-tradable-assets'
|
|
94
89
|
GET_DEPOSIT_WITHDrAW_STATUS = '/api/v5/asset/deposit-withdraw-status'
|
|
95
90
|
|
|
96
91
|
|
|
97
|
-
# Market Data
|
|
92
|
+
# Market Data
|
|
98
93
|
TICKERS_INFO = '/api/v5/market/tickers'
|
|
99
94
|
TICKER_INFO = '/api/v5/market/ticker'
|
|
100
95
|
INDEX_TICKERS = '/api/v5/market/index-tickers'
|
|
@@ -104,17 +99,17 @@ HISTORY_CANDLES = '/api/v5/market/history-candles'
|
|
|
104
99
|
INDEX_CANSLES = '/api/v5/market/index-candles'
|
|
105
100
|
MARKPRICE_CANDLES = '/api/v5/market/mark-price-candles'
|
|
106
101
|
MARKET_TRADES = '/api/v5/market/trades'
|
|
107
|
-
VOLUMNE = '/api/v5/market/platform-24-volume'
|
|
108
|
-
INDEX_COMPONENTS = '/api/v5/market/index-components'
|
|
109
|
-
EXCHANGE_RATE = '/api/v5/market/exchange-rate'
|
|
110
|
-
HISTORY_TRADES = '/api/v5/market/history-trades'
|
|
111
|
-
BLOCK_TICKERS = '/api/v5/market/block-tickers'
|
|
112
|
-
BLOCK_TICKER = '/api/v5/market/block-ticker'
|
|
113
|
-
BLOCK_TRADES = '/api/v5/market/block-trades'
|
|
102
|
+
VOLUMNE = '/api/v5/market/platform-24-volume'
|
|
103
|
+
INDEX_COMPONENTS = '/api/v5/market/index-components'
|
|
104
|
+
EXCHANGE_RATE = '/api/v5/market/exchange-rate'
|
|
105
|
+
HISTORY_TRADES = '/api/v5/market/history-trades'
|
|
106
|
+
BLOCK_TICKERS = '/api/v5/market/block-tickers'
|
|
107
|
+
BLOCK_TICKER = '/api/v5/market/block-ticker'
|
|
108
|
+
BLOCK_TRADES = '/api/v5/market/block-trades'
|
|
114
109
|
GET_ORDER_LITE_BOOK = '/api/v5/market/books-lite'
|
|
115
110
|
GET_OPTION_TRADES = '/api/v5/market/option/instrument-family-trades'
|
|
116
111
|
|
|
117
|
-
# Public Data
|
|
112
|
+
# Public Data
|
|
118
113
|
INSTRUMENT_INFO = '/api/v5/public/instruments'
|
|
119
114
|
DELIVERY_EXERCISE = '/api/v5/public/delivery-exercise-history'
|
|
120
115
|
OPEN_INTEREST = '/api/v5/public/open-interest'
|
|
@@ -128,15 +123,15 @@ SYSTEM_TIME = '/api/v5/public/time'
|
|
|
128
123
|
LIQUIDATION_ORDERS = '/api/v5/public/liquidation-orders'
|
|
129
124
|
MARK_PRICE = '/api/v5/public/mark-price'
|
|
130
125
|
TIER = '/api/v5/public/position-tiers'
|
|
131
|
-
INTEREST_LOAN = '/api/v5/public/interest-rate-loan-quota'
|
|
132
|
-
UNDERLYING = '/api/v5/public/underlying'
|
|
133
|
-
VIP_INTEREST_RATE_LOAN_QUOTA = '/api/v5/public/vip-interest-rate-loan-quota'
|
|
134
|
-
INSURANCE_FUND = '/api/v5/public/insurance-fund'
|
|
135
|
-
CONVERT_CONTRACT_COIN = '/api/v5/public/convert-contract-coin'
|
|
126
|
+
INTEREST_LOAN = '/api/v5/public/interest-rate-loan-quota'
|
|
127
|
+
UNDERLYING = '/api/v5/public/underlying'
|
|
128
|
+
VIP_INTEREST_RATE_LOAN_QUOTA = '/api/v5/public/vip-interest-rate-loan-quota'
|
|
129
|
+
INSURANCE_FUND = '/api/v5/public/insurance-fund'
|
|
130
|
+
CONVERT_CONTRACT_COIN = '/api/v5/public/convert-contract-coin'
|
|
136
131
|
GET_OPTION_TICKBANDS = '/api/v5/public/instrument-tick-bands'
|
|
137
132
|
GET_OPTION_TRADES = '/api/v5/public/option-trades'
|
|
138
133
|
|
|
139
|
-
#
|
|
134
|
+
# Trading data
|
|
140
135
|
SUPPORT_COIN = '/api/v5/rubik/stat/trading-data/support-coin'
|
|
141
136
|
TAKER_VOLUME = '/api/v5/rubik/stat/taker-volume'
|
|
142
137
|
MARGIN_LENDING_RATIO = '/api/v5/rubik/stat/margin/loan-ratio'
|
|
@@ -148,7 +143,7 @@ OPEN_INTEREST_VOLUME_EXPIRY = '/api/v5/rubik/stat/option/open-interest-volume-ex
|
|
|
148
143
|
INTEREST_VOLUME_STRIKE = '/api/v5/rubik/stat/option/open-interest-volume-strike'
|
|
149
144
|
TAKER_FLOW = '/api/v5/rubik/stat/option/taker-block-volume'
|
|
150
145
|
|
|
151
|
-
#
|
|
146
|
+
# Trade
|
|
152
147
|
PLACR_ORDER = '/api/v5/trade/order'
|
|
153
148
|
BATCH_ORDERS = '/api/v5/trade/batch-orders'
|
|
154
149
|
CANCEL_ORDER = '/api/v5/trade/cancel-order'
|
|
@@ -168,40 +163,41 @@ ORDERS_ALGO_PENDING = '/api/v5/trade/orders-algo-pending'
|
|
|
168
163
|
ORDERS_ALGO_HISTORY = '/api/v5/trade/orders-algo-history'
|
|
169
164
|
GET_ALGO_ORDER_DETAILS = '/api/v5/trade/order-algo'
|
|
170
165
|
AMEND_ALGO_ORDER = '/api/v5/trade/amend-algos'
|
|
171
|
-
|
|
172
166
|
EASY_CONVERT_CURRENCY_LIST = '/api/v5/trade/easy-convert-currency-list'
|
|
173
167
|
EASY_CONVERT = '/api/v5/trade/easy-convert'
|
|
174
168
|
CONVERT_EASY_HISTORY = '/api/v5/trade/easy-convert-history'
|
|
175
169
|
ONE_CLICK_REPAY_SUPPORT = '/api/v5/trade/one-click-repay-currency-list'
|
|
176
170
|
ONE_CLICK_REPAY = '/api/v5/trade/one-click-repay'
|
|
177
171
|
ONE_CLICK_REPAY_HISTORY = '/api/v5/trade/one-click-repay-history'
|
|
172
|
+
ONE_CLICK_REPAY_SUPPORT_V2 = '/api/v5/trade/one-click-repay-currency-list-v2'
|
|
173
|
+
ONE_CLICK_REPAY_V2 = '/api/v5/trade/one-click-repay-v2'
|
|
174
|
+
ONE_CLICK_REPAY_HISTORY_V2 = '/api/v5/trade/one-click-repay-history-v2'
|
|
178
175
|
|
|
179
176
|
|
|
180
|
-
# SubAccount
|
|
177
|
+
# SubAccount
|
|
181
178
|
BALANCE = '/api/v5/account/subaccount/balances'
|
|
182
179
|
BILLs = '/api/v5/asset/subaccount/bills'
|
|
183
180
|
RESET = '/api/v5/users/subaccount/modify-apikey'
|
|
184
181
|
VIEW_LIST = '/api/v5/users/subaccount/list'
|
|
185
182
|
SUBACCOUNT_TRANSFER = '/api/v5/asset/subaccount/transfer'
|
|
186
|
-
ENTRUST_SUBACCOUNT_LIST = '/api/v5/users/entrust-subaccount-list'
|
|
187
|
-
SET_TRSNSFER_OUT = '/api/v5/users/subaccount/set-transfer-out'
|
|
188
|
-
GET_ASSET_SUBACCOUNT_BALANCE = '/api/v5/asset/subaccount/balances'
|
|
189
|
-
GET_THE_USER_AFFILIATE_REBATE = '/api/v5/users/partner/if-rebate'
|
|
183
|
+
ENTRUST_SUBACCOUNT_LIST = '/api/v5/users/entrust-subaccount-list'
|
|
184
|
+
SET_TRSNSFER_OUT = '/api/v5/users/subaccount/set-transfer-out'
|
|
185
|
+
GET_ASSET_SUBACCOUNT_BALANCE = '/api/v5/asset/subaccount/balances'
|
|
190
186
|
SET_SUB_ACCOUNTS_VIP_LOAN = '/api/v5/account/subaccount/set-loan-allocation'
|
|
191
187
|
GET_SUB_ACCOUNT_BORROW_INTEREST_AND_LIMIT = '/api/v5/account/subaccount/interest-limits'
|
|
192
188
|
|
|
193
|
-
# Convert
|
|
189
|
+
# Convert
|
|
194
190
|
GET_CURRENCIES = '/api/v5/asset/convert/currencies'
|
|
195
191
|
GET_CURRENCY_PAIR = '/api/v5/asset/convert/currency-pair'
|
|
196
192
|
ESTIMATE_QUOTE = '/api/v5/asset/convert/estimate-quote'
|
|
197
193
|
CONVERT_TRADE = '/api/v5/asset/convert/trade'
|
|
198
194
|
CONVERT_HISTORY = '/api/v5/asset/convert/history'
|
|
199
195
|
|
|
200
|
-
#
|
|
196
|
+
# FD Broker
|
|
201
197
|
FD_GET_REBATE_PER_ORDERS = '/api/v5/broker/fd/rebate-per-orders'
|
|
202
198
|
FD_REBATE_PER_ORDERS = '/api/v5/broker/fd/rebate-per-orders'
|
|
203
199
|
|
|
204
|
-
#
|
|
200
|
+
# BlockTrading
|
|
205
201
|
COUNTERPARTIES = '/api/v5/rfq/counterparties'
|
|
206
202
|
CREATE_RFQ = '/api/v5/rfq/create-rfq'
|
|
207
203
|
CANCEL_RFQ = '/api/v5/rfq/cancel-rfq'
|
|
@@ -220,7 +216,7 @@ MMP_RESET = '/api/v5/rfq/mmp-reset'
|
|
|
220
216
|
MARKER_INSTRUMENT_SETTING = '/api/v5/rfq/maker-instrument-settings'
|
|
221
217
|
|
|
222
218
|
|
|
223
|
-
#
|
|
219
|
+
# Trading Bot
|
|
224
220
|
GRID_ORDER_ALGO = '/api/v5/tradingBot/grid/order-algo'
|
|
225
221
|
GRID_AMEND_ORDER_ALGO = '/api/v5/tradingBot/grid/amend-order-algo'
|
|
226
222
|
GRID_STOP_ORDER_ALGO = '/api/v5/tradingBot/grid/stop-order-algo'
|
|
@@ -230,7 +226,6 @@ GRID_ORDERS_ALGO_DETAILS = '/api/v5/tradingBot/grid/orders-algo-details'
|
|
|
230
226
|
GRID_SUB_ORDERS = '/api/v5/tradingBot/grid/sub-orders'
|
|
231
227
|
GRID_POSITIONS = '/api/v5/tradingBot/grid/positions'
|
|
232
228
|
GRID_WITHDRAW_INCOME = '/api/v5/tradingBot/grid/withdraw-income'
|
|
233
|
-
#--------need to add:
|
|
234
229
|
GRID_COMPUTE_MARIGIN_BALANCE = '/api/v5/tradingBot/grid/compute-margin-balance'
|
|
235
230
|
GRID_MARGIN_BALANCE = '/api/v5/tradingBot/grid/margin-balance'
|
|
236
231
|
GRID_AI_PARAM = '/api/v5/tradingBot/grid/ai-param'
|
|
@@ -242,7 +237,7 @@ GET_RECURRING_BUY_ORDER_HISTORY = '/api/v5/tradingBot/recurring/orders-algo-hist
|
|
|
242
237
|
GET_RECURRING_BUY_ORDER_DETAILS = '/api/v5/tradingBot/recurring/orders-algo-details'
|
|
243
238
|
GET_RECURRING_BUY_SUB_ORDERS = '/api/v5/tradingBot/recurring/sub-orders'
|
|
244
239
|
|
|
245
|
-
#
|
|
240
|
+
# Stacking
|
|
246
241
|
STACK_DEFI_OFFERS = '/api/v5/finance/staking-defi/offers'
|
|
247
242
|
STACK_DEFI_PURCHASE = '/api/v5/finance/staking-defi/purchase'
|
|
248
243
|
STACK_DEFI_REDEEM = '/api/v5/finance/staking-defi/redeem'
|
|
@@ -267,10 +262,10 @@ STACK_SOL_BALANCE = '/api/v5/finance/staking-defi/sol/balance'
|
|
|
267
262
|
STACK_SOL_PURCHASE_REDEEM_HISTORY = '/api/v5/finance/staking-defi/sol/purchase-redeem-history'
|
|
268
263
|
STACK_SOL_APY_HISTORY = '/api/v5/finance/staking-defi/sol/apy-history'
|
|
269
264
|
|
|
270
|
-
#
|
|
265
|
+
# Status
|
|
271
266
|
STATUS = '/api/v5/system/status'
|
|
272
267
|
|
|
273
|
-
#Copy Trading
|
|
268
|
+
# Copy Trading
|
|
274
269
|
GET_EXISTING_LEADING_POSITIONS = '/api/v5/copytrading/current-subpositions'
|
|
275
270
|
GET_LEADING_POSITIONS_HISTORY = '/api/v5/copytrading/subpositions-history'
|
|
276
271
|
PLACE_LEADING_STOP_ORDER = '/api/v5/copytrading/algo-order'
|
|
@@ -294,13 +289,14 @@ SPREAD_GET_ORDER_BOOK = '/api/v5/sprd/books'
|
|
|
294
289
|
SPREAD_GET_TICKER = '/api/v5/sprd/ticker'
|
|
295
290
|
SPREAD_GET_PUBLIC_TRADES = '/api/v5/sprd/public-trades'
|
|
296
291
|
|
|
297
|
-
#
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
292
|
+
# Flexible loan
|
|
293
|
+
FINANCE_BORROW_CURRENCIES = '/api/v5/finance/flexible-loan/borrow-currencies'
|
|
294
|
+
FINANCE_COLLATERAL_ASSETS = '/api/v5/finance/flexible-loan/collateral-assets'
|
|
295
|
+
FINANCE_MAX_LOAN = '/api/v5/finance/flexible-loan/max-loan'
|
|
296
|
+
FINANCE_MAX_REDEEM = '/api/v5/finance/flexible-loan/max-collateral-redeem-amount'
|
|
297
|
+
FINANCE_ADJUST_COLLATERAL = '/api/v5/finance/flexible-loan/adjust-collateral'
|
|
298
|
+
FINANCE_LOAN_INFO = '/api/v5/finance/flexible-loan/loan-info'
|
|
299
|
+
FINANCE_LOAN_HISTORY = '/api/v5/finance/flexible-loan/loan-history'
|
|
300
|
+
FINANCE_INTEREST_ACCRUED = '/api/v5/finance/flexible-loan/interest-accrued'
|
|
305
301
|
|
|
306
302
|
|
|
@@ -9,7 +9,6 @@ okx/Funding.py
|
|
|
9
9
|
okx/Grid.py
|
|
10
10
|
okx/MarketData.py
|
|
11
11
|
okx/PublicData.py
|
|
12
|
-
okx/SimpleEarnFixed.py
|
|
13
12
|
okx/SpreadTrading.py
|
|
14
13
|
okx/Status.py
|
|
15
14
|
okx/SubAccount.py
|
|
@@ -21,6 +20,7 @@ okx/exceptions.py
|
|
|
21
20
|
okx/okxclient.py
|
|
22
21
|
okx/utils.py
|
|
23
22
|
okx/Finance/EthStaking.py
|
|
23
|
+
okx/Finance/FlexibleLoan.py
|
|
24
24
|
okx/Finance/Savings.py
|
|
25
25
|
okx/Finance/SolStaking.py
|
|
26
26
|
okx/Finance/StakingDefi.py
|
|
@@ -1,91 +0,0 @@
|
|
|
1
|
-
from okx.consts import GET, LENDING_OFFERS, LENDING_APY_HISTORY, PENDING_LENDING_VOLUME, PLACE_LENDING_ORDER, POST, \
|
|
2
|
-
AMEND_LENDING_ORDER, LENDING_ORDERS_LIST, LENDING_SUB_ORDERS
|
|
3
|
-
from okx.okxclient import OkxClient
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
class SimpleEarnFixedAPI(OkxClient):
|
|
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=False, proxy=None):
|
|
9
|
-
OkxClient.__init__(self, api_key, api_secret_key, passphrase, use_server_time, flag, domain, debug, proxy)
|
|
10
|
-
|
|
11
|
-
def get_lending_offers(self, ccy=None, term=None):
|
|
12
|
-
params = {}
|
|
13
|
-
if ccy is not None:
|
|
14
|
-
params['ccy'] = ccy
|
|
15
|
-
if term is not None:
|
|
16
|
-
params['term'] = term
|
|
17
|
-
return self._request_with_params(GET, LENDING_OFFERS, params)
|
|
18
|
-
|
|
19
|
-
def get_lending_apy_history(self, ccy=None, term=None):
|
|
20
|
-
params = {}
|
|
21
|
-
if ccy is not None:
|
|
22
|
-
params['ccy'] = ccy
|
|
23
|
-
if term is not None:
|
|
24
|
-
params['term'] = term
|
|
25
|
-
return self._request_with_params(GET, LENDING_APY_HISTORY, params)
|
|
26
|
-
|
|
27
|
-
def get_pending_lending_volume(self, ccy=None, term=None):
|
|
28
|
-
params = {}
|
|
29
|
-
if ccy is not None:
|
|
30
|
-
params['ccy'] = ccy
|
|
31
|
-
if term is not None:
|
|
32
|
-
params['term'] = term
|
|
33
|
-
return self._request_with_params(GET, PENDING_LENDING_VOLUME, params)
|
|
34
|
-
|
|
35
|
-
def place_lending_order(self, ccy=None, amt=None, rate=None, term=None, autoRenewal=False):
|
|
36
|
-
params = {}
|
|
37
|
-
if ccy is not None:
|
|
38
|
-
params['ccy'] = ccy
|
|
39
|
-
if amt is not None:
|
|
40
|
-
params['amt'] = amt
|
|
41
|
-
if rate is not None:
|
|
42
|
-
params['rate'] = rate
|
|
43
|
-
if term is not None:
|
|
44
|
-
params['term'] = term
|
|
45
|
-
if autoRenewal:
|
|
46
|
-
params['autoRenewal'] = autoRenewal
|
|
47
|
-
return self._request_with_params(POST, PLACE_LENDING_ORDER, params)
|
|
48
|
-
def amend_lending_order(self, ordId=None, changeAmt=None, rate=None,autoRenewal=False):
|
|
49
|
-
params = {}
|
|
50
|
-
if ordId is not None:
|
|
51
|
-
params['ordId'] = ordId
|
|
52
|
-
if changeAmt is not None:
|
|
53
|
-
params['amt'] = changeAmt
|
|
54
|
-
if rate is not None:
|
|
55
|
-
params['rate'] = rate
|
|
56
|
-
params['autoRenewal'] = autoRenewal
|
|
57
|
-
return self._request_with_params(POST, AMEND_LENDING_ORDER, params)
|
|
58
|
-
|
|
59
|
-
def get_lending_orders_list(self, ordId = None,ccy=None, state=None, after=None,before=None,limit=None):
|
|
60
|
-
params = {}
|
|
61
|
-
if ordId is not None:
|
|
62
|
-
params['ordId'] = ordId
|
|
63
|
-
if ccy is not None:
|
|
64
|
-
params['ccy'] = ccy
|
|
65
|
-
if state is not None:
|
|
66
|
-
params['state'] = state
|
|
67
|
-
if after is not None:
|
|
68
|
-
params['after'] = after
|
|
69
|
-
if before is not None:
|
|
70
|
-
params['before'] = before
|
|
71
|
-
if limit:
|
|
72
|
-
params['limit'] = limit
|
|
73
|
-
return self._request_with_params(GET, LENDING_ORDERS_LIST, params)
|
|
74
|
-
|
|
75
|
-
def get_lending_sub_orders(self, ordId = None, state=None, after=None,before=None,limit=None):
|
|
76
|
-
params = {}
|
|
77
|
-
if ordId is not None:
|
|
78
|
-
params['ordId'] = ordId
|
|
79
|
-
if state is not None:
|
|
80
|
-
params['state'] = state
|
|
81
|
-
if after is not None:
|
|
82
|
-
params['after'] = after
|
|
83
|
-
if before is not None:
|
|
84
|
-
params['before'] = before
|
|
85
|
-
if limit:
|
|
86
|
-
params['limit'] = limit
|
|
87
|
-
return self._request_with_params(GET, LENDING_SUB_ORDERS, params)
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
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
|
|
File without changes
|