ccxt 4.1.19__py2.py3-none-any.whl → 4.1.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.
- ccxt/__init__.py +1 -1
- ccxt/abstract/okcoin.py +70 -206
- ccxt/ace.py +12 -12
- ccxt/ascendex.py +5 -5
- ccxt/async_support/__init__.py +1 -1
- ccxt/async_support/ace.py +12 -12
- ccxt/async_support/ascendex.py +5 -5
- ccxt/async_support/base/exchange.py +1 -1
- ccxt/async_support/bigone.py +2 -2
- ccxt/async_support/binance.py +184 -184
- ccxt/async_support/bingx.py +48 -48
- ccxt/async_support/bitbank.py +14 -14
- ccxt/async_support/bitbns.py +7 -7
- ccxt/async_support/bitfinex.py +2 -2
- ccxt/async_support/bitfinex2.py +35 -35
- ccxt/async_support/bitflyer.py +17 -17
- ccxt/async_support/bitforex.py +9 -9
- ccxt/async_support/bitget.py +433 -215
- ccxt/async_support/bitmart.py +39 -39
- ccxt/async_support/bitmex.py +7 -7
- ccxt/async_support/bitopro.py +1 -1
- ccxt/async_support/bitpanda.py +1 -1
- ccxt/async_support/bitrue.py +2 -2
- ccxt/async_support/bitso.py +2 -2
- ccxt/async_support/bitstamp.py +3 -3
- ccxt/async_support/bitvavo.py +2 -2
- ccxt/async_support/bl3p.py +1 -1
- ccxt/async_support/btcalpha.py +7 -7
- ccxt/async_support/btcturk.py +1 -1
- ccxt/async_support/bybit.py +58 -58
- ccxt/async_support/cex.py +1 -1
- ccxt/async_support/coinbase.py +13 -13
- ccxt/async_support/coinbasepro.py +15 -15
- ccxt/async_support/coinex.py +19 -19
- ccxt/async_support/coinone.py +2 -2
- ccxt/async_support/coinsph.py +4 -4
- ccxt/async_support/coinspot.py +2 -2
- ccxt/async_support/cryptocom.py +28 -28
- ccxt/async_support/currencycom.py +1 -1
- ccxt/async_support/delta.py +26 -26
- ccxt/async_support/deribit.py +9 -9
- ccxt/async_support/digifinex.py +38 -38
- ccxt/async_support/exmo.py +18 -18
- ccxt/async_support/gate.py +59 -59
- ccxt/async_support/gemini.py +4 -4
- ccxt/async_support/hitbtc.py +6 -6
- ccxt/async_support/hollaex.py +2 -2
- ccxt/async_support/huobi.py +70 -70
- ccxt/async_support/indodax.py +1 -1
- ccxt/async_support/kraken.py +33 -33
- ccxt/async_support/krakenfutures.py +6 -5
- ccxt/async_support/kucoin.py +74 -74
- ccxt/async_support/kucoinfutures.py +8 -8
- ccxt/async_support/latoken.py +14 -14
- ccxt/async_support/lbank2.py +33 -33
- ccxt/async_support/mexc.py +22 -22
- ccxt/async_support/ndax.py +1 -1
- ccxt/async_support/novadax.py +22 -22
- ccxt/async_support/oceanex.py +18 -18
- ccxt/async_support/okcoin.py +1950 -2758
- ccxt/async_support/okx.py +73 -73
- ccxt/async_support/paymium.py +11 -11
- ccxt/async_support/phemex.py +26 -26
- ccxt/async_support/poloniex.py +30 -30
- ccxt/async_support/poloniexfutures.py +25 -25
- ccxt/async_support/probit.py +21 -21
- ccxt/async_support/tokocrypto.py +22 -22
- ccxt/async_support/upbit.py +21 -21
- ccxt/async_support/wavesexchange.py +2 -2
- ccxt/async_support/wazirx.py +14 -14
- ccxt/async_support/whitebit.py +6 -6
- ccxt/async_support/woo.py +21 -21
- ccxt/async_support/yobit.py +16 -16
- ccxt/async_support/zaif.py +10 -10
- ccxt/async_support/zonda.py +15 -15
- ccxt/base/exchange.py +2 -1
- ccxt/bigone.py +2 -2
- ccxt/binance.py +184 -184
- ccxt/bingx.py +48 -48
- ccxt/bitbank.py +14 -14
- ccxt/bitbns.py +7 -7
- ccxt/bitfinex.py +2 -2
- ccxt/bitfinex2.py +35 -35
- ccxt/bitflyer.py +17 -17
- ccxt/bitforex.py +9 -9
- ccxt/bitget.py +433 -215
- ccxt/bitmart.py +39 -39
- ccxt/bitmex.py +7 -7
- ccxt/bitopro.py +1 -1
- ccxt/bitpanda.py +1 -1
- ccxt/bitrue.py +2 -2
- ccxt/bitso.py +2 -2
- ccxt/bitstamp.py +3 -3
- ccxt/bitvavo.py +2 -2
- ccxt/bl3p.py +1 -1
- ccxt/btcalpha.py +7 -7
- ccxt/btcturk.py +1 -1
- ccxt/bybit.py +58 -58
- ccxt/cex.py +1 -1
- ccxt/coinbase.py +13 -13
- ccxt/coinbasepro.py +15 -15
- ccxt/coinex.py +19 -19
- ccxt/coinone.py +2 -2
- ccxt/coinsph.py +4 -4
- ccxt/coinspot.py +2 -2
- ccxt/cryptocom.py +28 -28
- ccxt/currencycom.py +1 -1
- ccxt/delta.py +26 -26
- ccxt/deribit.py +9 -9
- ccxt/digifinex.py +38 -38
- ccxt/exmo.py +18 -18
- ccxt/gate.py +59 -59
- ccxt/gemini.py +4 -4
- ccxt/hitbtc.py +6 -6
- ccxt/hollaex.py +2 -2
- ccxt/huobi.py +70 -70
- ccxt/indodax.py +1 -1
- ccxt/kraken.py +33 -33
- ccxt/krakenfutures.py +6 -5
- ccxt/kucoin.py +74 -74
- ccxt/kucoinfutures.py +8 -8
- ccxt/latoken.py +14 -14
- ccxt/lbank2.py +33 -33
- ccxt/mexc.py +22 -22
- ccxt/ndax.py +1 -1
- ccxt/novadax.py +22 -22
- ccxt/oceanex.py +18 -18
- ccxt/okcoin.py +1950 -2758
- ccxt/okx.py +73 -73
- ccxt/paymium.py +11 -11
- ccxt/phemex.py +26 -26
- ccxt/poloniex.py +30 -30
- ccxt/poloniexfutures.py +25 -25
- ccxt/pro/__init__.py +1 -1
- ccxt/pro/ascendex.py +1 -1
- ccxt/pro/binance.py +9 -9
- ccxt/pro/bingx.py +12 -12
- ccxt/pro/bitget.py +2 -2
- ccxt/pro/bitpanda.py +7 -7
- ccxt/pro/bitrue.py +2 -2
- ccxt/pro/blockchaincom.py +6 -6
- ccxt/pro/bybit.py +15 -15
- ccxt/pro/cex.py +8 -8
- ccxt/pro/coinbase.py +6 -6
- ccxt/pro/coinbasepro.py +1 -1
- ccxt/pro/coinex.py +8 -8
- ccxt/pro/cryptocom.py +12 -12
- ccxt/pro/deribit.py +7 -7
- ccxt/pro/gemini.py +4 -4
- ccxt/pro/hitbtc.py +17 -17
- ccxt/pro/huobi.py +3 -3
- ccxt/pro/kraken.py +6 -6
- ccxt/pro/krakenfutures.py +10 -10
- ccxt/pro/kucoin.py +85 -42
- ccxt/pro/kucoinfutures.py +5 -5
- ccxt/pro/luno.py +1 -1
- ccxt/pro/mexc.py +7 -7
- ccxt/pro/okx.py +16 -15
- ccxt/pro/phemex.py +15 -15
- ccxt/pro/poloniex.py +9 -9
- ccxt/pro/poloniexfutures.py +5 -5
- ccxt/pro/probit.py +5 -5
- ccxt/pro/wazirx.py +5 -5
- ccxt/pro/woo.py +1 -1
- ccxt/probit.py +21 -21
- ccxt/test/base/test_shared_methods.py +1 -1
- ccxt/tokocrypto.py +22 -22
- ccxt/upbit.py +21 -21
- ccxt/wavesexchange.py +2 -2
- ccxt/wazirx.py +14 -14
- ccxt/whitebit.py +6 -6
- ccxt/woo.py +21 -21
- ccxt/yobit.py +16 -16
- ccxt/zaif.py +10 -10
- ccxt/zonda.py +15 -15
- {ccxt-4.1.19.dist-info → ccxt-4.1.22.dist-info}/METADATA +5 -9
- {ccxt-4.1.19.dist-info → ccxt-4.1.22.dist-info}/RECORD +179 -179
- {ccxt-4.1.19.dist-info → ccxt-4.1.22.dist-info}/WHEEL +0 -0
- {ccxt-4.1.19.dist-info → ccxt-4.1.22.dist-info}/top_level.txt +0 -0
ccxt/async_support/bitget.py
CHANGED
@@ -1088,7 +1088,7 @@ class bitget(Exchange, ImplicitAPI):
|
|
1088
1088
|
async def fetch_time(self, params={}):
|
1089
1089
|
"""
|
1090
1090
|
fetches the current integer timestamp in milliseconds from the exchange server
|
1091
|
-
see https://bitgetlimited.github.io/apidoc/en/spot/#get-server-time
|
1091
|
+
:see: https://bitgetlimited.github.io/apidoc/en/spot/#get-server-time
|
1092
1092
|
:param dict [params]: extra parameters specific to the bitget api endpoint
|
1093
1093
|
:returns int: the current integer timestamp in milliseconds from the exchange server
|
1094
1094
|
"""
|
@@ -1106,8 +1106,8 @@ class bitget(Exchange, ImplicitAPI):
|
|
1106
1106
|
async def fetch_markets(self, params={}):
|
1107
1107
|
"""
|
1108
1108
|
retrieves data on all markets for bitget
|
1109
|
-
see https://bitgetlimited.github.io/apidoc/en/spot/#get-symbols
|
1110
|
-
see https://bitgetlimited.github.io/apidoc/en/mix/#get-all-symbols
|
1109
|
+
:see: https://bitgetlimited.github.io/apidoc/en/spot/#get-symbols
|
1110
|
+
:see: https://bitgetlimited.github.io/apidoc/en/mix/#get-all-symbols
|
1111
1111
|
:param dict [params]: extra parameters specific to the exchange api endpoint
|
1112
1112
|
:returns dict[]: an array of objects representing market data
|
1113
1113
|
"""
|
@@ -1365,7 +1365,7 @@ class bitget(Exchange, ImplicitAPI):
|
|
1365
1365
|
async def fetch_currencies(self, params={}):
|
1366
1366
|
"""
|
1367
1367
|
fetches all available currencies on an exchange
|
1368
|
-
see https://bitgetlimited.github.io/apidoc/en/spot/#get-coin-list
|
1368
|
+
:see: https://bitgetlimited.github.io/apidoc/en/spot/#get-coin-list
|
1369
1369
|
:param dict [params]: extra parameters specific to the bitget api endpoint
|
1370
1370
|
:returns dict: an associative dictionary of currencies
|
1371
1371
|
"""
|
@@ -1483,7 +1483,7 @@ class bitget(Exchange, ImplicitAPI):
|
|
1483
1483
|
async def fetch_market_leverage_tiers(self, symbol: str, params={}):
|
1484
1484
|
"""
|
1485
1485
|
retrieve information on the maximum leverage, and maintenance margin for trades of varying trade sizes for a single market
|
1486
|
-
see https://bitgetlimited.github.io/apidoc/en/mix/#get-position-tier
|
1486
|
+
:see: https://bitgetlimited.github.io/apidoc/en/mix/#get-position-tier
|
1487
1487
|
:param str symbol: unified market symbol
|
1488
1488
|
:param dict [params]: extra parameters specific to the bitget api endpoint
|
1489
1489
|
:returns dict: a `leverage tiers structure <https://github.com/ccxt/ccxt/wiki/Manual#leverage-tiers-structure>`
|
@@ -1547,7 +1547,7 @@ class bitget(Exchange, ImplicitAPI):
|
|
1547
1547
|
async def fetch_deposits(self, code: Optional[str] = None, since: Optional[int] = None, limit: Optional[int] = None, params={}):
|
1548
1548
|
"""
|
1549
1549
|
fetch all deposits made to an account
|
1550
|
-
see https://bitgetlimited.github.io/apidoc/en/spot/#get-deposit-list
|
1550
|
+
:see: https://bitgetlimited.github.io/apidoc/en/spot/#get-deposit-list
|
1551
1551
|
:param str code: unified currency code
|
1552
1552
|
:param int [since]: the earliest time in ms to fetch deposits for
|
1553
1553
|
:param int [limit]: the maximum number of deposits structures to retrieve
|
@@ -1604,7 +1604,7 @@ class bitget(Exchange, ImplicitAPI):
|
|
1604
1604
|
async def withdraw(self, code: str, amount, address, tag=None, params={}):
|
1605
1605
|
"""
|
1606
1606
|
make a withdrawal
|
1607
|
-
see https://bitgetlimited.github.io/apidoc/en/spot/#withdraw-v2
|
1607
|
+
:see: https://bitgetlimited.github.io/apidoc/en/spot/#withdraw-v2
|
1608
1608
|
:param str code: unified currency code
|
1609
1609
|
:param float amount: the amount to withdraw
|
1610
1610
|
:param str address: the address to withdraw to
|
@@ -1690,7 +1690,7 @@ class bitget(Exchange, ImplicitAPI):
|
|
1690
1690
|
async def fetch_withdrawals(self, code: Optional[str] = None, since: Optional[int] = None, limit: Optional[int] = None, params={}):
|
1691
1691
|
"""
|
1692
1692
|
fetch all withdrawals made from an account
|
1693
|
-
see https://bitgetlimited.github.io/apidoc/en/spot/#get-withdraw-list
|
1693
|
+
:see: https://bitgetlimited.github.io/apidoc/en/spot/#get-withdraw-list
|
1694
1694
|
:param str code: unified currency code
|
1695
1695
|
:param int [since]: the earliest time in ms to fetch withdrawals for
|
1696
1696
|
:param int [limit]: the maximum number of withdrawals structures to retrieve
|
@@ -1810,7 +1810,7 @@ class bitget(Exchange, ImplicitAPI):
|
|
1810
1810
|
async def fetch_deposit_address(self, code: str, params={}):
|
1811
1811
|
"""
|
1812
1812
|
fetch the deposit address for a currency associated with self account
|
1813
|
-
see https://bitgetlimited.github.io/apidoc/en/spot/#get-coin-address
|
1813
|
+
:see: https://bitgetlimited.github.io/apidoc/en/spot/#get-coin-address
|
1814
1814
|
:param str code: unified currency code
|
1815
1815
|
:param dict [params]: extra parameters specific to the bitget api endpoint
|
1816
1816
|
:returns dict: an `address structure <https://github.com/ccxt/ccxt/wiki/Manual#address-structure>`
|
@@ -1865,8 +1865,8 @@ class bitget(Exchange, ImplicitAPI):
|
|
1865
1865
|
async def fetch_order_book(self, symbol: str, limit: Optional[int] = None, params={}):
|
1866
1866
|
"""
|
1867
1867
|
fetches information on open orders with bid(buy) and ask(sell) prices, volumes and other data
|
1868
|
-
see https://bitgetlimited.github.io/apidoc/en/spot/#get-depth
|
1869
|
-
see https://bitgetlimited.github.io/apidoc/en/mix/#get-depth
|
1868
|
+
:see: https://bitgetlimited.github.io/apidoc/en/spot/#get-depth
|
1869
|
+
:see: https://bitgetlimited.github.io/apidoc/en/mix/#get-depth
|
1870
1870
|
:param str symbol: unified symbol of the market to fetch the order book for
|
1871
1871
|
:param int [limit]: the maximum amount of order book entries to return
|
1872
1872
|
:param dict [params]: extra parameters specific to the bitget api endpoint
|
@@ -2019,8 +2019,8 @@ class bitget(Exchange, ImplicitAPI):
|
|
2019
2019
|
async def fetch_ticker(self, symbol: str, params={}):
|
2020
2020
|
"""
|
2021
2021
|
fetches a price ticker, a statistical calculation with the information calculated over the past 24 hours for a specific market
|
2022
|
-
see https://bitgetlimited.github.io/apidoc/en/spot/#get-single-ticker
|
2023
|
-
see https://bitgetlimited.github.io/apidoc/en/mix/#get-single-symbol-ticker
|
2022
|
+
:see: https://bitgetlimited.github.io/apidoc/en/spot/#get-single-ticker
|
2023
|
+
:see: https://bitgetlimited.github.io/apidoc/en/mix/#get-single-symbol-ticker
|
2024
2024
|
:param str symbol: unified symbol of the market to fetch the ticker for
|
2025
2025
|
:param dict [params]: extra parameters specific to the bitget api endpoint
|
2026
2026
|
:returns dict: a `ticker structure <https://github.com/ccxt/ccxt/wiki/Manual#ticker-structure>`
|
@@ -2061,8 +2061,8 @@ class bitget(Exchange, ImplicitAPI):
|
|
2061
2061
|
async def fetch_tickers(self, symbols: Optional[List[str]] = None, params={}):
|
2062
2062
|
"""
|
2063
2063
|
fetches price tickers for multiple markets, statistical calculations with the information calculated over the past 24 hours each market
|
2064
|
-
see https://bitgetlimited.github.io/apidoc/en/spot/#get-all-tickers
|
2065
|
-
see https://bitgetlimited.github.io/apidoc/en/mix/#get-all-symbol-ticker
|
2064
|
+
:see: https://bitgetlimited.github.io/apidoc/en/spot/#get-all-tickers
|
2065
|
+
:see: https://bitgetlimited.github.io/apidoc/en/mix/#get-all-symbol-ticker
|
2066
2066
|
:param str[]|None symbols: unified symbols of the markets to fetch the ticker for, all market tickers are returned if not assigned
|
2067
2067
|
:param dict [params]: extra parameters specific to the bitget api endpoint
|
2068
2068
|
:returns dict: a dictionary of `ticker structures <https://github.com/ccxt/ccxt/wiki/Manual#ticker-structure>`
|
@@ -2162,42 +2162,61 @@ class bitget(Exchange, ImplicitAPI):
|
|
2162
2162
|
# "symbol": "BTCUSDT_UMCBL"
|
2163
2163
|
# }
|
2164
2164
|
#
|
2165
|
-
#
|
2165
|
+
# spot: fetchMyTrades
|
2166
2166
|
#
|
2167
2167
|
# {
|
2168
|
-
# accountId:
|
2169
|
-
# symbol:
|
2170
|
-
# orderId:
|
2171
|
-
# fillId:
|
2172
|
-
# orderType:
|
2173
|
-
# side:
|
2174
|
-
# fillPrice:
|
2175
|
-
# fillQuantity:
|
2176
|
-
# fillTotalAmount:
|
2177
|
-
# feeCcy:
|
2178
|
-
# fees:
|
2179
|
-
#
|
2168
|
+
# "accountId": "7264631750",
|
2169
|
+
# "symbol": "BTCUSDT_SPBL",
|
2170
|
+
# "orderId": "1098394344925597696",
|
2171
|
+
# "fillId": "1098394344974925824",
|
2172
|
+
# "orderType": "market",
|
2173
|
+
# "side": "sell",
|
2174
|
+
# "fillPrice": "28467.68",
|
2175
|
+
# "fillQuantity": "0.0002",
|
2176
|
+
# "fillTotalAmount": "5.693536",
|
2177
|
+
# "feeCcy": "USDT",
|
2178
|
+
# "fees": "-0.005693536",
|
2179
|
+
# "takerMakerFlag": "taker",
|
2180
|
+
# "cTime": "1697603539699"
|
2180
2181
|
# }
|
2181
2182
|
#
|
2183
|
+
# swap and future: fetchMyTrades
|
2184
|
+
#
|
2182
2185
|
# {
|
2183
|
-
# tradeId:
|
2184
|
-
# symbol:
|
2185
|
-
# orderId:
|
2186
|
-
# price:
|
2187
|
-
# sizeQty:
|
2188
|
-
# fee:
|
2189
|
-
# side:
|
2190
|
-
# fillAmount:
|
2191
|
-
# profit:
|
2192
|
-
#
|
2186
|
+
# "tradeId": "1099351653724958721",
|
2187
|
+
# "symbol": "BTCUSDT_UMCBL",
|
2188
|
+
# "orderId": "1099351653682413569",
|
2189
|
+
# "price": "29531.3",
|
2190
|
+
# "sizeQty": "0.001",
|
2191
|
+
# "fee": "-0.01771878",
|
2192
|
+
# "side": "close_long",
|
2193
|
+
# "fillAmount": "29.5313",
|
2194
|
+
# "profit": "0.001",
|
2195
|
+
# "enterPointSource": "WEB",
|
2196
|
+
# "tradeSide": "close_long",
|
2197
|
+
# "holdMode": "double_hold",
|
2198
|
+
# "takerMakerFlag": "taker",
|
2199
|
+
# "cTime": "1697831779891"
|
2200
|
+
# }
|
2201
|
+
#
|
2202
|
+
# isolated and cross margin: fetchMyTrades
|
2203
|
+
#
|
2204
|
+
# {
|
2205
|
+
# "orderId": "1099353730455318528",
|
2206
|
+
# "fillId": "1099353730627092481",
|
2207
|
+
# "orderType": "market",
|
2208
|
+
# "side": "sell",
|
2209
|
+
# "fillPrice": "29543.7",
|
2210
|
+
# "fillQuantity": "0.0001",
|
2211
|
+
# "fillTotalAmount": "2.95437",
|
2212
|
+
# "feeCcy": "USDT",
|
2213
|
+
# "fees": "-0.00295437",
|
2214
|
+
# "ctime": "1697832275063"
|
2193
2215
|
# }
|
2194
2216
|
#
|
2195
2217
|
marketId = self.safe_string(trade, 'symbol')
|
2196
2218
|
symbol = self.safe_symbol(marketId, market)
|
2197
|
-
|
2198
|
-
amount = self.safe_string(trade, 'sizeQty', amount)
|
2199
|
-
timestamp = self.safe_integer_2(trade, 'fillTime', 'timestamp')
|
2200
|
-
timestamp = self.safe_integer(trade, 'cTime', timestamp)
|
2219
|
+
timestamp = self.safe_integer_n(trade, ['fillTime', 'timestamp', 'ctime', 'cTime'])
|
2201
2220
|
fee = None
|
2202
2221
|
feeAmount = self.safe_string(trade, 'fees')
|
2203
2222
|
if feeAmount is not None:
|
@@ -2207,7 +2226,6 @@ class bitget(Exchange, ImplicitAPI):
|
|
2207
2226
|
'currency': currencyCode,
|
2208
2227
|
'cost': Precise.string_neg(feeAmount),
|
2209
2228
|
}
|
2210
|
-
datetime = self.iso8601(timestamp)
|
2211
2229
|
return self.safe_trade({
|
2212
2230
|
'info': trade,
|
2213
2231
|
'id': self.safe_string_2(trade, 'tradeId', 'fillId'),
|
@@ -2215,22 +2233,22 @@ class bitget(Exchange, ImplicitAPI):
|
|
2215
2233
|
'symbol': symbol,
|
2216
2234
|
'side': self.safe_string_lower(trade, 'side'),
|
2217
2235
|
'type': self.safe_string(trade, 'orderType'),
|
2218
|
-
'takerOrMaker':
|
2236
|
+
'takerOrMaker': self.safe_string(trade, 'takerMakerFlag'),
|
2219
2237
|
'price': self.safe_string_2(trade, 'fillPrice', 'price'),
|
2220
|
-
'amount':
|
2238
|
+
'amount': self.safe_string_n(trade, ['fillQuantity', 'size', 'sizeQty']),
|
2221
2239
|
'cost': None,
|
2222
|
-
'fee': fee,
|
2223
2240
|
'timestamp': timestamp,
|
2224
|
-
'datetime':
|
2241
|
+
'datetime': self.iso8601(timestamp),
|
2242
|
+
'fee': fee,
|
2225
2243
|
}, market)
|
2226
2244
|
|
2227
2245
|
async def fetch_trades(self, symbol: str, since: Optional[int] = None, limit: Optional[int] = None, params={}):
|
2228
2246
|
"""
|
2229
2247
|
get the list of most recent trades for a particular symbol
|
2230
|
-
see https://bitgetlimited.github.io/apidoc/en/spot/#get-market-trades
|
2231
|
-
see https://bitgetlimited.github.io/apidoc/en/mix/#get-fills
|
2232
|
-
see https://bitgetlimited.github.io/apidoc/en/spot/#get-recent-trades
|
2233
|
-
see https://bitgetlimited.github.io/apidoc/en/mix/#get-recent-fills
|
2248
|
+
:see: https://bitgetlimited.github.io/apidoc/en/spot/#get-market-trades
|
2249
|
+
:see: https://bitgetlimited.github.io/apidoc/en/mix/#get-fills
|
2250
|
+
:see: https://bitgetlimited.github.io/apidoc/en/spot/#get-recent-trades
|
2251
|
+
:see: https://bitgetlimited.github.io/apidoc/en/mix/#get-recent-fills
|
2234
2252
|
:param str symbol: unified symbol of the market to fetch trades for
|
2235
2253
|
:param int [since]: timestamp in ms of the earliest trade to fetch
|
2236
2254
|
:param int [limit]: the maximum amount of trades to fetch
|
@@ -2332,7 +2350,7 @@ class bitget(Exchange, ImplicitAPI):
|
|
2332
2350
|
async def fetch_trading_fee(self, symbol: str, params={}):
|
2333
2351
|
"""
|
2334
2352
|
fetch the trading fees for a market
|
2335
|
-
see https://bitgetlimited.github.io/apidoc/en/spot/#get-single-symbol
|
2353
|
+
:see: https://bitgetlimited.github.io/apidoc/en/spot/#get-single-symbol
|
2336
2354
|
:param str symbol: unified market symbol
|
2337
2355
|
:param dict [params]: extra parameters specific to the bitget api endpoint
|
2338
2356
|
:returns dict: a `fee structure <https://github.com/ccxt/ccxt/wiki/Manual#fee-structure>`
|
@@ -2369,7 +2387,7 @@ class bitget(Exchange, ImplicitAPI):
|
|
2369
2387
|
async def fetch_trading_fees(self, params={}):
|
2370
2388
|
"""
|
2371
2389
|
fetch the trading fees for multiple markets
|
2372
|
-
see https://bitgetlimited.github.io/apidoc/en/spot/#get-symbols
|
2390
|
+
:see: https://bitgetlimited.github.io/apidoc/en/spot/#get-symbols
|
2373
2391
|
:param dict [params]: extra parameters specific to the bitget api endpoint
|
2374
2392
|
:returns dict: a dictionary of `fee structures <https://github.com/ccxt/ccxt/wiki/Manual#fee-structure>` indexed by market symbols
|
2375
2393
|
"""
|
@@ -2455,12 +2473,12 @@ class bitget(Exchange, ImplicitAPI):
|
|
2455
2473
|
async def fetch_ohlcv(self, symbol: str, timeframe='1m', since: Optional[int] = None, limit: Optional[int] = None, params={}):
|
2456
2474
|
"""
|
2457
2475
|
fetches historical candlestick data containing the open, high, low, and close price, and the volume of a market
|
2458
|
-
see https://bitgetlimited.github.io/apidoc/en/spot/#get-candle-data
|
2459
|
-
see https://bitgetlimited.github.io/apidoc/en/spot/#get-history-candle-data
|
2460
|
-
see https://bitgetlimited.github.io/apidoc/en/mix/#get-candle-data
|
2461
|
-
see https://bitgetlimited.github.io/apidoc/en/mix/#get-history-candle-data
|
2462
|
-
see https://bitgetlimited.github.io/apidoc/en/mix/#get-history-index-candle-data
|
2463
|
-
see https://bitgetlimited.github.io/apidoc/en/mix/#get-history-mark-candle-data
|
2476
|
+
:see: https://bitgetlimited.github.io/apidoc/en/spot/#get-candle-data
|
2477
|
+
:see: https://bitgetlimited.github.io/apidoc/en/spot/#get-history-candle-data
|
2478
|
+
:see: https://bitgetlimited.github.io/apidoc/en/mix/#get-candle-data
|
2479
|
+
:see: https://bitgetlimited.github.io/apidoc/en/mix/#get-history-candle-data
|
2480
|
+
:see: https://bitgetlimited.github.io/apidoc/en/mix/#get-history-index-candle-data
|
2481
|
+
:see: https://bitgetlimited.github.io/apidoc/en/mix/#get-history-mark-candle-data
|
2464
2482
|
:param str symbol: unified symbol of the market to fetch OHLCV data for
|
2465
2483
|
:param str timeframe: the length of time each candle represents
|
2466
2484
|
:param int [since]: timestamp in ms of the earliest candle to fetch
|
@@ -2548,10 +2566,10 @@ class bitget(Exchange, ImplicitAPI):
|
|
2548
2566
|
async def fetch_balance(self, params={}):
|
2549
2567
|
"""
|
2550
2568
|
query for balance and get the amount of funds available for trading or funds locked in orders
|
2551
|
-
see https://bitgetlimited.github.io/apidoc/en/spot/#get-account-assets
|
2552
|
-
see https://bitgetlimited.github.io/apidoc/en/mix/#get-account-list
|
2553
|
-
see https://bitgetlimited.github.io/apidoc/en/margin/#get-cross-assets
|
2554
|
-
see https://bitgetlimited.github.io/apidoc/en/margin/#get-isolated-assets
|
2569
|
+
:see: https://bitgetlimited.github.io/apidoc/en/spot/#get-account-assets
|
2570
|
+
:see: https://bitgetlimited.github.io/apidoc/en/mix/#get-account-list
|
2571
|
+
:see: https://bitgetlimited.github.io/apidoc/en/margin/#get-cross-assets
|
2572
|
+
:see: https://bitgetlimited.github.io/apidoc/en/margin/#get-isolated-assets
|
2555
2573
|
:param dict [params]: extra parameters specific to the bitget api endpoint
|
2556
2574
|
:returns dict: a `balance structure <https://github.com/ccxt/ccxt/wiki/Manual#balance-structure>`
|
2557
2575
|
"""
|
@@ -2844,24 +2862,36 @@ class bitget(Exchange, ImplicitAPI):
|
|
2844
2862
|
# "data": "1098753830701928448"
|
2845
2863
|
# }
|
2846
2864
|
#
|
2865
|
+
# isolated and cross margin: fetchOpenOrders, fetchCanceledOrders, fetchClosedOrders
|
2866
|
+
#
|
2867
|
+
# {
|
2868
|
+
# "symbol": "BTCUSDT",
|
2869
|
+
# "orderType": "limit",
|
2870
|
+
# "source": "WEB",
|
2871
|
+
# "orderId": "1099108898629627904",
|
2872
|
+
# "clientOid": "f9b55416029e4cc2bbbe2f40ac368c38",
|
2873
|
+
# "loanType": "autoLoan",
|
2874
|
+
# "price": "25000",
|
2875
|
+
# "side": "buy",
|
2876
|
+
# "status": "new",
|
2877
|
+
# "baseQuantity": "0.0002",
|
2878
|
+
# "quoteAmount": "5",
|
2879
|
+
# "fillPrice": "0",
|
2880
|
+
# "fillQuantity": "0",
|
2881
|
+
# "fillTotalAmount": "0",
|
2882
|
+
# "ctime": "1697773902588"
|
2883
|
+
# }
|
2884
|
+
#
|
2847
2885
|
marketId = self.safe_string(order, 'symbol')
|
2848
2886
|
market = self.safe_market(marketId, market)
|
2849
|
-
|
2850
|
-
|
2851
|
-
|
2852
|
-
amount = self.safe_string_2(order, 'quantity', 'size')
|
2853
|
-
filled = self.safe_string_2(order, 'fillQuantity', 'filledQty')
|
2854
|
-
cost = self.safe_string_2(order, 'fillTotalAmount', 'filledAmount')
|
2855
|
-
average = self.safe_string_2(order, 'fillPrice', 'priceAvg')
|
2856
|
-
type = self.safe_string(order, 'orderType')
|
2857
|
-
timestamp = self.safe_integer(order, 'cTime')
|
2858
|
-
lastUpdatetimestamp = self.safe_integer(order, 'uTime')
|
2887
|
+
timestamp = self.safe_integer_2(order, 'cTime', 'ctime')
|
2888
|
+
updateTimestamp = self.safe_integer(order, 'uTime')
|
2889
|
+
rawStatus = self.safe_string_2(order, 'status', 'state')
|
2859
2890
|
side = self.safe_string_2(order, 'side', 'posSide')
|
2860
2891
|
if (side == 'open_long') or (side == 'close_short'):
|
2861
2892
|
side = 'buy'
|
2862
2893
|
elif (side == 'close_long') or (side == 'open_short'):
|
2863
2894
|
side = 'sell'
|
2864
|
-
clientOrderId = self.safe_string_2(order, 'clientOrderId', 'clientOid')
|
2865
2895
|
fee = None
|
2866
2896
|
feeCostString = self.safe_string(order, 'fee')
|
2867
2897
|
if feeCostString is not None:
|
@@ -2879,31 +2909,28 @@ class bitget(Exchange, ImplicitAPI):
|
|
2879
2909
|
'cost': self.safe_string(first, 'totalFee'),
|
2880
2910
|
'currency': self.safe_currency_code(self.safe_string(first, 'feeCoinCode')),
|
2881
2911
|
}
|
2882
|
-
rawStatus = self.safe_string_2(order, 'status', 'state')
|
2883
|
-
status = self.parse_order_status(rawStatus)
|
2884
|
-
lastTradeTimestamp = self.safe_integer(order, 'uTime')
|
2885
2912
|
return self.safe_order({
|
2886
2913
|
'info': order,
|
2887
|
-
'id':
|
2888
|
-
'clientOrderId': clientOrderId,
|
2914
|
+
'id': self.safe_string_2(order, 'orderId', 'data'),
|
2915
|
+
'clientOrderId': self.safe_string_2(order, 'clientOrderId', 'clientOid'),
|
2889
2916
|
'timestamp': timestamp,
|
2890
2917
|
'datetime': self.iso8601(timestamp),
|
2891
|
-
'lastTradeTimestamp':
|
2892
|
-
'lastUpdateTimestamp':
|
2893
|
-
'symbol': symbol,
|
2894
|
-
'type':
|
2918
|
+
'lastTradeTimestamp': updateTimestamp,
|
2919
|
+
'lastUpdateTimestamp': updateTimestamp,
|
2920
|
+
'symbol': market['symbol'],
|
2921
|
+
'type': self.safe_string(order, 'orderType'),
|
2895
2922
|
'timeInForce': None,
|
2896
2923
|
'postOnly': None,
|
2897
2924
|
'side': side,
|
2898
|
-
'price': price,
|
2925
|
+
'price': self.safe_string_2(order, 'price', 'executePrice'),
|
2899
2926
|
'stopPrice': self.safe_number(order, 'triggerPrice'),
|
2900
2927
|
'triggerPrice': self.safe_number(order, 'triggerPrice'),
|
2901
|
-
'average':
|
2902
|
-
'cost':
|
2903
|
-
'amount':
|
2904
|
-
'filled':
|
2928
|
+
'average': self.safe_string_2(order, 'fillPrice', 'priceAvg'),
|
2929
|
+
'cost': self.safe_string_2(order, 'fillTotalAmount', 'filledAmount'),
|
2930
|
+
'amount': self.safe_string_n(order, ['quantity', 'size', 'baseQuantity']),
|
2931
|
+
'filled': self.safe_string_2(order, 'fillQuantity', 'filledQty'),
|
2905
2932
|
'remaining': None,
|
2906
|
-
'status':
|
2933
|
+
'status': self.parse_order_status(rawStatus),
|
2907
2934
|
'fee': fee,
|
2908
2935
|
'trades': None,
|
2909
2936
|
}, market)
|
@@ -2911,14 +2938,14 @@ class bitget(Exchange, ImplicitAPI):
|
|
2911
2938
|
async def create_order(self, symbol: str, type: OrderType, side: OrderSide, amount, price=None, params={}):
|
2912
2939
|
"""
|
2913
2940
|
create a trade order
|
2914
|
-
see https://bitgetlimited.github.io/apidoc/en/spot/#place-order
|
2915
|
-
see https://bitgetlimited.github.io/apidoc/en/spot/#place-plan-order
|
2916
|
-
see https://bitgetlimited.github.io/apidoc/en/mix/#place-order
|
2917
|
-
see https://bitgetlimited.github.io/apidoc/en/mix/#place-stop-order
|
2918
|
-
see https://bitgetlimited.github.io/apidoc/en/mix/#place-position-tpsl
|
2919
|
-
see https://bitgetlimited.github.io/apidoc/en/mix/#place-plan-order
|
2920
|
-
see https://bitgetlimited.github.io/apidoc/en/margin/#isolated-place-order
|
2921
|
-
see https://bitgetlimited.github.io/apidoc/en/margin/#cross-place-order
|
2941
|
+
:see: https://bitgetlimited.github.io/apidoc/en/spot/#place-order
|
2942
|
+
:see: https://bitgetlimited.github.io/apidoc/en/spot/#place-plan-order
|
2943
|
+
:see: https://bitgetlimited.github.io/apidoc/en/mix/#place-order
|
2944
|
+
:see: https://bitgetlimited.github.io/apidoc/en/mix/#place-stop-order
|
2945
|
+
:see: https://bitgetlimited.github.io/apidoc/en/mix/#place-position-tpsl
|
2946
|
+
:see: https://bitgetlimited.github.io/apidoc/en/mix/#place-plan-order
|
2947
|
+
:see: https://bitgetlimited.github.io/apidoc/en/margin/#isolated-place-order
|
2948
|
+
:see: https://bitgetlimited.github.io/apidoc/en/margin/#cross-place-order
|
2922
2949
|
:param str symbol: unified symbol of the market to create an order in
|
2923
2950
|
:param str type: 'market' or 'limit'
|
2924
2951
|
:param str side: 'buy' or 'sell' or 'open_long' or 'open_short' or 'close_long' or 'close_short'
|
@@ -3099,10 +3126,10 @@ class bitget(Exchange, ImplicitAPI):
|
|
3099
3126
|
async def edit_order(self, id: str, symbol, type, side, amount=None, price=None, params={}):
|
3100
3127
|
"""
|
3101
3128
|
edit a trade order
|
3102
|
-
see https://bitgetlimited.github.io/apidoc/en/spot/#modify-plan-order
|
3103
|
-
see https://bitgetlimited.github.io/apidoc/en/mix/#modify-plan-order
|
3104
|
-
see https://bitgetlimited.github.io/apidoc/en/mix/#modify-plan-order-tpsl
|
3105
|
-
see https://bitgetlimited.github.io/apidoc/en/mix/#modify-stop-order
|
3129
|
+
:see: https://bitgetlimited.github.io/apidoc/en/spot/#modify-plan-order
|
3130
|
+
:see: https://bitgetlimited.github.io/apidoc/en/mix/#modify-plan-order
|
3131
|
+
:see: https://bitgetlimited.github.io/apidoc/en/mix/#modify-plan-order-tpsl
|
3132
|
+
:see: https://bitgetlimited.github.io/apidoc/en/mix/#modify-stop-order
|
3106
3133
|
:param str id: cancel order id
|
3107
3134
|
:param str symbol: unified symbol of the market to create an order in
|
3108
3135
|
:param str type: 'market' or 'limit'
|
@@ -3190,12 +3217,12 @@ class bitget(Exchange, ImplicitAPI):
|
|
3190
3217
|
async def cancel_order(self, id: str, symbol: Optional[str] = None, params={}):
|
3191
3218
|
"""
|
3192
3219
|
cancels an open order
|
3193
|
-
see https://bitgetlimited.github.io/apidoc/en/spot/#cancel-order
|
3194
|
-
see https://bitgetlimited.github.io/apidoc/en/spot/#cancel-plan-order
|
3195
|
-
see https://bitgetlimited.github.io/apidoc/en/mix/#cancel-order
|
3196
|
-
see https://bitgetlimited.github.io/apidoc/en/mix/#cancel-plan-order-tpsl
|
3197
|
-
see https://bitgetlimited.github.io/apidoc/en/margin/#isolated-cancel-order
|
3198
|
-
see https://bitgetlimited.github.io/apidoc/en/margin/#cross-cancel-order
|
3220
|
+
:see: https://bitgetlimited.github.io/apidoc/en/spot/#cancel-order
|
3221
|
+
:see: https://bitgetlimited.github.io/apidoc/en/spot/#cancel-plan-order
|
3222
|
+
:see: https://bitgetlimited.github.io/apidoc/en/mix/#cancel-order
|
3223
|
+
:see: https://bitgetlimited.github.io/apidoc/en/mix/#cancel-plan-order-tpsl
|
3224
|
+
:see: https://bitgetlimited.github.io/apidoc/en/margin/#isolated-cancel-order
|
3225
|
+
:see: https://bitgetlimited.github.io/apidoc/en/margin/#cross-cancel-order
|
3199
3226
|
:param str id: order id
|
3200
3227
|
:param str symbol: unified symbol of the market the order was made in
|
3201
3228
|
:param dict [params]: extra parameters specific to the bitget api endpoint
|
@@ -3308,10 +3335,10 @@ class bitget(Exchange, ImplicitAPI):
|
|
3308
3335
|
async def cancel_orders(self, ids, symbol: Optional[str] = None, params={}):
|
3309
3336
|
"""
|
3310
3337
|
cancel multiple orders
|
3311
|
-
see https://bitgetlimited.github.io/apidoc/en/spot/#cancel-order-in-batch-v2-single-instruments
|
3312
|
-
see https://bitgetlimited.github.io/apidoc/en/mix/#batch-cancel-order
|
3313
|
-
see https://bitgetlimited.github.io/apidoc/en/margin/#isolated-batch-cancel-orders
|
3314
|
-
see https://bitgetlimited.github.io/apidoc/en/margin/#cross-batch-cancel-order
|
3338
|
+
:see: https://bitgetlimited.github.io/apidoc/en/spot/#cancel-order-in-batch-v2-single-instruments
|
3339
|
+
:see: https://bitgetlimited.github.io/apidoc/en/mix/#batch-cancel-order
|
3340
|
+
:see: https://bitgetlimited.github.io/apidoc/en/margin/#isolated-batch-cancel-orders
|
3341
|
+
:see: https://bitgetlimited.github.io/apidoc/en/margin/#cross-batch-cancel-order
|
3315
3342
|
:param str[] ids: order ids
|
3316
3343
|
:param str symbol: unified market symbol, default is None
|
3317
3344
|
:param dict [params]: extra parameters specific to the bitget api endpoint
|
@@ -3383,10 +3410,10 @@ class bitget(Exchange, ImplicitAPI):
|
|
3383
3410
|
async def cancel_all_orders(self, symbol: Optional[str] = None, params={}):
|
3384
3411
|
"""
|
3385
3412
|
cancel all open orders
|
3386
|
-
see https://bitgetlimited.github.io/apidoc/en/mix/#cancel-all-order
|
3387
|
-
see https://bitgetlimited.github.io/apidoc/en/mix/#cancel-all-trigger-order-tpsl
|
3388
|
-
see https://bitgetlimited.github.io/apidoc/en/margin/#isolated-batch-cancel-orders
|
3389
|
-
see https://bitgetlimited.github.io/apidoc/en/margin/#cross-batch-cancel-order
|
3413
|
+
:see: https://bitgetlimited.github.io/apidoc/en/mix/#cancel-all-order
|
3414
|
+
:see: https://bitgetlimited.github.io/apidoc/en/mix/#cancel-all-trigger-order-tpsl
|
3415
|
+
:see: https://bitgetlimited.github.io/apidoc/en/margin/#isolated-batch-cancel-orders
|
3416
|
+
:see: https://bitgetlimited.github.io/apidoc/en/margin/#cross-batch-cancel-order
|
3390
3417
|
:param str symbol: unified market symbol
|
3391
3418
|
:param dict [params]: extra parameters specific to the bitget api endpoint
|
3392
3419
|
:param str [params.marginMode]: 'isolated' or 'cross' for spot margin trading
|
@@ -3419,7 +3446,7 @@ class bitget(Exchange, ImplicitAPI):
|
|
3419
3446
|
return await self.privateMarginPostIsolatedOrderBatchCancelOrder(self.extend(spotMarginRequest, params))
|
3420
3447
|
request = {
|
3421
3448
|
'productType': productType,
|
3422
|
-
'marginCoin': market
|
3449
|
+
'marginCoin': self.safe_string(market, 'settleId', 'USDT'),
|
3423
3450
|
}
|
3424
3451
|
stop = self.safe_value_2(params, 'stop', 'trigger')
|
3425
3452
|
planType = self.safe_string(params, 'planType')
|
@@ -3454,8 +3481,8 @@ class bitget(Exchange, ImplicitAPI):
|
|
3454
3481
|
async def fetch_order(self, id: str, symbol: Optional[str] = None, params={}):
|
3455
3482
|
"""
|
3456
3483
|
fetches information on an order made by the user
|
3457
|
-
see https://bitgetlimited.github.io/apidoc/en/spot/#get-order-details
|
3458
|
-
see https://bitgetlimited.github.io/apidoc/en/mix/#get-order-details
|
3484
|
+
:see: https://bitgetlimited.github.io/apidoc/en/spot/#get-order-details
|
3485
|
+
:see: https://bitgetlimited.github.io/apidoc/en/mix/#get-order-details
|
3459
3486
|
:param str symbol: unified symbol of the market the order was made in
|
3460
3487
|
:param dict [params]: extra parameters specific to the bitget api endpoint
|
3461
3488
|
:returns dict: An `order structure <https://github.com/ccxt/ccxt/wiki/Manual#order-structure>`
|
@@ -3535,10 +3562,13 @@ class bitget(Exchange, ImplicitAPI):
|
|
3535
3562
|
async def fetch_open_orders(self, symbol: Optional[str] = None, since: Optional[int] = None, limit: Optional[int] = None, params={}):
|
3536
3563
|
"""
|
3537
3564
|
fetch all unfilled currently open orders
|
3538
|
-
see https://bitgetlimited.github.io/apidoc/en/spot/#get-order-list
|
3539
|
-
see https://bitgetlimited.github.io/apidoc/en/
|
3540
|
-
see https://bitgetlimited.github.io/apidoc/en/mix/#get-
|
3541
|
-
see https://bitgetlimited.github.io/apidoc/en/mix/#get-
|
3565
|
+
:see: https://bitgetlimited.github.io/apidoc/en/spot/#get-order-list
|
3566
|
+
:see: https://bitgetlimited.github.io/apidoc/en/spot/#get-current-plan-orders
|
3567
|
+
:see: https://bitgetlimited.github.io/apidoc/en/mix/#get-all-open-order
|
3568
|
+
:see: https://bitgetlimited.github.io/apidoc/en/mix/#get-plan-order-tpsl-list
|
3569
|
+
:see: https://bitgetlimited.github.io/apidoc/en/mix/#get-open-order
|
3570
|
+
:see: https://bitgetlimited.github.io/apidoc/en/margin/#isolated-open-orders
|
3571
|
+
:see: https://bitgetlimited.github.io/apidoc/en/margin/#get-cross-open-orders
|
3542
3572
|
:param str symbol: unified market symbol
|
3543
3573
|
:param int [since]: the earliest time in ms to fetch open orders for
|
3544
3574
|
:param int [limit]: the maximum number of open order structures to retrieve
|
@@ -3547,27 +3577,46 @@ class bitget(Exchange, ImplicitAPI):
|
|
3547
3577
|
"""
|
3548
3578
|
await self.load_markets()
|
3549
3579
|
request = {}
|
3550
|
-
marketType = None
|
3551
|
-
query = None
|
3552
3580
|
market = None
|
3581
|
+
marketType = None
|
3582
|
+
marginMode = None
|
3583
|
+
response = None
|
3553
3584
|
if symbol is not None:
|
3554
3585
|
market = self.market(symbol)
|
3555
|
-
|
3556
|
-
|
3557
|
-
|
3558
|
-
|
3586
|
+
symbolRequest = (market['info']['symbolName']) if (marginMode is not None) else (market['id'])
|
3587
|
+
request['symbol'] = symbolRequest
|
3588
|
+
marketType, params = self.handle_market_type_and_params('fetchOpenOrders', market, params)
|
3589
|
+
marginMode, params = self.handle_margin_mode_and_params('fetchOpenOrders', params)
|
3590
|
+
stop = self.safe_value_2(params, 'stop', 'trigger')
|
3591
|
+
params = self.omit(params, ['stop', 'trigger'])
|
3559
3592
|
if stop:
|
3560
3593
|
self.check_required_symbol('fetchOpenOrders', symbol)
|
3561
|
-
query = self.omit(query, 'stop')
|
3562
3594
|
if marketType == 'spot':
|
3563
3595
|
if limit is not None:
|
3564
3596
|
request['pageSize'] = limit
|
3565
|
-
response = await self.privateSpotPostPlanCurrentPlan(self.extend(request,
|
3597
|
+
response = await self.privateSpotPostPlanCurrentPlan(self.extend(request, params))
|
3566
3598
|
else:
|
3567
|
-
response = await self.privateMixGetPlanCurrentPlan(self.extend(request,
|
3599
|
+
response = await self.privateMixGetPlanCurrentPlan(self.extend(request, params))
|
3568
3600
|
else:
|
3569
3601
|
if marketType == 'spot':
|
3570
|
-
|
3602
|
+
if marginMode is not None:
|
3603
|
+
clientOrderId = self.safe_string_2(params, 'clientOid', 'clientOrderId')
|
3604
|
+
endTime = self.safe_integer_n(params, ['endTime', 'until', 'till'])
|
3605
|
+
params = self.omit(params, ['until', 'till', 'clientOrderId'])
|
3606
|
+
if clientOrderId is not None:
|
3607
|
+
request['clientOid'] = clientOrderId
|
3608
|
+
if endTime is not None:
|
3609
|
+
request['endTime'] = endTime
|
3610
|
+
if since is not None:
|
3611
|
+
request['startTime'] = since
|
3612
|
+
if limit is not None:
|
3613
|
+
request['pageSize'] = limit
|
3614
|
+
if marginMode == 'isolated':
|
3615
|
+
response = await self.privateMarginGetIsolatedOrderOpenOrders(self.extend(request, params))
|
3616
|
+
elif marginMode == 'cross':
|
3617
|
+
response = await self.privateMarginGetCrossOrderOpenOrders(self.extend(request, params))
|
3618
|
+
else:
|
3619
|
+
response = await self.privateSpotPostTradeOpenOrders(self.extend(request, params))
|
3571
3620
|
else:
|
3572
3621
|
if market is None:
|
3573
3622
|
subType = None
|
@@ -3577,9 +3626,10 @@ class bitget(Exchange, ImplicitAPI):
|
|
3577
3626
|
if sandboxMode:
|
3578
3627
|
productType = 'S' + productType
|
3579
3628
|
request['productType'] = productType
|
3580
|
-
response = await self.privateMixGetOrderMarginCoinCurrent(self.extend(request,
|
3629
|
+
response = await self.privateMixGetOrderMarginCoinCurrent(self.extend(request, params))
|
3581
3630
|
else:
|
3582
|
-
|
3631
|
+
self.check_required_symbol('fetchOpenOrders', symbol)
|
3632
|
+
response = await self.privateMixGetOrderCurrent(self.extend(request, params))
|
3583
3633
|
#
|
3584
3634
|
# spot
|
3585
3635
|
# {
|
@@ -3683,9 +3733,43 @@ class bitget(Exchange, ImplicitAPI):
|
|
3683
3733
|
# }
|
3684
3734
|
# }
|
3685
3735
|
#
|
3736
|
+
# isolated and cross margin
|
3737
|
+
#
|
3738
|
+
# {
|
3739
|
+
# "code": "00000",
|
3740
|
+
# "msg": "success",
|
3741
|
+
# "requestTime": 1697773997250,
|
3742
|
+
# "data": {
|
3743
|
+
# "orderList": [
|
3744
|
+
# {
|
3745
|
+
# "symbol": "BTCUSDT",
|
3746
|
+
# "orderType": "limit",
|
3747
|
+
# "source": "WEB",
|
3748
|
+
# "orderId": "1099108898629627904",
|
3749
|
+
# "clientOid": "f9b55416029e4cc2bbbe2f40ac368c38",
|
3750
|
+
# "loanType": "autoLoan",
|
3751
|
+
# "price": "25000",
|
3752
|
+
# "side": "buy",
|
3753
|
+
# "status": "new",
|
3754
|
+
# "baseQuantity": "0.0002",
|
3755
|
+
# "quoteAmount": "5",
|
3756
|
+
# "fillPrice": "0",
|
3757
|
+
# "fillQuantity": "0",
|
3758
|
+
# "fillTotalAmount": "0",
|
3759
|
+
# "ctime": "1697773902588"
|
3760
|
+
# }
|
3761
|
+
# ],
|
3762
|
+
# "maxId": "1099108898629627904",
|
3763
|
+
# "minId": "1099108898629627904"
|
3764
|
+
# }
|
3765
|
+
# }
|
3766
|
+
#
|
3686
3767
|
if isinstance(response, str):
|
3687
3768
|
response = json.loads(response)
|
3688
3769
|
data = self.safe_value(response, 'data', [])
|
3770
|
+
if marginMode is not None:
|
3771
|
+
resultList = self.safe_value(data, 'orderList', [])
|
3772
|
+
return self.parse_orders(resultList, market, since, limit)
|
3689
3773
|
if not isinstance(data, list):
|
3690
3774
|
result = self.safe_value(data, 'orderList', [])
|
3691
3775
|
return self.add_pagination_cursor_to_result(data, result)
|
@@ -3694,10 +3778,12 @@ class bitget(Exchange, ImplicitAPI):
|
|
3694
3778
|
async def fetch_closed_orders(self, symbol: Optional[str] = None, since: Optional[int] = None, limit: Optional[int] = None, params={}):
|
3695
3779
|
"""
|
3696
3780
|
fetches information on multiple closed orders made by the user
|
3697
|
-
see https://bitgetlimited.github.io/apidoc/en/spot/#get-order-history
|
3698
|
-
see https://bitgetlimited.github.io/apidoc/en/
|
3699
|
-
see https://bitgetlimited.github.io/apidoc/en/mix/#get-history-
|
3700
|
-
see https://bitgetlimited.github.io/apidoc/en/
|
3781
|
+
:see: https://bitgetlimited.github.io/apidoc/en/spot/#get-order-history
|
3782
|
+
:see: https://bitgetlimited.github.io/apidoc/en/spot/#get-history-plan-orders
|
3783
|
+
:see: https://bitgetlimited.github.io/apidoc/en/mix/#get-history-orders
|
3784
|
+
:see: https://bitgetlimited.github.io/apidoc/en/mix/#get-history-plan-orders-tpsl
|
3785
|
+
:see: https://bitgetlimited.github.io/apidoc/en/margin/#get-isolated-order-history
|
3786
|
+
:see: https://bitgetlimited.github.io/apidoc/en/margin/#get-cross-order-history
|
3701
3787
|
:param str symbol: unified market symbol of the closed orders
|
3702
3788
|
:param int [since]: timestamp in ms of the earliest order
|
3703
3789
|
:param int [limit]: the max number of closed orders to return
|
@@ -3727,10 +3813,12 @@ class bitget(Exchange, ImplicitAPI):
|
|
3727
3813
|
async def fetch_canceled_orders(self, symbol: Optional[str] = None, since: Optional[int] = None, limit: Optional[int] = None, params={}):
|
3728
3814
|
"""
|
3729
3815
|
fetches information on multiple canceled orders made by the user
|
3730
|
-
see https://bitgetlimited.github.io/apidoc/en/spot/#get-order-history
|
3731
|
-
see https://bitgetlimited.github.io/apidoc/en/
|
3732
|
-
see https://bitgetlimited.github.io/apidoc/en/mix/#get-history-
|
3733
|
-
see https://bitgetlimited.github.io/apidoc/en/
|
3816
|
+
:see: https://bitgetlimited.github.io/apidoc/en/spot/#get-order-history
|
3817
|
+
:see: https://bitgetlimited.github.io/apidoc/en/spot/#get-history-plan-orders
|
3818
|
+
:see: https://bitgetlimited.github.io/apidoc/en/mix/#get-history-orders
|
3819
|
+
:see: https://bitgetlimited.github.io/apidoc/en/mix/#get-history-plan-orders-tpsl
|
3820
|
+
:see: https://bitgetlimited.github.io/apidoc/en/margin/#get-isolated-order-history
|
3821
|
+
:see: https://bitgetlimited.github.io/apidoc/en/margin/#get-cross-order-history
|
3734
3822
|
:param str symbol: unified market symbol of the canceled orders
|
3735
3823
|
:param int [since]: timestamp in ms of the earliest order
|
3736
3824
|
:param int [limit]: the max number of canceled orders to return
|
@@ -3761,43 +3849,62 @@ class bitget(Exchange, ImplicitAPI):
|
|
3761
3849
|
await self.load_markets()
|
3762
3850
|
market = self.market(symbol)
|
3763
3851
|
marketType = None
|
3852
|
+
marginMode = None
|
3853
|
+
response = None
|
3764
3854
|
marketType, params = self.handle_market_type_and_params('fetchCanceledAndClosedOrders', market, params)
|
3765
|
-
|
3766
|
-
|
3855
|
+
marginMode, params = self.handle_margin_mode_and_params('fetchCanceledAndClosedOrders', params)
|
3856
|
+
symbolRequest = (market['info']['symbolName']) if (marginMode is not None) else (market['id'])
|
3767
3857
|
request = {
|
3768
|
-
'symbol':
|
3858
|
+
'symbol': symbolRequest,
|
3769
3859
|
}
|
3770
|
-
|
3771
|
-
|
3772
|
-
method = self.get_supported_mapping(marketType, {
|
3773
|
-
'spot': 'privateSpotPostTradeHistory',
|
3774
|
-
'swap': 'privateMixGetOrderHistory',
|
3775
|
-
'future': 'privateMixGetOrderHistory',
|
3776
|
-
})
|
3860
|
+
now = self.milliseconds()
|
3861
|
+
endTime = self.safe_integer_n(params, ['endTime', 'until', 'till'])
|
3777
3862
|
stop = self.safe_value(params, 'stop')
|
3778
|
-
|
3779
|
-
|
3780
|
-
method = 'privateSpotPostPlanHistoryPlan'
|
3781
|
-
else:
|
3782
|
-
method = 'privateMixGetPlanHistoryPlan'
|
3783
|
-
params = self.omit(params, 'stop')
|
3784
|
-
if marketType == 'swap' or stop:
|
3863
|
+
params = self.omit(params, ['until', 'till', 'stop'])
|
3864
|
+
if stop or (marketType == 'swap') or (marketType == 'future'):
|
3785
3865
|
if limit is None:
|
3786
3866
|
limit = 100
|
3787
3867
|
request['pageSize'] = limit
|
3788
3868
|
if since is None:
|
3789
|
-
|
3869
|
+
if marketType == 'spot':
|
3870
|
+
since = now - 7776000000
|
3871
|
+
else:
|
3872
|
+
since = 0
|
3790
3873
|
request['startTime'] = since
|
3791
3874
|
if endTime is None:
|
3792
3875
|
request['endTime'] = self.milliseconds()
|
3793
3876
|
else:
|
3794
3877
|
request['endTime'] = endTime
|
3878
|
+
if stop:
|
3879
|
+
if marketType == 'spot':
|
3880
|
+
response = await self.privateSpotPostPlanHistoryPlan(self.extend(request, params))
|
3881
|
+
else:
|
3882
|
+
response = await self.privateMixGetPlanHistoryPlan(self.extend(request, params))
|
3795
3883
|
else:
|
3796
|
-
if
|
3797
|
-
|
3798
|
-
|
3799
|
-
|
3800
|
-
|
3884
|
+
if (marketType == 'swap') or (marketType == 'future'):
|
3885
|
+
response = await self.privateMixGetOrderHistory(self.extend(request, params))
|
3886
|
+
else:
|
3887
|
+
if marginMode is not None:
|
3888
|
+
if since is None:
|
3889
|
+
since = now - 7776000000
|
3890
|
+
request['startTime'] = since
|
3891
|
+
if endTime is not None:
|
3892
|
+
request['endTime'] = endTime
|
3893
|
+
if limit is not None:
|
3894
|
+
request['pageSize'] = limit
|
3895
|
+
if marginMode == 'isolated':
|
3896
|
+
response = await self.privateMarginGetIsolatedOrderHistory(self.extend(request, params))
|
3897
|
+
elif marginMode == 'cross':
|
3898
|
+
response = await self.privateMarginGetCrossOrderHistory(self.extend(request, params))
|
3899
|
+
else:
|
3900
|
+
if limit is not None:
|
3901
|
+
request['limit'] = limit
|
3902
|
+
if since is not None:
|
3903
|
+
request['after'] = since
|
3904
|
+
if endTime is not None:
|
3905
|
+
params = self.omit(params, 'endTime')
|
3906
|
+
request['before'] = endTime
|
3907
|
+
response = await self.privateSpotPostTradeHistory(self.extend(request, params))
|
3801
3908
|
#
|
3802
3909
|
# spot
|
3803
3910
|
#
|
@@ -3914,6 +4021,37 @@ class bitget(Exchange, ImplicitAPI):
|
|
3914
4021
|
# "requestTime":1627354109502
|
3915
4022
|
# }
|
3916
4023
|
#
|
4024
|
+
# isolated and cross margin
|
4025
|
+
#
|
4026
|
+
# {
|
4027
|
+
# "code": "00000",
|
4028
|
+
# "msg": "success",
|
4029
|
+
# "requestTime": 1697779608818,
|
4030
|
+
# "data": {
|
4031
|
+
# "orderList": [
|
4032
|
+
# {
|
4033
|
+
# "symbol": "BTCUSDT",
|
4034
|
+
# "orderType": "limit",
|
4035
|
+
# "source": "API",
|
4036
|
+
# "orderId": "1098761451063619584",
|
4037
|
+
# "clientOid": "8d8ac3454ed345fca914c9cd55682121",
|
4038
|
+
# "loanType": "normal",
|
4039
|
+
# "price": "25000",
|
4040
|
+
# "side": "buy",
|
4041
|
+
# "status": "cancelled",
|
4042
|
+
# "baseQuantity": "0.0002",
|
4043
|
+
# "quoteAmount": "0",
|
4044
|
+
# "fillPrice": "0",
|
4045
|
+
# "fillQuantity": "0",
|
4046
|
+
# "fillTotalAmount": "0",
|
4047
|
+
# "ctime": "1697691064614"
|
4048
|
+
# },
|
4049
|
+
# ],
|
4050
|
+
# "maxId": "1098761451063619584",
|
4051
|
+
# "minId": "1098394690472521728"
|
4052
|
+
# }
|
4053
|
+
# }
|
4054
|
+
#
|
3917
4055
|
data = self.safe_value(response, 'data')
|
3918
4056
|
if data is not None:
|
3919
4057
|
if 'orderList' in data:
|
@@ -3941,7 +4079,7 @@ class bitget(Exchange, ImplicitAPI):
|
|
3941
4079
|
|
3942
4080
|
async def fetch_ledger(self, code: Optional[str] = None, since: Optional[int] = None, limit: Optional[int] = None, params={}):
|
3943
4081
|
"""
|
3944
|
-
see https://bitgetlimited.github.io/apidoc/en/spot/#get-bills
|
4082
|
+
:see: https://bitgetlimited.github.io/apidoc/en/spot/#get-bills
|
3945
4083
|
fetch the history of changes, actions done by the user or operations that altered balance of the user
|
3946
4084
|
:param str code: unified currency code, default is None
|
3947
4085
|
:param int [since]: timestamp in ms of the earliest ledger entry, default is None
|
@@ -4036,14 +4174,16 @@ class bitget(Exchange, ImplicitAPI):
|
|
4036
4174
|
async def fetch_my_trades(self, symbol: Optional[str] = None, since: Optional[int] = None, limit: Optional[int] = None, params={}):
|
4037
4175
|
"""
|
4038
4176
|
fetch all trades made by the user
|
4039
|
-
see https://bitgetlimited.github.io/apidoc/en/spot/#get-transaction-details
|
4040
|
-
see https://bitgetlimited.github.io/apidoc/en/mix/#get-order-fill-detail
|
4177
|
+
:see: https://bitgetlimited.github.io/apidoc/en/spot/#get-transaction-details
|
4178
|
+
:see: https://bitgetlimited.github.io/apidoc/en/mix/#get-order-fill-detail
|
4179
|
+
:see: https://bitgetlimited.github.io/apidoc/en/margin/#get-isolated-transaction-details
|
4180
|
+
:see: https://bitgetlimited.github.io/apidoc/en/margin/#get-cross-order-fills
|
4041
4181
|
:param str symbol: unified market symbol
|
4042
4182
|
:param int [since]: the earliest time in ms to fetch trades for
|
4043
4183
|
:param int [limit]: the maximum number of trades structures to retrieve
|
4044
4184
|
:param dict [params]: extra parameters specific to the bitget api endpoint
|
4045
|
-
:param int [params.until]:
|
4046
|
-
:param boolean [params.paginate]: default False, when True will automatically paginate by calling self endpoint multiple times. See in the docs all the [
|
4185
|
+
:param int [params.until]: the latest time in ms to fetch entries for
|
4186
|
+
: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)
|
4047
4187
|
:returns Trade[]: a list of `trade structures <https://github.com/ccxt/ccxt/wiki/Manual#trade-structure>`
|
4048
4188
|
"""
|
4049
4189
|
self.check_required_symbol('fetchMyTrades', symbol)
|
@@ -4056,14 +4196,34 @@ class bitget(Exchange, ImplicitAPI):
|
|
4056
4196
|
return await self.fetch_paginated_call_cursor('fetchMyTrades', symbol, since, limit, params, 'orderId', 'after', None, 50)
|
4057
4197
|
else:
|
4058
4198
|
return await self.fetch_paginated_call_dynamic('fetchMyTrades', symbol, since, limit, params, 500)
|
4199
|
+
response = None
|
4200
|
+
marginMode = None
|
4201
|
+
marginMode, params = self.handle_margin_mode_and_params('fetchMyTrades', params)
|
4202
|
+
symbolRequest = (market['info']['symbolName']) if (marginMode is not None) else (market['id'])
|
4059
4203
|
request = {
|
4060
|
-
'symbol':
|
4204
|
+
'symbol': symbolRequest,
|
4061
4205
|
}
|
4062
|
-
if limit is not None:
|
4063
|
-
request['limit'] = limit
|
4064
|
-
response = None
|
4065
4206
|
if market['spot']:
|
4066
|
-
|
4207
|
+
if marginMode is not None:
|
4208
|
+
request, params = self.handle_until_option('endTime', request, params)
|
4209
|
+
if since is not None:
|
4210
|
+
request['startTime'] = since
|
4211
|
+
else:
|
4212
|
+
now = self.milliseconds()
|
4213
|
+
request['startTime'] = now - 7776000000
|
4214
|
+
if limit is not None:
|
4215
|
+
request['pageSize'] = limit
|
4216
|
+
if marginMode == 'isolated':
|
4217
|
+
response = await self.privateMarginGetIsolatedOrderFills(self.extend(request, params))
|
4218
|
+
elif marginMode == 'cross':
|
4219
|
+
response = await self.privateMarginGetCrossOrderFills(self.extend(request, params))
|
4220
|
+
else:
|
4221
|
+
request, params = self.handle_until_option('before', request, params)
|
4222
|
+
if since is not None:
|
4223
|
+
request['after'] = since
|
4224
|
+
if limit is not None:
|
4225
|
+
request['limit'] = limit
|
4226
|
+
response = await self.privateSpotPostTradeFills(self.extend(request, params))
|
4067
4227
|
else:
|
4068
4228
|
orderId = self.safe_string(params, 'orderId') # when order id is not defined, startTime and endTime are required
|
4069
4229
|
if since is not None:
|
@@ -4075,36 +4235,94 @@ class bitget(Exchange, ImplicitAPI):
|
|
4075
4235
|
request['endTime'] = self.milliseconds()
|
4076
4236
|
response = await self.privateMixGetOrderFills(self.extend(request, params))
|
4077
4237
|
#
|
4238
|
+
# spot
|
4239
|
+
#
|
4078
4240
|
# {
|
4079
|
-
#
|
4080
|
-
#
|
4081
|
-
#
|
4082
|
-
#
|
4083
|
-
#
|
4084
|
-
#
|
4085
|
-
#
|
4086
|
-
#
|
4087
|
-
#
|
4088
|
-
#
|
4089
|
-
#
|
4090
|
-
#
|
4091
|
-
#
|
4092
|
-
#
|
4093
|
-
#
|
4094
|
-
#
|
4095
|
-
#
|
4241
|
+
# "code": "00000",
|
4242
|
+
# "msg": "success",
|
4243
|
+
# "requestTime": 1697831543676,
|
4244
|
+
# "data": [
|
4245
|
+
# {
|
4246
|
+
# "accountId": "7264631750",
|
4247
|
+
# "symbol": "BTCUSDT_SPBL",
|
4248
|
+
# "orderId": "1098394344925597696",
|
4249
|
+
# "fillId": "1098394344974925824",
|
4250
|
+
# "orderType": "market",
|
4251
|
+
# "side": "sell",
|
4252
|
+
# "fillPrice": "28467.68",
|
4253
|
+
# "fillQuantity": "0.0002",
|
4254
|
+
# "fillTotalAmount": "5.693536",
|
4255
|
+
# "feeCcy": "USDT",
|
4256
|
+
# "fees": "-0.005693536",
|
4257
|
+
# "takerMakerFlag": "taker",
|
4258
|
+
# "cTime": "1697603539699"
|
4259
|
+
# },
|
4260
|
+
# ]
|
4261
|
+
# }
|
4262
|
+
#
|
4263
|
+
# swap and future
|
4264
|
+
#
|
4265
|
+
# {
|
4266
|
+
# "code": "00000",
|
4267
|
+
# "msg": "success",
|
4268
|
+
# "requestTime": 1697831790948,
|
4269
|
+
# "data": [
|
4270
|
+
# {
|
4271
|
+
# "tradeId": "1099351653724958721",
|
4272
|
+
# "symbol": "BTCUSDT_UMCBL",
|
4273
|
+
# "orderId": "1099351653682413569",
|
4274
|
+
# "price": "29531.3",
|
4275
|
+
# "sizeQty": "0.001",
|
4276
|
+
# "fee": "-0.01771878",
|
4277
|
+
# "side": "close_long",
|
4278
|
+
# "fillAmount": "29.5313",
|
4279
|
+
# "profit": "0.001",
|
4280
|
+
# "enterPointSource": "WEB",
|
4281
|
+
# "tradeSide": "close_long",
|
4282
|
+
# "holdMode": "double_hold",
|
4283
|
+
# "takerMakerFlag": "taker",
|
4284
|
+
# "cTime": "1697831779891"
|
4285
|
+
# },
|
4286
|
+
# ]
|
4287
|
+
# }
|
4288
|
+
#
|
4289
|
+
# isolated and cross margin
|
4290
|
+
#
|
4291
|
+
# {
|
4292
|
+
# "code": "00000",
|
4293
|
+
# "msg": "success",
|
4294
|
+
# "requestTime": 1697832285469,
|
4295
|
+
# "data": {
|
4296
|
+
# "fills": [
|
4297
|
+
# {
|
4298
|
+
# "orderId": "1099353730455318528",
|
4299
|
+
# "fillId": "1099353730627092481",
|
4300
|
+
# "orderType": "market",
|
4301
|
+
# "side": "sell",
|
4302
|
+
# "fillPrice": "29543.7",
|
4303
|
+
# "fillQuantity": "0.0001",
|
4304
|
+
# "fillTotalAmount": "2.95437",
|
4305
|
+
# "feeCcy": "USDT",
|
4306
|
+
# "fees": "-0.00295437",
|
4307
|
+
# "ctime": "1697832275063"
|
4308
|
+
# },
|
4309
|
+
# ],
|
4310
|
+
# "minId": "1099353591699161118",
|
4311
|
+
# "maxId": "1099353730627092481"
|
4096
4312
|
# }
|
4097
|
-
# ]
|
4098
4313
|
# }
|
4099
4314
|
#
|
4100
4315
|
data = self.safe_value(response, 'data')
|
4316
|
+
if marginMode is not None:
|
4317
|
+
fills = self.safe_value(data, 'fills', [])
|
4318
|
+
return self.parse_trades(fills, market, since, limit)
|
4101
4319
|
return self.parse_trades(data, market, since, limit)
|
4102
4320
|
|
4103
4321
|
async def fetch_order_trades(self, id: str, symbol: Optional[str] = None, since: Optional[int] = None, limit: Optional[int] = None, params={}):
|
4104
4322
|
"""
|
4105
4323
|
fetch all the trades made from a single order
|
4106
|
-
see https://bitgetlimited.github.io/apidoc/en/spot/#get-transaction-details
|
4107
|
-
see https://bitgetlimited.github.io/apidoc/en/mix/#get-order-fill-detail
|
4324
|
+
:see: https://bitgetlimited.github.io/apidoc/en/spot/#get-transaction-details
|
4325
|
+
:see: https://bitgetlimited.github.io/apidoc/en/mix/#get-order-fill-detail
|
4108
4326
|
:param str id: order id
|
4109
4327
|
:param str symbol: unified market symbol
|
4110
4328
|
:param int [since]: the earliest time in ms to fetch trades for
|
@@ -4155,7 +4373,7 @@ class bitget(Exchange, ImplicitAPI):
|
|
4155
4373
|
async def fetch_position(self, symbol: str, params={}):
|
4156
4374
|
"""
|
4157
4375
|
fetch data on a single open contract trade position
|
4158
|
-
see https://bitgetlimited.github.io/apidoc/en/mix/#get-symbol-position-v2
|
4376
|
+
:see: https://bitgetlimited.github.io/apidoc/en/mix/#get-symbol-position-v2
|
4159
4377
|
:param str symbol: unified market symbol of the market the position is held in, default is None
|
4160
4378
|
:param dict [params]: extra parameters specific to the bitget api endpoint
|
4161
4379
|
:returns dict: a `position structure <https://github.com/ccxt/ccxt/wiki/Manual#position-structure>`
|
@@ -4203,8 +4421,8 @@ class bitget(Exchange, ImplicitAPI):
|
|
4203
4421
|
async def fetch_positions(self, symbols: Optional[List[str]] = None, params={}):
|
4204
4422
|
"""
|
4205
4423
|
fetch all open positions
|
4206
|
-
see https://bitgetlimited.github.io/apidoc/en/mix/#get-all-position-v2
|
4207
|
-
see https://bitgetlimited.github.io/apidoc/en/mix/#get-history-position
|
4424
|
+
:see: https://bitgetlimited.github.io/apidoc/en/mix/#get-all-position-v2
|
4425
|
+
:see: https://bitgetlimited.github.io/apidoc/en/mix/#get-history-position
|
4208
4426
|
:param str[]|None symbols: list of unified market symbols
|
4209
4427
|
:param dict [params]: extra parameters specific to the bitget api endpoint
|
4210
4428
|
:returns dict[]: a list of `position structure <https://github.com/ccxt/ccxt/wiki/Manual#position-structure>`
|
@@ -4441,7 +4659,7 @@ class bitget(Exchange, ImplicitAPI):
|
|
4441
4659
|
|
4442
4660
|
async def fetch_funding_rate_history(self, symbol: Optional[str] = None, since: Optional[int] = None, limit: Optional[int] = None, params={}):
|
4443
4661
|
"""
|
4444
|
-
see https://bitgetlimited.github.io/apidoc/en/mix/#get-history-funding-rate
|
4662
|
+
:see: https://bitgetlimited.github.io/apidoc/en/mix/#get-history-funding-rate
|
4445
4663
|
fetches historical funding rate prices
|
4446
4664
|
:param str symbol: unified symbol of the market to fetch the funding rate history for
|
4447
4665
|
:param int [since]: timestamp in ms of the earliest funding rate to fetch
|
@@ -4501,7 +4719,7 @@ class bitget(Exchange, ImplicitAPI):
|
|
4501
4719
|
async def fetch_funding_rate(self, symbol: str, params={}):
|
4502
4720
|
"""
|
4503
4721
|
fetch the current funding rate
|
4504
|
-
see https://bitgetlimited.github.io/apidoc/en/mix/#get-current-funding-rate
|
4722
|
+
:see: https://bitgetlimited.github.io/apidoc/en/mix/#get-current-funding-rate
|
4505
4723
|
:param str symbol: unified market symbol
|
4506
4724
|
:param dict [params]: extra parameters specific to the bitget api endpoint
|
4507
4725
|
:returns dict: a `funding rate structure <https://github.com/ccxt/ccxt/wiki/Manual#funding-rate-structure>`
|
@@ -4560,7 +4778,7 @@ class bitget(Exchange, ImplicitAPI):
|
|
4560
4778
|
async def fetch_funding_history(self, symbol: str, since: Optional[int] = None, limit: Optional[int] = None, params={}):
|
4561
4779
|
"""
|
4562
4780
|
fetch the funding history
|
4563
|
-
see https://bitgetlimited.github.io/apidoc/en/mix/#get-account-bill
|
4781
|
+
:see: https://bitgetlimited.github.io/apidoc/en/mix/#get-account-bill
|
4564
4782
|
:param str symbol: unified market symbol
|
4565
4783
|
:param int [since]: the starting timestamp in milliseconds
|
4566
4784
|
:param int [limit]: the number of entries to return
|
@@ -4695,7 +4913,7 @@ class bitget(Exchange, ImplicitAPI):
|
|
4695
4913
|
async def reduce_margin(self, symbol: str, amount, params={}):
|
4696
4914
|
"""
|
4697
4915
|
remove margin from a position
|
4698
|
-
see https://bitgetlimited.github.io/apidoc/en/mix/#change-margin
|
4916
|
+
:see: https://bitgetlimited.github.io/apidoc/en/mix/#change-margin
|
4699
4917
|
:param str symbol: unified market symbol
|
4700
4918
|
:param float amount: the amount of margin to remove
|
4701
4919
|
:param dict [params]: extra parameters specific to the bitget api endpoint
|
@@ -4711,7 +4929,7 @@ class bitget(Exchange, ImplicitAPI):
|
|
4711
4929
|
async def add_margin(self, symbol: str, amount, params={}):
|
4712
4930
|
"""
|
4713
4931
|
add margin
|
4714
|
-
see https://bitgetlimited.github.io/apidoc/en/mix/#change-margin
|
4932
|
+
:see: https://bitgetlimited.github.io/apidoc/en/mix/#change-margin
|
4715
4933
|
:param str symbol: unified market symbol
|
4716
4934
|
:param float amount: amount of margin to add
|
4717
4935
|
:param dict [params]: extra parameters specific to the bitget api endpoint
|
@@ -4725,7 +4943,7 @@ class bitget(Exchange, ImplicitAPI):
|
|
4725
4943
|
async def fetch_leverage(self, symbol: str, params={}):
|
4726
4944
|
"""
|
4727
4945
|
fetch the set leverage for a market
|
4728
|
-
see https://bitgetlimited.github.io/apidoc/en/mix/#get-single-account
|
4946
|
+
:see: https://bitgetlimited.github.io/apidoc/en/mix/#get-single-account
|
4729
4947
|
:param str symbol: unified market symbol
|
4730
4948
|
:param dict [params]: extra parameters specific to the bitget api endpoint
|
4731
4949
|
:returns dict: a `leverage structure <https://github.com/ccxt/ccxt/wiki/Manual#leverage-structure>`
|
@@ -4768,7 +4986,7 @@ class bitget(Exchange, ImplicitAPI):
|
|
4768
4986
|
async def set_leverage(self, leverage, symbol: Optional[str] = None, params={}):
|
4769
4987
|
"""
|
4770
4988
|
set the level of leverage for a market
|
4771
|
-
see https://bitgetlimited.github.io/apidoc/en/mix/#change-leverage
|
4989
|
+
:see: https://bitgetlimited.github.io/apidoc/en/mix/#change-leverage
|
4772
4990
|
:param float leverage: the rate of leverage
|
4773
4991
|
:param str symbol: unified market symbol
|
4774
4992
|
:param dict [params]: extra parameters specific to the bitget api endpoint
|
@@ -4788,7 +5006,7 @@ class bitget(Exchange, ImplicitAPI):
|
|
4788
5006
|
async def set_margin_mode(self, marginMode, symbol: Optional[str] = None, params={}):
|
4789
5007
|
"""
|
4790
5008
|
set margin mode to 'cross' or 'isolated'
|
4791
|
-
see https://bitgetlimited.github.io/apidoc/en/mix/#change-margin-mode
|
5009
|
+
:see: https://bitgetlimited.github.io/apidoc/en/mix/#change-margin-mode
|
4792
5010
|
:param str marginMode: 'cross' or 'isolated'
|
4793
5011
|
:param str symbol: unified market symbol
|
4794
5012
|
:param dict [params]: extra parameters specific to the bitget api endpoint
|
@@ -4814,7 +5032,7 @@ class bitget(Exchange, ImplicitAPI):
|
|
4814
5032
|
async def set_position_mode(self, hedged, symbol: Optional[str] = None, params={}):
|
4815
5033
|
"""
|
4816
5034
|
set hedged to True or False for a market
|
4817
|
-
see https://bitgetlimited.github.io/apidoc/en/mix/#change-hold-mode
|
5035
|
+
:see: https://bitgetlimited.github.io/apidoc/en/mix/#change-hold-mode
|
4818
5036
|
:param bool hedged: set to True to use dualSidePosition
|
4819
5037
|
:param str symbol: not used by bitget setPositionMode()
|
4820
5038
|
:param dict [params]: extra parameters specific to the bitget api endpoint
|
@@ -4850,7 +5068,7 @@ class bitget(Exchange, ImplicitAPI):
|
|
4850
5068
|
async def fetch_open_interest(self, symbol: str, params={}):
|
4851
5069
|
"""
|
4852
5070
|
Retrieves the open interest of a currency
|
4853
|
-
see https://bitgetlimited.github.io/apidoc/en/mix/#get-open-interest
|
5071
|
+
:see: https://bitgetlimited.github.io/apidoc/en/mix/#get-open-interest
|
4854
5072
|
:param str symbol: Unified CCXT market symbol
|
4855
5073
|
:param dict [params]: exchange specific parameters
|
4856
5074
|
:returns dict} an open interest structure{@link https://github.com/ccxt/ccxt/wiki/Manual#interest-history-structure:
|
@@ -4881,7 +5099,7 @@ class bitget(Exchange, ImplicitAPI):
|
|
4881
5099
|
async def fetch_transfers(self, code: Optional[str] = None, since: Optional[int] = None, limit: Optional[int] = None, params={}):
|
4882
5100
|
"""
|
4883
5101
|
fetch a history of internal transfers made on an account
|
4884
|
-
see https://bitgetlimited.github.io/apidoc/en/spot/#get-transfer-list
|
5102
|
+
:see: https://bitgetlimited.github.io/apidoc/en/spot/#get-transfer-list
|
4885
5103
|
:param str code: unified currency code of the currency transferred
|
4886
5104
|
:param int [since]: the earliest time in ms to fetch transfers for
|
4887
5105
|
:param int [limit]: the maximum number of transfers structures to retrieve
|
@@ -4936,7 +5154,7 @@ class bitget(Exchange, ImplicitAPI):
|
|
4936
5154
|
|
4937
5155
|
async def transfer(self, code: str, amount, fromAccount, toAccount, params={}):
|
4938
5156
|
"""
|
4939
|
-
see https://bitgetlimited.github.io/apidoc/en/spot/#transfer-v2
|
5157
|
+
:see: https://bitgetlimited.github.io/apidoc/en/spot/#transfer-v2
|
4940
5158
|
transfer currency internally between wallets on the same account
|
4941
5159
|
:param str code: unified currency code
|
4942
5160
|
:param float amount: amount to transfer
|
@@ -5090,7 +5308,7 @@ class bitget(Exchange, ImplicitAPI):
|
|
5090
5308
|
async def fetch_deposit_withdraw_fees(self, codes: Optional[List[str]] = None, params={}):
|
5091
5309
|
"""
|
5092
5310
|
fetch deposit and withdraw fees
|
5093
|
-
see https://bitgetlimited.github.io/apidoc/en/spot/#get-coin-list
|
5311
|
+
:see: https://bitgetlimited.github.io/apidoc/en/spot/#get-coin-list
|
5094
5312
|
:param str[]|None codes: list of unified currency codes
|
5095
5313
|
:param dict [params]: extra parameters specific to the bitget api endpoint
|
5096
5314
|
:returns dict: a list of `fee structures <https://github.com/ccxt/ccxt/wiki/Manual#fee-structure>`
|
@@ -5131,8 +5349,8 @@ class bitget(Exchange, ImplicitAPI):
|
|
5131
5349
|
async def borrow_margin(self, code: str, amount, symbol: Optional[str] = None, params={}):
|
5132
5350
|
"""
|
5133
5351
|
create a loan to borrow margin
|
5134
|
-
see https://bitgetlimited.github.io/apidoc/en/margin/#cross-borrow
|
5135
|
-
see https://bitgetlimited.github.io/apidoc/en/margin/#isolated-borrow
|
5352
|
+
:see: https://bitgetlimited.github.io/apidoc/en/margin/#cross-borrow
|
5353
|
+
:see: https://bitgetlimited.github.io/apidoc/en/margin/#isolated-borrow
|
5136
5354
|
:param str code: unified currency code of the currency to borrow
|
5137
5355
|
:param str amount: the amount to borrow
|
5138
5356
|
:param str [symbol]: unified market symbol
|
@@ -5193,8 +5411,8 @@ class bitget(Exchange, ImplicitAPI):
|
|
5193
5411
|
async def repay_margin(self, code: str, amount, symbol: Optional[str] = None, params={}):
|
5194
5412
|
"""
|
5195
5413
|
repay borrowed margin and interest
|
5196
|
-
see https://bitgetlimited.github.io/apidoc/en/margin/#cross-repay
|
5197
|
-
see https://bitgetlimited.github.io/apidoc/en/margin/#isolated-repay
|
5414
|
+
:see: https://bitgetlimited.github.io/apidoc/en/margin/#cross-repay
|
5415
|
+
:see: https://bitgetlimited.github.io/apidoc/en/margin/#isolated-repay
|
5198
5416
|
:param str code: unified currency code of the currency to repay
|
5199
5417
|
:param str amount: the amount to repay
|
5200
5418
|
:param str [symbol]: unified market symbol
|