ccxt 4.4.21__py2.py3-none-any.whl → 4.4.22__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.
Files changed (47) hide show
  1. ccxt/__init__.py +1 -1
  2. ccxt/abstract/bitflyer.py +1 -0
  3. ccxt/abstract/bitget.py +3 -0
  4. ccxt/abstract/cex.py +28 -29
  5. ccxt/abstract/gate.py +5 -0
  6. ccxt/abstract/gateio.py +5 -0
  7. ccxt/abstract/kucoin.py +1 -0
  8. ccxt/abstract/kucoinfutures.py +1 -0
  9. ccxt/abstract/okx.py +1 -0
  10. ccxt/alpaca.py +1 -0
  11. ccxt/async_support/__init__.py +1 -1
  12. ccxt/async_support/alpaca.py +1 -0
  13. ccxt/async_support/base/exchange.py +7 -1
  14. ccxt/async_support/bigone.py +3 -0
  15. ccxt/async_support/binance.py +96 -1
  16. ccxt/async_support/bitflyer.py +56 -1
  17. ccxt/async_support/bitget.py +73 -1
  18. ccxt/async_support/bybit.py +74 -1
  19. ccxt/async_support/cex.py +1247 -1326
  20. ccxt/async_support/cryptocom.py +1 -1
  21. ccxt/async_support/gate.py +97 -2
  22. ccxt/async_support/htx.py +1 -5
  23. ccxt/async_support/hyperliquid.py +10 -8
  24. ccxt/async_support/kucoin.py +27 -57
  25. ccxt/async_support/okx.py +67 -1
  26. ccxt/base/exchange.py +21 -1
  27. ccxt/base/types.py +9 -0
  28. ccxt/bigone.py +3 -0
  29. ccxt/binance.py +96 -1
  30. ccxt/bitflyer.py +56 -1
  31. ccxt/bitget.py +73 -1
  32. ccxt/bybit.py +74 -1
  33. ccxt/cex.py +1246 -1326
  34. ccxt/cryptocom.py +1 -1
  35. ccxt/gate.py +97 -2
  36. ccxt/htx.py +1 -5
  37. ccxt/hyperliquid.py +10 -8
  38. ccxt/kucoin.py +27 -57
  39. ccxt/okx.py +67 -1
  40. ccxt/pro/__init__.py +1 -1
  41. ccxt/test/tests_async.py +4 -4
  42. ccxt/test/tests_sync.py +4 -4
  43. {ccxt-4.4.21.dist-info → ccxt-4.4.22.dist-info}/METADATA +5 -5
  44. {ccxt-4.4.21.dist-info → ccxt-4.4.22.dist-info}/RECORD +47 -47
  45. {ccxt-4.4.21.dist-info → ccxt-4.4.22.dist-info}/LICENSE.txt +0 -0
  46. {ccxt-4.4.21.dist-info → ccxt-4.4.22.dist-info}/WHEEL +0 -0
  47. {ccxt-4.4.21.dist-info → ccxt-4.4.22.dist-info}/top_level.txt +0 -0
ccxt/__init__.py CHANGED
@@ -22,7 +22,7 @@
22
22
 
23
23
  # ----------------------------------------------------------------------------
24
24
 
25
- __version__ = '4.4.21'
25
+ __version__ = '4.4.22'
26
26
 
27
27
  # ----------------------------------------------------------------------------
28
28
 
ccxt/abstract/bitflyer.py CHANGED
@@ -11,6 +11,7 @@ class ImplicitAPI:
11
11
  public_get_gethealth = publicGetGethealth = Entry('gethealth', 'public', 'GET', {})
12
12
  public_get_getboardstate = publicGetGetboardstate = Entry('getboardstate', 'public', 'GET', {})
13
13
  public_get_getchats = publicGetGetchats = Entry('getchats', 'public', 'GET', {})
14
+ public_get_getfundingrate = publicGetGetfundingrate = Entry('getfundingrate', 'public', 'GET', {})
14
15
  private_get_getpermissions = privateGetGetpermissions = Entry('getpermissions', 'private', 'GET', {})
15
16
  private_get_getbalance = privateGetGetbalance = Entry('getbalance', 'private', 'GET', {})
16
17
  private_get_getbalancehistory = privateGetGetbalancehistory = Entry('getbalancehistory', 'private', 'GET', {})
ccxt/abstract/bitget.py CHANGED
@@ -68,12 +68,14 @@ class ImplicitAPI:
68
68
  public_mix_get_v2_mix_market_current_fund_rate = publicMixGetV2MixMarketCurrentFundRate = Entry('v2/mix/market/current-fund-rate', ['public', 'mix'], 'GET', {'cost': 1})
69
69
  public_mix_get_v2_mix_market_contracts = publicMixGetV2MixMarketContracts = Entry('v2/mix/market/contracts', ['public', 'mix'], 'GET', {'cost': 1})
70
70
  public_mix_get_v2_mix_market_query_position_lever = publicMixGetV2MixMarketQueryPositionLever = Entry('v2/mix/market/query-position-lever', ['public', 'mix'], 'GET', {'cost': 2})
71
+ public_mix_get_v2_mix_market_account_long_short = publicMixGetV2MixMarketAccountLongShort = Entry('v2/mix/market/account-long-short', ['public', 'mix'], 'GET', {'cost': 20})
71
72
  public_margin_get_margin_v1_cross_public_interestrateandlimit = publicMarginGetMarginV1CrossPublicInterestRateAndLimit = Entry('margin/v1/cross/public/interestRateAndLimit', ['public', 'margin'], 'GET', {'cost': 2})
72
73
  public_margin_get_margin_v1_isolated_public_interestrateandlimit = publicMarginGetMarginV1IsolatedPublicInterestRateAndLimit = Entry('margin/v1/isolated/public/interestRateAndLimit', ['public', 'margin'], 'GET', {'cost': 2})
73
74
  public_margin_get_margin_v1_cross_public_tierdata = publicMarginGetMarginV1CrossPublicTierData = Entry('margin/v1/cross/public/tierData', ['public', 'margin'], 'GET', {'cost': 2})
74
75
  public_margin_get_margin_v1_isolated_public_tierdata = publicMarginGetMarginV1IsolatedPublicTierData = Entry('margin/v1/isolated/public/tierData', ['public', 'margin'], 'GET', {'cost': 2})
75
76
  public_margin_get_margin_v1_public_currencies = publicMarginGetMarginV1PublicCurrencies = Entry('margin/v1/public/currencies', ['public', 'margin'], 'GET', {'cost': 1})
76
77
  public_margin_get_v2_margin_currencies = publicMarginGetV2MarginCurrencies = Entry('v2/margin/currencies', ['public', 'margin'], 'GET', {'cost': 2})
78
+ public_margin_get_v2_margin_market_long_short_ratio = publicMarginGetV2MarginMarketLongShortRatio = Entry('v2/margin/market/long-short-ratio', ['public', 'margin'], 'GET', {'cost': 20})
77
79
  public_earn_get_v2_earn_loan_public_coininfos = publicEarnGetV2EarnLoanPublicCoinInfos = Entry('v2/earn/loan/public/coinInfos', ['public', 'earn'], 'GET', {'cost': 2})
78
80
  public_earn_get_v2_earn_loan_public_hour_interest = publicEarnGetV2EarnLoanPublicHourInterest = Entry('v2/earn/loan/public/hour-interest', ['public', 'earn'], 'GET', {'cost': 2})
79
81
  private_spot_get_spot_v1_wallet_deposit_address = privateSpotGetSpotV1WalletDepositAddress = Entry('spot/v1/wallet/deposit-address', ['private', 'spot'], 'GET', {'cost': 4})
@@ -220,6 +222,7 @@ class ImplicitAPI:
220
222
  private_mix_get_v2_mix_order_orders_history = privateMixGetV2MixOrderOrdersHistory = Entry('v2/mix/order/orders-history', ['private', 'mix'], 'GET', {'cost': 2})
221
223
  private_mix_get_v2_mix_order_orders_plan_pending = privateMixGetV2MixOrderOrdersPlanPending = Entry('v2/mix/order/orders-plan-pending', ['private', 'mix'], 'GET', {'cost': 2})
222
224
  private_mix_get_v2_mix_order_orders_plan_history = privateMixGetV2MixOrderOrdersPlanHistory = Entry('v2/mix/order/orders-plan-history', ['private', 'mix'], 'GET', {'cost': 2})
225
+ private_mix_get_v2_mix_market_position_long_short = privateMixGetV2MixMarketPositionLongShort = Entry('v2/mix/market/position-long-short', ['private', 'mix'], 'GET', {'cost': 20})
223
226
  private_mix_post_mix_v1_account_sub_account_contract_assets = privateMixPostMixV1AccountSubAccountContractAssets = Entry('mix/v1/account/sub-account-contract-assets', ['private', 'mix'], 'POST', {'cost': 200})
224
227
  private_mix_post_mix_v1_account_open_count = privateMixPostMixV1AccountOpenCount = Entry('mix/v1/account/open-count', ['private', 'mix'], 'POST', {'cost': 1})
225
228
  private_mix_post_mix_v1_account_setleverage = privateMixPostMixV1AccountSetLeverage = Entry('mix/v1/account/setLeverage', ['private', 'mix'], 'POST', {'cost': 4})
ccxt/abstract/cex.py CHANGED
@@ -2,32 +2,31 @@ from ccxt.base.types import Entry
2
2
 
3
3
 
4
4
  class ImplicitAPI:
5
- public_get_currency_profile = publicGetCurrencyProfile = Entry('currency_profile', 'public', 'GET', {})
6
- public_get_currency_limits = publicGetCurrencyLimits = Entry('currency_limits/', 'public', 'GET', {})
7
- public_get_last_price_pair = publicGetLastPricePair = Entry('last_price/{pair}/', 'public', 'GET', {})
8
- public_get_last_prices_currencies = publicGetLastPricesCurrencies = Entry('last_prices/{currencies}/', 'public', 'GET', {})
9
- public_get_ohlcv_hd_yyyymmdd_pair = publicGetOhlcvHdYyyymmddPair = Entry('ohlcv/hd/{yyyymmdd}/{pair}', 'public', 'GET', {})
10
- public_get_order_book_pair = publicGetOrderBookPair = Entry('order_book/{pair}/', 'public', 'GET', {})
11
- public_get_ticker_pair = publicGetTickerPair = Entry('ticker/{pair}/', 'public', 'GET', {})
12
- public_get_tickers_currencies = publicGetTickersCurrencies = Entry('tickers/{currencies}/', 'public', 'GET', {})
13
- public_get_trade_history_pair = publicGetTradeHistoryPair = Entry('trade_history/{pair}/', 'public', 'GET', {})
14
- public_post_convert_pair = publicPostConvertPair = Entry('convert/{pair}', 'public', 'POST', {})
15
- public_post_price_stats_pair = publicPostPriceStatsPair = Entry('price_stats/{pair}', 'public', 'POST', {})
16
- private_post_active_orders_status = privatePostActiveOrdersStatus = Entry('active_orders_status/', 'private', 'POST', {})
17
- private_post_archived_orders_pair = privatePostArchivedOrdersPair = Entry('archived_orders/{pair}/', 'private', 'POST', {})
18
- private_post_balance = privatePostBalance = Entry('balance/', 'private', 'POST', {})
19
- private_post_cancel_order = privatePostCancelOrder = Entry('cancel_order/', 'private', 'POST', {})
20
- private_post_cancel_orders_pair = privatePostCancelOrdersPair = Entry('cancel_orders/{pair}/', 'private', 'POST', {})
21
- private_post_cancel_replace_order_pair = privatePostCancelReplaceOrderPair = Entry('cancel_replace_order/{pair}/', 'private', 'POST', {})
22
- private_post_close_position_pair = privatePostClosePositionPair = Entry('close_position/{pair}/', 'private', 'POST', {})
23
- private_post_get_address = privatePostGetAddress = Entry('get_address/', 'private', 'POST', {})
24
- private_post_get_crypto_address = privatePostGetCryptoAddress = Entry('get_crypto_address', 'private', 'POST', {})
25
- private_post_get_myfee = privatePostGetMyfee = Entry('get_myfee/', 'private', 'POST', {})
26
- private_post_get_order = privatePostGetOrder = Entry('get_order/', 'private', 'POST', {})
27
- private_post_get_order_tx = privatePostGetOrderTx = Entry('get_order_tx/', 'private', 'POST', {})
28
- private_post_open_orders_pair = privatePostOpenOrdersPair = Entry('open_orders/{pair}/', 'private', 'POST', {})
29
- private_post_open_orders = privatePostOpenOrders = Entry('open_orders/', 'private', 'POST', {})
30
- private_post_open_position_pair = privatePostOpenPositionPair = Entry('open_position/{pair}/', 'private', 'POST', {})
31
- private_post_open_positions_pair = privatePostOpenPositionsPair = Entry('open_positions/{pair}/', 'private', 'POST', {})
32
- private_post_place_order_pair = privatePostPlaceOrderPair = Entry('place_order/{pair}/', 'private', 'POST', {})
33
- private_post_raw_tx_history = privatePostRawTxHistory = Entry('raw_tx_history', 'private', 'POST', {})
5
+ public_post_get_server_time = publicPostGetServerTime = Entry('get_server_time', 'public', 'POST', {'cost': 1})
6
+ public_post_get_pairs_info = publicPostGetPairsInfo = Entry('get_pairs_info', 'public', 'POST', {'cost': 1})
7
+ public_post_get_currencies_info = publicPostGetCurrenciesInfo = Entry('get_currencies_info', 'public', 'POST', {'cost': 1})
8
+ public_post_get_processing_info = publicPostGetProcessingInfo = Entry('get_processing_info', 'public', 'POST', {'cost': 10})
9
+ public_post_get_ticker = publicPostGetTicker = Entry('get_ticker', 'public', 'POST', {'cost': 1})
10
+ public_post_get_trade_history = publicPostGetTradeHistory = Entry('get_trade_history', 'public', 'POST', {'cost': 1})
11
+ public_post_get_order_book = publicPostGetOrderBook = Entry('get_order_book', 'public', 'POST', {'cost': 1})
12
+ public_post_get_candles = publicPostGetCandles = Entry('get_candles', 'public', 'POST', {'cost': 1})
13
+ private_post_get_my_current_fee = privatePostGetMyCurrentFee = Entry('get_my_current_fee', 'private', 'POST', {'cost': 5})
14
+ private_post_get_fee_strategy = privatePostGetFeeStrategy = Entry('get_fee_strategy', 'private', 'POST', {'cost': 1})
15
+ private_post_get_my_volume = privatePostGetMyVolume = Entry('get_my_volume', 'private', 'POST', {'cost': 5})
16
+ private_post_do_create_account = privatePostDoCreateAccount = Entry('do_create_account', 'private', 'POST', {'cost': 1})
17
+ private_post_get_my_account_status_v3 = privatePostGetMyAccountStatusV3 = Entry('get_my_account_status_v3', 'private', 'POST', {'cost': 5})
18
+ private_post_get_my_wallet_balance = privatePostGetMyWalletBalance = Entry('get_my_wallet_balance', 'private', 'POST', {'cost': 5})
19
+ private_post_get_my_orders = privatePostGetMyOrders = Entry('get_my_orders', 'private', 'POST', {'cost': 5})
20
+ private_post_do_my_new_order = privatePostDoMyNewOrder = Entry('do_my_new_order', 'private', 'POST', {'cost': 1})
21
+ private_post_do_cancel_my_order = privatePostDoCancelMyOrder = Entry('do_cancel_my_order', 'private', 'POST', {'cost': 1})
22
+ private_post_do_cancel_all_orders = privatePostDoCancelAllOrders = Entry('do_cancel_all_orders', 'private', 'POST', {'cost': 5})
23
+ private_post_get_order_book = privatePostGetOrderBook = Entry('get_order_book', 'private', 'POST', {'cost': 1})
24
+ private_post_get_candles = privatePostGetCandles = Entry('get_candles', 'private', 'POST', {'cost': 1})
25
+ private_post_get_trade_history = privatePostGetTradeHistory = Entry('get_trade_history', 'private', 'POST', {'cost': 1})
26
+ private_post_get_my_transaction_history = privatePostGetMyTransactionHistory = Entry('get_my_transaction_history', 'private', 'POST', {'cost': 1})
27
+ private_post_get_my_funding_history = privatePostGetMyFundingHistory = Entry('get_my_funding_history', 'private', 'POST', {'cost': 5})
28
+ private_post_do_my_internal_transfer = privatePostDoMyInternalTransfer = Entry('do_my_internal_transfer', 'private', 'POST', {'cost': 1})
29
+ private_post_get_processing_info = privatePostGetProcessingInfo = Entry('get_processing_info', 'private', 'POST', {'cost': 10})
30
+ private_post_get_deposit_address = privatePostGetDepositAddress = Entry('get_deposit_address', 'private', 'POST', {'cost': 5})
31
+ private_post_do_deposit_funds_from_wallet = privatePostDoDepositFundsFromWallet = Entry('do_deposit_funds_from_wallet', 'private', 'POST', {'cost': 1})
32
+ private_post_do_withdrawal_funds_to_wallet = privatePostDoWithdrawalFundsToWallet = Entry('do_withdrawal_funds_to_wallet', 'private', 'POST', {'cost': 1})
ccxt/abstract/gate.py CHANGED
@@ -92,8 +92,13 @@ class ImplicitAPI:
92
92
  private_unified_get_interest_records = privateUnifiedGetInterestRecords = Entry('interest_records', ['private', 'unified'], 'GET', {'cost': 1.3333333333333333})
93
93
  private_unified_get_estimate_rate = privateUnifiedGetEstimateRate = Entry('estimate_rate', ['private', 'unified'], 'GET', {'cost': 1.3333333333333333})
94
94
  private_unified_get_currency_discount_tiers = privateUnifiedGetCurrencyDiscountTiers = Entry('currency_discount_tiers', ['private', 'unified'], 'GET', {'cost': 1.3333333333333333})
95
+ private_unified_get_risk_units = privateUnifiedGetRiskUnits = Entry('risk_units', ['private', 'unified'], 'GET', {'cost': 1.3333333333333333})
96
+ private_unified_get_unified_mode = privateUnifiedGetUnifiedMode = Entry('unified_mode', ['private', 'unified'], 'GET', {'cost': 1.3333333333333333})
97
+ private_unified_get_loan_margin_tiers = privateUnifiedGetLoanMarginTiers = Entry('loan_margin_tiers', ['private', 'unified'], 'GET', {'cost': 1.3333333333333333})
95
98
  private_unified_post_account_mode = privateUnifiedPostAccountMode = Entry('account_mode', ['private', 'unified'], 'POST', {'cost': 1.3333333333333333})
96
99
  private_unified_post_loans = privateUnifiedPostLoans = Entry('loans', ['private', 'unified'], 'POST', {'cost': 13.333333333333334})
100
+ private_unified_post_portfolio_calculator = privateUnifiedPostPortfolioCalculator = Entry('portfolio_calculator', ['private', 'unified'], 'POST', {'cost': 1.3333333333333333})
101
+ private_unified_put_unified_mode = privateUnifiedPutUnifiedMode = Entry('unified_mode', ['private', 'unified'], 'PUT', {'cost': 1.3333333333333333})
97
102
  private_spot_get_fee = privateSpotGetFee = Entry('fee', ['private', 'spot'], 'GET', {'cost': 1})
98
103
  private_spot_get_batch_fee = privateSpotGetBatchFee = Entry('batch_fee', ['private', 'spot'], 'GET', {'cost': 1})
99
104
  private_spot_get_accounts = privateSpotGetAccounts = Entry('accounts', ['private', 'spot'], 'GET', {'cost': 1})
ccxt/abstract/gateio.py CHANGED
@@ -92,8 +92,13 @@ class ImplicitAPI:
92
92
  private_unified_get_interest_records = privateUnifiedGetInterestRecords = Entry('interest_records', ['private', 'unified'], 'GET', {'cost': 1.3333333333333333})
93
93
  private_unified_get_estimate_rate = privateUnifiedGetEstimateRate = Entry('estimate_rate', ['private', 'unified'], 'GET', {'cost': 1.3333333333333333})
94
94
  private_unified_get_currency_discount_tiers = privateUnifiedGetCurrencyDiscountTiers = Entry('currency_discount_tiers', ['private', 'unified'], 'GET', {'cost': 1.3333333333333333})
95
+ private_unified_get_risk_units = privateUnifiedGetRiskUnits = Entry('risk_units', ['private', 'unified'], 'GET', {'cost': 1.3333333333333333})
96
+ private_unified_get_unified_mode = privateUnifiedGetUnifiedMode = Entry('unified_mode', ['private', 'unified'], 'GET', {'cost': 1.3333333333333333})
97
+ private_unified_get_loan_margin_tiers = privateUnifiedGetLoanMarginTiers = Entry('loan_margin_tiers', ['private', 'unified'], 'GET', {'cost': 1.3333333333333333})
95
98
  private_unified_post_account_mode = privateUnifiedPostAccountMode = Entry('account_mode', ['private', 'unified'], 'POST', {'cost': 1.3333333333333333})
96
99
  private_unified_post_loans = privateUnifiedPostLoans = Entry('loans', ['private', 'unified'], 'POST', {'cost': 13.333333333333334})
100
+ private_unified_post_portfolio_calculator = privateUnifiedPostPortfolioCalculator = Entry('portfolio_calculator', ['private', 'unified'], 'POST', {'cost': 1.3333333333333333})
101
+ private_unified_put_unified_mode = privateUnifiedPutUnifiedMode = Entry('unified_mode', ['private', 'unified'], 'PUT', {'cost': 1.3333333333333333})
97
102
  private_spot_get_fee = privateSpotGetFee = Entry('fee', ['private', 'spot'], 'GET', {'cost': 1})
98
103
  private_spot_get_batch_fee = privateSpotGetBatchFee = Entry('batch_fee', ['private', 'spot'], 'GET', {'cost': 1})
99
104
  private_spot_get_accounts = privateSpotGetAccounts = Entry('accounts', ['private', 'spot'], 'GET', {'cost': 1})
ccxt/abstract/kucoin.py CHANGED
@@ -124,6 +124,7 @@ class ImplicitAPI:
124
124
  private_post_lend_purchase_update = privatePostLendPurchaseUpdate = Entry('lend/purchase/update', 'private', 'POST', {'cost': 10})
125
125
  private_post_bullet_private = privatePostBulletPrivate = Entry('bullet-private', 'private', 'POST', {'cost': 10})
126
126
  private_post_position_update_user_leverage = privatePostPositionUpdateUserLeverage = Entry('position/update-user-leverage', 'private', 'POST', {'cost': 5})
127
+ private_post_deposit_address_create = privatePostDepositAddressCreate = Entry('deposit-address/create', 'private', 'POST', {'cost': 20})
127
128
  private_delete_sub_api_key = privateDeleteSubApiKey = Entry('sub/api-key', 'private', 'DELETE', {'cost': 45})
128
129
  private_delete_withdrawals_withdrawalid = privateDeleteWithdrawalsWithdrawalId = Entry('withdrawals/{withdrawalId}', 'private', 'DELETE', {'cost': 30})
129
130
  private_delete_hf_orders_orderid = privateDeleteHfOrdersOrderId = Entry('hf/orders/{orderId}', 'private', 'DELETE', {'cost': 1})
@@ -124,6 +124,7 @@ class ImplicitAPI:
124
124
  private_post_lend_purchase_update = privatePostLendPurchaseUpdate = Entry('lend/purchase/update', 'private', 'POST', {'cost': 10})
125
125
  private_post_bullet_private = privatePostBulletPrivate = Entry('bullet-private', 'private', 'POST', {'cost': 10})
126
126
  private_post_position_update_user_leverage = privatePostPositionUpdateUserLeverage = Entry('position/update-user-leverage', 'private', 'POST', {'cost': 5})
127
+ private_post_deposit_address_create = privatePostDepositAddressCreate = Entry('deposit-address/create', 'private', 'POST', {'cost': 20})
127
128
  private_delete_sub_api_key = privateDeleteSubApiKey = Entry('sub/api-key', 'private', 'DELETE', {'cost': 45})
128
129
  private_delete_withdrawals_withdrawalid = privateDeleteWithdrawalsWithdrawalId = Entry('withdrawals/{withdrawalId}', 'private', 'DELETE', {'cost': 30})
129
130
  private_delete_hf_orders_orderid = privateDeleteHfOrdersOrderId = Entry('hf/orders/{orderId}', 'private', 'DELETE', {'cost': 1})
ccxt/abstract/okx.py CHANGED
@@ -48,6 +48,7 @@ class ImplicitAPI:
48
48
  public_get_rubik_stat_taker_volume = publicGetRubikStatTakerVolume = Entry('rubik/stat/taker-volume', 'public', 'GET', {'cost': 4})
49
49
  public_get_rubik_stat_margin_loan_ratio = publicGetRubikStatMarginLoanRatio = Entry('rubik/stat/margin/loan-ratio', 'public', 'GET', {'cost': 4})
50
50
  public_get_rubik_stat_contracts_long_short_account_ratio = publicGetRubikStatContractsLongShortAccountRatio = Entry('rubik/stat/contracts/long-short-account-ratio', 'public', 'GET', {'cost': 4})
51
+ public_get_rubik_stat_contracts_long_short_account_ratio_contract = publicGetRubikStatContractsLongShortAccountRatioContract = Entry('rubik/stat/contracts/long-short-account-ratio-contract', 'public', 'GET', {'cost': 4})
51
52
  public_get_rubik_stat_contracts_open_interest_volume = publicGetRubikStatContractsOpenInterestVolume = Entry('rubik/stat/contracts/open-interest-volume', 'public', 'GET', {'cost': 4})
52
53
  public_get_rubik_stat_option_open_interest_volume = publicGetRubikStatOptionOpenInterestVolume = Entry('rubik/stat/option/open-interest-volume', 'public', 'GET', {'cost': 4})
53
54
  public_get_rubik_stat_option_open_interest_volume_ratio = publicGetRubikStatOptionOpenInterestVolumeRatio = Entry('rubik/stat/option/open-interest-volume-ratio', 'public', 'GET', {'cost': 4})
ccxt/alpaca.py CHANGED
@@ -69,6 +69,7 @@ class alpaca(Exchange, ImplicitAPI):
69
69
  'fetchDepositsWithdrawals': False,
70
70
  'fetchFundingHistory': False,
71
71
  'fetchFundingRate': False,
72
+ 'fetchFundingRateHistory': False,
72
73
  'fetchFundingRates': False,
73
74
  'fetchL1OrderBook': True,
74
75
  'fetchL2OrderBook': False,
@@ -4,7 +4,7 @@
4
4
 
5
5
  # -----------------------------------------------------------------------------
6
6
 
7
- __version__ = '4.4.21'
7
+ __version__ = '4.4.22'
8
8
 
9
9
  # -----------------------------------------------------------------------------
10
10
 
@@ -69,6 +69,7 @@ class alpaca(Exchange, ImplicitAPI):
69
69
  'fetchDepositsWithdrawals': False,
70
70
  'fetchFundingHistory': False,
71
71
  'fetchFundingRate': False,
72
+ 'fetchFundingRateHistory': False,
72
73
  'fetchFundingRates': False,
73
74
  'fetchL1OrderBook': True,
74
75
  'fetchL2OrderBook': False,
@@ -2,7 +2,7 @@
2
2
 
3
3
  # -----------------------------------------------------------------------------
4
4
 
5
- __version__ = '4.4.21'
5
+ __version__ = '4.4.22'
6
6
 
7
7
  # -----------------------------------------------------------------------------
8
8
 
@@ -707,6 +707,12 @@ class Exchange(BaseExchange):
707
707
  async def set_margin(self, symbol: str, amount: float, params={}):
708
708
  raise NotSupported(self.id + ' setMargin() is not supported yet')
709
709
 
710
+ async def fetch_long_short_ratio(self, symbol: str, timeframe: Str = None, params={}):
711
+ raise NotSupported(self.id + ' fetchLongShortRatio() is not supported yet')
712
+
713
+ async def fetch_long_short_ratio_history(self, symbol: Str = None, timeframe: Str = None, since: Int = None, limit: Int = None, params={}):
714
+ raise NotSupported(self.id + ' fetchLongShortRatioHistory() is not supported yet')
715
+
710
716
  async def fetch_margin_adjustment_history(self, symbol: Str = None, type: Str = None, since: Num = None, limit: Num = None, params={}):
711
717
  """
712
718
  fetches the history of margin added or reduced from contract isolated positions
@@ -55,7 +55,10 @@ class bigone(Exchange, ImplicitAPI):
55
55
  'fetchDepositAddresses': False,
56
56
  'fetchDepositAddressesByNetwork': False,
57
57
  'fetchDeposits': True,
58
+ 'fetchFundingHistory': False,
58
59
  'fetchFundingRate': False,
60
+ 'fetchFundingRateHistory': False,
61
+ 'fetchFundingRates': False,
59
62
  'fetchMarkets': True,
60
63
  'fetchMyTrades': True,
61
64
  'fetchOHLCV': True,
@@ -8,7 +8,7 @@ from ccxt.abstract.binance import ImplicitAPI
8
8
  import asyncio
9
9
  import hashlib
10
10
  import json
11
- from ccxt.base.types import Balances, Conversion, CrossBorrowRate, Currencies, Currency, DepositAddress, Greeks, Int, IsolatedBorrowRate, IsolatedBorrowRates, LedgerEntry, Leverage, Leverages, LeverageTier, LeverageTiers, MarginMode, MarginModes, MarginModification, Market, MarketInterface, Num, Option, Order, OrderBook, OrderRequest, OrderSide, OrderType, Str, Strings, Ticker, Tickers, FundingRate, FundingRates, Trade, TradingFeeInterface, TradingFees, Transaction, TransferEntry
11
+ from ccxt.base.types import LongShortRatio, Balances, Conversion, CrossBorrowRate, Currencies, Currency, DepositAddress, Greeks, Int, IsolatedBorrowRate, IsolatedBorrowRates, LedgerEntry, Leverage, Leverages, LeverageTier, LeverageTiers, MarginMode, MarginModes, MarginModification, Market, MarketInterface, Num, Option, Order, OrderBook, OrderRequest, OrderSide, OrderType, Str, Strings, Ticker, Tickers, FundingRate, FundingRates, Trade, TradingFeeInterface, TradingFees, Transaction, TransferEntry
12
12
  from typing import List
13
13
  from ccxt.base.errors import ExchangeError
14
14
  from ccxt.base.errors import AuthenticationError
@@ -129,6 +129,8 @@ class binance(Exchange, ImplicitAPI):
129
129
  'fetchLeverages': True,
130
130
  'fetchLeverageTiers': True,
131
131
  'fetchLiquidations': False,
132
+ 'fetchLongShortRatio': False,
133
+ 'fetchLongShortRatioHistory': True,
132
134
  'fetchMarginAdjustmentHistory': True,
133
135
  'fetchMarginMode': 'emulated',
134
136
  'fetchMarginModes': True,
@@ -12701,3 +12703,96 @@ class binance(Exchange, ImplicitAPI):
12701
12703
  #
12702
12704
  result = self.parse_funding_rates(response, market)
12703
12705
  return self.filter_by_array(result, 'symbol', symbols)
12706
+
12707
+ async def fetch_long_short_ratio_history(self, symbol: Str = None, timeframe: Str = None, since: Int = None, limit: Int = None, params={}) -> List[LongShortRatio]:
12708
+ """
12709
+ fetches the long short ratio history for a unified market symbol
12710
+ :see: https://developers.binance.com/docs/derivatives/usds-margined-futures/market-data/rest-api/Long-Short-Ratio
12711
+ :see: https://developers.binance.com/docs/derivatives/coin-margined-futures/market-data/Long-Short-Ratio
12712
+ :param str symbol: unified symbol of the market to fetch the long short ratio for
12713
+ :param str [timeframe]: the period for the ratio, default is 24 hours
12714
+ :param int [since]: the earliest time in ms to fetch ratios for
12715
+ :param int [limit]: the maximum number of long short ratio structures to retrieve
12716
+ :param dict [params]: extra parameters specific to the exchange API endpoint
12717
+ :param int [params.until]: timestamp in ms of the latest ratio to fetch
12718
+ :returns dict[]: an array of `long short ratio structures <https://docs.ccxt.com/#/?id=long-short-ratio-structure>`
12719
+ """
12720
+ await self.load_markets()
12721
+ market = self.market(symbol)
12722
+ if timeframe is None:
12723
+ timeframe = '1d'
12724
+ request: dict = {
12725
+ 'period': timeframe,
12726
+ }
12727
+ request, params = self.handle_until_option('endTime', request, params)
12728
+ if since is not None:
12729
+ request['startTime'] = since
12730
+ if limit is not None:
12731
+ request['limit'] = limit
12732
+ subType = None
12733
+ subType, params = self.handle_sub_type_and_params('fetchLongShortRatioHistory', market, params)
12734
+ response = None
12735
+ if subType == 'linear':
12736
+ request['symbol'] = market['id']
12737
+ response = await self.fapiDataGetGlobalLongShortAccountRatio(self.extend(request, params))
12738
+ #
12739
+ # [
12740
+ # {
12741
+ # "symbol": "BTCUSDT",
12742
+ # "longAccount": "0.4558",
12743
+ # "longShortRatio": "0.8376",
12744
+ # "shortAccount": "0.5442",
12745
+ # "timestamp": 1726790400000
12746
+ # },
12747
+ # ]
12748
+ #
12749
+ elif subType == 'inverse':
12750
+ request['pair'] = market['info']['pair']
12751
+ response = await self.dapiDataGetGlobalLongShortAccountRatio(self.extend(request, params))
12752
+ #
12753
+ # [
12754
+ # {
12755
+ # "longAccount": "0.7262",
12756
+ # "longShortRatio": "2.6523",
12757
+ # "shortAccount": "0.2738",
12758
+ # "pair": "BTCUSD",
12759
+ # "timestamp": 1726790400000
12760
+ # },
12761
+ # ]
12762
+ #
12763
+ else:
12764
+ raise BadRequest(self.id + ' fetchLongShortRatioHistory() supports linear and inverse subTypes only')
12765
+ return self.parse_long_short_ratio_history(response, market)
12766
+
12767
+ def parse_long_short_ratio(self, info: dict, market: Market = None) -> LongShortRatio:
12768
+ #
12769
+ # linear
12770
+ #
12771
+ # {
12772
+ # "symbol": "BTCUSDT",
12773
+ # "longAccount": "0.4558",
12774
+ # "longShortRatio": "0.8376",
12775
+ # "shortAccount": "0.5442",
12776
+ # "timestamp": 1726790400000
12777
+ # }
12778
+ #
12779
+ # inverse
12780
+ #
12781
+ # {
12782
+ # "longAccount": "0.7262",
12783
+ # "longShortRatio": "2.6523",
12784
+ # "shortAccount": "0.2738",
12785
+ # "pair": "BTCUSD",
12786
+ # "timestamp": 1726790400000
12787
+ # }
12788
+ #
12789
+ marketId = self.safe_string(info, 'symbol')
12790
+ timestamp = self.safe_integer_omit_zero(info, 'timestamp')
12791
+ return {
12792
+ 'info': info,
12793
+ 'symbol': self.safe_symbol(marketId, market, None, 'contract'),
12794
+ 'timestamp': timestamp,
12795
+ 'datetime': self.iso8601(timestamp),
12796
+ 'timeframe': None,
12797
+ 'longShortRatio': self.safe_number(info, 'longShortRatio'),
12798
+ }
@@ -6,7 +6,7 @@
6
6
  from ccxt.async_support.base.exchange import Exchange
7
7
  from ccxt.abstract.bitflyer import ImplicitAPI
8
8
  import hashlib
9
- from ccxt.base.types import Balances, Currency, Int, Market, MarketInterface, Num, Order, OrderBook, OrderSide, OrderType, Str, Strings, Ticker, Trade, TradingFeeInterface, Transaction
9
+ from ccxt.base.types import Balances, Currency, Int, Market, MarketInterface, Num, Order, OrderBook, OrderSide, OrderType, Str, Strings, Ticker, FundingRate, Trade, TradingFeeInterface, Transaction
10
10
  from typing import List
11
11
  from ccxt.base.errors import ExchangeError
12
12
  from ccxt.base.errors import ArgumentsRequired
@@ -39,6 +39,8 @@ class bitflyer(Exchange, ImplicitAPI):
39
39
  'fetchBalance': True,
40
40
  'fetchClosedOrders': 'emulated',
41
41
  'fetchDeposits': True,
42
+ 'fetchFundingRate': True,
43
+ 'fetchFundingRateHistory': False,
42
44
  'fetchMarginMode': False,
43
45
  'fetchMarkets': True,
44
46
  'fetchMyTrades': True,
@@ -78,6 +80,7 @@ class bitflyer(Exchange, ImplicitAPI):
78
80
  'gethealth',
79
81
  'getboardstate',
80
82
  'getchats',
83
+ 'getfundingrate',
81
84
  ],
82
85
  },
83
86
  'private': {
@@ -963,6 +966,58 @@ class bitflyer(Exchange, ImplicitAPI):
963
966
  'fee': fee,
964
967
  }
965
968
 
969
+ async def fetch_funding_rate(self, symbol: str, params={}) -> FundingRate:
970
+ """
971
+ fetch the current funding rate
972
+ :see: https://lightning.bitflyer.com/docs#funding-rate
973
+ :param str symbol: unified market symbol
974
+ :param dict [params]: extra parameters specific to the exchange API endpoint
975
+ :returns dict: a `funding rate structure <https://docs.ccxt.com/#/?id=funding-rate-structure>`
976
+ """
977
+ await self.load_markets()
978
+ market = self.market(symbol)
979
+ request: dict = {
980
+ 'product_code': market['id'],
981
+ }
982
+ response = await self.publicGetGetfundingrate(self.extend(request, params))
983
+ #
984
+ # {
985
+ # "current_funding_rate": -0.003750000000
986
+ # "next_funding_rate_settledate": "2024-04-15T13:00:00"
987
+ # }
988
+ #
989
+ return self.parse_funding_rate(response, market)
990
+
991
+ def parse_funding_rate(self, contract, market: Market = None) -> FundingRate:
992
+ #
993
+ # {
994
+ # "current_funding_rate": -0.003750000000
995
+ # "next_funding_rate_settledate": "2024-04-15T13:00:00"
996
+ # }
997
+ #
998
+ nextFundingDatetime = self.safe_string(contract, 'next_funding_rate_settledate')
999
+ nextFundingTimestamp = self.parse8601(nextFundingDatetime)
1000
+ return {
1001
+ 'info': contract,
1002
+ 'symbol': self.safe_string(market, 'symbol'),
1003
+ 'markPrice': None,
1004
+ 'indexPrice': None,
1005
+ 'interestRate': None,
1006
+ 'estimatedSettlePrice': None,
1007
+ 'timestamp': None,
1008
+ 'datetime': None,
1009
+ 'fundingRate': None,
1010
+ 'fundingTimestamp': None,
1011
+ 'fundingDatetime': None,
1012
+ 'nextFundingRate': self.safe_number(contract, 'current_funding_rate'),
1013
+ 'nextFundingTimestamp': nextFundingTimestamp,
1014
+ 'nextFundingDatetime': self.iso8601(nextFundingTimestamp),
1015
+ 'previousFundingRate': None,
1016
+ 'previousFundingTimestamp': None,
1017
+ 'previousFundingDatetime': None,
1018
+ 'interval': None,
1019
+ }
1020
+
966
1021
  def sign(self, path, api='public', method='GET', params={}, headers=None, body=None):
967
1022
  request = '/' + self.version + '/'
968
1023
  if api == 'private':
@@ -8,7 +8,7 @@ from ccxt.abstract.bitget import ImplicitAPI
8
8
  import asyncio
9
9
  import hashlib
10
10
  import json
11
- from ccxt.base.types import Balances, Conversion, CrossBorrowRate, Currencies, Currency, DepositAddress, FundingHistory, Int, IsolatedBorrowRate, LedgerEntry, Leverage, LeverageTier, Liquidation, MarginMode, MarginModification, Market, Num, Order, OrderBook, OrderRequest, OrderSide, OrderType, Position, Str, Strings, Ticker, Tickers, FundingRate, Trade, TradingFeeInterface, TradingFees, Transaction, TransferEntry
11
+ from ccxt.base.types import LongShortRatio, Balances, Conversion, CrossBorrowRate, Currencies, Currency, DepositAddress, FundingHistory, Int, IsolatedBorrowRate, LedgerEntry, Leverage, LeverageTier, Liquidation, MarginMode, MarginModification, Market, Num, Order, OrderBook, OrderRequest, OrderSide, OrderType, Position, Str, Strings, Ticker, Tickers, FundingRate, Trade, TradingFeeInterface, TradingFees, Transaction, TransferEntry
12
12
  from typing import List
13
13
  from ccxt.base.errors import ExchangeError
14
14
  from ccxt.base.errors import AuthenticationError
@@ -114,6 +114,8 @@ class bitget(Exchange, ImplicitAPI):
114
114
  'fetchLeverage': True,
115
115
  'fetchLeverageTiers': False,
116
116
  'fetchLiquidations': False,
117
+ 'fetchLongShortRatio': False,
118
+ 'fetchLongShortRatioHistory': True,
117
119
  'fetchMarginAdjustmentHistory': False,
118
120
  'fetchMarginMode': True,
119
121
  'fetchMarketLeverageTiers': True,
@@ -289,6 +291,7 @@ class bitget(Exchange, ImplicitAPI):
289
291
  'v2/mix/market/current-fund-rate': 1,
290
292
  'v2/mix/market/contracts': 1,
291
293
  'v2/mix/market/query-position-lever': 2,
294
+ 'v2/mix/market/account-long-short': 20,
292
295
  },
293
296
  },
294
297
  'margin': {
@@ -299,6 +302,7 @@ class bitget(Exchange, ImplicitAPI):
299
302
  'margin/v1/isolated/public/tierData': 2, # 10 times/1s(IP) => 20/10 = 2
300
303
  'margin/v1/public/currencies': 1, # 20 times/1s(IP) => 20/20 = 1
301
304
  'v2/margin/currencies': 2,
305
+ 'v2/margin/market/long-short-ratio': 20,
302
306
  },
303
307
  },
304
308
  'earn': {
@@ -461,6 +465,7 @@ class bitget(Exchange, ImplicitAPI):
461
465
  'v2/mix/order/orders-history': 2,
462
466
  'v2/mix/order/orders-plan-pending': 2,
463
467
  'v2/mix/order/orders-plan-history': 2,
468
+ 'v2/mix/market/position-long-short': 20,
464
469
  },
465
470
  'post': {
466
471
  'mix/v1/account/sub-account-contract-assets': 200, # 0.1 times/1s(UID) => 20/0.1 = 200
@@ -8273,6 +8278,73 @@ class bitget(Exchange, ImplicitAPI):
8273
8278
  first = self.safe_dict(data, 0, {})
8274
8279
  return self.parse_funding_rate(first, market)
8275
8280
 
8281
+ async def fetch_long_short_ratio_history(self, symbol: Str = None, timeframe: Str = None, since: Int = None, limit: Int = None, params={}) -> List[LongShortRatio]:
8282
+ """
8283
+ fetches the long short ratio history for a unified market symbol
8284
+ :see: https://www.bitget.com/api-doc/common/apidata/Margin-Ls-Ratio
8285
+ :see: https://www.bitget.com/api-doc/common/apidata/Account-Long-Short
8286
+ :param str symbol: unified symbol of the market to fetch the long short ratio for
8287
+ :param str [timeframe]: the period for the ratio
8288
+ :param int [since]: the earliest time in ms to fetch ratios for
8289
+ :param int [limit]: the maximum number of long short ratio structures to retrieve
8290
+ :param dict [params]: extra parameters specific to the exchange API endpoint
8291
+ :returns dict[]: an array of `long short ratio structures <https://docs.ccxt.com/#/?id=long-short-ratio-structure>`
8292
+ """
8293
+ await self.load_markets()
8294
+ market = self.market(symbol)
8295
+ request: dict = {
8296
+ 'symbol': market['id'],
8297
+ }
8298
+ if timeframe is not None:
8299
+ request['period'] = timeframe
8300
+ response = None
8301
+ if market['swap'] or market['future']:
8302
+ response = await self.publicMixGetV2MixMarketAccountLongShort(self.extend(request, params))
8303
+ #
8304
+ # {
8305
+ # "code": "00000",
8306
+ # "msg": "success",
8307
+ # "requestTime": 1729321233281,
8308
+ # "data": [
8309
+ # {
8310
+ # "longAccountRatio": "0.58",
8311
+ # "shortAccountRatio": "0.42",
8312
+ # "longShortAccountRatio": "0.0138",
8313
+ # "ts": "1729312200000"
8314
+ # },
8315
+ # ]
8316
+ # }
8317
+ #
8318
+ else:
8319
+ response = await self.publicMarginGetV2MarginMarketLongShortRatio(self.extend(request, params))
8320
+ #
8321
+ # {
8322
+ # "code": "00000",
8323
+ # "msg": "success",
8324
+ # "requestTime": 1729306974712,
8325
+ # "data": [
8326
+ # {
8327
+ # "longShortRatio": "40.66",
8328
+ # "ts": "1729306800000"
8329
+ # },
8330
+ # ]
8331
+ # }
8332
+ #
8333
+ data = self.safe_list(response, 'data', [])
8334
+ return self.parse_long_short_ratio_history(data, market)
8335
+
8336
+ def parse_long_short_ratio(self, info: dict, market: Market = None) -> LongShortRatio:
8337
+ marketId = self.safe_string(info, 'symbol')
8338
+ timestamp = self.safe_integer_omit_zero(info, 'ts')
8339
+ return {
8340
+ 'info': info,
8341
+ 'symbol': self.safe_symbol(marketId, market, None, 'contract'),
8342
+ 'timestamp': timestamp,
8343
+ 'datetime': self.iso8601(timestamp),
8344
+ 'timeframe': None,
8345
+ 'longShortRatio': self.safe_number_2(info, 'longShortRatio', 'longShortAccountRatio'),
8346
+ }
8347
+
8276
8348
  def handle_errors(self, code: int, reason: str, url: str, method: str, headers: dict, body: str, response, requestHeaders, requestBody):
8277
8349
  if not response:
8278
8350
  return None # fallback to default error handler