python-okx 0.3.5__tar.gz → 0.3.7__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.
Files changed (41) hide show
  1. {python_okx-0.3.5 → python_okx-0.3.7}/PKG-INFO +1 -1
  2. {python_okx-0.3.5 → python_okx-0.3.7}/okx/Account.py +12 -3
  3. python_okx-0.3.7/okx/Finance/EthStaking.py +52 -0
  4. python_okx-0.3.7/okx/Finance/Savings.py +62 -0
  5. python_okx-0.3.7/okx/Finance/SolStaking.py +48 -0
  6. python_okx-0.3.7/okx/Finance/StakingDefi.py +63 -0
  7. {python_okx-0.3.5 → python_okx-0.3.7}/okx/Funding.py +2 -2
  8. {python_okx-0.3.5 → python_okx-0.3.7}/okx/MarketData.py +0 -4
  9. {python_okx-0.3.5 → python_okx-0.3.7}/okx/Trade.py +2 -6
  10. {python_okx-0.3.5 → python_okx-0.3.7}/okx/__init__.py +1 -1
  11. {python_okx-0.3.5 → python_okx-0.3.7}/okx/consts.py +13 -22
  12. python_okx-0.3.7/okx/websocket/__init__.py +0 -0
  13. {python_okx-0.3.5 → python_okx-0.3.7}/python_okx.egg-info/PKG-INFO +1 -1
  14. {python_okx-0.3.5 → python_okx-0.3.7}/python_okx.egg-info/SOURCES.txt +5 -2
  15. python_okx-0.3.5/okx/Earning.py +0 -115
  16. python_okx-0.3.5/okx/NDBroker.py +0 -150
  17. {python_okx-0.3.5 → python_okx-0.3.7}/README.md +0 -0
  18. {python_okx-0.3.5 → python_okx-0.3.7}/okx/BlockTrading.py +0 -0
  19. {python_okx-0.3.5 → python_okx-0.3.7}/okx/Convert.py +0 -0
  20. {python_okx-0.3.5 → python_okx-0.3.7}/okx/CopyTrading.py +0 -0
  21. {python_okx-0.3.5 → python_okx-0.3.7}/okx/FDBroker.py +0 -0
  22. {python_okx-0.3.5/okx/websocket → python_okx-0.3.7/okx/Finance}/__init__.py +0 -0
  23. {python_okx-0.3.5 → python_okx-0.3.7}/okx/Grid.py +0 -0
  24. {python_okx-0.3.5 → python_okx-0.3.7}/okx/PublicData.py +0 -0
  25. {python_okx-0.3.5 → python_okx-0.3.7}/okx/SimpleEarnFixed.py +0 -0
  26. {python_okx-0.3.5 → python_okx-0.3.7}/okx/SpreadTrading.py +0 -0
  27. {python_okx-0.3.5 → python_okx-0.3.7}/okx/Status.py +0 -0
  28. {python_okx-0.3.5 → python_okx-0.3.7}/okx/SubAccount.py +0 -0
  29. {python_okx-0.3.5 → python_okx-0.3.7}/okx/TradingData.py +0 -0
  30. {python_okx-0.3.5 → python_okx-0.3.7}/okx/exceptions.py +0 -0
  31. {python_okx-0.3.5 → python_okx-0.3.7}/okx/okxclient.py +0 -0
  32. {python_okx-0.3.5 → python_okx-0.3.7}/okx/utils.py +0 -0
  33. {python_okx-0.3.5 → python_okx-0.3.7}/okx/websocket/WebSocketFactory.py +0 -0
  34. {python_okx-0.3.5 → python_okx-0.3.7}/okx/websocket/WsPrivateAsync.py +0 -0
  35. {python_okx-0.3.5 → python_okx-0.3.7}/okx/websocket/WsPublicAsync.py +0 -0
  36. {python_okx-0.3.5 → python_okx-0.3.7}/okx/websocket/WsUtils.py +0 -0
  37. {python_okx-0.3.5 → python_okx-0.3.7}/python_okx.egg-info/dependency_links.txt +0 -0
  38. {python_okx-0.3.5 → python_okx-0.3.7}/python_okx.egg-info/requires.txt +0 -0
  39. {python_okx-0.3.5 → python_okx-0.3.7}/python_okx.egg-info/top_level.txt +0 -0
  40. {python_okx-0.3.5 → python_okx-0.3.7}/setup.cfg +0 -0
  41. {python_okx-0.3.5 → python_okx-0.3.7}/setup.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: python-okx
3
- Version: 0.3.5
3
+ Version: 0.3.7
4
4
  Summary: Python SDK for OKX
5
5
  Home-page: https://okx.com/docs-v5/
6
6
  Author: okxv5api
@@ -27,13 +27,15 @@ class AccountAPI(OkxClient):
27
27
  params = {'instType': instType, 'instId': instId}
28
28
  return self._request_with_params(GET, POSITION_INFO, params)
29
29
 
30
- def position_builder(self, inclRealPosAndEq=False, spotOffsetType=None, greeksType=None, simPos=None,
30
+ def position_builder(self, acctLv=None,inclRealPosAndEq=False, lever=None, greeksType=None, simPos=None,
31
31
  simAsset=None):
32
32
  params = {}
33
+ if acctLv is not None:
34
+ params['acctLv'] = acctLv
33
35
  if inclRealPosAndEq is not None:
34
36
  params['inclRealPosAndEq'] = inclRealPosAndEq
35
- if spotOffsetType is not None:
36
- params['spotOffsetType'] = spotOffsetType
37
+ if lever is not None:
38
+ params['spotOffsetType'] = lever
37
39
  if greeksType is not None:
38
40
  params['greksType'] = greeksType
39
41
  if simPos is not None:
@@ -217,6 +219,13 @@ class AccountAPI(OkxClient):
217
219
  }
218
220
  return self._request_with_params(POST, SET_AUTO_LOAN, params)
219
221
 
222
+ # - Set auto loan
223
+ def set_account_level(self, acctLv):
224
+ params = {
225
+ 'acctLv': acctLv
226
+ }
227
+ return self._request_with_params(POST, SET_ACCOUNT_LEVEL, params)
228
+
220
229
  # - Activate option
221
230
  def activate_option(self):
222
231
  return self._request_without_params(POST, ACTIVSTE_OPTION)
@@ -0,0 +1,52 @@
1
+ from okx.okxclient import OkxClient
2
+ from okx.consts import *
3
+
4
+
5
+ class EthStakingAPI(OkxClient):
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 = False, proxy=None):
7
+ OkxClient.__init__(self, api_key, api_secret_key, passphrase, use_server_time, flag, domain, debug, proxy)
8
+
9
+ def eth_product_info(self):
10
+
11
+ return self._request_without_params(GET, STACK_ETH_PRODUCT_INFO)
12
+
13
+ def eth_purchase(self, amt=''):
14
+
15
+ params = {
16
+ 'amt': amt,
17
+ }
18
+ return self._request_with_params(POST, STACK_ETH_PURCHASE, params)
19
+
20
+ def eth_redeem(self, amt=''):
21
+
22
+ params = {
23
+ 'amt': amt,
24
+ }
25
+ return self._request_with_params(POST, STACK_ETH_REDEEM, params)
26
+
27
+ def eth_balance(self):
28
+
29
+ params = {}
30
+ return self._request_with_params(GET, STACK_ETH_BALANCE, params)
31
+
32
+ def eth_purchase_redeem_history(self, type='', status='', after='', before='', limit=''):
33
+
34
+ params = {}
35
+ if type != '':
36
+ params['type'] = type
37
+ if status != '':
38
+ params['status'] = status
39
+ if after != '':
40
+ params['after'] = after
41
+ if before != '':
42
+ params['before'] = before
43
+ if limit != '':
44
+ params['limit'] = limit
45
+ return self._request_with_params(GET, STACK_ETH_PURCHASE_REDEEM_HISTORY, params)
46
+
47
+ def eth_apy_history(self, days):
48
+
49
+ params = {
50
+ 'days': days,
51
+ }
52
+ return self._request_with_params(GET, STACK_ETH_APY_HISTORY, params)
@@ -0,0 +1,62 @@
1
+ from okx.okxclient import OkxClient
2
+ from okx.consts import *
3
+
4
+
5
+ class SavingsAPI(OkxClient):
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 = False, proxy=None):
7
+ OkxClient.__init__(self, api_key, api_secret_key, passphrase, use_server_time, flag, domain, debug, proxy)
8
+
9
+ # - Get saving balance
10
+ def get_saving_balance(self, ccy=''):
11
+ params = {
12
+ 'ccy': ccy
13
+ }
14
+ return self._request_with_params(GET, GET_SAVING_BALANCE, params)
15
+
16
+ # - Savings purchase/redemption
17
+ def savings_purchase_redemption(self, ccy='', amt='', side='', rate=''):
18
+
19
+ params = {
20
+ 'ccy': ccy,
21
+ 'amt': amt,
22
+ 'side': side,
23
+ 'rate': rate
24
+ }
25
+ return self._request_with_params(POST, SAVING_PURCHASE_REDEMPTION, params)
26
+
27
+ # - Set lending rate
28
+ def set_lending_rate(self, ccy='', rate=''):
29
+ params = {
30
+ 'ccy': ccy,
31
+ 'rate': rate
32
+ }
33
+ return self._request_with_params(POST, SET_LENDING_RATE, params)
34
+
35
+ # - Get lending history
36
+ def get_lending_history(self, ccy='', after='', before='', limit=''):
37
+ params = {
38
+ 'ccy': ccy,
39
+ 'after': after,
40
+ 'before': before,
41
+ 'limit': limit
42
+ }
43
+ return self._request_with_params(GET, GET_LENDING_HISTORY, params)
44
+
45
+ # - Get public borrow history (public)
46
+ def get_public_borrow_history(self, ccy='', after='', before='', limit=''):
47
+ params = {
48
+ 'ccy': ccy,
49
+ 'after': after,
50
+ 'before': before,
51
+ 'limit': limit
52
+ }
53
+ return self._request_with_params(GET, GET_PUBLIC_BORROW_HISTORY, params)
54
+
55
+ # GET / Public borrow info (public)
56
+ def get_public_borrow_info(self, ccy=''):
57
+ params = {
58
+ 'ccy': ccy
59
+ }
60
+ return self._request_with_params(GET, GET_PUBLIC_BORROW_INFO, params)
61
+
62
+
@@ -0,0 +1,48 @@
1
+ from okx.okxclient import OkxClient
2
+ from okx.consts import *
3
+
4
+
5
+ class SolStakingAPI(OkxClient):
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 = False, proxy=None):
7
+ OkxClient.__init__(self, api_key, api_secret_key, passphrase, use_server_time, flag, domain, debug, proxy)
8
+
9
+ def sol_purchase(self, amt):
10
+
11
+ params = {
12
+ 'amt': amt,
13
+ }
14
+ return self._request_with_params(POST, STACK_SOL_PURCHASE, params)
15
+
16
+ def sol_redeem(self, amt=''):
17
+
18
+ params = {
19
+ 'amt': amt,
20
+ }
21
+ return self._request_with_params(POST, STACK_SOL_REDEEM, params)
22
+
23
+ def sol_balance(self):
24
+
25
+ params = {}
26
+ return self._request_with_params(GET, STACK_SOL_BALANCE, params)
27
+
28
+ def sol_purchase_redeem_history(self, type='', status='', after='', before='', limit=''):
29
+
30
+ params = {}
31
+ if type != '':
32
+ params['type'] = type
33
+ if status != '':
34
+ params['status'] = status
35
+ if after != '':
36
+ params['after'] = after
37
+ if before != '':
38
+ params['before'] = before
39
+ if limit != '':
40
+ params['limit'] = limit
41
+ return self._request_with_params(GET, STACK_SOL_PURCHASE_REDEEM_HISTORY, params)
42
+
43
+ def sol_apy_history(self, days):
44
+
45
+ params = {
46
+ 'days': days,
47
+ }
48
+ return self._request_with_params(GET, STACK_SOL_APY_HISTORY, params)
@@ -0,0 +1,63 @@
1
+ from okx.okxclient import OkxClient
2
+ from okx.consts import *
3
+
4
+
5
+ class StakingDefiAPI(OkxClient):
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 = False, proxy=None):
7
+ OkxClient.__init__(self, api_key, api_secret_key, passphrase, use_server_time, flag, domain, debug, proxy)
8
+
9
+ def get_offers(self, productId='', protocolType='', ccy=''):
10
+ params = {
11
+ 'productId': productId,
12
+ 'protocolType': protocolType,
13
+ 'ccy': ccy
14
+ }
15
+ return self._request_with_params(GET, STACK_DEFI_OFFERS, params)
16
+
17
+ def purchase(self, productId='', investData=[], term='', tag=''):
18
+
19
+ params = {
20
+ 'productId': productId,
21
+ 'investData': investData
22
+ }
23
+ if term != '':
24
+ params['term'] = term
25
+ if tag != '':
26
+ params['tag'] = tag
27
+ return self._request_with_params(POST, STACK_DEFI_PURCHASE, params)
28
+
29
+ def redeem(self, ordId='', protocolType='', allowEarlyRedeem=''):
30
+ params = {
31
+ 'ordId': ordId,
32
+ 'protocolType': protocolType,
33
+ 'allowEarlyRedeem': allowEarlyRedeem
34
+ }
35
+ return self._request_with_params(POST, STACK_DEFI_REDEEM, params)
36
+
37
+ def cancel(self, ordId='', protocolType=''):
38
+ params = {
39
+ 'ordId': ordId,
40
+ 'protocolType': protocolType
41
+ }
42
+ return self._request_with_params(POST, STACK_DEFI_CANCEL, params)
43
+
44
+ def get_activity_orders(self, productId='', protocolType='', ccy='', state=''):
45
+ params = {
46
+ 'productId': productId,
47
+ 'protocolType': protocolType,
48
+ 'ccy': ccy,
49
+ 'state': state
50
+ }
51
+ return self._request_with_params(GET, STACK_DEFI_ORDERS_ACTIVITY, params)
52
+
53
+ def get_orders_history(self, productId='', protocolType='', ccy='', after='', before='', limit=''):
54
+ params = {
55
+ 'productId': productId,
56
+ 'protocolType': protocolType,
57
+ 'ccy': ccy,
58
+ 'after': after,
59
+ 'before': before,
60
+ 'limit': limit
61
+ }
62
+ return self._request_with_params(GET, STACK_DEFI_ORDERS_HISTORY, params)
63
+
@@ -41,8 +41,8 @@ class FundingAPI(OkxClient):
41
41
  return self._request_with_params(POST, WITHDRAWAL_COIN, params)
42
42
 
43
43
  # Get Deposit History
44
- def get_deposit_history(self, ccy='', state='', after='', before='', limit='', txId='', depId='', fromWdId=''):
45
- params = {'ccy': ccy, 'state': state, 'after': after, 'before': before, 'limit': limit, 'txId': txId,
44
+ def get_deposit_history(self, ccy='', type='', state='', after='', before='', limit='', txId='', depId='', fromWdId=''):
45
+ params = {'ccy': ccy, 'type': type, 'state': state, 'after': after, 'before': before, 'limit': limit, 'txId': txId,
46
46
  'depId': depId, 'fromWdId': fromWdId}
47
47
  return self._request_with_params(GET, DEPOSIT_HISTORY, params)
48
48
 
@@ -60,10 +60,6 @@ class MarketAPI(OkxClient):
60
60
  def get_volume(self):
61
61
  return self._request_without_params(GET, VOLUMNE)
62
62
 
63
- # Get Oracle
64
- def get_oracle(self):
65
- return self._request_without_params(GET, ORACLE)
66
-
67
63
  # Get Tier
68
64
  def get_tier(self, instType='', tdMode='', uly='', instId='', ccy='', tier=''):
69
65
  params = {'instType': instType, 'tdMode': tdMode, 'uly': uly, 'instId': instId, 'ccy': ccy, 'tier': tier}
@@ -39,11 +39,11 @@ class TradeAPI(OkxClient):
39
39
  # Amend Order
40
40
  def amend_order(self, instId, cxlOnFail='', ordId='', clOrdId='', reqId='', newSz='', newPx='', newTpTriggerPx='',
41
41
  newTpOrdPx='', newSlTriggerPx='', newSlOrdPx='', newTpTriggerPxType='', newSlTriggerPxType='',
42
- attachAlgoOrds=''):
42
+ attachAlgoOrds='', newTriggerPx='', newOrdPx=''):
43
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
- 'newSlTriggerPxType': newSlTriggerPxType}
46
+ 'newSlTriggerPxType': newSlTriggerPxType, 'newTriggerPx': newTriggerPx, 'newOrdPx': newOrdPx}
47
47
  params['attachAlgoOrds'] = attachAlgoOrds
48
48
  return self._request_with_params(POST, AMEND_ORDER, params)
49
49
 
@@ -115,10 +115,6 @@ class TradeAPI(OkxClient):
115
115
  def cancel_algo_order(self, params):
116
116
  return self._request_with_params(POST, CANCEL_ALGOS, params)
117
117
 
118
- # Cancel Advance Algos
119
- def cancel_advance_algos(self, params):
120
- return self._request_with_params(POST, Cancel_Advance_Algos, params)
121
-
122
118
  # Get Algo Order List
123
119
  def order_algos_list(self, ordType='', algoId='', instType='', instId='', after='', before='', limit='',
124
120
  algoClOrdId=''):
@@ -2,4 +2,4 @@
2
2
  Python SDK for the OKX API v5
3
3
 
4
4
  """
5
- __version__="0.3.5"
5
+ __version__="0.3.7"
@@ -52,6 +52,7 @@ GET_VIP_LOAN_ORDER_LIST= '/api/v5/account/vip-loan-order-list'
52
52
  GET_VIP_LOAN_ORDER_DETAIL= '/api/v5/account/vip-loan-order-detail'
53
53
  SET_RISK_OFFSET_TYPE = '/api/v5/account/set-riskOffset-type'
54
54
  SET_AUTO_LOAN = '/api/v5/account/set-auto-loan'
55
+ SET_ACCOUNT_LEVEL = '/api/v5/account/set-account-level'
55
56
  ACTIVSTE_OPTION = '/api/v5/account/activate-option'
56
57
  POSITION_BUILDER = '/api/v5/account/position-builder'
57
58
  GET_INSTRUMENTS = '/api/v5/account/instruments'
@@ -103,8 +104,7 @@ HISTORY_CANDLES = '/api/v5/market/history-candles'
103
104
  INDEX_CANSLES = '/api/v5/market/index-candles'
104
105
  MARKPRICE_CANDLES = '/api/v5/market/mark-price-candles'
105
106
  MARKET_TRADES = '/api/v5/market/trades'
106
- VOLUMNE = '/api/v5/market/platform-24-volume'
107
- ORACLE = '/api/v5/market/open-oracle' #need to update? if it is open oracle
107
+ VOLUMNE = '/api/v5/market/platform-24-volume' #need to update? if it is open oracle
108
108
  INDEX_COMPONENTS = '/api/v5/market/index-components' #need to add
109
109
  EXCHANGE_RATE = '/api/v5/market/exchange-rate' #need to add
110
110
  HISTORY_TRADES = '/api/v5/market/history-trades' #need to add
@@ -164,7 +164,6 @@ ORDER_FILLS = '/api/v5/trade/fills'
164
164
  ORDERS_FILLS_HISTORY = '/api/v5/trade/fills-history'
165
165
  PLACE_ALGO_ORDER = '/api/v5/trade/order-algo'
166
166
  CANCEL_ALGOS = '/api/v5/trade/cancel-algos'
167
- Cancel_Advance_Algos = '/api/v5/trade/cancel-advance-algos'
168
167
  ORDERS_ALGO_PENDING = '/api/v5/trade/orders-algo-pending'
169
168
  ORDERS_ALGO_HISTORY = '/api/v5/trade/orders-algo-history'
170
169
  GET_ALGO_ORDER_DETAILS = '/api/v5/trade/order-algo'
@@ -191,25 +190,6 @@ GET_THE_USER_AFFILIATE_REBATE = '/api/v5/users/partner/if-rebate'
191
190
  SET_SUB_ACCOUNTS_VIP_LOAN = '/api/v5/account/subaccount/set-loan-allocation'
192
191
  GET_SUB_ACCOUNT_BORROW_INTEREST_AND_LIMIT = '/api/v5/account/subaccount/interest-limits'
193
192
 
194
- # Broker-all need to implmented-completed
195
- BROKER_INFO = '/api/v5/broker/nd/info'
196
- CREATE_SUBACCOUNT = '/api/v5/broker/nd/create-subaccount'
197
- DELETE_SUBACCOUNT = '/api/v5/broker/nd/delete-subaccount'
198
- SUBACCOUNT_INFO = '/api/v5/broker/nd/subaccount-info'
199
- SET_SUBACCOUNT_LEVEL = '/api/v5/broker/nd/set-subaccount-level'
200
- SET_SUBACCOUNT_FEE_REAT = '/api/v5/broker/nd/set-subaccount-fee-rate'
201
- SUBACCOUNT_DEPOSIT_ADDRESS = '/api/v5/asset/broker/nd/subaccount-deposit-address'
202
- SUBACCOUNT_DEPOSIT_HISTORY = '/api/v5/asset/broker/nd/subaccount-deposit-history'
203
- REBATE_DAILY = '/api/v5/broker/nd/rebate-daily'
204
- ND_CREAET_APIKEY = '/api/v5/broker/nd/subaccount/apikey'
205
- ND_SELECT_APIKEY = '/api/v5/broker/nd/subaccount/apikey'
206
- ND_MODIFY_APIKEY = '/api/v5/broker/nd/subaccount/modify-apikey'
207
- ND_DELETE_APIKEY = '/api/v5/broker/nd/subaccount/delete-apikey'
208
- GET_REBATE_PER_ORDERS = '/api/v5/broker/nd/rebate-per-orders'
209
- REBATE_PER_ORDERS = '/api/v5/broker/nd/rebate-per-orders'
210
- MODIFY_SUBACCOUNT_DEPOSIT_ADDRESS = '/api/v5/asset/broker/nd/modify-subaccount-deposit-address'
211
- GET_SUBACCOUNT_DEPOSIT='/api/v5/asset/broker/nd/subaccount-deposit-address'
212
-
213
193
  # Convert-Complete
214
194
  GET_CURRENCIES = '/api/v5/asset/convert/currencies'
215
195
  GET_CURRENCY_PAIR = '/api/v5/asset/convert/currency-pair'
@@ -275,6 +255,17 @@ SET_LENDING_RATE = '/api/v5/finance/savings/set-lending-rate'
275
255
  GET_LENDING_HISTORY = '/api/v5/finance/savings/lending-history'
276
256
  GET_PUBLIC_BORROW_INFO = '/api/v5/finance/savings/lending-rate-summary'
277
257
  GET_PUBLIC_BORROW_HISTORY = '/api/v5/finance/savings/lending-rate-history'
258
+ STACK_ETH_PRODUCT_INFO = '/api/v5/finance/staking-defi/eth/product-info'
259
+ STACK_ETH_PURCHASE = '/api/v5/finance/staking-defi/eth/purchase'
260
+ STACK_ETH_REDEEM = '/api/v5/finance/staking-defi/eth/redeem'
261
+ STACK_ETH_BALANCE = '/api/v5/finance/staking-defi/eth/balance'
262
+ STACK_ETH_PURCHASE_REDEEM_HISTORY = '/api/v5/finance/staking-defi/eth/purchase-redeem-history'
263
+ STACK_ETH_APY_HISTORY = '/api/v5/finance/staking-defi/eth/apy-history'
264
+ STACK_SOL_PURCHASE = '/api/v5/finance/staking-defi/sol/purchase'
265
+ STACK_SOL_REDEEM = '/api/v5/finance/staking-defi/sol/redeem'
266
+ STACK_SOL_BALANCE = '/api/v5/finance/staking-defi/sol/balance'
267
+ STACK_SOL_PURCHASE_REDEEM_HISTORY = '/api/v5/finance/staking-defi/sol/purchase-redeem-history'
268
+ STACK_SOL_APY_HISTORY = '/api/v5/finance/staking-defi/sol/apy-history'
278
269
 
279
270
  # status-complete
280
271
  STATUS = '/api/v5/system/status'
File without changes
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: python-okx
3
- Version: 0.3.5
3
+ Version: 0.3.7
4
4
  Summary: Python SDK for OKX
5
5
  Home-page: https://okx.com/docs-v5/
6
6
  Author: okxv5api
@@ -4,12 +4,10 @@ okx/Account.py
4
4
  okx/BlockTrading.py
5
5
  okx/Convert.py
6
6
  okx/CopyTrading.py
7
- okx/Earning.py
8
7
  okx/FDBroker.py
9
8
  okx/Funding.py
10
9
  okx/Grid.py
11
10
  okx/MarketData.py
12
- okx/NDBroker.py
13
11
  okx/PublicData.py
14
12
  okx/SimpleEarnFixed.py
15
13
  okx/SpreadTrading.py
@@ -22,6 +20,11 @@ okx/consts.py
22
20
  okx/exceptions.py
23
21
  okx/okxclient.py
24
22
  okx/utils.py
23
+ okx/Finance/EthStaking.py
24
+ okx/Finance/Savings.py
25
+ okx/Finance/SolStaking.py
26
+ okx/Finance/StakingDefi.py
27
+ okx/Finance/__init__.py
25
28
  okx/websocket/WebSocketFactory.py
26
29
  okx/websocket/WsPrivateAsync.py
27
30
  okx/websocket/WsPublicAsync.py
@@ -1,115 +0,0 @@
1
- from .okxclient import OkxClient
2
- from .consts import *
3
-
4
-
5
- class EarningAPI(OkxClient):
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 = False, proxy=None):
7
- OkxClient.__init__(self, api_key, api_secret_key, passphrase, use_server_time, flag, domain, debug, proxy)
8
-
9
- def get_offers(self,productId = '',protocolType = '',ccy = ''):
10
- params = {
11
- 'productId':productId,
12
- 'protocolType':protocolType,
13
- 'ccy':ccy
14
- }
15
- return self._request_with_params(GET,STACK_DEFI_OFFERS,params)
16
-
17
- def purchase(self, productId='', investData=[], term='', tag=''):
18
-
19
- params = {
20
- 'productId': productId,
21
- 'investData': investData
22
- }
23
- if term != '':
24
- params['term'] = term
25
- if tag != '':
26
- params['tag'] = tag
27
- return self._request_with_params(POST, STACK_DEFI_PURCHASE, params)
28
-
29
- def redeem(self,ordId = '',protocolType = '',allowEarlyRedeem = ''):
30
- params = {
31
- 'ordId':ordId,
32
- 'protocolType':protocolType,
33
- 'allowEarlyRedeem':allowEarlyRedeem
34
- }
35
- return self._request_with_params(POST,STACK_DEFI_REDEEM,params)
36
-
37
- def cancel(self,ordId = '',protocolType = ''):
38
- params = {
39
- 'ordId':ordId,
40
- 'protocolType':protocolType
41
- }
42
- return self._request_with_params(POST,STACK_DEFI_CANCEL,params)
43
-
44
- def get_activity_orders(self,productId = '',protocolType = '',ccy = '',state = ''):
45
- params = {
46
- 'productId':productId,
47
- 'protocolType':protocolType,
48
- 'ccy':ccy,
49
- 'state':state
50
- }
51
- return self._request_with_params(GET,STACK_DEFI_ORDERS_ACTIVITY,params)
52
-
53
- def get_orders_history(self,productId = '',protocolType = '',ccy = '',after = '',before = '',limit = ''):
54
- params = {
55
- 'productId':productId,
56
- 'protocolType':protocolType,
57
- 'ccy':ccy,
58
- 'after':after,
59
- 'before':before,
60
- 'limit':limit
61
- }
62
- return self._request_with_params(GET,STACK_DEFI_ORDERS_HISTORY,params)
63
-
64
- # - Get saving balance
65
- def get_saving_balance(self, ccy=''):
66
- params = {
67
- 'ccy': ccy
68
- }
69
- return self._request_with_params(GET, GET_SAVING_BALANCE, params)
70
-
71
- # - Savings purchase/redemption
72
- def savings_purchase_redemption(self, ccy='', amt='', side='', rate=''):
73
-
74
- params = {
75
- 'ccy': ccy,
76
- 'amt': amt,
77
- 'side': side,
78
- 'rate': rate
79
- }
80
- return self._request_with_params(POST, SAVING_PURCHASE_REDEMPTION, params)
81
-
82
- # - Set lending rate
83
- def set_lending_rate(self, ccy='', rate=''):
84
- params = {
85
- 'ccy': ccy,
86
- 'rate': rate
87
- }
88
- return self._request_with_params(POST, SET_LENDING_RATE, params)
89
-
90
- # - Get lending history
91
- def get_lending_history(self, ccy='', after='', before='', limit=''):
92
- params = {
93
- 'ccy': ccy,
94
- 'after': after,
95
- 'before': before,
96
- 'limit': limit
97
- }
98
- return self._request_with_params(GET, GET_LENDING_HISTORY, params)
99
-
100
- # - Get public borrow info (public)
101
- def get_public_borrow_info(self, ccy=''):
102
- params = {
103
- 'ccy': ccy
104
- }
105
- return self._request_with_params(GET, GET_PUBLIC_BORROW_INFO, params)
106
-
107
- # - Get public borrow history (public)
108
- def get_public_borrow_history(self, ccy='', after='', before='', limit=''):
109
- params = {
110
- 'ccy': ccy,
111
- 'after': after,
112
- 'before': before,
113
- 'limit': limit
114
- }
115
- return self._request_with_params(GET, GET_PUBLIC_BORROW_HISTORY, params)
@@ -1,150 +0,0 @@
1
- from .okxclient import OkxClient
2
- from .consts import *
3
- class NDBrokerAPI(OkxClient):
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 = False, proxy=None):
5
- OkxClient.__init__(self, api_key, api_secret_key, passphrase, use_server_time, flag, domain, debug, proxy)
6
-
7
- #GET /api/v5/broker/nd/info
8
- def get_broker_info(self):
9
- return self._request_without_params(GET, BROKER_INFO)
10
-
11
- #POST /api/v5/broker/nd/create-subaccount
12
- def create_subaccount(self,subAcct = '',label = ''):
13
- params = {
14
- 'subAcct':subAcct,
15
- 'label':label
16
- }
17
- return self._request_with_params(POST,CREATE_SUBACCOUNT,params)
18
-
19
- def delete_subaccount(self,subAcct = ''):
20
- params = {
21
- 'subAcct':subAcct
22
- }
23
- return self._request_with_params(POST,DELETE_SUBACCOUNT,params)
24
-
25
- def get_subaccount_info(self,subAcct = '',page = '',limit = ''):
26
- params = {
27
- 'subAcct':subAcct,
28
- 'page':page,
29
- 'limit':limit
30
- }
31
- return self._request_with_params(GET,SUBACCOUNT_INFO,params)
32
-
33
- def create_subaccount_apikey(self,subAcct = '',label='',passphrase='',ip='',perm=''):
34
- params = {
35
- 'subAcct':subAcct,
36
- 'label':label,
37
- 'passphrase':passphrase,
38
- 'ip':ip,
39
- 'perm':perm
40
- }
41
- return self._request_with_params(POST,ND_CREAET_APIKEY,params)
42
-
43
- def get_subaccount_apikey(self,subAcct = '',apiKey = ''):
44
- params = {
45
- 'subAcct':subAcct,
46
- 'apiKey':apiKey
47
- }
48
- return self._request_with_params(GET,ND_SELECT_APIKEY,params)
49
-
50
- def reset_subaccount_apikey(self,subAcct = '',apiKey = '',label='',perm = '',ip = ''):
51
- params = {
52
- 'subAcct':subAcct,
53
- 'apiKey':apiKey,
54
- 'label':label,
55
- 'perm':perm,
56
- 'ip':ip
57
- }
58
- return self._request_with_params(POST,ND_MODIFY_APIKEY,params)
59
-
60
- def delete_subaccount_apikey(self,subAcct = '',apiKey = ''):
61
- params = {
62
- 'subAcct':subAcct,
63
- 'apiKey':apiKey
64
- }
65
- return self._request_with_params(POST,ND_DELETE_APIKEY,params)
66
-
67
- def set_subaccount_level(self,subAcct = '',acctLv = ''):
68
- params = {
69
- 'subAcct':subAcct,
70
- 'acctLv':acctLv
71
- }
72
- return self._request_with_params(POST,SET_SUBACCOUNT_LEVEL,params)
73
-
74
- def set_subaccount_fee_rate(self,subAcct = '',instType = '',chgType = '',chgTaker = '',chgMaker = '',effDate = ''):
75
- params = {
76
- 'subAcct':subAcct,
77
- 'instType':instType,
78
- 'chgType':chgType,
79
- 'chgTaker':chgTaker,
80
- 'chgMaker':chgMaker,
81
- 'effDate':effDate
82
- }
83
- return self._request_with_params(POST,SET_SUBACCOUNT_FEE_REAT,params)
84
-
85
- def create_subaccount_deposit_address(self,subAcct = '',ccy = '',chain = '',addrType = '', to =''):
86
- params = {
87
- 'subAcct':subAcct,
88
- 'ccy':ccy,
89
- 'chain':chain,
90
- 'addrType':addrType,
91
- 'to':to
92
- }
93
- return self._request_with_params(POST,SUBACCOUNT_DEPOSIT_ADDRESS,params)
94
-
95
- def reset_subaccount_deposit_address(self,subAcct = '',ccy = '',chain = '',addr = '',to = ''):
96
- params = {
97
- 'subAcct':subAcct,
98
- 'ccy':ccy,
99
- 'chain':chain,
100
- 'addr':addr,
101
- 'to':to
102
- }
103
- return self._request_with_params(POST,MODIFY_SUBACCOUNT_DEPOSIT_ADDRESS,params)
104
-
105
- def get_subaccount_deposit_address(self,subAcct = '',ccy = ''):
106
- params = {
107
- 'subAcct':subAcct,
108
- 'ccy':ccy
109
- }
110
- return self._request_with_params(GET,GET_SUBACCOUNT_DEPOSIT,params)
111
-
112
- def get_subaccount_deposit_history(self,subAcct = '',ccy = '',txId = '',state = '',after = '',before = '',limit = ''):
113
- params = {
114
- 'subAcct':subAcct,
115
- 'ccy':ccy,
116
- 'txId':txId,
117
- 'state':state,
118
- 'after':after,
119
- 'before':before,
120
- 'limit':limit
121
- }
122
- return self._request_with_params(GET,SUBACCOUNT_DEPOSIT_HISTORY,params)
123
-
124
- def get_rebate_daily(self,subAcct = '',begin = '',end = '',page = '',limit = ''):
125
- params = {
126
- 'subAcct':subAcct,
127
- 'begin':begin,
128
- 'end':end,
129
- 'page':page,
130
- 'limit':limit
131
- }
132
- return self._request_with_params(GET,REBATE_DAILY,params)
133
-
134
- def get_rebate_details_download_link(self,type ='',begin = '',end = ''):
135
- params ={
136
- 'type':type,
137
- 'begin':begin,
138
- 'end':end
139
- }
140
- return self._request_with_params(GET,GET_REBATE_PER_ORDERS,params)
141
-
142
-
143
-
144
- def generate_rebate_details_download_link(self,begin = '',end = ''):
145
- params = {
146
- 'begin':begin,
147
- 'end':end
148
- }
149
- return self._request_with_params(POST,REBATE_PER_ORDERS,params)
150
-
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