python-okx 0.4.3__tar.gz → 0.4.4__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 (64) hide show
  1. {python_okx-0.4.3 → python_okx-0.4.4}/PKG-INFO +1 -2
  2. {python_okx-0.4.3 → python_okx-0.4.4}/README.md +0 -1
  3. {python_okx-0.4.3 → python_okx-0.4.4}/okx/Account.py +16 -1
  4. python_okx-0.4.4/okx/Affiliate.py +84 -0
  5. {python_okx-0.4.3 → python_okx-0.4.4}/okx/Finance/FlexibleLoan.py +25 -0
  6. python_okx-0.4.4/okx/Finance/Okusd.py +61 -0
  7. python_okx-0.4.4/okx/Finance/__init__.py +1 -0
  8. {python_okx-0.4.3 → python_okx-0.4.4}/okx/MarketData.py +5 -0
  9. {python_okx-0.4.3 → python_okx-0.4.4}/okx/__init__.py +1 -1
  10. {python_okx-0.4.3 → python_okx-0.4.4}/okx/consts.py +24 -1
  11. {python_okx-0.4.3 → python_okx-0.4.4}/python_okx.egg-info/PKG-INFO +1 -2
  12. {python_okx-0.4.3 → python_okx-0.4.4}/python_okx.egg-info/SOURCES.txt +2 -0
  13. python_okx-0.4.3/okx/websocket/__init__.py +0 -0
  14. {python_okx-0.4.3 → python_okx-0.4.4}/MANIFEST.in +0 -0
  15. {python_okx-0.4.3 → python_okx-0.4.4}/okx/BlockTrading.py +0 -0
  16. {python_okx-0.4.3 → python_okx-0.4.4}/okx/Convert.py +0 -0
  17. {python_okx-0.4.3 → python_okx-0.4.4}/okx/CopyTrading.py +0 -0
  18. {python_okx-0.4.3 → python_okx-0.4.4}/okx/DualInvest.py +0 -0
  19. {python_okx-0.4.3 → python_okx-0.4.4}/okx/FDBroker.py +0 -0
  20. {python_okx-0.4.3 → python_okx-0.4.4}/okx/Finance/EthStaking.py +0 -0
  21. {python_okx-0.4.3 → python_okx-0.4.4}/okx/Finance/Savings.py +0 -0
  22. {python_okx-0.4.3 → python_okx-0.4.4}/okx/Finance/SolStaking.py +0 -0
  23. {python_okx-0.4.3 → python_okx-0.4.4}/okx/Finance/StakingDefi.py +0 -0
  24. {python_okx-0.4.3 → python_okx-0.4.4}/okx/Funding.py +0 -0
  25. {python_okx-0.4.3 → python_okx-0.4.4}/okx/Grid.py +0 -0
  26. {python_okx-0.4.3 → python_okx-0.4.4}/okx/PublicData.py +0 -0
  27. {python_okx-0.4.3 → python_okx-0.4.4}/okx/SpreadTrading.py +0 -0
  28. {python_okx-0.4.3 → python_okx-0.4.4}/okx/Status.py +0 -0
  29. {python_okx-0.4.3 → python_okx-0.4.4}/okx/SubAccount.py +0 -0
  30. {python_okx-0.4.3 → python_okx-0.4.4}/okx/Trade.py +0 -0
  31. {python_okx-0.4.3 → python_okx-0.4.4}/okx/TradingData.py +0 -0
  32. {python_okx-0.4.3 → python_okx-0.4.4}/okx/exceptions.py +0 -0
  33. {python_okx-0.4.3 → python_okx-0.4.4}/okx/okxclient.py +0 -0
  34. {python_okx-0.4.3 → python_okx-0.4.4}/okx/utils.py +0 -0
  35. {python_okx-0.4.3 → python_okx-0.4.4}/okx/websocket/WebSocketFactory.py +0 -0
  36. {python_okx-0.4.3 → python_okx-0.4.4}/okx/websocket/WsPrivateAsync.py +0 -0
  37. {python_okx-0.4.3 → python_okx-0.4.4}/okx/websocket/WsPublicAsync.py +0 -0
  38. {python_okx-0.4.3 → python_okx-0.4.4}/okx/websocket/WsUtils.py +0 -0
  39. {python_okx-0.4.3/okx/Finance → python_okx-0.4.4/okx/websocket}/__init__.py +0 -0
  40. {python_okx-0.4.3 → python_okx-0.4.4}/python_okx.egg-info/dependency_links.txt +0 -0
  41. {python_okx-0.4.3 → python_okx-0.4.4}/python_okx.egg-info/requires.txt +0 -0
  42. {python_okx-0.4.3 → python_okx-0.4.4}/python_okx.egg-info/top_level.txt +0 -0
  43. {python_okx-0.4.3 → python_okx-0.4.4}/requirements.txt +0 -0
  44. {python_okx-0.4.3 → python_okx-0.4.4}/setup.cfg +0 -0
  45. {python_okx-0.4.3 → python_okx-0.4.4}/setup.py +0 -0
  46. {python_okx-0.4.3 → python_okx-0.4.4}/test/test_account.py +0 -0
  47. {python_okx-0.4.3 → python_okx-0.4.4}/test/test_block_trading.py +0 -0
  48. {python_okx-0.4.3 → python_okx-0.4.4}/test/test_convert.py +0 -0
  49. {python_okx-0.4.3 → python_okx-0.4.4}/test/test_copy_trading.py +0 -0
  50. {python_okx-0.4.3 → python_okx-0.4.4}/test/test_eth_staking.py +0 -0
  51. {python_okx-0.4.3 → python_okx-0.4.4}/test/test_flexible_loan.py +0 -0
  52. {python_okx-0.4.3 → python_okx-0.4.4}/test/test_funding.py +0 -0
  53. {python_okx-0.4.3 → python_okx-0.4.4}/test/test_grid.py +0 -0
  54. {python_okx-0.4.3 → python_okx-0.4.4}/test/test_market.py +0 -0
  55. {python_okx-0.4.3 → python_okx-0.4.4}/test/test_public_data.py +0 -0
  56. {python_okx-0.4.3 → python_okx-0.4.4}/test/test_savings.py +0 -0
  57. {python_okx-0.4.3 → python_okx-0.4.4}/test/test_sol_staking.py +0 -0
  58. {python_okx-0.4.3 → python_okx-0.4.4}/test/test_spread.py +0 -0
  59. {python_okx-0.4.3 → python_okx-0.4.4}/test/test_staking_defi.py +0 -0
  60. {python_okx-0.4.3 → python_okx-0.4.4}/test/test_sub_account.py +0 -0
  61. {python_okx-0.4.3 → python_okx-0.4.4}/test/test_trade.py +0 -0
  62. {python_okx-0.4.3 → python_okx-0.4.4}/test/test_trading_data.py +0 -0
  63. {python_okx-0.4.3 → python_okx-0.4.4}/test/test_ws_private_async.py +0 -0
  64. {python_okx-0.4.3 → python_okx-0.4.4}/test/test_ws_public_async.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: python-okx
3
- Version: 0.4.3
3
+ Version: 0.4.4
4
4
  Summary: Python SDK for OKX
5
5
  Home-page: https://okx.com/docs-v5/
6
6
  Author: okxv5api
@@ -51,7 +51,6 @@ Make sure you update often and check the [Changelog](https://www.okx.com/docs-v5
51
51
  - Websocket handling with reconnection and multiplexed connections
52
52
 
53
53
  ### Quick start
54
-
55
54
  #### Prerequisites
56
55
 
57
56
  `python version:>=3.7`
@@ -18,7 +18,6 @@ Make sure you update often and check the [Changelog](https://www.okx.com/docs-v5
18
18
  - Websocket handling with reconnection and multiplexed connections
19
19
 
20
20
  ### Quick start
21
-
22
21
  #### Prerequisites
23
22
 
24
23
  `python version:>=3.7`
@@ -229,7 +229,7 @@ class AccountAPI(OkxClient):
229
229
  }
230
230
  return self._request_with_params(POST, SET_AUTO_LOAN, params)
231
231
 
232
- # - Set auto loan
232
+ # - Set account level
233
233
  def set_account_level(self, acctLv):
234
234
  params = {
235
235
  'acctLv': acctLv
@@ -366,3 +366,18 @@ class AccountAPI(OkxClient):
366
366
  if type != '':
367
367
  params['type'] = type
368
368
  return self._request_with_params(POST, BILLS_APPLY, params)
369
+
370
+ # Get GLP daily performance history for a program
371
+ def get_glp_historical_performance(self, program, begin='', end='', limit=''):
372
+ params = {'program': program}
373
+ if begin != '':
374
+ params['begin'] = begin
375
+ if end != '':
376
+ params['end'] = end
377
+ if limit != '':
378
+ params['limit'] = limit
379
+ return self._request_with_params(GET, GLP_HISTORICAL_PERFORMANCE, params)
380
+
381
+ # Get current-day + MTD GLP snapshot for all enrolled programs
382
+ def get_glp_today_performance(self):
383
+ return self._request_without_params(GET, GLP_TODAY_PERFORMANCE)
@@ -0,0 +1,84 @@
1
+ from okx.okxclient import OkxClient
2
+ from okx.consts import (
3
+ GET,
4
+ _NO_CREDENTIAL,
5
+ AFFILIATE_TVB_INVITEE_DETAIL,
6
+ AFFILIATE_TVB_INVITEE_LIST,
7
+ AFFILIATE_TVB_LINK_LIST,
8
+ AFFILIATE_TVB_PERFORMANCE_SUMMARY,
9
+ AFFILIATE_TVB_TIER_BREAKDOWN,
10
+ )
11
+
12
+
13
+ class AffiliateAPI(OkxClient):
14
+ def __init__(self, api_key=_NO_CREDENTIAL, api_secret_key=_NO_CREDENTIAL, passphrase=_NO_CREDENTIAL, use_server_time=None, flag='1',
15
+ domain='https://www.okx.com', debug=False, proxy=None):
16
+ OkxClient.__init__(self, api_key, api_secret_key, passphrase, use_server_time, flag, domain, debug, proxy)
17
+
18
+ def get_tvb_invitee_detail(self, uid):
19
+ params = {'uid': uid}
20
+ return self._request_with_params(GET, AFFILIATE_TVB_INVITEE_DETAIL, params)
21
+
22
+ def get_tvb_invitee_list(self, periodType='', begin='', end='', feeTier=None, tradeType='',
23
+ keyword='', orderBy='', orderDir='', page='', limit=''):
24
+ params = {}
25
+ if periodType != '':
26
+ params['periodType'] = periodType
27
+ if begin != '':
28
+ params['begin'] = begin
29
+ if end != '':
30
+ params['end'] = end
31
+ if feeTier is not None:
32
+ params['feeTier'] = feeTier
33
+ if tradeType != '':
34
+ params['tradeType'] = tradeType
35
+ if keyword != '':
36
+ params['keyword'] = keyword
37
+ if orderBy != '':
38
+ params['orderBy'] = orderBy
39
+ if orderDir != '':
40
+ params['orderDir'] = orderDir
41
+ if page != '':
42
+ params['page'] = page
43
+ if limit != '':
44
+ params['limit'] = limit
45
+ return self._request_with_params(GET, AFFILIATE_TVB_INVITEE_LIST, params)
46
+
47
+ def get_tvb_link_list(self, periodType='', begin='', end='', page='', limit='',
48
+ linkType='', linkStatus=''):
49
+ params = {}
50
+ if periodType != '':
51
+ params['periodType'] = periodType
52
+ if begin != '':
53
+ params['begin'] = begin
54
+ if end != '':
55
+ params['end'] = end
56
+ if page != '':
57
+ params['page'] = page
58
+ if limit != '':
59
+ params['limit'] = limit
60
+ if linkType != '':
61
+ params['linkType'] = linkType
62
+ if linkStatus != '':
63
+ params['linkStatus'] = linkStatus
64
+ return self._request_with_params(GET, AFFILIATE_TVB_LINK_LIST, params)
65
+
66
+ def get_tvb_performance_summary(self, periodType='', begin='', end=''):
67
+ params = {}
68
+ if periodType != '':
69
+ params['periodType'] = periodType
70
+ if begin != '':
71
+ params['begin'] = begin
72
+ if end != '':
73
+ params['end'] = end
74
+ return self._request_with_params(GET, AFFILIATE_TVB_PERFORMANCE_SUMMARY, params)
75
+
76
+ def get_tvb_tier_breakdown(self, periodType='', begin='', end=''):
77
+ params = {}
78
+ if periodType != '':
79
+ params['periodType'] = periodType
80
+ if begin != '':
81
+ params['begin'] = begin
82
+ if end != '':
83
+ params['end'] = end
84
+ return self._request_with_params(GET, AFFILIATE_TVB_TIER_BREAKDOWN, params)
@@ -63,3 +63,28 @@ class FlexibleLoanAPI(OkxClient):
63
63
  if limit != '':
64
64
  params['limit'] = limit
65
65
  return self._request_with_params(GET, FINANCE_INTEREST_ACCRUED, params)
66
+
67
+ def borrow(self, loanData, clOrdId, ordId='', collateralData=None, eMode=''):
68
+ params = {
69
+ 'loanData': loanData,
70
+ 'clOrdId': clOrdId,
71
+ }
72
+ if ordId != '':
73
+ params['ordId'] = ordId
74
+ if collateralData is not None:
75
+ params['collateralData'] = collateralData
76
+ if eMode != '':
77
+ params['eMode'] = eMode
78
+ return self._request_with_params(POST, FINANCE_FLEXIBLE_LOAN_BORROW, params)
79
+
80
+ def repay(self, ordId, ccy, amt, clOrdId):
81
+ params = {
82
+ 'ordId': ordId,
83
+ 'ccy': ccy,
84
+ 'amt': amt,
85
+ 'clOrdId': clOrdId,
86
+ }
87
+ return self._request_with_params(POST, FINANCE_FLEXIBLE_LOAN_REPAY, params)
88
+
89
+ def emode_info(self):
90
+ return self._request_without_params(GET, FINANCE_FLEXIBLE_LOAN_EMODE_INFO)
@@ -0,0 +1,61 @@
1
+ from okx.okxclient import OkxClient
2
+ from okx.consts import (
3
+ GET,
4
+ _NO_CREDENTIAL,
5
+ OKUSD_ACCOUNT,
6
+ OKUSD_RATE_HISTORY,
7
+ OKUSD_SUBSCRIBE_HISTORY,
8
+ OKUSD_REDEEM_HISTORY,
9
+ OKUSD_REWARDS_HISTORY,
10
+ )
11
+
12
+
13
+ class OkusdAPI(OkxClient):
14
+ def __init__(self, api_key=_NO_CREDENTIAL, api_secret_key=_NO_CREDENTIAL, passphrase=_NO_CREDENTIAL, use_server_time=None, flag='1',
15
+ domain='https://www.okx.com', debug=False, proxy=None):
16
+ OkxClient.__init__(self, api_key, api_secret_key, passphrase, use_server_time, flag, domain, debug, proxy)
17
+
18
+ def get_account(self):
19
+ return self._request_without_params(GET, OKUSD_ACCOUNT)
20
+
21
+ def get_rate_history(self, limit='', begin='', end=''):
22
+ params = {}
23
+ if limit != '':
24
+ params['limit'] = limit
25
+ if begin != '':
26
+ params['begin'] = begin
27
+ if end != '':
28
+ params['end'] = end
29
+ return self._request_with_params(GET, OKUSD_RATE_HISTORY, params)
30
+
31
+ def get_subscribe_history(self, limit='', begin='', end=''):
32
+ params = {}
33
+ if limit != '':
34
+ params['limit'] = limit
35
+ if begin != '':
36
+ params['begin'] = begin
37
+ if end != '':
38
+ params['end'] = end
39
+ return self._request_with_params(GET, OKUSD_SUBSCRIBE_HISTORY, params)
40
+
41
+ def get_redeem_history(self, limit='', begin='', end='', type=''):
42
+ params = {}
43
+ if limit != '':
44
+ params['limit'] = limit
45
+ if begin != '':
46
+ params['begin'] = begin
47
+ if end != '':
48
+ params['end'] = end
49
+ if type != '':
50
+ params['type'] = type
51
+ return self._request_with_params(GET, OKUSD_REDEEM_HISTORY, params)
52
+
53
+ def get_rewards_history(self, limit='', begin='', end=''):
54
+ params = {}
55
+ if limit != '':
56
+ params['limit'] = limit
57
+ if begin != '':
58
+ params['begin'] = begin
59
+ if end != '':
60
+ params['end'] = end
61
+ return self._request_with_params(GET, OKUSD_REWARDS_HISTORY, params)
@@ -0,0 +1 @@
1
+ from okx.Finance import Okusd # noqa: F401
@@ -31,6 +31,11 @@ class MarketAPI(OkxClient):
31
31
  params = {'instId': instId, 'sz': sz}
32
32
  return self._request_with_params(GET, ORDER_BOOKS, params)
33
33
 
34
+ # Get RPI Order Book
35
+ def get_rpi_orderbook(self, instId, sz=''):
36
+ params = {'instId': instId, 'sz': sz}
37
+ return self._request_with_params(GET, MARKET_BOOKS_RPI, params)
38
+
34
39
  # Get Candlesticks
35
40
  def get_candlesticks(self, instId, after='', before='', bar='', limit=''):
36
41
  params = {'instId': instId, 'after': after, 'before': before, 'bar': bar, 'limit': limit}
@@ -2,4 +2,4 @@
2
2
  Python SDK for the OKX API v5
3
3
 
4
4
  """
5
- __version__="0.4.3"
5
+ __version__="0.4.4"
@@ -16,6 +16,10 @@ APPLICATION_JSON = 'application/json'
16
16
  GET = "GET"
17
17
  POST = "POST"
18
18
 
19
+ # Unset sentinel for credential args — lets public endpoints work without keys.
20
+ # Never signed or transmitted as a real key/secret/passphrase.
21
+ _NO_CREDENTIAL = '-1'
22
+
19
23
  SERVER_TIMESTAMP_URL = '/api/v5/public/time'
20
24
 
21
25
  # Account
@@ -112,6 +116,7 @@ BLOCK_TICKER = '/api/v5/market/block-ticker'
112
116
  BLOCK_TRADES = '/api/v5/market/block-trades'
113
117
  GET_ORDER_LITE_BOOK = '/api/v5/market/books-lite'
114
118
  GET_OPTION_TRADES = '/api/v5/market/option/instrument-family-trades'
119
+ MARKET_BOOKS_RPI = '/api/v5/market/books-rpi'
115
120
 
116
121
  # Public Data
117
122
  INSTRUMENT_INFO = '/api/v5/public/instruments'
@@ -193,6 +198,10 @@ GET_ASSET_SUBACCOUNT_BALANCE = '/api/v5/asset/subaccount/balances'
193
198
  SET_SUB_ACCOUNTS_VIP_LOAN = '/api/v5/account/subaccount/set-loan-allocation'
194
199
  GET_SUB_ACCOUNT_BORROW_INTEREST_AND_LIMIT = '/api/v5/account/subaccount/interest-limits'
195
200
 
201
+ # GLP performance
202
+ GLP_HISTORICAL_PERFORMANCE = '/api/v5/users/glp/historicalperformance'
203
+ GLP_TODAY_PERFORMANCE = '/api/v5/users/glp/todayperformance'
204
+
196
205
  # Convert
197
206
  GET_CURRENCIES = '/api/v5/asset/convert/currencies'
198
207
  GET_CURRENCY_PAIR = '/api/v5/asset/convert/currency-pair'
@@ -307,6 +316,9 @@ FINANCE_ADJUST_COLLATERAL = '/api/v5/finance/flexible-loan/adjust-collateral'
307
316
  FINANCE_LOAN_INFO = '/api/v5/finance/flexible-loan/loan-info'
308
317
  FINANCE_LOAN_HISTORY = '/api/v5/finance/flexible-loan/loan-history'
309
318
  FINANCE_INTEREST_ACCRUED = '/api/v5/finance/flexible-loan/interest-accrued'
319
+ FINANCE_FLEXIBLE_LOAN_BORROW = '/api/v5/finance/flexible-loan/borrow'
320
+ FINANCE_FLEXIBLE_LOAN_REPAY = '/api/v5/finance/flexible-loan/repay'
321
+ FINANCE_FLEXIBLE_LOAN_EMODE_INFO = '/api/v5/finance/flexible-loan/emode-info'
310
322
 
311
323
  # Dual Investment (DCD) — under /api/v5/finance/sfp/dcd/
312
324
  DUAL_INVEST_CURRENCY_PAIRS = '/api/v5/finance/sfp/dcd/currency-pair'
@@ -318,5 +330,16 @@ DUAL_INVEST_REDEEM = '/api/v5/finance/sfp/dcd/redeem'
318
330
  DUAL_INVEST_ORDER_STATE = '/api/v5/finance/sfp/dcd/order-status'
319
331
  DUAL_INVEST_ORDER_HISTORY = '/api/v5/finance/sfp/dcd/order-history'
320
332
 
333
+ # OKUSD
334
+ OKUSD_ACCOUNT = '/api/v5/finance/okusd/account'
335
+ OKUSD_RATE_HISTORY = '/api/v5/finance/okusd/rate/history'
336
+ OKUSD_SUBSCRIBE_HISTORY = '/api/v5/finance/okusd/subscribe/history'
337
+ OKUSD_REDEEM_HISTORY = '/api/v5/finance/okusd/redeem/history'
338
+ OKUSD_REWARDS_HISTORY = '/api/v5/finance/okusd/rewards/history'
321
339
 
322
-
340
+ # Affiliate TVB
341
+ AFFILIATE_TVB_INVITEE_DETAIL = '/api/v5/affiliate/tvb/invitee/detail'
342
+ AFFILIATE_TVB_INVITEE_LIST = '/api/v5/affiliate/tvb/invitee/list'
343
+ AFFILIATE_TVB_LINK_LIST = '/api/v5/affiliate/tvb/link/list'
344
+ AFFILIATE_TVB_PERFORMANCE_SUMMARY = '/api/v5/affiliate/tvb/performance/summary'
345
+ AFFILIATE_TVB_TIER_BREAKDOWN = '/api/v5/affiliate/tvb/tier-breakdown'
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: python-okx
3
- Version: 0.4.3
3
+ Version: 0.4.4
4
4
  Summary: Python SDK for OKX
5
5
  Home-page: https://okx.com/docs-v5/
6
6
  Author: okxv5api
@@ -51,7 +51,6 @@ Make sure you update often and check the [Changelog](https://www.okx.com/docs-v5
51
51
  - Websocket handling with reconnection and multiplexed connections
52
52
 
53
53
  ### Quick start
54
-
55
54
  #### Prerequisites
56
55
 
57
56
  `python version:>=3.7`
@@ -3,6 +3,7 @@ README.md
3
3
  requirements.txt
4
4
  setup.py
5
5
  okx/Account.py
6
+ okx/Affiliate.py
6
7
  okx/BlockTrading.py
7
8
  okx/Convert.py
8
9
  okx/CopyTrading.py
@@ -24,6 +25,7 @@ okx/okxclient.py
24
25
  okx/utils.py
25
26
  okx/Finance/EthStaking.py
26
27
  okx/Finance/FlexibleLoan.py
28
+ okx/Finance/Okusd.py
27
29
  okx/Finance/Savings.py
28
30
  okx/Finance/SolStaking.py
29
31
  okx/Finance/StakingDefi.py
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