ccxt 4.0.101__py2.py3-none-any.whl → 4.0.102__py2.py3-none-any.whl

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.
ccxt/__init__.py CHANGED
@@ -22,7 +22,7 @@
22
22
 
23
23
  # ----------------------------------------------------------------------------
24
24
 
25
- __version__ = '4.0.101'
25
+ __version__ = '4.0.102'
26
26
 
27
27
  # ----------------------------------------------------------------------------
28
28
 
@@ -105,7 +105,6 @@ from ccxt.bitstamp import bitstamp # noqa: F4
105
105
  from ccxt.bitstamp1 import bitstamp1 # noqa: F401
106
106
  from ccxt.bittrex import bittrex # noqa: F401
107
107
  from ccxt.bitvavo import bitvavo # noqa: F401
108
- from ccxt.bkex import bkex # noqa: F401
109
108
  from ccxt.bl3p import bl3p # noqa: F401
110
109
  from ccxt.blockchaincom import blockchaincom # noqa: F401
111
110
  from ccxt.btcalpha import btcalpha # noqa: F401
@@ -213,7 +212,6 @@ exchanges = [
213
212
  'bitstamp1',
214
213
  'bittrex',
215
214
  'bitvavo',
216
- 'bkex',
217
215
  'bl3p',
218
216
  'blockchaincom',
219
217
  'btcalpha',
ccxt/abstract/binance.py CHANGED
@@ -196,6 +196,7 @@ class ImplicitAPI:
196
196
  sapi_get_portfolio_interest_history = sapiGetPortfolioInterestHistory = Entry('portfolio/interest-history', 'sapi', 'GET', {'cost': 0.6667})
197
197
  sapi_get_portfolio_asset_index_price = sapiGetPortfolioAssetIndexPrice = Entry('portfolio/asset-index-price', 'sapi', 'GET', {'cost': 0.1})
198
198
  sapi_get_portfolio_repay_futures_switch = sapiGetPortfolioRepayFuturesSwitch = Entry('portfolio/repay-futures-switch', 'sapi', 'GET', {'cost': 3})
199
+ sapi_get_portfolio_margin_asset_leverage = sapiGetPortfolioMarginAssetLeverage = Entry('portfolio/margin-asset-leverage', 'sapi', 'GET', {'cost': 5})
199
200
  sapi_get_staking_productlist = sapiGetStakingProductList = Entry('staking/productList', 'sapi', 'GET', {'cost': 0.1})
200
201
  sapi_get_staking_position = sapiGetStakingPosition = Entry('staking/position', 'sapi', 'GET', {'cost': 0.1})
201
202
  sapi_get_staking_stakingrecord = sapiGetStakingStakingRecord = Entry('staking/stakingRecord', 'sapi', 'GET', {'cost': 0.1})
@@ -207,6 +208,11 @@ class ImplicitAPI:
207
208
  sapi_get_lending_auto_invest_plan_list = sapiGetLendingAutoInvestPlanList = Entry('lending/auto-invest/plan/list', 'sapi', 'GET', {'cost': 0.1})
208
209
  sapi_get_lending_auto_invest_plan_id = sapiGetLendingAutoInvestPlanId = Entry('lending/auto-invest/plan/id', 'sapi', 'GET', {'cost': 0.1})
209
210
  sapi_get_lending_auto_invest_history_list = sapiGetLendingAutoInvestHistoryList = Entry('lending/auto-invest/history/list', 'sapi', 'GET', {'cost': 0.1})
211
+ sapi_get_lending_auto_invest_index_info = sapiGetLendingAutoInvestIndexInfo = Entry('lending/auto-invest/index/info', 'sapi', 'GET', {'cost': 0.1})
212
+ sapi_get_lending_auto_invest_index_user_summary = sapiGetLendingAutoInvestIndexUserSummary = Entry('lending/auto-invest/index/user-summary', 'sapi', 'GET', {'cost': 0.1})
213
+ sapi_get_lending_auto_invest_one_off_status = sapiGetLendingAutoInvestOneOffStatus = Entry('lending/auto-invest/one-off/status', 'sapi', 'GET', {'cost': 0.1})
214
+ sapi_get_lending_auto_invest_redeem_history = sapiGetLendingAutoInvestRedeemHistory = Entry('lending/auto-invest/redeem/history', 'sapi', 'GET', {'cost': 0.1})
215
+ sapi_get_lending_auto_invest_rebalance_history = sapiGetLendingAutoInvestRebalanceHistory = Entry('lending/auto-invest/rebalance/history', 'sapi', 'GET', {'cost': 0.1})
210
216
  sapi_get_simple_earn_flexible_list = sapiGetSimpleEarnFlexibleList = Entry('simple-earn/flexible/list', 'sapi', 'GET', {'cost': 15})
211
217
  sapi_get_simple_earn_locked_list = sapiGetSimpleEarnLockedList = Entry('simple-earn/locked/list', 'sapi', 'GET', {'cost': 15})
212
218
  sapi_get_simple_earn_flexible_personalleftquota = sapiGetSimpleEarnFlexiblePersonalLeftQuota = Entry('simple-earn/flexible/personalLeftQuota', 'sapi', 'GET', {'cost': 15})
@@ -322,6 +328,8 @@ class ImplicitAPI:
322
328
  sapi_post_lending_auto_invest_plan_add = sapiPostLendingAutoInvestPlanAdd = Entry('lending/auto-invest/plan/add', 'sapi', 'POST', {'cost': 0.1})
323
329
  sapi_post_lending_auto_invest_plan_edit = sapiPostLendingAutoInvestPlanEdit = Entry('lending/auto-invest/plan/edit', 'sapi', 'POST', {'cost': 0.1})
324
330
  sapi_post_lending_auto_invest_plan_edit_status = sapiPostLendingAutoInvestPlanEditStatus = Entry('lending/auto-invest/plan/edit-status', 'sapi', 'POST', {'cost': 0.1})
331
+ sapi_post_lending_auto_invest_one_off = sapiPostLendingAutoInvestOneOff = Entry('lending/auto-invest/one-off', 'sapi', 'POST', {'cost': 0.1})
332
+ sapi_post_lending_auto_invest_redeem = sapiPostLendingAutoInvestRedeem = Entry('lending/auto-invest/redeem', 'sapi', 'POST', {'cost': 0.1})
325
333
  sapi_post_simple_earn_flexible_subscribe = sapiPostSimpleEarnFlexibleSubscribe = Entry('simple-earn/flexible/subscribe', 'sapi', 'POST', {'cost': 0.1})
326
334
  sapi_post_simple_earn_locked_subscribe = sapiPostSimpleEarnLockedSubscribe = Entry('simple-earn/locked/subscribe', 'sapi', 'POST', {'cost': 0.1})
327
335
  sapi_post_simple_earn_flexible_redeem = sapiPostSimpleEarnFlexibleRedeem = Entry('simple-earn/flexible/redeem', 'sapi', 'POST', {'cost': 0.1})
@@ -196,6 +196,7 @@ class ImplicitAPI:
196
196
  sapi_get_portfolio_interest_history = sapiGetPortfolioInterestHistory = Entry('portfolio/interest-history', 'sapi', 'GET', {'cost': 0.6667})
197
197
  sapi_get_portfolio_asset_index_price = sapiGetPortfolioAssetIndexPrice = Entry('portfolio/asset-index-price', 'sapi', 'GET', {'cost': 0.1})
198
198
  sapi_get_portfolio_repay_futures_switch = sapiGetPortfolioRepayFuturesSwitch = Entry('portfolio/repay-futures-switch', 'sapi', 'GET', {'cost': 3})
199
+ sapi_get_portfolio_margin_asset_leverage = sapiGetPortfolioMarginAssetLeverage = Entry('portfolio/margin-asset-leverage', 'sapi', 'GET', {'cost': 5})
199
200
  sapi_get_staking_productlist = sapiGetStakingProductList = Entry('staking/productList', 'sapi', 'GET', {'cost': 0.1})
200
201
  sapi_get_staking_position = sapiGetStakingPosition = Entry('staking/position', 'sapi', 'GET', {'cost': 0.1})
201
202
  sapi_get_staking_stakingrecord = sapiGetStakingStakingRecord = Entry('staking/stakingRecord', 'sapi', 'GET', {'cost': 0.1})
@@ -207,6 +208,11 @@ class ImplicitAPI:
207
208
  sapi_get_lending_auto_invest_plan_list = sapiGetLendingAutoInvestPlanList = Entry('lending/auto-invest/plan/list', 'sapi', 'GET', {'cost': 0.1})
208
209
  sapi_get_lending_auto_invest_plan_id = sapiGetLendingAutoInvestPlanId = Entry('lending/auto-invest/plan/id', 'sapi', 'GET', {'cost': 0.1})
209
210
  sapi_get_lending_auto_invest_history_list = sapiGetLendingAutoInvestHistoryList = Entry('lending/auto-invest/history/list', 'sapi', 'GET', {'cost': 0.1})
211
+ sapi_get_lending_auto_invest_index_info = sapiGetLendingAutoInvestIndexInfo = Entry('lending/auto-invest/index/info', 'sapi', 'GET', {'cost': 0.1})
212
+ sapi_get_lending_auto_invest_index_user_summary = sapiGetLendingAutoInvestIndexUserSummary = Entry('lending/auto-invest/index/user-summary', 'sapi', 'GET', {'cost': 0.1})
213
+ sapi_get_lending_auto_invest_one_off_status = sapiGetLendingAutoInvestOneOffStatus = Entry('lending/auto-invest/one-off/status', 'sapi', 'GET', {'cost': 0.1})
214
+ sapi_get_lending_auto_invest_redeem_history = sapiGetLendingAutoInvestRedeemHistory = Entry('lending/auto-invest/redeem/history', 'sapi', 'GET', {'cost': 0.1})
215
+ sapi_get_lending_auto_invest_rebalance_history = sapiGetLendingAutoInvestRebalanceHistory = Entry('lending/auto-invest/rebalance/history', 'sapi', 'GET', {'cost': 0.1})
210
216
  sapi_get_simple_earn_flexible_list = sapiGetSimpleEarnFlexibleList = Entry('simple-earn/flexible/list', 'sapi', 'GET', {'cost': 15})
211
217
  sapi_get_simple_earn_locked_list = sapiGetSimpleEarnLockedList = Entry('simple-earn/locked/list', 'sapi', 'GET', {'cost': 15})
212
218
  sapi_get_simple_earn_flexible_personalleftquota = sapiGetSimpleEarnFlexiblePersonalLeftQuota = Entry('simple-earn/flexible/personalLeftQuota', 'sapi', 'GET', {'cost': 15})
@@ -322,6 +328,8 @@ class ImplicitAPI:
322
328
  sapi_post_lending_auto_invest_plan_add = sapiPostLendingAutoInvestPlanAdd = Entry('lending/auto-invest/plan/add', 'sapi', 'POST', {'cost': 0.1})
323
329
  sapi_post_lending_auto_invest_plan_edit = sapiPostLendingAutoInvestPlanEdit = Entry('lending/auto-invest/plan/edit', 'sapi', 'POST', {'cost': 0.1})
324
330
  sapi_post_lending_auto_invest_plan_edit_status = sapiPostLendingAutoInvestPlanEditStatus = Entry('lending/auto-invest/plan/edit-status', 'sapi', 'POST', {'cost': 0.1})
331
+ sapi_post_lending_auto_invest_one_off = sapiPostLendingAutoInvestOneOff = Entry('lending/auto-invest/one-off', 'sapi', 'POST', {'cost': 0.1})
332
+ sapi_post_lending_auto_invest_redeem = sapiPostLendingAutoInvestRedeem = Entry('lending/auto-invest/redeem', 'sapi', 'POST', {'cost': 0.1})
325
333
  sapi_post_simple_earn_flexible_subscribe = sapiPostSimpleEarnFlexibleSubscribe = Entry('simple-earn/flexible/subscribe', 'sapi', 'POST', {'cost': 0.1})
326
334
  sapi_post_simple_earn_locked_subscribe = sapiPostSimpleEarnLockedSubscribe = Entry('simple-earn/locked/subscribe', 'sapi', 'POST', {'cost': 0.1})
327
335
  sapi_post_simple_earn_flexible_redeem = sapiPostSimpleEarnFlexibleRedeem = Entry('simple-earn/flexible/redeem', 'sapi', 'POST', {'cost': 0.1})
@@ -196,6 +196,7 @@ class ImplicitAPI:
196
196
  sapi_get_portfolio_interest_history = sapiGetPortfolioInterestHistory = Entry('portfolio/interest-history', 'sapi', 'GET', {'cost': 0.6667})
197
197
  sapi_get_portfolio_asset_index_price = sapiGetPortfolioAssetIndexPrice = Entry('portfolio/asset-index-price', 'sapi', 'GET', {'cost': 0.1})
198
198
  sapi_get_portfolio_repay_futures_switch = sapiGetPortfolioRepayFuturesSwitch = Entry('portfolio/repay-futures-switch', 'sapi', 'GET', {'cost': 3})
199
+ sapi_get_portfolio_margin_asset_leverage = sapiGetPortfolioMarginAssetLeverage = Entry('portfolio/margin-asset-leverage', 'sapi', 'GET', {'cost': 5})
199
200
  sapi_get_staking_productlist = sapiGetStakingProductList = Entry('staking/productList', 'sapi', 'GET', {'cost': 0.1})
200
201
  sapi_get_staking_position = sapiGetStakingPosition = Entry('staking/position', 'sapi', 'GET', {'cost': 0.1})
201
202
  sapi_get_staking_stakingrecord = sapiGetStakingStakingRecord = Entry('staking/stakingRecord', 'sapi', 'GET', {'cost': 0.1})
@@ -207,6 +208,11 @@ class ImplicitAPI:
207
208
  sapi_get_lending_auto_invest_plan_list = sapiGetLendingAutoInvestPlanList = Entry('lending/auto-invest/plan/list', 'sapi', 'GET', {'cost': 0.1})
208
209
  sapi_get_lending_auto_invest_plan_id = sapiGetLendingAutoInvestPlanId = Entry('lending/auto-invest/plan/id', 'sapi', 'GET', {'cost': 0.1})
209
210
  sapi_get_lending_auto_invest_history_list = sapiGetLendingAutoInvestHistoryList = Entry('lending/auto-invest/history/list', 'sapi', 'GET', {'cost': 0.1})
211
+ sapi_get_lending_auto_invest_index_info = sapiGetLendingAutoInvestIndexInfo = Entry('lending/auto-invest/index/info', 'sapi', 'GET', {'cost': 0.1})
212
+ sapi_get_lending_auto_invest_index_user_summary = sapiGetLendingAutoInvestIndexUserSummary = Entry('lending/auto-invest/index/user-summary', 'sapi', 'GET', {'cost': 0.1})
213
+ sapi_get_lending_auto_invest_one_off_status = sapiGetLendingAutoInvestOneOffStatus = Entry('lending/auto-invest/one-off/status', 'sapi', 'GET', {'cost': 0.1})
214
+ sapi_get_lending_auto_invest_redeem_history = sapiGetLendingAutoInvestRedeemHistory = Entry('lending/auto-invest/redeem/history', 'sapi', 'GET', {'cost': 0.1})
215
+ sapi_get_lending_auto_invest_rebalance_history = sapiGetLendingAutoInvestRebalanceHistory = Entry('lending/auto-invest/rebalance/history', 'sapi', 'GET', {'cost': 0.1})
210
216
  sapi_get_simple_earn_flexible_list = sapiGetSimpleEarnFlexibleList = Entry('simple-earn/flexible/list', 'sapi', 'GET', {'cost': 15})
211
217
  sapi_get_simple_earn_locked_list = sapiGetSimpleEarnLockedList = Entry('simple-earn/locked/list', 'sapi', 'GET', {'cost': 15})
212
218
  sapi_get_simple_earn_flexible_personalleftquota = sapiGetSimpleEarnFlexiblePersonalLeftQuota = Entry('simple-earn/flexible/personalLeftQuota', 'sapi', 'GET', {'cost': 15})
@@ -322,6 +328,8 @@ class ImplicitAPI:
322
328
  sapi_post_lending_auto_invest_plan_add = sapiPostLendingAutoInvestPlanAdd = Entry('lending/auto-invest/plan/add', 'sapi', 'POST', {'cost': 0.1})
323
329
  sapi_post_lending_auto_invest_plan_edit = sapiPostLendingAutoInvestPlanEdit = Entry('lending/auto-invest/plan/edit', 'sapi', 'POST', {'cost': 0.1})
324
330
  sapi_post_lending_auto_invest_plan_edit_status = sapiPostLendingAutoInvestPlanEditStatus = Entry('lending/auto-invest/plan/edit-status', 'sapi', 'POST', {'cost': 0.1})
331
+ sapi_post_lending_auto_invest_one_off = sapiPostLendingAutoInvestOneOff = Entry('lending/auto-invest/one-off', 'sapi', 'POST', {'cost': 0.1})
332
+ sapi_post_lending_auto_invest_redeem = sapiPostLendingAutoInvestRedeem = Entry('lending/auto-invest/redeem', 'sapi', 'POST', {'cost': 0.1})
325
333
  sapi_post_simple_earn_flexible_subscribe = sapiPostSimpleEarnFlexibleSubscribe = Entry('simple-earn/flexible/subscribe', 'sapi', 'POST', {'cost': 0.1})
326
334
  sapi_post_simple_earn_locked_subscribe = sapiPostSimpleEarnLockedSubscribe = Entry('simple-earn/locked/subscribe', 'sapi', 'POST', {'cost': 0.1})
327
335
  sapi_post_simple_earn_flexible_redeem = sapiPostSimpleEarnFlexibleRedeem = Entry('simple-earn/flexible/redeem', 'sapi', 'POST', {'cost': 0.1})
@@ -196,6 +196,7 @@ class ImplicitAPI:
196
196
  sapi_get_portfolio_interest_history = sapiGetPortfolioInterestHistory = Entry('portfolio/interest-history', 'sapi', 'GET', {'cost': 0.6667})
197
197
  sapi_get_portfolio_asset_index_price = sapiGetPortfolioAssetIndexPrice = Entry('portfolio/asset-index-price', 'sapi', 'GET', {'cost': 0.1})
198
198
  sapi_get_portfolio_repay_futures_switch = sapiGetPortfolioRepayFuturesSwitch = Entry('portfolio/repay-futures-switch', 'sapi', 'GET', {'cost': 3})
199
+ sapi_get_portfolio_margin_asset_leverage = sapiGetPortfolioMarginAssetLeverage = Entry('portfolio/margin-asset-leverage', 'sapi', 'GET', {'cost': 5})
199
200
  sapi_get_staking_productlist = sapiGetStakingProductList = Entry('staking/productList', 'sapi', 'GET', {'cost': 0.1})
200
201
  sapi_get_staking_position = sapiGetStakingPosition = Entry('staking/position', 'sapi', 'GET', {'cost': 0.1})
201
202
  sapi_get_staking_stakingrecord = sapiGetStakingStakingRecord = Entry('staking/stakingRecord', 'sapi', 'GET', {'cost': 0.1})
@@ -207,6 +208,11 @@ class ImplicitAPI:
207
208
  sapi_get_lending_auto_invest_plan_list = sapiGetLendingAutoInvestPlanList = Entry('lending/auto-invest/plan/list', 'sapi', 'GET', {'cost': 0.1})
208
209
  sapi_get_lending_auto_invest_plan_id = sapiGetLendingAutoInvestPlanId = Entry('lending/auto-invest/plan/id', 'sapi', 'GET', {'cost': 0.1})
209
210
  sapi_get_lending_auto_invest_history_list = sapiGetLendingAutoInvestHistoryList = Entry('lending/auto-invest/history/list', 'sapi', 'GET', {'cost': 0.1})
211
+ sapi_get_lending_auto_invest_index_info = sapiGetLendingAutoInvestIndexInfo = Entry('lending/auto-invest/index/info', 'sapi', 'GET', {'cost': 0.1})
212
+ sapi_get_lending_auto_invest_index_user_summary = sapiGetLendingAutoInvestIndexUserSummary = Entry('lending/auto-invest/index/user-summary', 'sapi', 'GET', {'cost': 0.1})
213
+ sapi_get_lending_auto_invest_one_off_status = sapiGetLendingAutoInvestOneOffStatus = Entry('lending/auto-invest/one-off/status', 'sapi', 'GET', {'cost': 0.1})
214
+ sapi_get_lending_auto_invest_redeem_history = sapiGetLendingAutoInvestRedeemHistory = Entry('lending/auto-invest/redeem/history', 'sapi', 'GET', {'cost': 0.1})
215
+ sapi_get_lending_auto_invest_rebalance_history = sapiGetLendingAutoInvestRebalanceHistory = Entry('lending/auto-invest/rebalance/history', 'sapi', 'GET', {'cost': 0.1})
210
216
  sapi_get_simple_earn_flexible_list = sapiGetSimpleEarnFlexibleList = Entry('simple-earn/flexible/list', 'sapi', 'GET', {'cost': 15})
211
217
  sapi_get_simple_earn_locked_list = sapiGetSimpleEarnLockedList = Entry('simple-earn/locked/list', 'sapi', 'GET', {'cost': 15})
212
218
  sapi_get_simple_earn_flexible_personalleftquota = sapiGetSimpleEarnFlexiblePersonalLeftQuota = Entry('simple-earn/flexible/personalLeftQuota', 'sapi', 'GET', {'cost': 15})
@@ -322,6 +328,8 @@ class ImplicitAPI:
322
328
  sapi_post_lending_auto_invest_plan_add = sapiPostLendingAutoInvestPlanAdd = Entry('lending/auto-invest/plan/add', 'sapi', 'POST', {'cost': 0.1})
323
329
  sapi_post_lending_auto_invest_plan_edit = sapiPostLendingAutoInvestPlanEdit = Entry('lending/auto-invest/plan/edit', 'sapi', 'POST', {'cost': 0.1})
324
330
  sapi_post_lending_auto_invest_plan_edit_status = sapiPostLendingAutoInvestPlanEditStatus = Entry('lending/auto-invest/plan/edit-status', 'sapi', 'POST', {'cost': 0.1})
331
+ sapi_post_lending_auto_invest_one_off = sapiPostLendingAutoInvestOneOff = Entry('lending/auto-invest/one-off', 'sapi', 'POST', {'cost': 0.1})
332
+ sapi_post_lending_auto_invest_redeem = sapiPostLendingAutoInvestRedeem = Entry('lending/auto-invest/redeem', 'sapi', 'POST', {'cost': 0.1})
325
333
  sapi_post_simple_earn_flexible_subscribe = sapiPostSimpleEarnFlexibleSubscribe = Entry('simple-earn/flexible/subscribe', 'sapi', 'POST', {'cost': 0.1})
326
334
  sapi_post_simple_earn_locked_subscribe = sapiPostSimpleEarnLockedSubscribe = Entry('simple-earn/locked/subscribe', 'sapi', 'POST', {'cost': 0.1})
327
335
  sapi_post_simple_earn_flexible_redeem = sapiPostSimpleEarnFlexibleRedeem = Entry('simple-earn/flexible/redeem', 'sapi', 'POST', {'cost': 0.1})
ccxt/abstract/bingx.py CHANGED
@@ -30,6 +30,7 @@ class ImplicitAPI:
30
30
  swap_v2_public_get_quote_klines = swapV2PublicGetQuoteKlines = Entry('quote/klines', ['swap', 'v2', 'public'], 'GET', {'cost': 1})
31
31
  swap_v2_public_get_quote_openinterest = swapV2PublicGetQuoteOpenInterest = Entry('quote/openInterest', ['swap', 'v2', 'public'], 'GET', {'cost': 1})
32
32
  swap_v2_public_get_quote_ticker = swapV2PublicGetQuoteTicker = Entry('quote/ticker', ['swap', 'v2', 'public'], 'GET', {'cost': 1})
33
+ swap_v2_public_get_quote_bookticker = swapV2PublicGetQuoteBookTicker = Entry('quote/bookTicker', ['swap', 'v2', 'public'], 'GET', {'cost': 1})
33
34
  swap_v2_private_get_user_balance = swapV2PrivateGetUserBalance = Entry('user/balance', ['swap', 'v2', 'private'], 'GET', {'cost': 3})
34
35
  swap_v2_private_get_user_positions = swapV2PrivateGetUserPositions = Entry('user/positions', ['swap', 'v2', 'private'], 'GET', {'cost': 3})
35
36
  swap_v2_private_get_user_income = swapV2PrivateGetUserIncome = Entry('user/income', ['swap', 'v2', 'private'], 'GET', {'cost': 3})
@@ -57,15 +58,29 @@ class ImplicitAPI:
57
58
  contract_v1_private_get_allorders = contractV1PrivateGetAllOrders = Entry('allOrders', ['contract', 'v1', 'private'], 'GET', {'cost': 3})
58
59
  contract_v1_private_get_balance = contractV1PrivateGetBalance = Entry('balance', ['contract', 'v1', 'private'], 'GET', {'cost': 3})
59
60
  wallets_v1_private_get_capital_config_getall = walletsV1PrivateGetCapitalConfigGetall = Entry('capital/config/getall', ['wallets', 'v1', 'private'], 'GET', {'cost': 3})
61
+ wallets_v1_private_get_capital_deposit_address = walletsV1PrivateGetCapitalDepositAddress = Entry('capital/deposit/address', ['wallets', 'v1', 'private'], 'GET', {'cost': 1})
62
+ wallets_v1_private_get_capital_innertransfer_records = walletsV1PrivateGetCapitalInnerTransferRecords = Entry('capital/innerTransfer/records', ['wallets', 'v1', 'private'], 'GET', {'cost': 1})
63
+ wallets_v1_private_get_capital_subaccount_deposit_address = walletsV1PrivateGetCapitalSubAccountDepositAddress = Entry('capital/subAccount/deposit/address', ['wallets', 'v1', 'private'], 'GET', {'cost': 1})
64
+ wallets_v1_private_get_capital_deposit_subhisrec = walletsV1PrivateGetCapitalDepositSubHisrec = Entry('capital/deposit/subHisrec', ['wallets', 'v1', 'private'], 'GET', {'cost': 1})
65
+ wallets_v1_private_get_capital_subaccount_innertransfer_records = walletsV1PrivateGetCapitalSubAccountInnerTransferRecords = Entry('capital/subAccount/innerTransfer/records', ['wallets', 'v1', 'private'], 'GET', {'cost': 1})
60
66
  wallets_v1_private_post_capital_withdraw_apply = walletsV1PrivatePostCapitalWithdrawApply = Entry('capital/withdraw/apply', ['wallets', 'v1', 'private'], 'POST', {'cost': 3})
61
67
  wallets_v1_private_post_capital_innertransfer_apply = walletsV1PrivatePostCapitalInnerTransferApply = Entry('capital/innerTransfer/apply', ['wallets', 'v1', 'private'], 'POST', {'cost': 3})
62
68
  wallets_v1_private_post_capital_subaccountinnertransfer_apply = walletsV1PrivatePostCapitalSubAccountInnerTransferApply = Entry('capital/subAccountInnerTransfer/apply', ['wallets', 'v1', 'private'], 'POST', {'cost': 3})
69
+ wallets_v1_private_post_capital_deposit_createsubaddress = walletsV1PrivatePostCapitalDepositCreateSubAddress = Entry('capital/deposit/createSubAddress', ['wallets', 'v1', 'private'], 'POST', {'cost': 1})
63
70
  subaccount_v1_private_get_list = subAccountV1PrivateGetList = Entry('list', ['subAccount', 'v1', 'private'], 'GET', {'cost': 3})
64
71
  subaccount_v1_private_get_assets = subAccountV1PrivateGetAssets = Entry('assets', ['subAccount', 'v1', 'private'], 'GET', {'cost': 3})
72
+ subaccount_v1_private_get_apikey_query = subAccountV1PrivateGetApiKeyQuery = Entry('apiKey/query', ['subAccount', 'v1', 'private'], 'GET', {'cost': 1})
65
73
  subaccount_v1_private_post_create = subAccountV1PrivatePostCreate = Entry('create', ['subAccount', 'v1', 'private'], 'POST', {'cost': 3})
66
74
  subaccount_v1_private_post_apikey_create = subAccountV1PrivatePostApiKeyCreate = Entry('apiKey/create', ['subAccount', 'v1', 'private'], 'POST', {'cost': 3})
67
75
  subaccount_v1_private_post_apikey_edit = subAccountV1PrivatePostApiKeyEdit = Entry('apiKey/edit', ['subAccount', 'v1', 'private'], 'POST', {'cost': 3})
68
76
  subaccount_v1_private_post_apikey_del = subAccountV1PrivatePostApiKeyDel = Entry('apiKey/del', ['subAccount', 'v1', 'private'], 'POST', {'cost': 3})
69
77
  subaccount_v1_private_post_updatestatus = subAccountV1PrivatePostUpdateStatus = Entry('updateStatus', ['subAccount', 'v1', 'private'], 'POST', {'cost': 3})
70
- account_v1_private_post_uid = accountV1PrivatePostUid = Entry('uid', ['account', 'v1', 'private'], 'POST', {'cost': 3})
78
+ account_v1_private_get_uid = accountV1PrivateGetUid = Entry('uid', ['account', 'v1', 'private'], 'GET', {'cost': 1})
71
79
  account_v1_private_post_innertransfer_authorizesubaccount = accountV1PrivatePostInnerTransferAuthorizeSubAccount = Entry('innerTransfer/authorizeSubAccount', ['account', 'v1', 'private'], 'POST', {'cost': 3})
80
+ copytrading_v1_private_get_swap_trace_currenttrack = copyTradingV1PrivateGetSwapTraceCurrentTrack = Entry('swap/trace/currentTrack', ['copyTrading', 'v1', 'private'], 'GET', {'cost': 1})
81
+ copytrading_v1_private_post_swap_trace_closetrackorder = copyTradingV1PrivatePostSwapTraceCloseTrackOrder = Entry('swap/trace/closeTrackOrder', ['copyTrading', 'v1', 'private'], 'POST', {'cost': 1})
82
+ copytrading_v1_private_post_swap_trace_settpsl = copyTradingV1PrivatePostSwapTraceSetTPSL = Entry('swap/trace/setTPSL', ['copyTrading', 'v1', 'private'], 'POST', {'cost': 1})
83
+ api_v3_private_get_asset_transfer = apiV3PrivateGetAssetTransfer = Entry('asset/transfer', ['api', 'v3', 'private'], 'GET', {'cost': 1})
84
+ api_v3_private_get_capital_deposit_hisrec = apiV3PrivateGetCapitalDepositHisrec = Entry('capital/deposit/hisrec', ['api', 'v3', 'private'], 'GET', {'cost': 1})
85
+ api_v3_private_get_capital_withdraw_history = apiV3PrivateGetCapitalWithdrawHistory = Entry('capital/withdraw/history', ['api', 'v3', 'private'], 'GET', {'cost': 1})
86
+ api_v3_private_post_post_asset_transfer = apiV3PrivatePostPostAssetTransfer = Entry('post/asset/transfer', ['api', 'v3', 'private'], 'POST', {'cost': 1})
@@ -4,7 +4,7 @@
4
4
 
5
5
  # -----------------------------------------------------------------------------
6
6
 
7
- __version__ = '4.0.101'
7
+ __version__ = '4.0.102'
8
8
 
9
9
  # -----------------------------------------------------------------------------
10
10
 
@@ -85,7 +85,6 @@ from ccxt.async_support.bitstamp import bitstamp
85
85
  from ccxt.async_support.bitstamp1 import bitstamp1 # noqa: F401
86
86
  from ccxt.async_support.bittrex import bittrex # noqa: F401
87
87
  from ccxt.async_support.bitvavo import bitvavo # noqa: F401
88
- from ccxt.async_support.bkex import bkex # noqa: F401
89
88
  from ccxt.async_support.bl3p import bl3p # noqa: F401
90
89
  from ccxt.async_support.blockchaincom import blockchaincom # noqa: F401
91
90
  from ccxt.async_support.btcalpha import btcalpha # noqa: F401
@@ -193,7 +192,6 @@ exchanges = [
193
192
  'bitstamp1',
194
193
  'bittrex',
195
194
  'bitvavo',
196
- 'bkex',
197
195
  'bl3p',
198
196
  'blockchaincom',
199
197
  'btcalpha',
@@ -2,7 +2,7 @@
2
2
 
3
3
  # -----------------------------------------------------------------------------
4
4
 
5
- __version__ = '4.0.101'
5
+ __version__ = '4.0.102'
6
6
 
7
7
  # -----------------------------------------------------------------------------
8
8
 
@@ -426,6 +426,7 @@ class binance(Exchange, ImplicitAPI):
426
426
  'portfolio/interest-history': 0.6667,
427
427
  'portfolio/asset-index-price': 0.1,
428
428
  'portfolio/repay-futures-switch': 3, # Weight(IP): 30 => cost = 0.1 * 30 = 3
429
+ 'portfolio/margin-asset-leverage': 5, # Weight(IP): 50 => cost = 0.1 * 50 = 5
429
430
  # staking
430
431
  'staking/productList': 0.1,
431
432
  'staking/position': 0.1,
@@ -438,6 +439,11 @@ class binance(Exchange, ImplicitAPI):
438
439
  'lending/auto-invest/plan/list': 0.1,
439
440
  'lending/auto-invest/plan/id': 0.1,
440
441
  'lending/auto-invest/history/list': 0.1,
442
+ 'lending/auto-invest/index/info': 0.1, # Weight(IP): 1 => cost = 0.1 * 1 = 0.1
443
+ 'lending/auto-invest/index/user-summary': 0.1, # Weight(IP): 1 => cost = 0.1 * 1 = 0.1
444
+ 'lending/auto-invest/one-off/status': 0.1, # Weight(IP): 1 => cost = 0.1 * 1 = 0.1
445
+ 'lending/auto-invest/redeem/history': 0.1, # Weight(IP): 1 => cost = 0.1 * 1 = 0.1
446
+ 'lending/auto-invest/rebalance/history': 0.1, # Weight(IP): 1 => cost = 0.1 * 1 = 0.1
441
447
  # simple earn
442
448
  'simple-earn/flexible/list': 15,
443
449
  'simple-earn/locked/list': 15,
@@ -565,6 +571,8 @@ class binance(Exchange, ImplicitAPI):
565
571
  'lending/auto-invest/plan/add': 0.1, # Weight(IP): 1 => cost = 0.1 * 1 = 0.1
566
572
  'lending/auto-invest/plan/edit': 0.1, # Weight(IP): 1 => cost = 0.1 * 1 = 0.1
567
573
  'lending/auto-invest/plan/edit-status': 0.1, # Weight(IP): 1 => cost = 0.1 * 1 = 0.1
574
+ 'lending/auto-invest/one-off': 0.1, # Weight(IP): 1 => cost = 0.1 * 1 = 0.1
575
+ 'lending/auto-invest/redeem': 0.1, # Weight(IP): 1 => cost = 0.1 * 1 = 0.1
568
576
  # simple earn
569
577
  'simple-earn/flexible/subscribe': 0.1,
570
578
  'simple-earn/locked/subscribe': 0.1,
@@ -154,6 +154,7 @@ class bingx(Exchange, ImplicitAPI):
154
154
  'quote/klines': 1,
155
155
  'quote/openInterest': 1,
156
156
  'quote/ticker': 1,
157
+ 'quote/bookTicker': 1,
157
158
  },
158
159
  },
159
160
  'private': {
@@ -205,11 +206,17 @@ class bingx(Exchange, ImplicitAPI):
205
206
  'private': {
206
207
  'get': {
207
208
  'capital/config/getall': 3,
209
+ 'capital/deposit/address': 1,
210
+ 'capital/innerTransfer/records': 1,
211
+ 'capital/subAccount/deposit/address': 1,
212
+ 'capital/deposit/subHisrec': 1,
213
+ 'capital/subAccount/innerTransfer/records': 1,
208
214
  },
209
215
  'post': {
210
216
  'capital/withdraw/apply': 3,
211
217
  'capital/innerTransfer/apply': 3,
212
218
  'capital/subAccountInnerTransfer/apply': 3,
219
+ 'capital/deposit/createSubAddress': 1,
213
220
  },
214
221
  },
215
222
  },
@@ -220,6 +227,7 @@ class bingx(Exchange, ImplicitAPI):
220
227
  'get': {
221
228
  'list': 3,
222
229
  'assets': 3,
230
+ 'apiKey/query': 1,
223
231
  },
224
232
  'post': {
225
233
  'create': 3,
@@ -234,13 +242,42 @@ class bingx(Exchange, ImplicitAPI):
234
242
  'account': {
235
243
  'v1': {
236
244
  'private': {
245
+ 'get': {
246
+ 'uid': 1,
247
+ },
237
248
  'post': {
238
- 'uid': 3,
239
249
  'innerTransfer/authorizeSubAccount': 3,
240
250
  },
241
251
  },
242
252
  },
243
253
  },
254
+ 'copyTrading': {
255
+ 'v1': {
256
+ 'private': {
257
+ 'get': {
258
+ 'swap/trace/currentTrack': 1,
259
+ },
260
+ 'post': {
261
+ 'swap/trace/closeTrackOrder': 1,
262
+ 'swap/trace/setTPSL': 1,
263
+ },
264
+ },
265
+ },
266
+ },
267
+ 'api': {
268
+ 'v3': {
269
+ 'private': {
270
+ 'get': {
271
+ 'asset/transfer': 1,
272
+ 'capital/deposit/hisrec': 1,
273
+ 'capital/withdraw/history': 1,
274
+ },
275
+ 'post': {
276
+ 'post/asset/transfer': 1,
277
+ },
278
+ },
279
+ },
280
+ },
244
281
  },
245
282
  'timeframes': {
246
283
  '1m': '1m',
@@ -1438,9 +1475,9 @@ class bingx(Exchange, ImplicitAPI):
1438
1475
  :param float [price]: the price at which the order is to be fullfilled, in units of the quote currency, ignored in market orders
1439
1476
  :param dict [params]: extra parameters specific to the bingx api endpoint
1440
1477
  :param bool [params.postOnly]: True to place a post only order
1441
- :param dict [params.triggerPrice]: triggerPrice at which the attached take profit / stop loss order will be triggered(swap markets only)
1442
- :param float [params.stopLossPrice]: stop loss trigger price(swap markets only)
1443
- :param float [params.takeProfitPrice]: take profit trigger price(swap markets only)
1478
+ :param float [params.triggerPrice]: *swap only* triggerPrice at which the attached take profit / stop loss order will be triggered
1479
+ :param float [params.stopLossPrice]: *swap only* stop loss trigger price
1480
+ :param float [params.takeProfitPrice]: *swap only* take profit trigger price
1444
1481
  :returns dict: an `order structure <https://github.com/ccxt/ccxt/wiki/Manual#order-structure>`
1445
1482
  """
1446
1483
  await self.load_markets()
@@ -76,6 +76,9 @@ class bitmart(Exchange, ImplicitAPI):
76
76
  'fetchDepositWithdrawFee': True,
77
77
  'fetchDepositWithdrawFees': False,
78
78
  'fetchFundingHistory': None,
79
+ 'fetchFundingRate': True,
80
+ 'fetchFundingRateHistory': False,
81
+ 'fetchFundingRates': False,
79
82
  'fetchMarginMode': False,
80
83
  'fetchMarkets': True,
81
84
  'fetchMyTrades': True,
@@ -3084,6 +3087,69 @@ class bitmart(Exchange, ImplicitAPI):
3084
3087
  }
3085
3088
  return await self.privatePostContractPrivateSubmitLeverage(self.extend(request, params))
3086
3089
 
3090
+ async def fetch_funding_rate(self, symbol: str, params={}):
3091
+ """
3092
+ fetch the current funding rate
3093
+ see https://developer-pro.bitmart.com/en/futures/#get-current-funding-rate
3094
+ :param str symbol: unified market symbol
3095
+ :param dict [params]: extra parameters specific to the bitmart api endpoint
3096
+ :returns dict: a `funding rate structure <https://github.com/ccxt/ccxt/wiki/Manual#funding-rate-structure>`
3097
+ """
3098
+ await self.load_markets()
3099
+ market = self.market(symbol)
3100
+ if not market['swap']:
3101
+ raise BadSymbol(self.id + ' fetchFundingRate() supports swap contracts only')
3102
+ request = {
3103
+ 'symbol': market['id'],
3104
+ }
3105
+ response = await self.publicGetContractPublicFundingRate(self.extend(request, params))
3106
+ #
3107
+ # {
3108
+ # "code": 1000,
3109
+ # "message": "Ok",
3110
+ # "data": {
3111
+ # "timestamp": 1695184410697,
3112
+ # "symbol": "BTCUSDT",
3113
+ # "rate_value": "-0.00002614",
3114
+ # "expected_rate": "-0.00002"
3115
+ # },
3116
+ # "trace": "4cad855074654097ac7ba5257c47305d.54.16951844206655589"
3117
+ # }
3118
+ #
3119
+ data = self.safe_value(response, 'data', {})
3120
+ return self.parse_funding_rate(data, market)
3121
+
3122
+ def parse_funding_rate(self, contract, market=None):
3123
+ #
3124
+ # {
3125
+ # "timestamp": 1695184410697,
3126
+ # "symbol": "BTCUSDT",
3127
+ # "rate_value": "-0.00002614",
3128
+ # "expected_rate": "-0.00002"
3129
+ # }
3130
+ #
3131
+ marketId = self.safe_string(contract, 'symbol')
3132
+ timestamp = self.safe_integer(contract, 'timestamp')
3133
+ return {
3134
+ 'info': contract,
3135
+ 'symbol': self.safe_symbol(marketId, market),
3136
+ 'markPrice': None,
3137
+ 'indexPrice': None,
3138
+ 'interestRate': None,
3139
+ 'estimatedSettlePrice': None,
3140
+ 'timestamp': timestamp,
3141
+ 'datetime': self.iso8601(timestamp),
3142
+ 'fundingRate': self.safe_number(contract, 'expected_rate'),
3143
+ 'fundingTimestamp': None,
3144
+ 'fundingDatetime': None,
3145
+ 'nextFundingRate': None,
3146
+ 'nextFundingTimestamp': None,
3147
+ 'nextFundingDatetime': None,
3148
+ 'previousFundingRate': self.safe_number(contract, 'rate_value'),
3149
+ 'previousFundingTimestamp': None,
3150
+ 'previousFundingDatetime': None,
3151
+ }
3152
+
3087
3153
  def nonce(self):
3088
3154
  return self.milliseconds()
3089
3155
 
@@ -35,6 +35,9 @@ class bl3p(Exchange, ImplicitAPI):
35
35
  'cancelOrder': True,
36
36
  'createOrder': True,
37
37
  'createReduceOnlyOrder': False,
38
+ 'createStopLimitOrder': False,
39
+ 'createStopMarketOrder': False,
40
+ 'createStopOrder': False,
38
41
  'fetchBalance': True,
39
42
  'fetchBorrowRate': False,
40
43
  'fetchBorrowRateHistories': False,
@@ -353,12 +356,17 @@ class bl3p(Exchange, ImplicitAPI):
353
356
  async def create_order(self, symbol: str, type: OrderType, side: OrderSide, amount, price=None, params={}):
354
357
  """
355
358
  create a trade order
359
+ see https://github.com/BitonicNL/bl3p-api/blob/master/examples/nodejs/example.md#21---create-an-order
356
360
  :param str symbol: unified symbol of the market to create an order in
357
361
  :param str type: 'market' or 'limit'
358
362
  :param str side: 'buy' or 'sell'
359
363
  :param float amount: how much of currency you want to trade in units of base currency
360
364
  :param float [price]: the price at which the order is to be fullfilled, in units of the quote currency, ignored in market orders
361
365
  :param dict [params]: extra parameters specific to the bl3p api endpoint
366
+ *
367
+ * EXCHANGE SPECIFIC PARAMETERS
368
+ :param int [params.amount_funds]: maximal EUR amount to spend(*1e5)
369
+ :param str [params.fee_currency]: 'EUR' or 'BTC'
362
370
  :returns dict: an `order structure <https://github.com/ccxt/ccxt/wiki/Manual#order-structure>`
363
371
  """
364
372
  market = self.market(symbol)
@@ -3559,11 +3559,11 @@ class bybit(Exchange, ImplicitAPI):
3559
3559
  request['reduceOnly'] = True
3560
3560
  elif isStopLoss or isTakeProfit:
3561
3561
  if isStopLoss:
3562
- stopLossTriggerPrice = self.safe_value_2(stopLoss, 'triggerPrice', 'stopPrice', stopLoss)
3563
- request['stopLoss'] = self.price_to_precision(symbol, stopLossTriggerPrice)
3562
+ slTriggerPrice = self.safe_value_2(stopLoss, 'triggerPrice', 'stopPrice', stopLoss)
3563
+ request['stopLoss'] = self.price_to_precision(symbol, slTriggerPrice)
3564
3564
  if isTakeProfit:
3565
- takeProfitTriggerPrice = self.safe_value_2(takeProfit, 'triggerPrice', 'stopPrice', takeProfit)
3566
- request['takeProfit'] = self.price_to_precision(symbol, takeProfitTriggerPrice)
3565
+ tpTriggerPrice = self.safe_value_2(takeProfit, 'triggerPrice', 'stopPrice', takeProfit)
3566
+ request['takeProfit'] = self.price_to_precision(symbol, tpTriggerPrice)
3567
3567
  if market['spot']:
3568
3568
  # only works for spot market
3569
3569
  if triggerPrice is not None:
@@ -3657,11 +3657,11 @@ class bybit(Exchange, ImplicitAPI):
3657
3657
  request['basePrice'] = Precise.string_sub(preciseStopPrice, delta) if isStopLossTriggerOrder else Precise.string_add(preciseStopPrice, delta)
3658
3658
  elif isStopLoss or isTakeProfit:
3659
3659
  if isStopLoss:
3660
- stopLossTriggerPrice = self.safe_value_2(stopLoss, 'triggerPrice', 'stopPrice', stopLoss)
3661
- request['stopLoss'] = self.price_to_precision(symbol, stopLossTriggerPrice)
3660
+ slTriggerPrice = self.safe_value_2(stopLoss, 'triggerPrice', 'stopPrice', stopLoss)
3661
+ request['stopLoss'] = self.price_to_precision(symbol, slTriggerPrice)
3662
3662
  if isTakeProfit:
3663
- takeProfitTriggerPrice = self.safe_value_2(takeProfit, 'triggerPrice', 'stopPrice', takeProfit)
3664
- request['takeProfit'] = self.price_to_precision(symbol, takeProfitTriggerPrice)
3663
+ tpTriggerPrice = self.safe_value_2(takeProfit, 'triggerPrice', 'stopPrice', takeProfit)
3664
+ request['takeProfit'] = self.price_to_precision(symbol, tpTriggerPrice)
3665
3665
  else:
3666
3666
  request['orderFilter'] = 'Order'
3667
3667
  clientOrderId = self.safe_string(params, 'clientOrderId')
@@ -3815,11 +3815,11 @@ class bybit(Exchange, ImplicitAPI):
3815
3815
  request['triggerPrice'] = self.price_to_precision(symbol, triggerPrice)
3816
3816
  if isStopLoss or isTakeProfit:
3817
3817
  if isStopLoss:
3818
- stopLossTriggerPrice = self.safe_value_2(stopLoss, 'triggerPrice', 'stopPrice', stopLoss)
3819
- request['stopLoss'] = self.price_to_precision(symbol, stopLossTriggerPrice)
3818
+ slTriggerPrice = self.safe_value_2(stopLoss, 'triggerPrice', 'stopPrice', stopLoss)
3819
+ request['stopLoss'] = self.price_to_precision(symbol, slTriggerPrice)
3820
3820
  if isTakeProfit:
3821
- takeProfitTriggerPrice = self.safe_value_2(takeProfit, 'triggerPrice', 'stopPrice', takeProfit)
3822
- request['takeProfit'] = self.price_to_precision(symbol, takeProfitTriggerPrice)
3821
+ tpTriggerPrice = self.safe_value_2(takeProfit, 'triggerPrice', 'stopPrice', takeProfit)
3822
+ request['takeProfit'] = self.price_to_precision(symbol, tpTriggerPrice)
3823
3823
  clientOrderId = self.safe_string(params, 'clientOrderId')
3824
3824
  if clientOrderId is not None:
3825
3825
  request['orderLinkId'] = clientOrderId
@@ -5642,11 +5642,10 @@ class bybit(Exchange, ImplicitAPI):
5642
5642
  await self.load_markets()
5643
5643
  enableUnifiedMargin, enableUnifiedAccount = await self.is_unified_enabled()
5644
5644
  isUnifiedAccount = (enableUnifiedMargin or enableUnifiedAccount)
5645
+ market = None
5645
5646
  response = None
5646
- if symbol is None:
5647
+ if isUnifiedAccount:
5647
5648
  if marginMode == 'isolated':
5648
- if not isUnifiedAccount:
5649
- raise NotSupported(self.id + ' setMarginMode() Normal Account not support ISOLATED_MARGIN')
5650
5649
  marginMode = 'ISOLATED_MARGIN'
5651
5650
  elif marginMode == 'cross':
5652
5651
  marginMode = 'REGULAR_MARGIN'
@@ -5659,36 +5658,56 @@ class bybit(Exchange, ImplicitAPI):
5659
5658
  }
5660
5659
  response = await self.privatePostV5AccountSetMarginMode(self.extend(request, params))
5661
5660
  else:
5661
+ if symbol is None:
5662
+ raise ArgumentsRequired(self.id + ' setMarginMode() requires a symbol parameter for non unified account')
5662
5663
  market = self.market(symbol)
5663
- type = None
5664
- type, params = self.get_bybit_type('setMarginMode', market, params)
5665
- if type == 'linear':
5666
- if isUnifiedAccount:
5667
- raise NotSupported(self.id + ' setMarginMode() with symbol Unified Account only support inverse contract')
5668
- isUsdtSettled = market['settle'] == 'USDT'
5669
- if not isUsdtSettled:
5670
- raise NotSupported(self.id + ' setMarginMode() with symbol only support USDT perpetual / inverse contract')
5671
- elif type != 'inverse':
5672
- raise NotSupported(self.id + ' setMarginMode() does not support self market type')
5673
- tradeMode = None
5674
- if marginMode == 'cross':
5675
- tradeMode = 0
5676
- elif marginMode == 'isolated':
5677
- tradeMode = 1
5664
+ isUsdcSettled = market['settle'] == 'USDC'
5665
+ if isUsdcSettled:
5666
+ if marginMode == 'cross':
5667
+ marginMode = 'REGULAR_MARGIN'
5668
+ elif marginMode == 'portfolio':
5669
+ marginMode = 'PORTFOLIO_MARGIN'
5670
+ else:
5671
+ raise NotSupported(self.id + ' setMarginMode() for usdc market marginMode must be either [cross, portfolio]')
5672
+ request = {
5673
+ 'setMarginMode': marginMode,
5674
+ }
5675
+ response = await self.privatePostV5AccountSetMarginMode(self.extend(request, params))
5678
5676
  else:
5679
- raise NotSupported(self.id + ' setMarginMode() with symbol marginMode must be either [isolated, cross]')
5680
- leverage = self.safe_string(params, 'leverage')
5681
- params = self.omit(params, ['leverage'])
5682
- if leverage is None:
5683
- raise ArgumentsRequired(self.id + ' setMarginMode() with symbol requires leverage')
5684
- request = {
5685
- 'category': type,
5686
- 'symbol': market['id'],
5687
- 'tradeMode': tradeMode,
5688
- 'buyLeverage': leverage,
5689
- 'sellLeverage': leverage,
5690
- }
5691
- response = await self.privatePostV5PositionSwitchIsolated(self.extend(request, params))
5677
+ type = None
5678
+ type, params = self.get_bybit_type('setPositionMode', market, params)
5679
+ tradeMode = None
5680
+ if marginMode == 'cross':
5681
+ tradeMode = 0
5682
+ elif marginMode == 'isolated':
5683
+ tradeMode = 1
5684
+ else:
5685
+ raise NotSupported(self.id + ' setMarginMode() with symbol marginMode must be either [isolated, cross]')
5686
+ sellLeverage = None
5687
+ buyLeverage = None
5688
+ leverage = self.safe_string(params, 'leverage')
5689
+ if leverage is None:
5690
+ sellLeverage = self.safe_string_2(params, 'sell_leverage', 'sellLeverage')
5691
+ buyLeverage = self.safe_string_2(params, 'buy_leverage', 'buyLeverage')
5692
+ if sellLeverage is None and buyLeverage is None:
5693
+ raise ArgumentsRequired(self.id + ' setMarginMode() requires a leverage parameter or sell_leverage and buy_leverage parameters')
5694
+ if buyLeverage is None:
5695
+ buyLeverage = sellLeverage
5696
+ if sellLeverage is None:
5697
+ sellLeverage = buyLeverage
5698
+ params = self.omit(params, ['buy_leverage', 'sell_leverage', 'sellLeverage', 'buyLeverage'])
5699
+ else:
5700
+ sellLeverage = leverage
5701
+ buyLeverage = leverage
5702
+ params = self.omit(params, 'leverage')
5703
+ request = {
5704
+ 'category': type,
5705
+ 'symbol': market['id'],
5706
+ 'tradeMode': tradeMode,
5707
+ 'buyLeverage': buyLeverage,
5708
+ 'sellLeverage': sellLeverage,
5709
+ }
5710
+ response = await self.privatePostV5PositionSwitchIsolated(self.extend(request, params))
5692
5711
  return response
5693
5712
 
5694
5713
  async def set_leverage(self, leverage, symbol: Optional[str] = None, params={}):