ccxt 4.2.69__py2.py3-none-any.whl → 4.2.71__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.
Potentially problematic release.
This version of ccxt might be problematic. Click here for more details.
- ccxt/__init__.py +1 -1
- ccxt/abstract/coinbase.py +2 -0
- ccxt/ascendex.py +1 -1
- ccxt/async_support/__init__.py +1 -1
- ccxt/async_support/ascendex.py +1 -1
- ccxt/async_support/base/exchange.py +1 -1
- ccxt/async_support/bigone.py +1 -1
- ccxt/async_support/binance.py +1 -1
- ccxt/async_support/bingx.py +1 -1
- ccxt/async_support/bitfinex.py +1 -1
- ccxt/async_support/bitfinex2.py +1 -1
- ccxt/async_support/bitget.py +13 -7
- ccxt/async_support/bitmart.py +1 -1
- ccxt/async_support/bitmex.py +1 -1
- ccxt/async_support/bitrue.py +1 -1
- ccxt/async_support/bitstamp.py +1 -1
- ccxt/async_support/bl3p.py +1 -1
- ccxt/async_support/blofin.py +1 -1
- ccxt/async_support/btcalpha.py +1 -1
- ccxt/async_support/bybit.py +1 -1
- ccxt/async_support/coinbase.py +104 -89
- ccxt/async_support/coinex.py +1 -1
- ccxt/async_support/coinlist.py +1 -1
- ccxt/async_support/coinmetro.py +1 -1
- ccxt/async_support/deribit.py +1 -1
- ccxt/async_support/digifinex.py +3 -2
- ccxt/async_support/gate.py +163 -2
- ccxt/async_support/hitbtc.py +1 -1
- ccxt/async_support/htx.py +1 -1
- ccxt/async_support/hyperliquid.py +2 -2
- ccxt/async_support/kraken.py +2 -1
- ccxt/async_support/krakenfutures.py +1 -1
- ccxt/async_support/kucoin.py +1 -1
- ccxt/async_support/kucoinfutures.py +1 -1
- ccxt/async_support/latoken.py +1 -1
- ccxt/async_support/lykke.py +1 -1
- ccxt/async_support/mexc.py +10 -1
- ccxt/async_support/ndax.py +1 -1
- ccxt/async_support/novadax.py +1 -1
- ccxt/async_support/okcoin.py +1 -1
- ccxt/async_support/okx.py +1 -1
- ccxt/async_support/paymium.py +1 -1
- ccxt/async_support/phemex.py +1 -1
- ccxt/async_support/poloniex.py +1 -1
- ccxt/async_support/wazirx.py +1 -1
- ccxt/async_support/whitebit.py +1 -1
- ccxt/async_support/woo.py +1 -1
- ccxt/async_support/zonda.py +1 -1
- ccxt/base/exchange.py +1 -1
- ccxt/bigone.py +1 -1
- ccxt/binance.py +1 -1
- ccxt/bingx.py +1 -1
- ccxt/bitfinex.py +1 -1
- ccxt/bitfinex2.py +1 -1
- ccxt/bitget.py +13 -7
- ccxt/bitmart.py +1 -1
- ccxt/bitmex.py +1 -1
- ccxt/bitrue.py +1 -1
- ccxt/bitstamp.py +1 -1
- ccxt/bl3p.py +1 -1
- ccxt/blofin.py +1 -1
- ccxt/btcalpha.py +1 -1
- ccxt/bybit.py +1 -1
- ccxt/coinbase.py +104 -89
- ccxt/coinex.py +1 -1
- ccxt/coinlist.py +1 -1
- ccxt/coinmetro.py +1 -1
- ccxt/deribit.py +1 -1
- ccxt/digifinex.py +3 -2
- ccxt/gate.py +163 -2
- ccxt/hitbtc.py +1 -1
- ccxt/htx.py +1 -1
- ccxt/hyperliquid.py +2 -2
- ccxt/kraken.py +2 -1
- ccxt/krakenfutures.py +1 -1
- ccxt/kucoin.py +1 -1
- ccxt/kucoinfutures.py +1 -1
- ccxt/latoken.py +1 -1
- ccxt/lykke.py +1 -1
- ccxt/mexc.py +10 -1
- ccxt/ndax.py +1 -1
- ccxt/novadax.py +1 -1
- ccxt/okcoin.py +1 -1
- ccxt/okx.py +1 -1
- ccxt/paymium.py +1 -1
- ccxt/phemex.py +1 -1
- ccxt/poloniex.py +1 -1
- ccxt/pro/__init__.py +3 -1
- ccxt/pro/hyperliquid.py +524 -0
- ccxt/pro/luno.py +1 -1
- ccxt/test/base/test_balance.py +3 -0
- ccxt/test/base/test_market.py +1 -1
- ccxt/test/base/test_order_book.py +1 -0
- ccxt/test/base/test_shared_methods.py +12 -2
- ccxt/test/base/test_trade.py +1 -1
- ccxt/test/test_async.py +78 -39
- ccxt/test/test_sync.py +78 -39
- ccxt/wazirx.py +1 -1
- ccxt/whitebit.py +1 -1
- ccxt/woo.py +1 -1
- ccxt/zonda.py +1 -1
- {ccxt-4.2.69.dist-info → ccxt-4.2.71.dist-info}/METADATA +5 -5
- {ccxt-4.2.69.dist-info → ccxt-4.2.71.dist-info}/RECORD +105 -104
- {ccxt-4.2.69.dist-info → ccxt-4.2.71.dist-info}/WHEEL +0 -0
- {ccxt-4.2.69.dist-info → ccxt-4.2.71.dist-info}/top_level.txt +0 -0
ccxt/async_support/gate.py
CHANGED
@@ -7,7 +7,7 @@ from ccxt.async_support.base.exchange import Exchange
|
|
7
7
|
from ccxt.abstract.gate import ImplicitAPI
|
8
8
|
import asyncio
|
9
9
|
import hashlib
|
10
|
-
from ccxt.base.types import Balances, Currency, Greeks, Int, Market, Order,
|
10
|
+
from ccxt.base.types import Balances, Currency, FundingHistory, Greeks, Int, Leverage, Leverages, Market, Order, OrderBook, OrderRequest, OrderSide, OrderType, Str, Strings, Ticker, Tickers, Trade, Transaction, TransferEntry
|
11
11
|
from typing import List
|
12
12
|
from ccxt.base.errors import ExchangeError
|
13
13
|
from ccxt.base.errors import PermissionDenied
|
@@ -134,7 +134,8 @@ class gate(Exchange, ImplicitAPI):
|
|
134
134
|
'fetchIsolatedBorrowRate': False,
|
135
135
|
'fetchIsolatedBorrowRates': False,
|
136
136
|
'fetchLedger': True,
|
137
|
-
'fetchLeverage':
|
137
|
+
'fetchLeverage': True,
|
138
|
+
'fetchLeverages': True,
|
138
139
|
'fetchLeverageTiers': True,
|
139
140
|
'fetchLiquidations': True,
|
140
141
|
'fetchMarginMode': False,
|
@@ -6517,6 +6518,166 @@ class gate(Exchange, ImplicitAPI):
|
|
6517
6518
|
side = '' # side is not used but needs to be present, otherwise crashes in php
|
6518
6519
|
return await self.create_order(symbol, 'market', side, 0, None, params)
|
6519
6520
|
|
6521
|
+
async def fetch_leverage(self, symbol: str, params={}) -> Leverage:
|
6522
|
+
"""
|
6523
|
+
fetch the set leverage for a market
|
6524
|
+
:see: https://www.gate.io/docs/developers/apiv4/en/#get-unified-account-information
|
6525
|
+
:see: https://www.gate.io/docs/developers/apiv4/en/#get-detail-of-lending-market
|
6526
|
+
:see: https://www.gate.io/docs/developers/apiv4/en/#query-one-single-margin-currency-pair-deprecated
|
6527
|
+
:param str symbol: unified market symbol
|
6528
|
+
:param dict [params]: extra parameters specific to the exchange API endpoint
|
6529
|
+
:param boolean [params.unified]: default False, set to True for fetching the unified accounts leverage
|
6530
|
+
:returns dict: a `leverage structure <https://docs.ccxt.com/#/?id=leverage-structure>`
|
6531
|
+
"""
|
6532
|
+
await self.load_markets()
|
6533
|
+
market = None
|
6534
|
+
if symbol is not None:
|
6535
|
+
# unified account does not require a symbol
|
6536
|
+
market = self.market(symbol)
|
6537
|
+
request = {}
|
6538
|
+
response = None
|
6539
|
+
isUnified = self.safe_bool(params, 'unified')
|
6540
|
+
params = self.omit(params, 'unified')
|
6541
|
+
if market['spot']:
|
6542
|
+
request['currency_pair'] = market['id']
|
6543
|
+
if isUnified:
|
6544
|
+
response = await self.publicMarginGetUniCurrencyPairsCurrencyPair(self.extend(request, params))
|
6545
|
+
#
|
6546
|
+
# {
|
6547
|
+
# "currency_pair": "BTC_USDT",
|
6548
|
+
# "base_min_borrow_amount": "0.0001",
|
6549
|
+
# "quote_min_borrow_amount": "1",
|
6550
|
+
# "leverage": "10"
|
6551
|
+
# }
|
6552
|
+
#
|
6553
|
+
else:
|
6554
|
+
response = await self.publicMarginGetCurrencyPairsCurrencyPair(self.extend(request, params))
|
6555
|
+
#
|
6556
|
+
# {
|
6557
|
+
# "id": "BTC_USDT",
|
6558
|
+
# "base": "BTC",
|
6559
|
+
# "quote": "USDT",
|
6560
|
+
# "leverage": 10,
|
6561
|
+
# "min_base_amount": "0.0001",
|
6562
|
+
# "min_quote_amount": "1",
|
6563
|
+
# "max_quote_amount": "40000000",
|
6564
|
+
# "status": 1
|
6565
|
+
# }
|
6566
|
+
#
|
6567
|
+
elif isUnified:
|
6568
|
+
response = await self.privateUnifiedGetAccounts(self.extend(request, params))
|
6569
|
+
#
|
6570
|
+
# {
|
6571
|
+
# "user_id": 10001,
|
6572
|
+
# "locked": False,
|
6573
|
+
# "balances": {
|
6574
|
+
# "ETH": {
|
6575
|
+
# "available": "0",
|
6576
|
+
# "freeze": "0",
|
6577
|
+
# "borrowed": "0.075393666654",
|
6578
|
+
# "negative_liab": "0",
|
6579
|
+
# "futures_pos_liab": "0",
|
6580
|
+
# "equity": "1016.1",
|
6581
|
+
# "total_freeze": "0",
|
6582
|
+
# "total_liab": "0"
|
6583
|
+
# },
|
6584
|
+
# "POINT": {
|
6585
|
+
# "available": "9999999999.017023138734",
|
6586
|
+
# "freeze": "0",
|
6587
|
+
# "borrowed": "0",
|
6588
|
+
# "negative_liab": "0",
|
6589
|
+
# "futures_pos_liab": "0",
|
6590
|
+
# "equity": "12016.1",
|
6591
|
+
# "total_freeze": "0",
|
6592
|
+
# "total_liab": "0"
|
6593
|
+
# },
|
6594
|
+
# "USDT": {
|
6595
|
+
# "available": "0.00000062023",
|
6596
|
+
# "freeze": "0",
|
6597
|
+
# "borrowed": "0",
|
6598
|
+
# "negative_liab": "0",
|
6599
|
+
# "futures_pos_liab": "0",
|
6600
|
+
# "equity": "16.1",
|
6601
|
+
# "total_freeze": "0",
|
6602
|
+
# "total_liab": "0"
|
6603
|
+
# }
|
6604
|
+
# },
|
6605
|
+
# "total": "230.94621713",
|
6606
|
+
# "borrowed": "161.66395521",
|
6607
|
+
# "total_initial_margin": "1025.0524665088",
|
6608
|
+
# "total_margin_balance": "3382495.944473949183",
|
6609
|
+
# "total_maintenance_margin": "205.01049330176",
|
6610
|
+
# "total_initial_margin_rate": "3299.827135672679",
|
6611
|
+
# "total_maintenance_margin_rate": "16499.135678363399",
|
6612
|
+
# "total_available_margin": "3381470.892007440383",
|
6613
|
+
# "unified_account_total": "3381470.892007440383",
|
6614
|
+
# "unified_account_total_liab": "0",
|
6615
|
+
# "unified_account_total_equity": "100016.1",
|
6616
|
+
# "leverage": "2"
|
6617
|
+
# }
|
6618
|
+
#
|
6619
|
+
else:
|
6620
|
+
raise NotSupported(self.id + ' fetchLeverage() does not support ' + market['type'] + ' markets')
|
6621
|
+
return self.parse_leverage(response, market)
|
6622
|
+
|
6623
|
+
async def fetch_leverages(self, symbols: List[str] = None, params={}) -> Leverages:
|
6624
|
+
"""
|
6625
|
+
fetch the set leverage for all leverage markets, only spot margin is supported on gate
|
6626
|
+
:see: https://www.gate.io/docs/developers/apiv4/en/#list-lending-markets
|
6627
|
+
:see: https://www.gate.io/docs/developers/apiv4/en/#list-all-supported-currency-pairs-supported-in-margin-trading-deprecated
|
6628
|
+
:param str[] symbols: a list of unified market symbols
|
6629
|
+
:param dict [params]: extra parameters specific to the exchange API endpoint
|
6630
|
+
:param boolean [params.unified]: default False, set to True for fetching unified account leverages
|
6631
|
+
:returns dict: a list of `leverage structures <https://docs.ccxt.com/#/?id=leverage-structure>`
|
6632
|
+
"""
|
6633
|
+
await self.load_markets()
|
6634
|
+
symbols = self.market_symbols(symbols)
|
6635
|
+
response = None
|
6636
|
+
isUnified = self.safe_bool(params, 'unified')
|
6637
|
+
params = self.omit(params, 'unified')
|
6638
|
+
marketIdRequest = 'id'
|
6639
|
+
if isUnified:
|
6640
|
+
marketIdRequest = 'currency_pair'
|
6641
|
+
response = await self.publicMarginGetUniCurrencyPairs(params)
|
6642
|
+
#
|
6643
|
+
# [
|
6644
|
+
# {
|
6645
|
+
# "currency_pair": "1INCH_USDT",
|
6646
|
+
# "base_min_borrow_amount": "8",
|
6647
|
+
# "quote_min_borrow_amount": "1",
|
6648
|
+
# "leverage": "3"
|
6649
|
+
# },
|
6650
|
+
# ]
|
6651
|
+
#
|
6652
|
+
else:
|
6653
|
+
response = await self.publicMarginGetCurrencyPairs(params)
|
6654
|
+
#
|
6655
|
+
# [
|
6656
|
+
# {
|
6657
|
+
# "id": "1CAT_USDT",
|
6658
|
+
# "base": "1CAT",
|
6659
|
+
# "quote": "USDT",
|
6660
|
+
# "leverage": 3,
|
6661
|
+
# "min_base_amount": "71",
|
6662
|
+
# "min_quote_amount": "1",
|
6663
|
+
# "max_quote_amount": "10000",
|
6664
|
+
# "status": 1
|
6665
|
+
# },
|
6666
|
+
# ]
|
6667
|
+
#
|
6668
|
+
return self.parse_leverages(response, symbols, marketIdRequest, 'spot')
|
6669
|
+
|
6670
|
+
def parse_leverage(self, leverage, market=None) -> Leverage:
|
6671
|
+
marketId = self.safe_string_2(leverage, 'currency_pair', 'id')
|
6672
|
+
leverageValue = self.safe_integer(leverage, 'leverage')
|
6673
|
+
return {
|
6674
|
+
'info': leverage,
|
6675
|
+
'symbol': self.safe_symbol(marketId, market, '_', 'spot'),
|
6676
|
+
'marginMode': None,
|
6677
|
+
'longLeverage': leverageValue,
|
6678
|
+
'shortLeverage': leverageValue,
|
6679
|
+
}
|
6680
|
+
|
6520
6681
|
def handle_errors(self, code, reason, url, method, headers, body, response, requestHeaders, requestBody):
|
6521
6682
|
if response is None:
|
6522
6683
|
return None
|
ccxt/async_support/hitbtc.py
CHANGED
@@ -6,7 +6,7 @@
|
|
6
6
|
from ccxt.async_support.base.exchange import Exchange
|
7
7
|
from ccxt.abstract.hitbtc import ImplicitAPI
|
8
8
|
import hashlib
|
9
|
-
from ccxt.base.types import Balances, Currency, Int, Leverage, MarginMode, MarginModes, Market, Order,
|
9
|
+
from ccxt.base.types import Balances, Currency, Int, Leverage, MarginMode, MarginModes, Market, Order, OrderBook, OrderSide, OrderType, Str, Strings, Ticker, Tickers, Trade, Transaction, TransferEntry
|
10
10
|
from typing import List
|
11
11
|
from ccxt.base.errors import ExchangeError
|
12
12
|
from ccxt.base.errors import PermissionDenied
|
ccxt/async_support/htx.py
CHANGED
@@ -7,7 +7,7 @@ from ccxt.async_support.base.exchange import Exchange
|
|
7
7
|
from ccxt.abstract.htx import ImplicitAPI
|
8
8
|
import asyncio
|
9
9
|
import hashlib
|
10
|
-
from ccxt.base.types import Balances, Currency, Int, Market, Order,
|
10
|
+
from ccxt.base.types import Balances, Currency, Int, Market, Order, OrderBook, OrderRequest, OrderSide, OrderType, Str, Strings, Ticker, Tickers, Trade, Transaction, TransferEntry
|
11
11
|
from typing import List
|
12
12
|
from ccxt.base.errors import ExchangeError
|
13
13
|
from ccxt.base.errors import PermissionDenied
|
@@ -5,7 +5,7 @@
|
|
5
5
|
|
6
6
|
from ccxt.async_support.base.exchange import Exchange
|
7
7
|
from ccxt.abstract.hyperliquid import ImplicitAPI
|
8
|
-
from ccxt.base.types import Balances, Int, Market, Order,
|
8
|
+
from ccxt.base.types import Balances, Int, Market, Order, OrderBook, OrderRequest, OrderSide, OrderType, Str, Strings, Trade, TransferEntry
|
9
9
|
from typing import List
|
10
10
|
from ccxt.base.errors import ExchangeError
|
11
11
|
from ccxt.base.errors import ArgumentsRequired
|
@@ -27,7 +27,7 @@ class hyperliquid(Exchange, ImplicitAPI):
|
|
27
27
|
'version': 'v1',
|
28
28
|
'rateLimit': 50, # 1200 requests per minute, 20 request per second
|
29
29
|
'certified': False,
|
30
|
-
'pro':
|
30
|
+
'pro': True,
|
31
31
|
'has': {
|
32
32
|
'CORS': None,
|
33
33
|
'spot': False,
|
ccxt/async_support/kraken.py
CHANGED
@@ -6,7 +6,7 @@
|
|
6
6
|
from ccxt.async_support.base.exchange import Exchange
|
7
7
|
from ccxt.abstract.kraken import ImplicitAPI
|
8
8
|
import hashlib
|
9
|
-
from ccxt.base.types import Balances, Currency, Int, Market, Order,
|
9
|
+
from ccxt.base.types import Balances, Currency, IndexType, Int, Market, Order, OrderBook, OrderSide, OrderType, Str, Strings, Ticker, Tickers, Trade, Transaction, TransferEntry
|
10
10
|
from typing import List
|
11
11
|
from ccxt.base.errors import ExchangeError
|
12
12
|
from ccxt.base.errors import PermissionDenied
|
@@ -1255,6 +1255,7 @@ class kraken(Exchange, ImplicitAPI):
|
|
1255
1255
|
lastTrade = trades[length - 1]
|
1256
1256
|
lastTradeId = self.safe_string(result, 'last')
|
1257
1257
|
lastTrade.append(lastTradeId)
|
1258
|
+
trades[length - 1] = lastTrade
|
1258
1259
|
return self.parse_trades(trades, market, since, limit)
|
1259
1260
|
|
1260
1261
|
def parse_balance(self, response) -> Balances:
|
@@ -6,7 +6,7 @@
|
|
6
6
|
from ccxt.async_support.base.exchange import Exchange
|
7
7
|
from ccxt.abstract.krakenfutures import ImplicitAPI
|
8
8
|
import hashlib
|
9
|
-
from ccxt.base.types import Balances, Currency, Int, Leverage, Leverages, Market, Order,
|
9
|
+
from ccxt.base.types import Balances, Currency, Int, Leverage, Leverages, Market, Order, OrderBook, OrderRequest, OrderSide, OrderType, Str, Strings, Ticker, Tickers, Trade, TransferEntry
|
10
10
|
from typing import List
|
11
11
|
from ccxt.base.errors import ExchangeError
|
12
12
|
from ccxt.base.errors import ArgumentsRequired
|
ccxt/async_support/kucoin.py
CHANGED
@@ -9,7 +9,7 @@ import asyncio
|
|
9
9
|
import hashlib
|
10
10
|
import math
|
11
11
|
import json
|
12
|
-
from ccxt.base.types import Balances, Currency, Int, Market, Order,
|
12
|
+
from ccxt.base.types import Balances, Currency, Int, Market, Order, OrderBook, OrderRequest, OrderSide, OrderType, Str, Strings, Ticker, Tickers, Trade, Transaction, TransferEntry
|
13
13
|
from typing import List
|
14
14
|
from ccxt.base.errors import ExchangeError
|
15
15
|
from ccxt.base.errors import PermissionDenied
|
@@ -5,7 +5,7 @@
|
|
5
5
|
|
6
6
|
from ccxt.async_support.kucoin import kucoin
|
7
7
|
from ccxt.abstract.kucoinfutures import ImplicitAPI
|
8
|
-
from ccxt.base.types import Balances, Currency, Int, Market, Order,
|
8
|
+
from ccxt.base.types import Balances, Currency, Int, Market, Order, OrderBook, OrderRequest, OrderSide, OrderType, Str, Strings, Ticker, Trade, Transaction, TransferEntry
|
9
9
|
from typing import List
|
10
10
|
from ccxt.base.errors import PermissionDenied
|
11
11
|
from ccxt.base.errors import AccountSuspended
|
ccxt/async_support/latoken.py
CHANGED
@@ -6,7 +6,7 @@
|
|
6
6
|
from ccxt.async_support.base.exchange import Exchange
|
7
7
|
from ccxt.abstract.latoken import ImplicitAPI
|
8
8
|
import hashlib
|
9
|
-
from ccxt.base.types import Balances, Currency, Int, Market, Order,
|
9
|
+
from ccxt.base.types import Balances, Currency, Int, Market, Order, OrderBook, OrderSide, OrderType, Str, Strings, Ticker, Tickers, Trade, Transaction, TransferEntry
|
10
10
|
from typing import List
|
11
11
|
from ccxt.base.errors import ExchangeError
|
12
12
|
from ccxt.base.errors import PermissionDenied
|
ccxt/async_support/lykke.py
CHANGED
@@ -5,7 +5,7 @@
|
|
5
5
|
|
6
6
|
from ccxt.async_support.base.exchange import Exchange
|
7
7
|
from ccxt.abstract.lykke import ImplicitAPI
|
8
|
-
from ccxt.base.types import Balances, Currency, Int, Market, Order, OrderBook, OrderSide, OrderType,
|
8
|
+
from ccxt.base.types import Balances, Currency, IndexType, Int, Market, Order, OrderBook, OrderSide, OrderType, Str, Strings, Ticker, Tickers, Trade, Transaction
|
9
9
|
from typing import List
|
10
10
|
from ccxt.base.errors import ExchangeError
|
11
11
|
from ccxt.base.errors import BadRequest
|
ccxt/async_support/mexc.py
CHANGED
@@ -6,7 +6,7 @@
|
|
6
6
|
from ccxt.async_support.base.exchange import Exchange
|
7
7
|
from ccxt.abstract.mexc import ImplicitAPI
|
8
8
|
import hashlib
|
9
|
-
from ccxt.base.types import Balances, Currency, Int, Leverage, Market, Order,
|
9
|
+
from ccxt.base.types import Balances, Currency, IndexType, Int, Leverage, Market, Order, OrderBook, OrderRequest, OrderSide, OrderType, Str, Strings, Ticker, Tickers, Trade, Transaction, TransferEntry
|
10
10
|
from typing import List
|
11
11
|
from ccxt.base.errors import ExchangeError
|
12
12
|
from ccxt.base.errors import PermissionDenied
|
@@ -55,6 +55,7 @@ class mexc(Exchange, ImplicitAPI):
|
|
55
55
|
'createMarketSellOrderWithCost': False,
|
56
56
|
'createOrder': True,
|
57
57
|
'createOrders': True,
|
58
|
+
'createPostOnlyOrder': True,
|
58
59
|
'createReduceOnlyOrder': True,
|
59
60
|
'deposit': None,
|
60
61
|
'editOrder': None,
|
@@ -2122,6 +2123,14 @@ class mexc(Exchange, ImplicitAPI):
|
|
2122
2123
|
:param dict [params]: extra parameters specific to the exchange API endpoint
|
2123
2124
|
:param str [params.marginMode]: only 'isolated' is supported for spot-margin trading
|
2124
2125
|
:param float [params.triggerPrice]: The price at which a trigger order is triggered at
|
2126
|
+
:param bool [params.postOnly]: if True, the order will only be posted if it will be a maker order
|
2127
|
+
:param bool [params.reduceOnly]: *contract only* indicates if self order is to reduce the size of a position
|
2128
|
+
*
|
2129
|
+
* EXCHANGE SPECIFIC PARAMETERS
|
2130
|
+
:param int [params.leverage]: *contract only* leverage is necessary on isolated margin
|
2131
|
+
:param long [params.positionId]: *contract only* it is recommended to hasattr(self, fill) parameter when closing a position
|
2132
|
+
:param str [params.externalOid]: *contract only* external order ID
|
2133
|
+
:param int [params.positionMode]: *contract only* 1:hedge, 2:one-way, default: the user's current config
|
2125
2134
|
:returns dict: an `order structure <https://docs.ccxt.com/#/?id=order-structure>`
|
2126
2135
|
"""
|
2127
2136
|
await self.load_markets()
|
ccxt/async_support/ndax.py
CHANGED
@@ -7,7 +7,7 @@ from ccxt.async_support.base.exchange import Exchange
|
|
7
7
|
from ccxt.abstract.ndax import ImplicitAPI
|
8
8
|
import hashlib
|
9
9
|
import json
|
10
|
-
from ccxt.base.types import Balances, Currency, Int, Market, Order, OrderBook, OrderSide, OrderType,
|
10
|
+
from ccxt.base.types import Balances, Currency, IndexType, Int, Market, Order, OrderBook, OrderSide, OrderType, Str, Ticker, Trade, Transaction
|
11
11
|
from typing import List
|
12
12
|
from ccxt.base.errors import ExchangeError
|
13
13
|
from ccxt.base.errors import BadSymbol
|
ccxt/async_support/novadax.py
CHANGED
@@ -6,7 +6,7 @@
|
|
6
6
|
from ccxt.async_support.base.exchange import Exchange
|
7
7
|
from ccxt.abstract.novadax import ImplicitAPI
|
8
8
|
import hashlib
|
9
|
-
from ccxt.base.types import Balances, Currency, Int, Market, Order,
|
9
|
+
from ccxt.base.types import Balances, Currency, Int, Market, Order, OrderBook, OrderSide, OrderType, Str, Strings, Ticker, Tickers, Trade, Transaction, TransferEntry
|
10
10
|
from typing import List
|
11
11
|
from ccxt.base.errors import ExchangeError
|
12
12
|
from ccxt.base.errors import PermissionDenied
|
ccxt/async_support/okcoin.py
CHANGED
@@ -6,7 +6,7 @@
|
|
6
6
|
from ccxt.async_support.base.exchange import Exchange
|
7
7
|
from ccxt.abstract.okcoin import ImplicitAPI
|
8
8
|
import hashlib
|
9
|
-
from ccxt.base.types import Balances, Currency, Int, Market, Order,
|
9
|
+
from ccxt.base.types import Balances, Currency, Int, Market, Order, OrderBook, OrderSide, OrderType, Str, Strings, Ticker, Tickers, Trade, Transaction, TransferEntry
|
10
10
|
from typing import List
|
11
11
|
from ccxt.base.errors import ExchangeError
|
12
12
|
from ccxt.base.errors import PermissionDenied
|
ccxt/async_support/okx.py
CHANGED
@@ -7,7 +7,7 @@ from ccxt.async_support.base.exchange import Exchange
|
|
7
7
|
from ccxt.abstract.okx import ImplicitAPI
|
8
8
|
import asyncio
|
9
9
|
import hashlib
|
10
|
-
from ccxt.base.types import Balances, Currency, Greeks, Int, Leverage, Market, Order,
|
10
|
+
from ccxt.base.types import Balances, Currency, Greeks, Int, Leverage, Market, Order, OrderBook, OrderRequest, OrderSide, OrderType, Str, Strings, Ticker, Tickers, Trade, Transaction, TransferEntry
|
11
11
|
from typing import List
|
12
12
|
from ccxt.base.errors import ExchangeError
|
13
13
|
from ccxt.base.errors import PermissionDenied
|
ccxt/async_support/paymium.py
CHANGED
@@ -6,7 +6,7 @@
|
|
6
6
|
from ccxt.async_support.base.exchange import Exchange
|
7
7
|
from ccxt.abstract.paymium import ImplicitAPI
|
8
8
|
import hashlib
|
9
|
-
from ccxt.base.types import Balances, Currency, Int, Market,
|
9
|
+
from ccxt.base.types import Balances, Currency, Int, Market, OrderBook, OrderSide, OrderType, Str, Ticker, Trade, TransferEntry
|
10
10
|
from typing import List
|
11
11
|
from ccxt.base.errors import ExchangeError
|
12
12
|
from ccxt.base.decimal_to_precision import TICK_SIZE
|
ccxt/async_support/phemex.py
CHANGED
@@ -7,7 +7,7 @@ from ccxt.async_support.base.exchange import Exchange
|
|
7
7
|
from ccxt.abstract.phemex import ImplicitAPI
|
8
8
|
import hashlib
|
9
9
|
import numbers
|
10
|
-
from ccxt.base.types import Balances, Currency, Int, Market,
|
10
|
+
from ccxt.base.types import Balances, Currency, Int, Market, Num, Order, OrderBook, OrderSide, OrderType, Str, Strings, Ticker, Tickers, Trade, Transaction, TransferEntry
|
11
11
|
from typing import List
|
12
12
|
from ccxt.base.errors import ExchangeError
|
13
13
|
from ccxt.base.errors import PermissionDenied
|
ccxt/async_support/poloniex.py
CHANGED
@@ -6,7 +6,7 @@
|
|
6
6
|
from ccxt.async_support.base.exchange import Exchange
|
7
7
|
from ccxt.abstract.poloniex import ImplicitAPI
|
8
8
|
import hashlib
|
9
|
-
from ccxt.base.types import Balances, Currency, Int, Market, Order,
|
9
|
+
from ccxt.base.types import Balances, Currency, Int, Market, Order, OrderBook, OrderSide, OrderType, Str, Strings, Ticker, Tickers, Trade, Transaction, TransferEntry
|
10
10
|
from typing import List
|
11
11
|
from ccxt.base.errors import ExchangeError
|
12
12
|
from ccxt.base.errors import PermissionDenied
|
ccxt/async_support/wazirx.py
CHANGED
@@ -6,7 +6,7 @@
|
|
6
6
|
from ccxt.async_support.base.exchange import Exchange
|
7
7
|
from ccxt.abstract.wazirx import ImplicitAPI
|
8
8
|
import hashlib
|
9
|
-
from ccxt.base.types import Balances, Currency, Int, Market, Order, OrderBook, OrderSide, OrderType,
|
9
|
+
from ccxt.base.types import Balances, Currency, Int, Market, Num, Order, OrderBook, OrderSide, OrderType, Str, Strings, Ticker, Tickers, Trade, Transaction
|
10
10
|
from typing import List
|
11
11
|
from ccxt.base.errors import ExchangeError
|
12
12
|
from ccxt.base.errors import PermissionDenied
|
ccxt/async_support/whitebit.py
CHANGED
@@ -6,7 +6,7 @@
|
|
6
6
|
from ccxt.async_support.base.exchange import Exchange
|
7
7
|
from ccxt.abstract.whitebit import ImplicitAPI
|
8
8
|
import hashlib
|
9
|
-
from ccxt.base.types import Balances, Currency, Int,
|
9
|
+
from ccxt.base.types import Balances, Bool, Currency, Int, Market, MarketType, Order, OrderBook, OrderSide, OrderType, Str, Strings, Ticker, Tickers, Trade, Transaction, TransferEntry
|
10
10
|
from typing import List
|
11
11
|
from ccxt.base.errors import ExchangeError
|
12
12
|
from ccxt.base.errors import PermissionDenied
|
ccxt/async_support/woo.py
CHANGED
@@ -6,7 +6,7 @@
|
|
6
6
|
from ccxt.async_support.base.exchange import Exchange
|
7
7
|
from ccxt.abstract.woo import ImplicitAPI
|
8
8
|
import hashlib
|
9
|
-
from ccxt.base.types import Balances, Currency, Int, Leverage, MarketType,
|
9
|
+
from ccxt.base.types import Balances, Bool, Currency, Int, Leverage, Market, MarketType, Num, Order, OrderBook, OrderSide, OrderType, Str, Strings, Trade, Transaction, TransferEntry
|
10
10
|
from typing import List
|
11
11
|
from ccxt.base.errors import ExchangeError
|
12
12
|
from ccxt.base.errors import ArgumentsRequired
|
ccxt/async_support/zonda.py
CHANGED
@@ -6,7 +6,7 @@
|
|
6
6
|
from ccxt.async_support.base.exchange import Exchange
|
7
7
|
from ccxt.abstract.zonda import ImplicitAPI
|
8
8
|
import hashlib
|
9
|
-
from ccxt.base.types import Balances, Currency, Int, Market, Order,
|
9
|
+
from ccxt.base.types import Balances, Currency, Int, Market, Order, OrderBook, OrderSide, OrderType, Str, Strings, Ticker, Tickers, Trade, Transaction, TransferEntry
|
10
10
|
from typing import List
|
11
11
|
from ccxt.base.errors import ExchangeError
|
12
12
|
from ccxt.base.errors import PermissionDenied
|
ccxt/base/exchange.py
CHANGED
ccxt/bigone.py
CHANGED
@@ -5,7 +5,7 @@
|
|
5
5
|
|
6
6
|
from ccxt.base.exchange import Exchange
|
7
7
|
from ccxt.abstract.bigone import ImplicitAPI
|
8
|
-
from ccxt.base.types import Balances, Currency, Int, Market, Order,
|
8
|
+
from ccxt.base.types import Balances, Bool, Currency, Int, Market, Order, OrderBook, OrderSide, OrderType, Str, Strings, Ticker, Tickers, Trade, Transaction, TransferEntry
|
9
9
|
from typing import List
|
10
10
|
from ccxt.base.errors import ExchangeError
|
11
11
|
from ccxt.base.errors import PermissionDenied
|
ccxt/binance.py
CHANGED
@@ -7,7 +7,7 @@ from ccxt.base.exchange import Exchange
|
|
7
7
|
from ccxt.abstract.binance import ImplicitAPI
|
8
8
|
import hashlib
|
9
9
|
import json
|
10
|
-
from ccxt.base.types import Balances, Currency, Greeks, Int, Leverage, Leverages, MarginMode, MarginModes, Market, Order,
|
10
|
+
from ccxt.base.types import Balances, Currency, Greeks, Int, Leverage, Leverages, MarginMode, MarginModes, Market, Order, OrderBook, OrderRequest, OrderSide, OrderType, Str, Strings, Ticker, Tickers, Trade, Transaction, TransferEntry
|
11
11
|
from typing import List
|
12
12
|
from ccxt.base.errors import ExchangeError
|
13
13
|
from ccxt.base.errors import PermissionDenied
|
ccxt/bingx.py
CHANGED
@@ -7,7 +7,7 @@ from ccxt.base.exchange import Exchange
|
|
7
7
|
from ccxt.abstract.bingx import ImplicitAPI
|
8
8
|
import hashlib
|
9
9
|
import numbers
|
10
|
-
from ccxt.base.types import Balances, Currency, Int, Leverage, MarginMode, Market, Order,
|
10
|
+
from ccxt.base.types import Balances, Currency, Int, Leverage, MarginMode, Market, Order, OrderBook, OrderRequest, OrderSide, OrderType, Position, Str, Strings, Ticker, Tickers, Trade, Transaction, TransferEntry
|
11
11
|
from typing import List
|
12
12
|
from ccxt.base.errors import ExchangeError
|
13
13
|
from ccxt.base.errors import PermissionDenied
|
ccxt/bitfinex.py
CHANGED
@@ -6,7 +6,7 @@
|
|
6
6
|
from ccxt.base.exchange import Exchange
|
7
7
|
from ccxt.abstract.bitfinex import ImplicitAPI
|
8
8
|
import hashlib
|
9
|
-
from ccxt.base.types import Balances, Currency, Int, Market, Order,
|
9
|
+
from ccxt.base.types import Balances, Currency, Int, Market, Order, OrderBook, OrderSide, OrderType, Str, Strings, Ticker, Tickers, Trade, Transaction, TransferEntry
|
10
10
|
from typing import List
|
11
11
|
from ccxt.base.errors import ExchangeError
|
12
12
|
from ccxt.base.errors import PermissionDenied
|
ccxt/bitfinex2.py
CHANGED
@@ -6,7 +6,7 @@
|
|
6
6
|
from ccxt.base.exchange import Exchange
|
7
7
|
from ccxt.abstract.bitfinex2 import ImplicitAPI
|
8
8
|
import hashlib
|
9
|
-
from ccxt.base.types import Balances, Currency, Int, Market, Order,
|
9
|
+
from ccxt.base.types import Balances, Currency, Int, Market, Order, OrderBook, OrderRequest, OrderSide, OrderType, Str, Strings, Ticker, Tickers, Trade, Transaction, TransferEntry
|
10
10
|
from typing import List
|
11
11
|
from ccxt.base.errors import ExchangeError
|
12
12
|
from ccxt.base.errors import PermissionDenied
|
ccxt/bitget.py
CHANGED
@@ -7,7 +7,7 @@ from ccxt.base.exchange import Exchange
|
|
7
7
|
from ccxt.abstract.bitget import ImplicitAPI
|
8
8
|
import hashlib
|
9
9
|
import json
|
10
|
-
from ccxt.base.types import Balances, Currency,
|
10
|
+
from ccxt.base.types import Balances, Currency, FundingHistory, Int, Leverage, Liquidation, MarginMode, Market, Order, OrderBook, OrderRequest, OrderSide, OrderType, Position, Str, Strings, Ticker, Tickers, Trade, Transaction, TransferEntry
|
11
11
|
from typing import List
|
12
12
|
from ccxt.base.errors import ExchangeError
|
13
13
|
from ccxt.base.errors import PermissionDenied
|
@@ -5868,11 +5868,13 @@ class bitget(Exchange, ImplicitAPI):
|
|
5868
5868
|
fetch all open positions
|
5869
5869
|
:see: https://www.bitget.com/api-doc/contract/position/get-all-position
|
5870
5870
|
:see: https://www.bitget.com/api-doc/contract/position/Get-History-Position
|
5871
|
-
:param str[]
|
5871
|
+
:param str[] [symbols]: list of unified market symbols
|
5872
5872
|
:param dict [params]: extra parameters specific to the exchange API endpoint
|
5873
5873
|
:param str [params.marginCoin]: the settle currency of the positions, needs to match the productType
|
5874
5874
|
:param str [params.productType]: 'USDT-FUTURES', 'USDC-FUTURES', 'COIN-FUTURES', 'SUSDT-FUTURES', 'SUSDC-FUTURES' or 'SCOIN-FUTURES'
|
5875
5875
|
:param boolean [params.paginate]: default False, when True will automatically paginate by calling self endpoint multiple times. See in the docs all the [available parameters](https://github.com/ccxt/ccxt/wiki/Manual#pagination-params)
|
5876
|
+
:param boolean [params.useHistoryEndpoint]: default False, when True will use the historic endpoint to fetch positions
|
5877
|
+
:param str [params.method]: either(default) 'privateMixGetV2MixPositionAllPosition' or 'privateMixGetV2MixPositionHistoryPosition'
|
5876
5878
|
:returns dict[]: a list of `position structure <https://docs.ccxt.com/#/?id=position-structure>`
|
5877
5879
|
"""
|
5878
5880
|
self.load_markets()
|
@@ -5880,8 +5882,12 @@ class bitget(Exchange, ImplicitAPI):
|
|
5880
5882
|
paginate, params = self.handle_option_and_params(params, 'fetchPositions', 'paginate')
|
5881
5883
|
if paginate:
|
5882
5884
|
return self.fetch_paginated_call_cursor('fetchPositions', None, None, None, params, 'endId', 'idLessThan')
|
5883
|
-
|
5884
|
-
|
5885
|
+
method = None
|
5886
|
+
useHistoryEndpoint = self.safe_bool(params, 'useHistoryEndpoint', False)
|
5887
|
+
if useHistoryEndpoint:
|
5888
|
+
method = 'privateMixGetV2MixPositionHistoryPosition'
|
5889
|
+
else:
|
5890
|
+
method, params = self.handle_option_and_params(params, 'fetchPositions', 'method', 'privateMixGetV2MixPositionAllPosition')
|
5885
5891
|
market = None
|
5886
5892
|
if symbols is not None:
|
5887
5893
|
first = self.safe_string(symbols, 0)
|
@@ -5984,10 +5990,10 @@ class bitget(Exchange, ImplicitAPI):
|
|
5984
5990
|
#
|
5985
5991
|
position = []
|
5986
5992
|
if not isHistory:
|
5987
|
-
position = self.
|
5993
|
+
position = self.safe_list(response, 'data', [])
|
5988
5994
|
else:
|
5989
|
-
data = self.
|
5990
|
-
position = self.
|
5995
|
+
data = self.safe_dict(response, 'data', {})
|
5996
|
+
position = self.safe_list(data, 'list', [])
|
5991
5997
|
result = []
|
5992
5998
|
for i in range(0, len(position)):
|
5993
5999
|
result.append(self.parse_position(position[i], market))
|
ccxt/bitmart.py
CHANGED
@@ -6,7 +6,7 @@
|
|
6
6
|
from ccxt.base.exchange import Exchange
|
7
7
|
from ccxt.abstract.bitmart import ImplicitAPI
|
8
8
|
import hashlib
|
9
|
-
from ccxt.base.types import Balances, Currency, Int, Market, Order,
|
9
|
+
from ccxt.base.types import Balances, Currency, Int, Market, Order, OrderBook, OrderSide, OrderType, Str, Strings, Ticker, Tickers, Trade, Transaction, TransferEntry
|
10
10
|
from typing import List
|
11
11
|
from ccxt.base.errors import ExchangeError
|
12
12
|
from ccxt.base.errors import PermissionDenied
|
ccxt/bitmex.py
CHANGED
@@ -6,7 +6,7 @@
|
|
6
6
|
from ccxt.base.exchange import Exchange
|
7
7
|
from ccxt.abstract.bitmex import ImplicitAPI
|
8
8
|
import hashlib
|
9
|
-
from ccxt.base.types import Balances, Currency, Int, Leverage, Leverages,
|
9
|
+
from ccxt.base.types import Balances, Currency, Int, Leverage, Leverages, Market, MarketType, Order, OrderBook, OrderSide, OrderType, Str, Strings, Ticker, Tickers, Trade, Transaction
|
10
10
|
from typing import List
|
11
11
|
from ccxt.base.errors import ExchangeError
|
12
12
|
from ccxt.base.errors import PermissionDenied
|
ccxt/bitrue.py
CHANGED
@@ -7,7 +7,7 @@ from ccxt.base.exchange import Exchange
|
|
7
7
|
from ccxt.abstract.bitrue import ImplicitAPI
|
8
8
|
import hashlib
|
9
9
|
import json
|
10
|
-
from ccxt.base.types import Balances, Currency, Int, Market, Order,
|
10
|
+
from ccxt.base.types import Balances, Currency, Int, Market, Order, OrderBook, OrderSide, OrderType, Str, Strings, Ticker, Tickers, Trade, Transaction, TransferEntry
|
11
11
|
from typing import List
|
12
12
|
from ccxt.base.errors import ExchangeError
|
13
13
|
from ccxt.base.errors import PermissionDenied
|
ccxt/bitstamp.py
CHANGED
@@ -6,7 +6,7 @@
|
|
6
6
|
from ccxt.base.exchange import Exchange
|
7
7
|
from ccxt.abstract.bitstamp import ImplicitAPI
|
8
8
|
import hashlib
|
9
|
-
from ccxt.base.types import Balances, Currency, Int, Market, Order,
|
9
|
+
from ccxt.base.types import Balances, Currency, Int, Market, Order, OrderBook, OrderSide, OrderType, Str, Strings, Ticker, Tickers, Trade, Transaction, TransferEntry
|
10
10
|
from typing import List
|
11
11
|
from ccxt.base.errors import ExchangeError
|
12
12
|
from ccxt.base.errors import PermissionDenied
|
ccxt/bl3p.py
CHANGED
@@ -6,7 +6,7 @@
|
|
6
6
|
from ccxt.base.exchange import Exchange
|
7
7
|
from ccxt.abstract.bl3p import ImplicitAPI
|
8
8
|
import hashlib
|
9
|
-
from ccxt.base.types import Balances, Currency, Int, Market, OrderBook, OrderSide, OrderType,
|
9
|
+
from ccxt.base.types import Balances, Currency, IndexType, Int, Market, OrderBook, OrderSide, OrderType, Str, Ticker, Trade
|
10
10
|
from typing import List
|
11
11
|
from ccxt.base.decimal_to_precision import TICK_SIZE
|
12
12
|
from ccxt.base.precise import Precise
|
ccxt/blofin.py
CHANGED
@@ -6,7 +6,7 @@
|
|
6
6
|
from ccxt.base.exchange import Exchange
|
7
7
|
from ccxt.abstract.blofin import ImplicitAPI
|
8
8
|
import hashlib
|
9
|
-
from ccxt.base.types import Balances, Currency, Int, Leverage, Leverages, MarginMode, Market, Order,
|
9
|
+
from ccxt.base.types import Balances, Currency, Int, Leverage, Leverages, MarginMode, Market, Order, OrderBook, OrderRequest, OrderSide, OrderType, Position, Str, Strings, Ticker, Tickers, Trade, Transaction, TransferEntry
|
10
10
|
from typing import List
|
11
11
|
from ccxt.base.errors import ExchangeError
|
12
12
|
from ccxt.base.errors import ArgumentsRequired
|
ccxt/btcalpha.py
CHANGED
@@ -6,7 +6,7 @@
|
|
6
6
|
from ccxt.base.exchange import Exchange
|
7
7
|
from ccxt.abstract.btcalpha import ImplicitAPI
|
8
8
|
import hashlib
|
9
|
-
from ccxt.base.types import Balances, Currency, Int, Market, Order, OrderBook, OrderSide, OrderType,
|
9
|
+
from ccxt.base.types import Balances, Currency, IndexType, Int, Market, Order, OrderBook, OrderSide, OrderType, Str, Strings, Ticker, Tickers, Trade, Transaction
|
10
10
|
from typing import List
|
11
11
|
from ccxt.base.errors import ExchangeError
|
12
12
|
from ccxt.base.errors import InsufficientFunds
|