ccxt 4.3.6__py2.py3-none-any.whl → 4.3.7__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 +5 -0
- ccxt/ace.py +5 -0
- ccxt/alpaca.py +6 -0
- ccxt/ascendex.py +2 -2
- ccxt/async_support/__init__.py +1 -1
- ccxt/async_support/ace.py +5 -0
- ccxt/async_support/alpaca.py +6 -0
- ccxt/async_support/ascendex.py +2 -2
- ccxt/async_support/base/exchange.py +27 -1
- ccxt/async_support/bigone.py +1 -1
- ccxt/async_support/binance.py +5 -3
- ccxt/async_support/bingx.py +3 -1
- ccxt/async_support/bitbank.py +4 -1
- ccxt/async_support/bitfinex.py +1 -1
- ccxt/async_support/bitfinex2.py +1 -1
- ccxt/async_support/bitflyer.py +1 -1
- ccxt/async_support/bitget.py +70 -4
- ccxt/async_support/bithumb.py +5 -1
- ccxt/async_support/bitmart.py +1 -1
- ccxt/async_support/bitmex.py +3 -1
- ccxt/async_support/bitopro.py +6 -1
- ccxt/async_support/bitrue.py +1 -1
- ccxt/async_support/bitso.py +4 -1
- ccxt/async_support/bitstamp.py +4 -1
- ccxt/async_support/bitteam.py +4 -0
- ccxt/async_support/bitvavo.py +4 -1
- ccxt/async_support/bl3p.py +3 -0
- ccxt/async_support/blockchaincom.py +1 -1
- ccxt/async_support/btcalpha.py +3 -0
- ccxt/async_support/btcbox.py +3 -0
- ccxt/async_support/btcmarkets.py +4 -1
- ccxt/async_support/btcturk.py +3 -0
- ccxt/async_support/bybit.py +116 -14
- ccxt/async_support/cex.py +6 -0
- ccxt/async_support/coinbase.py +94 -18
- ccxt/async_support/coinbaseinternational.py +3 -1
- ccxt/async_support/coinbasepro.py +7 -1
- ccxt/async_support/coincheck.py +3 -0
- ccxt/async_support/coinex.py +151 -47
- ccxt/async_support/coinlist.py +5 -1
- ccxt/async_support/coinmate.py +4 -1
- ccxt/async_support/coinone.py +3 -0
- ccxt/async_support/coinsph.py +5 -1
- ccxt/async_support/coinspot.py +3 -0
- ccxt/async_support/cryptocom.py +3 -1
- ccxt/async_support/delta.py +2 -2
- ccxt/async_support/deribit.py +1 -1
- ccxt/async_support/digifinex.py +3 -3
- ccxt/async_support/exmo.py +8 -3
- ccxt/async_support/gate.py +112 -24
- ccxt/async_support/gemini.py +1 -1
- ccxt/async_support/hitbtc.py +7 -6
- ccxt/async_support/hollaex.py +1 -1
- ccxt/async_support/htx.py +3 -1
- ccxt/async_support/huobijp.py +1 -1
- ccxt/async_support/hyperliquid.py +2 -2
- ccxt/async_support/idex.py +4 -1
- ccxt/async_support/independentreserve.py +3 -0
- ccxt/async_support/indodax.py +4 -1
- ccxt/async_support/kraken.py +1 -1
- ccxt/async_support/kucoin.py +3 -1
- ccxt/async_support/kucoinfutures.py +3 -1
- ccxt/async_support/kuna.py +1 -1
- ccxt/async_support/latoken.py +6 -0
- ccxt/async_support/lbank.py +1 -1
- ccxt/async_support/luno.py +3 -0
- ccxt/async_support/lykke.py +6 -1
- ccxt/async_support/mercado.py +4 -1
- ccxt/async_support/mexc.py +110 -4
- ccxt/async_support/ndax.py +5 -1
- ccxt/async_support/novadax.py +5 -1
- ccxt/async_support/okcoin.py +1 -1
- ccxt/async_support/okx.py +80 -4
- ccxt/async_support/onetrading.py +4 -1
- ccxt/async_support/p2b.py +3 -0
- ccxt/async_support/phemex.py +1 -1
- ccxt/async_support/poloniex.py +1 -1
- ccxt/async_support/probit.py +4 -1
- ccxt/async_support/timex.py +3 -0
- ccxt/async_support/tokocrypto.py +1 -1
- ccxt/async_support/tradeogre.py +3 -0
- ccxt/async_support/upbit.py +1 -1
- ccxt/async_support/wavesexchange.py +4 -1
- ccxt/async_support/wazirx.py +3 -0
- ccxt/async_support/whitebit.py +1 -1
- ccxt/async_support/woo.py +3 -1
- ccxt/async_support/yobit.py +4 -1
- ccxt/async_support/zaif.py +1 -1
- ccxt/async_support/zonda.py +1 -1
- ccxt/base/exchange.py +27 -1
- ccxt/bigone.py +1 -1
- ccxt/binance.py +5 -3
- ccxt/bingx.py +3 -1
- ccxt/bitbank.py +4 -1
- ccxt/bitfinex.py +1 -1
- ccxt/bitfinex2.py +1 -1
- ccxt/bitflyer.py +1 -1
- ccxt/bitget.py +70 -4
- ccxt/bithumb.py +5 -1
- ccxt/bitmart.py +1 -1
- ccxt/bitmex.py +3 -1
- ccxt/bitopro.py +6 -1
- ccxt/bitrue.py +1 -1
- ccxt/bitso.py +4 -1
- ccxt/bitstamp.py +4 -1
- ccxt/bitteam.py +4 -0
- ccxt/bitvavo.py +4 -1
- ccxt/bl3p.py +3 -0
- ccxt/blockchaincom.py +1 -1
- ccxt/btcalpha.py +3 -0
- ccxt/btcbox.py +3 -0
- ccxt/btcmarkets.py +4 -1
- ccxt/btcturk.py +3 -0
- ccxt/bybit.py +116 -14
- ccxt/cex.py +6 -0
- ccxt/coinbase.py +94 -18
- ccxt/coinbaseinternational.py +3 -1
- ccxt/coinbasepro.py +7 -1
- ccxt/coincheck.py +3 -0
- ccxt/coinex.py +151 -47
- ccxt/coinlist.py +5 -1
- ccxt/coinmate.py +4 -1
- ccxt/coinone.py +3 -0
- ccxt/coinsph.py +5 -1
- ccxt/coinspot.py +3 -0
- ccxt/cryptocom.py +3 -1
- ccxt/delta.py +2 -2
- ccxt/deribit.py +1 -1
- ccxt/digifinex.py +3 -3
- ccxt/exmo.py +8 -3
- ccxt/gate.py +112 -24
- ccxt/gemini.py +1 -1
- ccxt/hitbtc.py +7 -6
- ccxt/hollaex.py +1 -1
- ccxt/htx.py +3 -1
- ccxt/huobijp.py +1 -1
- ccxt/hyperliquid.py +2 -2
- ccxt/idex.py +4 -1
- ccxt/independentreserve.py +3 -0
- ccxt/indodax.py +4 -1
- ccxt/kraken.py +1 -1
- ccxt/kucoin.py +3 -1
- ccxt/kucoinfutures.py +3 -1
- ccxt/kuna.py +1 -1
- ccxt/latoken.py +6 -0
- ccxt/lbank.py +1 -1
- ccxt/luno.py +3 -0
- ccxt/lykke.py +6 -1
- ccxt/mercado.py +4 -1
- ccxt/mexc.py +110 -4
- ccxt/ndax.py +5 -1
- ccxt/novadax.py +5 -1
- ccxt/okcoin.py +1 -1
- ccxt/okx.py +80 -4
- ccxt/onetrading.py +4 -1
- ccxt/p2b.py +3 -0
- ccxt/phemex.py +1 -1
- ccxt/poloniex.py +1 -1
- ccxt/pro/__init__.py +1 -1
- ccxt/pro/bybit.py +1 -1
- ccxt/pro/coinbase.py +28 -28
- ccxt/probit.py +4 -1
- ccxt/timex.py +3 -0
- ccxt/tokocrypto.py +1 -1
- ccxt/tradeogre.py +3 -0
- ccxt/upbit.py +1 -1
- ccxt/wavesexchange.py +4 -1
- ccxt/wazirx.py +3 -0
- ccxt/whitebit.py +1 -1
- ccxt/woo.py +3 -1
- ccxt/yobit.py +4 -1
- ccxt/zaif.py +1 -1
- ccxt/zonda.py +1 -1
- {ccxt-4.3.6.dist-info → ccxt-4.3.7.dist-info}/METADATA +4 -4
- {ccxt-4.3.6.dist-info → ccxt-4.3.7.dist-info}/RECORD +178 -178
- {ccxt-4.3.6.dist-info → ccxt-4.3.7.dist-info}/WHEEL +0 -0
- {ccxt-4.3.6.dist-info → ccxt-4.3.7.dist-info}/top_level.txt +0 -0
ccxt/async_support/btcmarkets.py
CHANGED
@@ -73,8 +73,11 @@ class btcmarkets(Exchange, ImplicitAPI):
|
|
73
73
|
'fetchOrderBook': True,
|
74
74
|
'fetchOrders': True,
|
75
75
|
'fetchPosition': False,
|
76
|
+
'fetchPositionHistory': False,
|
76
77
|
'fetchPositionMode': False,
|
77
78
|
'fetchPositions': False,
|
79
|
+
'fetchPositionsForSymbol': False,
|
80
|
+
'fetchPositionsHistory': False,
|
78
81
|
'fetchPositionsRisk': False,
|
79
82
|
'fetchPremiumIndexOHLCV': False,
|
80
83
|
'fetchTicker': True,
|
@@ -1093,7 +1096,7 @@ class btcmarkets(Exchange, ImplicitAPI):
|
|
1093
1096
|
#
|
1094
1097
|
return self.parse_trades(response, market, since, limit)
|
1095
1098
|
|
1096
|
-
async def withdraw(self, code: str, amount: float, address, tag=None, params={}):
|
1099
|
+
async def withdraw(self, code: str, amount: float, address: str, tag=None, params={}):
|
1097
1100
|
"""
|
1098
1101
|
make a withdrawal
|
1099
1102
|
:see: https://docs.btcmarkets.net/v3/#tag/Fund-Management-APIs/paths/~1v3~1withdrawals/post
|
ccxt/async_support/btcturk.py
CHANGED
@@ -66,8 +66,11 @@ class btcturk(Exchange, ImplicitAPI):
|
|
66
66
|
'fetchOrderBook': True,
|
67
67
|
'fetchOrders': True,
|
68
68
|
'fetchPosition': False,
|
69
|
+
'fetchPositionHistory': False,
|
69
70
|
'fetchPositionMode': False,
|
70
71
|
'fetchPositions': False,
|
72
|
+
'fetchPositionsForSymbol': False,
|
73
|
+
'fetchPositionsHistory': False,
|
71
74
|
'fetchPositionsRisk': False,
|
72
75
|
'fetchPremiumIndexOHLCV': False,
|
73
76
|
'fetchTicker': True,
|
ccxt/async_support/bybit.py
CHANGED
@@ -7,7 +7,7 @@ from ccxt.async_support.base.exchange import Exchange
|
|
7
7
|
from ccxt.abstract.bybit import ImplicitAPI
|
8
8
|
import asyncio
|
9
9
|
import hashlib
|
10
|
-
from ccxt.base.types import Balances, Currencies, Currency, Greeks, Int, Leverage, Market, MarketInterface, Num, Option, OptionChain, Order, OrderBook, OrderRequest, CancellationRequest, OrderSide, OrderType, Str, Strings, Ticker, Tickers, Trade, TradingFeeInterface, TradingFees, Transaction, TransferEntry
|
10
|
+
from ccxt.base.types import Balances, Currencies, Currency, Greeks, Int, Leverage, Market, MarketInterface, Num, Option, OptionChain, Order, OrderBook, OrderRequest, CancellationRequest, OrderSide, OrderType, Position, Str, Strings, Ticker, Tickers, Trade, TradingFeeInterface, TradingFees, Transaction, TransferEntry
|
11
11
|
from typing import List
|
12
12
|
from ccxt.base.errors import ExchangeError
|
13
13
|
from ccxt.base.errors import AuthenticationError
|
@@ -117,7 +117,9 @@ class bybit(Exchange, ImplicitAPI):
|
|
117
117
|
'fetchOrders': False,
|
118
118
|
'fetchOrderTrades': True,
|
119
119
|
'fetchPosition': True,
|
120
|
+
'fetchPositionHistory': 'emulated',
|
120
121
|
'fetchPositions': True,
|
122
|
+
'fetchPositionsHistory': True,
|
121
123
|
'fetchPremiumIndexOHLCV': True,
|
122
124
|
'fetchSettlementHistory': True,
|
123
125
|
'fetchTicker': True,
|
@@ -5614,7 +5616,7 @@ class bybit(Exchange, ImplicitAPI):
|
|
5614
5616
|
}
|
5615
5617
|
return self.safe_string(types, type, type)
|
5616
5618
|
|
5617
|
-
async def withdraw(self, code: str, amount: float, address, tag=None, params={}):
|
5619
|
+
async def withdraw(self, code: str, amount: float, address: str, tag=None, params={}):
|
5618
5620
|
"""
|
5619
5621
|
make a withdrawal
|
5620
5622
|
:see: https://bybit-exchange.github.io/docs/v5/asset/withdraw
|
@@ -6014,31 +6016,57 @@ class bybit(Exchange, ImplicitAPI):
|
|
6014
6016
|
# "tradeMode": 0
|
6015
6017
|
# }
|
6016
6018
|
#
|
6019
|
+
# fetchPositionsHistory
|
6020
|
+
#
|
6021
|
+
# {
|
6022
|
+
# symbol: 'XRPUSDT',
|
6023
|
+
# orderType: 'Market',
|
6024
|
+
# leverage: '10',
|
6025
|
+
# updatedTime: '1712717265572',
|
6026
|
+
# side: 'Sell',
|
6027
|
+
# orderId: '071749f3-a9fa-427b-b5ca-27b2f52b81de',
|
6028
|
+
# closedPnl: '-0.00049568',
|
6029
|
+
# avgEntryPrice: '0.6045',
|
6030
|
+
# qty: '3',
|
6031
|
+
# cumEntryValue: '1.8135',
|
6032
|
+
# createdTime: '1712717265566',
|
6033
|
+
# orderPrice: '0.5744',
|
6034
|
+
# closedSize: '3',
|
6035
|
+
# avgExitPrice: '0.605',
|
6036
|
+
# execType: 'Trade',
|
6037
|
+
# fillCount: '1',
|
6038
|
+
# cumExitValue: '1.815'
|
6039
|
+
# }
|
6040
|
+
#
|
6041
|
+
closedSize = self.safe_string(position, 'closedSize')
|
6042
|
+
isHistory = (closedSize is not None)
|
6017
6043
|
contract = self.safe_string(position, 'symbol')
|
6018
6044
|
market = self.safe_market(contract, market, None, 'contract')
|
6019
|
-
size = Precise.string_abs(self.
|
6045
|
+
size = Precise.string_abs(self.safe_string_2(position, 'size', 'qty'))
|
6020
6046
|
side = self.safe_string(position, 'side')
|
6021
6047
|
if side is not None:
|
6022
6048
|
if side == 'Buy':
|
6023
|
-
side = 'long'
|
6049
|
+
side = 'short' if isHistory else 'long'
|
6024
6050
|
elif side == 'Sell':
|
6025
|
-
side = 'short'
|
6051
|
+
side = 'long' if isHistory else 'short'
|
6026
6052
|
else:
|
6027
6053
|
side = None
|
6028
|
-
notional = self.
|
6054
|
+
notional = self.safe_string_2(position, 'positionValue', 'cumExitValue')
|
6029
6055
|
unrealisedPnl = self.omit_zero(self.safe_string(position, 'unrealisedPnl'))
|
6030
|
-
initialMarginString = self.
|
6056
|
+
initialMarginString = self.safe_string_n(position, ['positionIM', 'cumEntryValue'])
|
6031
6057
|
maintenanceMarginString = self.safe_string(position, 'positionMM')
|
6032
|
-
timestamp = self.
|
6033
|
-
|
6034
|
-
|
6058
|
+
timestamp = self.safe_integer_n(position, ['createdTime', 'createdAt'])
|
6059
|
+
lastUpdateTimestamp = self.parse8601(self.safe_string(position, 'updated_at'))
|
6060
|
+
if lastUpdateTimestamp is None:
|
6061
|
+
lastUpdateTimestamp = self.safe_integer_n(position, ['updatedTime', 'updatedAt', 'updatedTime'])
|
6035
6062
|
tradeMode = self.safe_integer(position, 'tradeMode', 0)
|
6036
6063
|
marginMode = None
|
6037
6064
|
if (not self.options['enableUnifiedAccount']) or (self.options['enableUnifiedAccount'] and market['inverse']):
|
6038
6065
|
# tradeMode would work for classic and UTA(inverse)
|
6039
|
-
marginMode
|
6066
|
+
if not isHistory: # cannot tell marginMode for fetchPositionsHistory, and closedSize will only be defined for fetchPositionsHistory response
|
6067
|
+
marginMode = 'isolated' if (tradeMode == 1) else 'cross'
|
6040
6068
|
collateralString = self.safe_string(position, 'positionBalance')
|
6041
|
-
entryPrice = self.omit_zero(self.
|
6069
|
+
entryPrice = self.omit_zero(self.safe_string_n(position, ['entryPrice', 'avgPrice', 'avgEntryPrice']))
|
6042
6070
|
liquidationPrice = self.omit_zero(self.safe_string(position, 'liqPrice'))
|
6043
6071
|
leverage = self.safe_string(position, 'leverage')
|
6044
6072
|
if liquidationPrice is not None:
|
@@ -6077,7 +6105,7 @@ class bybit(Exchange, ImplicitAPI):
|
|
6077
6105
|
'symbol': market['symbol'],
|
6078
6106
|
'timestamp': timestamp,
|
6079
6107
|
'datetime': self.iso8601(timestamp),
|
6080
|
-
'lastUpdateTimestamp':
|
6108
|
+
'lastUpdateTimestamp': lastUpdateTimestamp,
|
6081
6109
|
'initialMargin': self.parse_number(initialMarginString),
|
6082
6110
|
'initialMarginPercentage': self.parse_number(Precise.string_div(initialMarginString, notional)),
|
6083
6111
|
'maintenanceMargin': self.parse_number(maintenanceMarginString),
|
@@ -6086,12 +6114,13 @@ class bybit(Exchange, ImplicitAPI):
|
|
6086
6114
|
'notional': self.parse_number(notional),
|
6087
6115
|
'leverage': self.parse_number(leverage),
|
6088
6116
|
'unrealizedPnl': self.parse_number(unrealisedPnl),
|
6117
|
+
'realizedPnl': self.safe_number(position, 'closedPnl'),
|
6089
6118
|
'contracts': self.parse_number(size), # in USD for inverse swaps
|
6090
6119
|
'contractSize': self.safe_number(market, 'contractSize'),
|
6091
6120
|
'marginRatio': self.parse_number(marginRatio),
|
6092
6121
|
'liquidationPrice': self.parse_number(liquidationPrice),
|
6093
6122
|
'markPrice': self.safe_number(position, 'markPrice'),
|
6094
|
-
'lastPrice':
|
6123
|
+
'lastPrice': self.safe_number(position, 'avgExitPrice'),
|
6095
6124
|
'collateral': self.parse_number(collateralString),
|
6096
6125
|
'marginMode': marginMode,
|
6097
6126
|
'side': side,
|
@@ -7885,6 +7914,79 @@ class bybit(Exchange, ImplicitAPI):
|
|
7885
7914
|
'quoteVolume': None,
|
7886
7915
|
}
|
7887
7916
|
|
7917
|
+
async def fetch_positions_history(self, symbols: Strings = None, since: Int = None, limit: Int = None, params={}) -> List[Position]:
|
7918
|
+
"""
|
7919
|
+
fetches historical positions
|
7920
|
+
:see: https://bybit-exchange.github.io/docs/v5/position/close-pnl
|
7921
|
+
:param str [symbol]: unified market symbols, symbols must have the same subType(must all be linear or all be inverse)
|
7922
|
+
:param int [since]: timestamp in ms of the earliest position to fetch, params["until"] - since <= 7 days
|
7923
|
+
:param int [limit]: the maximum amount of records to fetch, default=50, max=100
|
7924
|
+
:param dict params: extra parameters specific to the exchange api endpoint
|
7925
|
+
:param int [params.until]: timestamp in ms of the latest position to fetch, params["until"] - since <= 7 days
|
7926
|
+
:param str [params.subType]: 'linear' or 'inverse'
|
7927
|
+
:returns dict[]: a list of `position structures <https://docs.ccxt.com/#/?id=position-structure>`
|
7928
|
+
"""
|
7929
|
+
await self.load_markets()
|
7930
|
+
market = None
|
7931
|
+
subType = None
|
7932
|
+
symbolsLength = 0
|
7933
|
+
if symbols is not None:
|
7934
|
+
symbolsLength = len(symbols)
|
7935
|
+
if symbolsLength > 0:
|
7936
|
+
market = self.market(symbols[0])
|
7937
|
+
until = self.safe_integer(params, 'until')
|
7938
|
+
subType, params = self.handle_sub_type_and_params('fetchPositionsHistory', market, params, 'linear')
|
7939
|
+
params = self.omit(params, 'until')
|
7940
|
+
request = {
|
7941
|
+
'category': subType,
|
7942
|
+
}
|
7943
|
+
if (symbols is not None) and (symbolsLength == 1):
|
7944
|
+
request['symbol'] = market['id']
|
7945
|
+
if since is not None:
|
7946
|
+
request['startTime'] = since
|
7947
|
+
if limit is not None:
|
7948
|
+
request['limit'] = limit
|
7949
|
+
if until is not None:
|
7950
|
+
request['endTime'] = until
|
7951
|
+
response = await self.privateGetV5PositionClosedPnl(self.extend(request, params))
|
7952
|
+
#
|
7953
|
+
# {
|
7954
|
+
# retCode: '0',
|
7955
|
+
# retMsg: 'OK',
|
7956
|
+
# result: {
|
7957
|
+
# nextPageCursor: '071749f3-a9fa-427b-b5ca-27b2f52b81de%3A1712717265566520788%2C071749f3-a9fa-427b-b5ca-27b2f52b81de%3A1712717265566520788',
|
7958
|
+
# category: 'linear',
|
7959
|
+
# list: [
|
7960
|
+
# {
|
7961
|
+
# symbol: 'XRPUSDT',
|
7962
|
+
# orderType: 'Market',
|
7963
|
+
# leverage: '10',
|
7964
|
+
# updatedTime: '1712717265572',
|
7965
|
+
# side: 'Sell',
|
7966
|
+
# orderId: '071749f3-a9fa-427b-b5ca-27b2f52b81de',
|
7967
|
+
# closedPnl: '-0.00049568',
|
7968
|
+
# avgEntryPrice: '0.6045',
|
7969
|
+
# qty: '3',
|
7970
|
+
# cumEntryValue: '1.8135',
|
7971
|
+
# createdTime: '1712717265566',
|
7972
|
+
# orderPrice: '0.5744',
|
7973
|
+
# closedSize: '3',
|
7974
|
+
# avgExitPrice: '0.605',
|
7975
|
+
# execType: 'Trade',
|
7976
|
+
# fillCount: '1',
|
7977
|
+
# cumExitValue: '1.815'
|
7978
|
+
# }
|
7979
|
+
# ]
|
7980
|
+
# },
|
7981
|
+
# retExtInfo: {},
|
7982
|
+
# time: '1712717286073'
|
7983
|
+
# }
|
7984
|
+
#
|
7985
|
+
result = self.safe_dict(response, 'result')
|
7986
|
+
rawPositions = self.safe_list(result, 'list')
|
7987
|
+
positions = self.parse_positions(rawPositions, symbols, params)
|
7988
|
+
return self.filter_by_since_limit(positions, since, limit)
|
7989
|
+
|
7888
7990
|
def sign(self, path, api='public', method='GET', params={}, headers=None, body=None):
|
7889
7991
|
url = self.implode_hostname(self.urls['api'][api]) + '/' + path
|
7890
7992
|
if api == 'public':
|
ccxt/async_support/cex.py
CHANGED
@@ -75,7 +75,13 @@ class cex(Exchange, ImplicitAPI):
|
|
75
75
|
'fetchOrder': True,
|
76
76
|
'fetchOrderBook': True,
|
77
77
|
'fetchOrders': True,
|
78
|
+
'fetchPosition': False,
|
79
|
+
'fetchPositionHistory': False,
|
78
80
|
'fetchPositionMode': False,
|
81
|
+
'fetchPositions': False,
|
82
|
+
'fetchPositionsForSymbol': False,
|
83
|
+
'fetchPositionsHistory': False,
|
84
|
+
'fetchPositionsRisk': False,
|
79
85
|
'fetchPremiumIndexOHLCV': False,
|
80
86
|
'fetchTicker': True,
|
81
87
|
'fetchTickers': True,
|
ccxt/async_support/coinbase.py
CHANGED
@@ -213,6 +213,11 @@ class coinbase(Exchange, ImplicitAPI):
|
|
213
213
|
'public': {
|
214
214
|
'get': {
|
215
215
|
'brokerage/time': 3,
|
216
|
+
'brokerage/market/product_book': 3,
|
217
|
+
'brokerage/market/products': 3,
|
218
|
+
'brokerage/market/products/{product_id}': 3,
|
219
|
+
'brokerage/market/products/{product_id}/candles': 3,
|
220
|
+
'brokerage/market/products/{product_id}/ticker': 3,
|
216
221
|
},
|
217
222
|
},
|
218
223
|
'private': {
|
@@ -1060,7 +1065,7 @@ class coinbase(Exchange, ImplicitAPI):
|
|
1060
1065
|
|
1061
1066
|
async def fetch_markets(self, params={}) -> List[Market]:
|
1062
1067
|
"""
|
1063
|
-
:see: https://docs.cloud.coinbase.com/advanced-trade-api/reference/
|
1068
|
+
:see: https://docs.cloud.coinbase.com/advanced-trade-api/reference/retailbrokerageapi_getpublicproducts
|
1064
1069
|
:see: https://docs.cloud.coinbase.com/sign-in-with-coinbase/docs/api-currencies#get-fiat-currencies
|
1065
1070
|
:see: https://docs.cloud.coinbase.com/sign-in-with-coinbase/docs/api-exchange-rates#get-exchange-rates
|
1066
1071
|
retrieves data on all markets for coinbase
|
@@ -1143,19 +1148,89 @@ class coinbase(Exchange, ImplicitAPI):
|
|
1143
1148
|
|
1144
1149
|
async def fetch_markets_v3(self, params={}):
|
1145
1150
|
spotUnresolvedPromises = [
|
1146
|
-
self.
|
1147
|
-
|
1151
|
+
self.v3PublicGetBrokerageMarketProducts(params),
|
1152
|
+
#
|
1153
|
+
# {
|
1154
|
+
# products: [
|
1155
|
+
# {
|
1156
|
+
# product_id: 'BTC-USD',
|
1157
|
+
# price: '67060',
|
1158
|
+
# price_percentage_change_24h: '3.30054960636883',
|
1159
|
+
# volume_24h: '10967.87426597',
|
1160
|
+
# volume_percentage_change_24h: '141.73048325503036',
|
1161
|
+
# base_increment: '0.00000001',
|
1162
|
+
# quote_increment: '0.01',
|
1163
|
+
# quote_min_size: '1',
|
1164
|
+
# quote_max_size: '150000000',
|
1165
|
+
# base_min_size: '0.00000001',
|
1166
|
+
# base_max_size: '3400',
|
1167
|
+
# base_name: 'Bitcoin',
|
1168
|
+
# quote_name: 'US Dollar',
|
1169
|
+
# watched: False,
|
1170
|
+
# is_disabled: False,
|
1171
|
+
# new: False,
|
1172
|
+
# status: 'online',
|
1173
|
+
# cancel_only: False,
|
1174
|
+
# limit_only: False,
|
1175
|
+
# post_only: False,
|
1176
|
+
# trading_disabled: False,
|
1177
|
+
# auction_mode: False,
|
1178
|
+
# product_type: 'SPOT',
|
1179
|
+
# quote_currency_id: 'USD',
|
1180
|
+
# base_currency_id: 'BTC',
|
1181
|
+
# fcm_trading_session_details: null,
|
1182
|
+
# mid_market_price: '',
|
1183
|
+
# alias: '',
|
1184
|
+
# alias_to: ['BTC-USDC'],
|
1185
|
+
# base_display_symbol: 'BTC',
|
1186
|
+
# quote_display_symbol: 'USD',
|
1187
|
+
# view_only: False,
|
1188
|
+
# price_increment: '0.01',
|
1189
|
+
# display_name: 'BTC-USD',
|
1190
|
+
# product_venue: 'CBE'
|
1191
|
+
# },
|
1192
|
+
# ...
|
1193
|
+
# ],
|
1194
|
+
# num_products: '646'
|
1195
|
+
# }
|
1196
|
+
#
|
1148
1197
|
]
|
1198
|
+
if self.check_required_credentials(False):
|
1199
|
+
spotUnresolvedPromises.append(self.v3PrivateGetBrokerageTransactionSummary(params))
|
1200
|
+
#
|
1201
|
+
# {
|
1202
|
+
# total_volume: '9.995989116664404',
|
1203
|
+
# total_fees: '0.07996791093331522',
|
1204
|
+
# fee_tier: {
|
1205
|
+
# pricing_tier: 'Advanced 1',
|
1206
|
+
# usd_from: '0',
|
1207
|
+
# usd_to: '1000',
|
1208
|
+
# taker_fee_rate: '0.008',
|
1209
|
+
# maker_fee_rate: '0.006',
|
1210
|
+
# aop_from: '',
|
1211
|
+
# aop_to: ''
|
1212
|
+
# },
|
1213
|
+
# margin_rate: null,
|
1214
|
+
# goods_and_services_tax: null,
|
1215
|
+
# advanced_trade_only_volume: '9.995989116664404',
|
1216
|
+
# advanced_trade_only_fees: '0.07996791093331522',
|
1217
|
+
# coinbase_pro_volume: '0',
|
1218
|
+
# coinbase_pro_fees: '0',
|
1219
|
+
# total_balance: '',
|
1220
|
+
# has_promo_fee: False
|
1221
|
+
# }
|
1222
|
+
#
|
1149
1223
|
unresolvedContractPromises = []
|
1150
1224
|
try:
|
1151
1225
|
unresolvedContractPromises = [
|
1152
|
-
self.
|
1153
|
-
self.
|
1154
|
-
self.v3PrivateGetBrokerageTransactionSummary(self.extend(params, {'product_type': 'FUTURE'})),
|
1155
|
-
self.v3PrivateGetBrokerageTransactionSummary(self.extend(params, {'product_type': 'FUTURE', 'contract_expiry_type': 'PERPETUAL'})),
|
1226
|
+
self.v3PublicGetBrokerageMarketProducts(self.extend(params, {'product_type': 'FUTURE'})),
|
1227
|
+
self.v3PublicGetBrokerageMarketProducts(self.extend(params, {'product_type': 'FUTURE', 'contract_expiry_type': 'PERPETUAL'})),
|
1156
1228
|
]
|
1229
|
+
if self.check_required_credentials(False):
|
1230
|
+
unresolvedContractPromises.append(self.extend(params, {'product_type': 'FUTURE'}))
|
1231
|
+
unresolvedContractPromises.append(self.extend(params, {'product_type': 'FUTURE', 'contract_expiry_type': 'PERPETUAL'}))
|
1157
1232
|
except Exception as e:
|
1158
|
-
unresolvedContractPromises = [] # the sync version of ccxt won't have the promise.all line so the request is made here
|
1233
|
+
unresolvedContractPromises = [] # the sync version of ccxt won't have the promise.all line so the request is made here. Some users can't access perpetual products
|
1159
1234
|
promises = await asyncio.gather(*spotUnresolvedPromises)
|
1160
1235
|
contractPromises = None
|
1161
1236
|
try:
|
@@ -1418,6 +1493,7 @@ class coinbase(Exchange, ImplicitAPI):
|
|
1418
1493
|
contractSize = self.safe_number(futureProductDetails, 'contract_size')
|
1419
1494
|
contractExpire = self.safe_string(futureProductDetails, 'contract_expiry')
|
1420
1495
|
expireTimestamp = self.parse8601(contractExpire)
|
1496
|
+
expireDateTime = self.iso8601(expireTimestamp)
|
1421
1497
|
isSwap = (contractExpiryType == 'PERPETUAL')
|
1422
1498
|
baseId = self.safe_string(futureProductDetails, 'contract_root_unit')
|
1423
1499
|
quoteId = self.safe_string(market, 'quote_currency_id')
|
@@ -1459,7 +1535,7 @@ class coinbase(Exchange, ImplicitAPI):
|
|
1459
1535
|
'maker': maker,
|
1460
1536
|
'contractSize': contractSize,
|
1461
1537
|
'expiry': expireTimestamp,
|
1462
|
-
'expiryDatetime':
|
1538
|
+
'expiryDatetime': expireDateTime,
|
1463
1539
|
'strike': None,
|
1464
1540
|
'optionType': None,
|
1465
1541
|
'precision': {
|
@@ -1674,7 +1750,7 @@ class coinbase(Exchange, ImplicitAPI):
|
|
1674
1750
|
request = {}
|
1675
1751
|
if symbols is not None:
|
1676
1752
|
request['product_ids'] = self.market_ids(symbols)
|
1677
|
-
response = await self.
|
1753
|
+
response = await self.v3PublicGetBrokerageMarketProducts(self.extend(request, params))
|
1678
1754
|
#
|
1679
1755
|
# {
|
1680
1756
|
# "products": [
|
@@ -1773,7 +1849,7 @@ class coinbase(Exchange, ImplicitAPI):
|
|
1773
1849
|
'product_id': market['id'],
|
1774
1850
|
'limit': 1,
|
1775
1851
|
}
|
1776
|
-
response = await self.
|
1852
|
+
response = await self.v3PublicGetBrokerageMarketProductsProductIdTicker(self.extend(request, params))
|
1777
1853
|
#
|
1778
1854
|
# {
|
1779
1855
|
# "trades": [
|
@@ -3212,7 +3288,7 @@ class coinbase(Exchange, ImplicitAPI):
|
|
3212
3288
|
async def fetch_ohlcv(self, symbol: str, timeframe='1m', since: Int = None, limit: Int = None, params={}) -> List[list]:
|
3213
3289
|
"""
|
3214
3290
|
fetches historical candlestick data containing the open, high, low, and close price, and the volume of a market
|
3215
|
-
:see: https://docs.cloud.coinbase.com/advanced-trade-api/reference/
|
3291
|
+
:see: https://docs.cloud.coinbase.com/advanced-trade-api/reference/retailbrokerageapi_getpubliccandles
|
3216
3292
|
:param str symbol: unified symbol of the market to fetch OHLCV data for
|
3217
3293
|
:param str timeframe: the length of time each candle represents
|
3218
3294
|
:param int [since]: timestamp in ms of the earliest candle to fetch
|
@@ -3250,7 +3326,7 @@ class coinbase(Exchange, ImplicitAPI):
|
|
3250
3326
|
else:
|
3251
3327
|
# 300 candles max
|
3252
3328
|
request['end'] = Precise.string_add(sinceString, str(requestedDuration))
|
3253
|
-
response = await self.
|
3329
|
+
response = await self.v3PublicGetBrokerageMarketProductsProductIdCandles(self.extend(request, params))
|
3254
3330
|
#
|
3255
3331
|
# {
|
3256
3332
|
# "candles": [
|
@@ -3293,7 +3369,7 @@ class coinbase(Exchange, ImplicitAPI):
|
|
3293
3369
|
async def fetch_trades(self, symbol: str, since: Int = None, limit: Int = None, params={}) -> List[Trade]:
|
3294
3370
|
"""
|
3295
3371
|
get the list of most recent trades for a particular symbol
|
3296
|
-
:see: https://docs.cloud.coinbase.com/advanced-trade-api/reference/
|
3372
|
+
:see: https://docs.cloud.coinbase.com/advanced-trade-api/reference/retailbrokerageapi_getpublicmarkettrades
|
3297
3373
|
:param str symbol: unified market symbol of the trades
|
3298
3374
|
:param int [since]: not used by coinbase fetchTrades
|
3299
3375
|
:param int [limit]: the maximum number of trade structures to fetch
|
@@ -3315,7 +3391,7 @@ class coinbase(Exchange, ImplicitAPI):
|
|
3315
3391
|
request['end'] = self.number_to_string(self.parse_to_int(until / 1000))
|
3316
3392
|
elif since is not None:
|
3317
3393
|
raise ArgumentsRequired(self.id + ' fetchTrades() requires a `until` parameter when you use `since` argument')
|
3318
|
-
response = await self.
|
3394
|
+
response = await self.v3PublicGetBrokerageMarketProductsProductIdTicker(self.extend(request, params))
|
3319
3395
|
#
|
3320
3396
|
# {
|
3321
3397
|
# "trades": [
|
@@ -3401,7 +3477,7 @@ class coinbase(Exchange, ImplicitAPI):
|
|
3401
3477
|
async def fetch_order_book(self, symbol: str, limit: Int = None, params={}) -> OrderBook:
|
3402
3478
|
"""
|
3403
3479
|
fetches information on open orders with bid(buy) and ask(sell) prices, volumes and other data
|
3404
|
-
:see: https://docs.cloud.coinbase.com/advanced-trade-api/reference/
|
3480
|
+
:see: https://docs.cloud.coinbase.com/advanced-trade-api/reference/retailbrokerageapi_getpublicproductbook
|
3405
3481
|
:param str symbol: unified symbol of the market to fetch the order book for
|
3406
3482
|
:param int [limit]: the maximum amount of order book entries to return
|
3407
3483
|
:param dict [params]: extra parameters specific to the exchange API endpoint
|
@@ -3414,7 +3490,7 @@ class coinbase(Exchange, ImplicitAPI):
|
|
3414
3490
|
}
|
3415
3491
|
if limit is not None:
|
3416
3492
|
request['limit'] = limit
|
3417
|
-
response = await self.
|
3493
|
+
response = await self.v3PublicGetBrokerageMarketProductBook(self.extend(request, params))
|
3418
3494
|
#
|
3419
3495
|
# {
|
3420
3496
|
# "pricebook": {
|
@@ -3479,7 +3555,7 @@ class coinbase(Exchange, ImplicitAPI):
|
|
3479
3555
|
tickers = self.safe_list(response, 'pricebooks', [])
|
3480
3556
|
return self.parse_tickers(tickers, symbols)
|
3481
3557
|
|
3482
|
-
async def withdraw(self, code: str, amount: float, address, tag=None, params={}):
|
3558
|
+
async def withdraw(self, code: str, amount: float, address: str, tag=None, params={}):
|
3483
3559
|
"""
|
3484
3560
|
make a withdrawal
|
3485
3561
|
:see: https://docs.cloud.coinbase.com/sign-in-with-coinbase/docs/api-transactions#send-money
|
@@ -99,8 +99,10 @@ class coinbaseinternational(Exchange, ImplicitAPI):
|
|
99
99
|
'fetchOrderBook': False,
|
100
100
|
'fetchOrders': False,
|
101
101
|
'fetchPosition': True,
|
102
|
+
'fetchPositionHistory': False,
|
102
103
|
'fetchPositionMode': False,
|
103
104
|
'fetchPositions': True,
|
105
|
+
'fetchPositionsHistory': False,
|
104
106
|
'fetchPositionsRisk': False,
|
105
107
|
'fetchPremiumIndexOHLCV': False,
|
106
108
|
'fetchTicker': True,
|
@@ -1771,7 +1773,7 @@ class coinbaseinternational(Exchange, ImplicitAPI):
|
|
1771
1773
|
trades = self.safe_list(response, 'results', [])
|
1772
1774
|
return self.parse_trades(trades, market, since, limit)
|
1773
1775
|
|
1774
|
-
async def withdraw(self, code: str, amount: float, address, tag=None, params={}):
|
1776
|
+
async def withdraw(self, code: str, amount: float, address: str, tag=None, params={}):
|
1775
1777
|
"""
|
1776
1778
|
make a withdrawal
|
1777
1779
|
:see: https://docs.cloud.coinbase.com/intx/reference/withdraw
|
@@ -64,7 +64,13 @@ class coinbasepro(Exchange, ImplicitAPI):
|
|
64
64
|
'fetchOrderBook': True,
|
65
65
|
'fetchOrders': True,
|
66
66
|
'fetchOrderTrades': True,
|
67
|
+
'fetchPosition': False,
|
68
|
+
'fetchPositionHistory': False,
|
67
69
|
'fetchPositionMode': False,
|
70
|
+
'fetchPositions': False,
|
71
|
+
'fetchPositionsForSymbol': False,
|
72
|
+
'fetchPositionsHistory': False,
|
73
|
+
'fetchPositionsRisk': False,
|
68
74
|
'fetchTicker': True,
|
69
75
|
'fetchTickers': True,
|
70
76
|
'fetchTime': True,
|
@@ -1274,7 +1280,7 @@ class coinbasepro(Exchange, ImplicitAPI):
|
|
1274
1280
|
async def fetch_payment_methods(self, params={}):
|
1275
1281
|
return await self.privateGetPaymentMethods(params)
|
1276
1282
|
|
1277
|
-
async def withdraw(self, code: str, amount: float, address, tag=None, params={}):
|
1283
|
+
async def withdraw(self, code: str, amount: float, address: str, tag=None, params={}):
|
1278
1284
|
"""
|
1279
1285
|
make a withdrawal
|
1280
1286
|
:see: https://docs.cloud.coinbase.com/exchange/reference/exchangerestapi_postwithdrawpaymentmethod
|
ccxt/async_support/coincheck.py
CHANGED
@@ -56,8 +56,11 @@ class coincheck(Exchange, ImplicitAPI):
|
|
56
56
|
'fetchOpenOrders': True,
|
57
57
|
'fetchOrderBook': True,
|
58
58
|
'fetchPosition': False,
|
59
|
+
'fetchPositionHistory': False,
|
59
60
|
'fetchPositionMode': False,
|
60
61
|
'fetchPositions': False,
|
62
|
+
'fetchPositionsForSymbol': False,
|
63
|
+
'fetchPositionsHistory': False,
|
61
64
|
'fetchPositionsRisk': False,
|
62
65
|
'fetchPremiumIndexOHLCV': False,
|
63
66
|
'fetchTicker': True,
|