ccxt 4.4.25__py2.py3-none-any.whl → 4.4.27__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/alpaca.py +3 -0
- ccxt/abstract/bingx.py +1 -0
- ccxt/abstract/hyperliquid.py +1 -1
- ccxt/abstract/okx.py +1 -0
- ccxt/abstract/phemex.py +1 -0
- ccxt/ace.py +1 -1
- ccxt/alpaca.py +426 -17
- ccxt/ascendex.py +1 -1
- ccxt/async_support/__init__.py +1 -1
- ccxt/async_support/ace.py +1 -1
- ccxt/async_support/alpaca.py +426 -17
- ccxt/async_support/ascendex.py +1 -1
- ccxt/async_support/base/exchange.py +24 -6
- ccxt/async_support/bequant.py +1 -1
- ccxt/async_support/bigone.py +1 -1
- ccxt/async_support/binance.py +6 -7
- ccxt/async_support/binancecoinm.py +1 -1
- ccxt/async_support/binanceus.py +1 -1
- ccxt/async_support/binanceusdm.py +1 -1
- ccxt/async_support/bingx.py +29 -29
- ccxt/async_support/bit2c.py +1 -1
- ccxt/async_support/bitbank.py +1 -1
- ccxt/async_support/bitbns.py +1 -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 +6 -6
- ccxt/async_support/bithumb.py +1 -1
- ccxt/async_support/bitmart.py +7 -7
- ccxt/async_support/bitmex.py +1 -1
- ccxt/async_support/bitopro.py +1 -1
- ccxt/async_support/bitrue.py +1 -1
- ccxt/async_support/bitso.py +1 -1
- ccxt/async_support/bitstamp.py +1 -1
- ccxt/async_support/bitteam.py +1 -1
- ccxt/async_support/bitvavo.py +1 -1
- ccxt/async_support/bl3p.py +1 -1
- ccxt/async_support/blockchaincom.py +1 -1
- ccxt/async_support/blofin.py +1 -1
- ccxt/async_support/btcalpha.py +1 -1
- ccxt/async_support/btcbox.py +1 -1
- ccxt/async_support/btcmarkets.py +1 -1
- ccxt/async_support/btcturk.py +1 -1
- ccxt/async_support/bybit.py +10 -16
- ccxt/async_support/cex.py +36 -0
- ccxt/async_support/coinbase.py +89 -11
- ccxt/async_support/coinex.py +6 -8
- ccxt/async_support/digifinex.py +5 -5
- ccxt/async_support/exmo.py +1 -0
- ccxt/async_support/gate.py +26 -22
- ccxt/async_support/htx.py +5 -6
- ccxt/async_support/hyperliquid.py +31 -5
- ccxt/async_support/kucoin.py +5 -5
- ccxt/async_support/lbank.py +97 -2
- ccxt/async_support/okx.py +6 -5
- ccxt/async_support/phemex.py +4 -2
- ccxt/async_support/wavesexchange.py +13 -2
- ccxt/async_support/whitebit.py +5 -5
- ccxt/async_support/woo.py +1 -1
- ccxt/async_support/xt.py +32 -24
- ccxt/base/exchange.py +29 -6
- ccxt/base/types.py +12 -0
- ccxt/bequant.py +1 -1
- ccxt/bigone.py +1 -1
- ccxt/binance.py +6 -7
- ccxt/binancecoinm.py +1 -1
- ccxt/binanceus.py +1 -1
- ccxt/binanceusdm.py +1 -1
- ccxt/bingx.py +29 -29
- ccxt/bit2c.py +1 -1
- ccxt/bitbank.py +1 -1
- ccxt/bitbns.py +1 -1
- ccxt/bitfinex.py +1 -1
- ccxt/bitfinex2.py +1 -1
- ccxt/bitflyer.py +1 -1
- ccxt/bitget.py +6 -6
- ccxt/bithumb.py +1 -1
- ccxt/bitmart.py +7 -7
- ccxt/bitmex.py +1 -1
- ccxt/bitopro.py +1 -1
- ccxt/bitrue.py +1 -1
- ccxt/bitso.py +1 -1
- ccxt/bitstamp.py +1 -1
- ccxt/bitteam.py +1 -1
- ccxt/bitvavo.py +1 -1
- ccxt/bl3p.py +1 -1
- ccxt/blockchaincom.py +1 -1
- ccxt/blofin.py +1 -1
- ccxt/btcalpha.py +1 -1
- ccxt/btcbox.py +1 -1
- ccxt/btcmarkets.py +1 -1
- ccxt/btcturk.py +1 -1
- ccxt/bybit.py +10 -16
- ccxt/cex.py +36 -0
- ccxt/coinbase.py +89 -11
- ccxt/coinex.py +6 -8
- ccxt/digifinex.py +5 -5
- ccxt/exmo.py +1 -0
- ccxt/gate.py +26 -22
- ccxt/htx.py +5 -6
- ccxt/hyperliquid.py +31 -5
- ccxt/kucoin.py +5 -5
- ccxt/lbank.py +97 -2
- ccxt/okx.py +6 -5
- ccxt/phemex.py +4 -2
- ccxt/pro/__init__.py +1 -1
- ccxt/pro/binance.py +2 -2
- ccxt/pro/bybit.py +1 -1
- ccxt/pro/exmo.py +204 -4
- ccxt/pro/lbank.py +7 -4
- ccxt/pro/okx.py +1 -1
- ccxt/test/tests_helpers.py +3 -1
- ccxt/wavesexchange.py +13 -2
- ccxt/whitebit.py +5 -5
- ccxt/woo.py +1 -1
- ccxt/xt.py +32 -24
- ccxt-4.4.27.dist-info/METADATA +637 -0
- {ccxt-4.4.25.dist-info → ccxt-4.4.27.dist-info}/RECORD +122 -122
- ccxt-4.4.25.dist-info/METADATA +0 -636
- {ccxt-4.4.25.dist-info → ccxt-4.4.27.dist-info}/LICENSE.txt +0 -0
- {ccxt-4.4.25.dist-info → ccxt-4.4.27.dist-info}/WHEEL +0 -0
- {ccxt-4.4.25.dist-info → ccxt-4.4.27.dist-info}/top_level.txt +0 -0
ccxt/async_support/alpaca.py
CHANGED
@@ -5,10 +5,11 @@
|
|
5
5
|
|
6
6
|
from ccxt.async_support.base.exchange import Exchange
|
7
7
|
from ccxt.abstract.alpaca import ImplicitAPI
|
8
|
-
from ccxt.base.types import Int, Market, Num, Order, OrderBook, OrderSide, OrderType, Str, Trade
|
8
|
+
from ccxt.base.types import Currency, DepositAddress, Int, Market, Num, Order, OrderBook, OrderSide, OrderType, Str, Strings, Ticker, Tickers, Trade, Transaction
|
9
9
|
from typing import List
|
10
10
|
from ccxt.base.errors import ExchangeError
|
11
11
|
from ccxt.base.errors import PermissionDenied
|
12
|
+
from ccxt.base.errors import ArgumentsRequired
|
12
13
|
from ccxt.base.errors import BadRequest
|
13
14
|
from ccxt.base.errors import BadSymbol
|
14
15
|
from ccxt.base.errors import InsufficientFunds
|
@@ -32,7 +33,7 @@ class alpaca(Exchange, ImplicitAPI):
|
|
32
33
|
'hostname': 'alpaca.markets',
|
33
34
|
'pro': True,
|
34
35
|
'urls': {
|
35
|
-
'logo': 'https://
|
36
|
+
'logo': 'https://github.com/user-attachments/assets/e9476df8-a450-4c3e-ab9a-1a7794219e1b',
|
36
37
|
'www': 'https://alpaca.markets',
|
37
38
|
'api': {
|
38
39
|
'broker': 'https://broker-api.{hostname}',
|
@@ -63,10 +64,10 @@ class alpaca(Exchange, ImplicitAPI):
|
|
63
64
|
'fetchBidsAsks': False,
|
64
65
|
'fetchClosedOrders': True,
|
65
66
|
'fetchCurrencies': False,
|
66
|
-
'fetchDepositAddress':
|
67
|
+
'fetchDepositAddress': True,
|
67
68
|
'fetchDepositAddressesByNetwork': False,
|
68
|
-
'fetchDeposits':
|
69
|
-
'fetchDepositsWithdrawals':
|
69
|
+
'fetchDeposits': True,
|
70
|
+
'fetchDepositsWithdrawals': True,
|
70
71
|
'fetchFundingHistory': False,
|
71
72
|
'fetchFundingRate': False,
|
72
73
|
'fetchFundingRateHistory': False,
|
@@ -74,7 +75,7 @@ class alpaca(Exchange, ImplicitAPI):
|
|
74
75
|
'fetchL1OrderBook': True,
|
75
76
|
'fetchL2OrderBook': False,
|
76
77
|
'fetchMarkets': True,
|
77
|
-
'fetchMyTrades':
|
78
|
+
'fetchMyTrades': True,
|
78
79
|
'fetchOHLCV': True,
|
79
80
|
'fetchOpenOrder': False,
|
80
81
|
'fetchOpenOrders': True,
|
@@ -89,8 +90,8 @@ class alpaca(Exchange, ImplicitAPI):
|
|
89
90
|
'fetchPositionsHistory': False,
|
90
91
|
'fetchPositionsRisk': False,
|
91
92
|
'fetchStatus': False,
|
92
|
-
'fetchTicker':
|
93
|
-
'fetchTickers':
|
93
|
+
'fetchTicker': True,
|
94
|
+
'fetchTickers': True,
|
94
95
|
'fetchTime': True,
|
95
96
|
'fetchTrades': True,
|
96
97
|
'fetchTradingFee': False,
|
@@ -98,12 +99,12 @@ class alpaca(Exchange, ImplicitAPI):
|
|
98
99
|
'fetchTransactionFees': False,
|
99
100
|
'fetchTransactions': False,
|
100
101
|
'fetchTransfers': False,
|
101
|
-
'fetchWithdrawals':
|
102
|
+
'fetchWithdrawals': True,
|
102
103
|
'sandbox': True,
|
103
104
|
'setLeverage': False,
|
104
105
|
'setMarginMode': False,
|
105
106
|
'transfer': False,
|
106
|
-
'withdraw':
|
107
|
+
'withdraw': True,
|
107
108
|
},
|
108
109
|
'api': {
|
109
110
|
'broker': {
|
@@ -129,12 +130,15 @@ class alpaca(Exchange, ImplicitAPI):
|
|
129
130
|
'v2/assets/{symbol_or_asset_id}',
|
130
131
|
'v2/corporate_actions/announcements/{id}',
|
131
132
|
'v2/corporate_actions/announcements',
|
133
|
+
'v2/wallets',
|
134
|
+
'v2/wallets/transfers',
|
132
135
|
],
|
133
136
|
'post': [
|
134
137
|
'v2/orders',
|
135
138
|
'v2/watchlists',
|
136
139
|
'v2/watchlists/{watchlist_id}',
|
137
140
|
'v2/watchlists:by_name',
|
141
|
+
'v2/wallets/transfers',
|
138
142
|
],
|
139
143
|
'put': [
|
140
144
|
'v2/watchlists/{watchlist_id}',
|
@@ -671,6 +675,130 @@ class alpaca(Exchange, ImplicitAPI):
|
|
671
675
|
self.safe_number(ohlcv, 'v'), # volume
|
672
676
|
]
|
673
677
|
|
678
|
+
async def fetch_ticker(self, symbol: str, params={}) -> Ticker:
|
679
|
+
"""
|
680
|
+
fetches a price ticker, a statistical calculation with the information calculated over the past 24 hours for a specific market
|
681
|
+
:see: https://docs.alpaca.markets/reference/cryptosnapshots-1
|
682
|
+
:param str symbol: unified symbol of the market to fetch the ticker for
|
683
|
+
:param dict [params]: extra parameters specific to the exchange API endpoint
|
684
|
+
:param str [params.loc]: crypto location, default: us
|
685
|
+
:returns dict: a `ticker structure <https://docs.ccxt.com/#/?id=ticker-structure>`
|
686
|
+
"""
|
687
|
+
await self.load_markets()
|
688
|
+
symbol = self.symbol(symbol)
|
689
|
+
tickers = await self.fetch_tickers([symbol], params)
|
690
|
+
return self.safe_dict(tickers, symbol)
|
691
|
+
|
692
|
+
async def fetch_tickers(self, symbols: Strings = None, params={}) -> Tickers:
|
693
|
+
"""
|
694
|
+
fetches price tickers for multiple markets, statistical information calculated over the past 24 hours for each market
|
695
|
+
:see: https://docs.alpaca.markets/reference/cryptosnapshots-1
|
696
|
+
:param str[] symbols: unified symbols of the markets to fetch tickers for
|
697
|
+
:param dict [params]: extra parameters specific to the exchange API endpoint
|
698
|
+
:param str [params.loc]: crypto location, default: us
|
699
|
+
:returns dict: a dictionary of `ticker structures <https://docs.ccxt.com/#/?id=ticker-structure>`
|
700
|
+
"""
|
701
|
+
if symbols is None:
|
702
|
+
raise ArgumentsRequired(self.id + ' fetchTickers() requires a symbols argument')
|
703
|
+
await self.load_markets()
|
704
|
+
symbols = self.market_symbols(symbols)
|
705
|
+
loc = self.safe_string(params, 'loc', 'us')
|
706
|
+
ids = self.market_ids(symbols)
|
707
|
+
request = {
|
708
|
+
'symbols': ','.join(ids),
|
709
|
+
'loc': loc,
|
710
|
+
}
|
711
|
+
params = self.omit(params, 'loc')
|
712
|
+
response = await self.marketPublicGetV1beta3CryptoLocSnapshots(self.extend(request, params))
|
713
|
+
#
|
714
|
+
# {
|
715
|
+
# "snapshots": {
|
716
|
+
# "BTC/USD": {
|
717
|
+
# "dailyBar": {
|
718
|
+
# "c": 69403.554,
|
719
|
+
# "h": 69609.6515,
|
720
|
+
# "l": 69013.26,
|
721
|
+
# "n": 9,
|
722
|
+
# "o": 69536.7,
|
723
|
+
# "t": "2024-11-01T05:00:00Z",
|
724
|
+
# "v": 0.210809181,
|
725
|
+
# "vw": 69327.655393908
|
726
|
+
# },
|
727
|
+
# "latestQuote": {
|
728
|
+
# "ap": 69424.19,
|
729
|
+
# "as": 0.68149,
|
730
|
+
# "bp": 69366.086,
|
731
|
+
# "bs": 0.68312,
|
732
|
+
# "t": "2024-11-01T08:31:41.880246926Z"
|
733
|
+
# },
|
734
|
+
# "latestTrade": {
|
735
|
+
# "i": 5272941104897543146,
|
736
|
+
# "p": 69416.9,
|
737
|
+
# "s": 0.014017324,
|
738
|
+
# "t": "2024-11-01T08:14:28.245088803Z",
|
739
|
+
# "tks": "B"
|
740
|
+
# },
|
741
|
+
# "minuteBar": {
|
742
|
+
# "c": 69403.554,
|
743
|
+
# "h": 69403.554,
|
744
|
+
# "l": 69399.125,
|
745
|
+
# "n": 0,
|
746
|
+
# "o": 69399.125,
|
747
|
+
# "t": "2024-11-01T08:30:00Z",
|
748
|
+
# "v": 0,
|
749
|
+
# "vw": 0
|
750
|
+
# },
|
751
|
+
# "prevDailyBar": {
|
752
|
+
# "c": 69515.1415,
|
753
|
+
# "h": 72668.837,
|
754
|
+
# "l": 68796.85,
|
755
|
+
# "n": 129,
|
756
|
+
# "o": 72258.9,
|
757
|
+
# "t": "2024-10-31T05:00:00Z",
|
758
|
+
# "v": 2.217683307,
|
759
|
+
# "vw": 70782.6811608144
|
760
|
+
# }
|
761
|
+
# },
|
762
|
+
# }
|
763
|
+
# }
|
764
|
+
#
|
765
|
+
results = []
|
766
|
+
snapshots = self.safe_dict(response, 'snapshots', {})
|
767
|
+
marketIds = list(snapshots.keys())
|
768
|
+
for i in range(0, len(marketIds)):
|
769
|
+
marketId = marketIds[i]
|
770
|
+
market = self.safe_market(marketId)
|
771
|
+
entry = self.safe_dict(snapshots, marketId)
|
772
|
+
dailyBar = self.safe_dict(entry, 'dailyBar', {})
|
773
|
+
prevDailyBar = self.safe_dict(entry, 'prevDailyBar', {})
|
774
|
+
latestQuote = self.safe_dict(entry, 'latestQuote', {})
|
775
|
+
latestTrade = self.safe_dict(entry, 'latestTrade', {})
|
776
|
+
datetime = self.safe_string(latestQuote, 't')
|
777
|
+
ticker = self.safe_ticker({
|
778
|
+
'info': entry,
|
779
|
+
'symbol': market['symbol'],
|
780
|
+
'timestamp': self.parse8601(datetime),
|
781
|
+
'datetime': datetime,
|
782
|
+
'high': self.safe_string(dailyBar, 'h'),
|
783
|
+
'low': self.safe_string(dailyBar, 'l'),
|
784
|
+
'bid': self.safe_string(latestQuote, 'bp'),
|
785
|
+
'bidVolume': self.safe_string(latestQuote, 'bs'),
|
786
|
+
'ask': self.safe_string(latestQuote, 'ap'),
|
787
|
+
'askVolume': self.safe_string(latestQuote, 'as'),
|
788
|
+
'vwap': self.safe_string(dailyBar, 'vw'),
|
789
|
+
'open': self.safe_string(dailyBar, 'o'),
|
790
|
+
'close': self.safe_string(dailyBar, 'c'),
|
791
|
+
'last': self.safe_string(latestTrade, 'p'),
|
792
|
+
'previousClose': self.safe_string(prevDailyBar, 'c'),
|
793
|
+
'change': None,
|
794
|
+
'percentage': None,
|
795
|
+
'average': None,
|
796
|
+
'baseVolume': self.safe_string(dailyBar, 'v'),
|
797
|
+
'quoteVolume': self.safe_string(dailyBar, 'n'),
|
798
|
+
}, market)
|
799
|
+
results.append(ticker)
|
800
|
+
return self.filter_by_array(results, 'symbol', symbols)
|
801
|
+
|
674
802
|
async def create_order(self, symbol: str, type: OrderType, side: OrderSide, amount: float, price: Num = None, params={}):
|
675
803
|
"""
|
676
804
|
create a trade order
|
@@ -1014,7 +1142,54 @@ class alpaca(Exchange, ImplicitAPI):
|
|
1014
1142
|
}
|
1015
1143
|
return self.safe_string(timeInForces, timeInForce, timeInForce)
|
1016
1144
|
|
1145
|
+
async def fetch_my_trades(self, symbol: Str = None, since: Int = None, limit: Int = None, params={}):
|
1146
|
+
"""
|
1147
|
+
fetch all trades made by the user
|
1148
|
+
:see: https://docs.alpaca.markets/reference/getaccountactivitiesbyactivitytype-1
|
1149
|
+
:param str [symbol]: unified market symbol
|
1150
|
+
:param int [since]: the earliest time in ms to fetch trades for
|
1151
|
+
:param int [limit]: the maximum number of trade structures to retrieve
|
1152
|
+
:param dict [params]: extra parameters specific to the exchange API endpoint
|
1153
|
+
:param int [params.until]: the latest time in ms to fetch trades for
|
1154
|
+
:returns Trade[]: a list of `trade structures <https://docs.ccxt.com/#/?id=trade-structure>`
|
1155
|
+
"""
|
1156
|
+
await self.load_markets()
|
1157
|
+
market = None
|
1158
|
+
request: dict = {
|
1159
|
+
'activity_type': 'FILL',
|
1160
|
+
}
|
1161
|
+
if symbol is not None:
|
1162
|
+
market = self.market(symbol)
|
1163
|
+
if since is not None:
|
1164
|
+
request['after'] = since
|
1165
|
+
if limit is not None:
|
1166
|
+
request['page_size'] = limit
|
1167
|
+
request, params = self.handle_until_option('until', request, params)
|
1168
|
+
response = await self.traderPrivateGetV2AccountActivitiesActivityType(self.extend(request, params))
|
1169
|
+
#
|
1170
|
+
# [
|
1171
|
+
# {
|
1172
|
+
# "id": "20221228071929579::ca2aafd0-1270-4b56-b0a9-85423b4a07c8",
|
1173
|
+
# "activity_type": "FILL",
|
1174
|
+
# "transaction_time": "2022-12-28T12:19:29.579352Z",
|
1175
|
+
# "type": "fill",
|
1176
|
+
# "price": "67.31",
|
1177
|
+
# "qty": "0.07",
|
1178
|
+
# "side": "sell",
|
1179
|
+
# "symbol": "LTC/USD",
|
1180
|
+
# "leaves_qty": "0",
|
1181
|
+
# "order_id": "82eebcf7-6e66-4b7e-93f8-be0df0e4f12e",
|
1182
|
+
# "cum_qty": "0.07",
|
1183
|
+
# "order_status": "filled",
|
1184
|
+
# "swap_rate": "1"
|
1185
|
+
# },
|
1186
|
+
# ]
|
1187
|
+
#
|
1188
|
+
return self.parse_trades(response, market, since, limit)
|
1189
|
+
|
1017
1190
|
def parse_trade(self, trade: dict, market: Market = None) -> Trade:
|
1191
|
+
#
|
1192
|
+
# fetchTrades
|
1018
1193
|
#
|
1019
1194
|
# {
|
1020
1195
|
# "t":"2022-06-14T05:00:00.027869Z",
|
@@ -1025,25 +1200,43 @@ class alpaca(Exchange, ImplicitAPI):
|
|
1025
1200
|
# "i":"355681339"
|
1026
1201
|
# }
|
1027
1202
|
#
|
1028
|
-
|
1203
|
+
# fetchMyTrades
|
1204
|
+
#
|
1205
|
+
# {
|
1206
|
+
# "id": "20221228071929579::ca2aafd0-1270-4b56-b0a9-85423b4a07c8",
|
1207
|
+
# "activity_type": "FILL",
|
1208
|
+
# "transaction_time": "2022-12-28T12:19:29.579352Z",
|
1209
|
+
# "type": "fill",
|
1210
|
+
# "price": "67.31",
|
1211
|
+
# "qty": "0.07",
|
1212
|
+
# "side": "sell",
|
1213
|
+
# "symbol": "LTC/USD",
|
1214
|
+
# "leaves_qty": "0",
|
1215
|
+
# "order_id": "82eebcf7-6e66-4b7e-93f8-be0df0e4f12e",
|
1216
|
+
# "cum_qty": "0.07",
|
1217
|
+
# "order_status": "filled",
|
1218
|
+
# "swap_rate": "1"
|
1219
|
+
# },
|
1220
|
+
#
|
1221
|
+
marketId = self.safe_string_2(trade, 'S', 'symbol')
|
1029
1222
|
symbol = self.safe_symbol(marketId, market)
|
1030
|
-
datetime = self.
|
1223
|
+
datetime = self.safe_string_2(trade, 't', 'transaction_time')
|
1031
1224
|
timestamp = self.parse8601(datetime)
|
1032
1225
|
alpacaSide = self.safe_string(trade, 'tks')
|
1033
|
-
side
|
1226
|
+
side = self.safe_string(trade, 'side')
|
1034
1227
|
if alpacaSide == 'B':
|
1035
1228
|
side = 'buy'
|
1036
1229
|
elif alpacaSide == 'S':
|
1037
1230
|
side = 'sell'
|
1038
|
-
priceString = self.
|
1039
|
-
amountString = self.
|
1231
|
+
priceString = self.safe_string_2(trade, 'p', 'price')
|
1232
|
+
amountString = self.safe_string_2(trade, 's', 'qty')
|
1040
1233
|
return self.safe_trade({
|
1041
1234
|
'info': trade,
|
1042
|
-
'id': self.
|
1235
|
+
'id': self.safe_string_2(trade, 'i', 'id'),
|
1043
1236
|
'timestamp': timestamp,
|
1044
1237
|
'datetime': self.iso8601(timestamp),
|
1045
1238
|
'symbol': symbol,
|
1046
|
-
'order':
|
1239
|
+
'order': self.safe_string(trade, 'order_id'),
|
1047
1240
|
'type': None,
|
1048
1241
|
'side': side,
|
1049
1242
|
'takerOrMaker': 'taker',
|
@@ -1053,6 +1246,222 @@ class alpaca(Exchange, ImplicitAPI):
|
|
1053
1246
|
'fee': None,
|
1054
1247
|
}, market)
|
1055
1248
|
|
1249
|
+
async def fetch_deposit_address(self, code: str, params={}) -> DepositAddress:
|
1250
|
+
"""
|
1251
|
+
fetch the deposit address for a currency associated with self account
|
1252
|
+
:see: https://docs.alpaca.markets/reference/listcryptofundingwallets
|
1253
|
+
:param str code: unified currency code
|
1254
|
+
:param dict [params]: extra parameters specific to the exchange API endpoint
|
1255
|
+
:returns dict: an `address structure <https://docs.ccxt.com/#/?id=address-structure>`
|
1256
|
+
"""
|
1257
|
+
await self.load_markets()
|
1258
|
+
currency = self.currency(code)
|
1259
|
+
request: dict = {
|
1260
|
+
'asset': currency['id'],
|
1261
|
+
}
|
1262
|
+
response = await self.traderPrivateGetV2Wallets(self.extend(request, params))
|
1263
|
+
#
|
1264
|
+
# {
|
1265
|
+
# "asset_id": "4fa30c85-77b7-4cbc-92dd-7b7513640aad",
|
1266
|
+
# "address": "bc1q2fpskfnwem3uq9z8660e4z6pfv7aqfamysk75r",
|
1267
|
+
# "created_at": "2024-11-03T07:30:05.609976344Z"
|
1268
|
+
# }
|
1269
|
+
#
|
1270
|
+
return self.parse_deposit_address(response, currency)
|
1271
|
+
|
1272
|
+
def parse_deposit_address(self, depositAddress, currency: Currency = None) -> DepositAddress:
|
1273
|
+
#
|
1274
|
+
# {
|
1275
|
+
# "asset_id": "4fa30c85-77b7-4cbc-92dd-7b7513640aad",
|
1276
|
+
# "address": "bc1q2fpskfnwem3uq9z8660e4z6pfv7aqfamysk75r",
|
1277
|
+
# "created_at": "2024-11-03T07:30:05.609976344Z"
|
1278
|
+
# }
|
1279
|
+
#
|
1280
|
+
parsedCurrency = None
|
1281
|
+
if currency is not None:
|
1282
|
+
parsedCurrency = currency['id']
|
1283
|
+
return {
|
1284
|
+
'info': depositAddress,
|
1285
|
+
'currency': parsedCurrency,
|
1286
|
+
'network': None,
|
1287
|
+
'address': self.safe_string(depositAddress, 'address'),
|
1288
|
+
'tag': None,
|
1289
|
+
}
|
1290
|
+
|
1291
|
+
async def withdraw(self, code: str, amount: float, address: str, tag=None, params={}):
|
1292
|
+
"""
|
1293
|
+
make a withdrawal
|
1294
|
+
:see: https://docs.alpaca.markets/reference/createcryptotransferforaccount
|
1295
|
+
:param str code: unified currency code
|
1296
|
+
:param float amount: the amount to withdraw
|
1297
|
+
:param str address: the address to withdraw to
|
1298
|
+
:param str tag: a memo for the transaction
|
1299
|
+
:param dict [params]: extra parameters specific to the exchange API endpoint
|
1300
|
+
:returns dict: a `transaction structure <https://docs.ccxt.com/#/?id=transaction-structure>`
|
1301
|
+
"""
|
1302
|
+
tag, params = self.handle_withdraw_tag_and_params(tag, params)
|
1303
|
+
self.check_address(address)
|
1304
|
+
await self.load_markets()
|
1305
|
+
currency = self.currency(code)
|
1306
|
+
if tag:
|
1307
|
+
address = address + ':' + tag
|
1308
|
+
request: dict = {
|
1309
|
+
'asset': currency['id'],
|
1310
|
+
'address': address,
|
1311
|
+
'amount': self.number_to_string(amount),
|
1312
|
+
}
|
1313
|
+
response = await self.traderPrivatePostV2WalletsTransfers(self.extend(request, params))
|
1314
|
+
#
|
1315
|
+
# {
|
1316
|
+
# "id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
|
1317
|
+
# "tx_hash": "string",
|
1318
|
+
# "direction": "INCOMING",
|
1319
|
+
# "status": "PROCESSING",
|
1320
|
+
# "amount": "string",
|
1321
|
+
# "usd_value": "string",
|
1322
|
+
# "network_fee": "string",
|
1323
|
+
# "fees": "string",
|
1324
|
+
# "chain": "string",
|
1325
|
+
# "asset": "string",
|
1326
|
+
# "from_address": "string",
|
1327
|
+
# "to_address": "string",
|
1328
|
+
# "created_at": "2024-11-02T07:42:48.402Z"
|
1329
|
+
# }
|
1330
|
+
#
|
1331
|
+
return self.parse_transaction(response, currency)
|
1332
|
+
|
1333
|
+
async def fetch_transactions_helper(self, type, code, since, limit, params):
|
1334
|
+
await self.load_markets()
|
1335
|
+
currency = None
|
1336
|
+
if code is not None:
|
1337
|
+
currency = self.currency(code)
|
1338
|
+
response = await self.traderPrivateGetV2WalletsTransfers(params)
|
1339
|
+
#
|
1340
|
+
# {
|
1341
|
+
# "id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
|
1342
|
+
# "tx_hash": "string",
|
1343
|
+
# "direction": "INCOMING",
|
1344
|
+
# "status": "PROCESSING",
|
1345
|
+
# "amount": "string",
|
1346
|
+
# "usd_value": "string",
|
1347
|
+
# "network_fee": "string",
|
1348
|
+
# "fees": "string",
|
1349
|
+
# "chain": "string",
|
1350
|
+
# "asset": "string",
|
1351
|
+
# "from_address": "string",
|
1352
|
+
# "to_address": "string",
|
1353
|
+
# "created_at": "2024-11-02T07:42:48.402Z"
|
1354
|
+
# }
|
1355
|
+
#
|
1356
|
+
results = []
|
1357
|
+
for i in range(0, len(response)):
|
1358
|
+
entry = response[i]
|
1359
|
+
direction = self.safe_string(entry, 'direction')
|
1360
|
+
if direction == type:
|
1361
|
+
results.append(entry)
|
1362
|
+
elif direction == 'BOTH':
|
1363
|
+
results.append(entry)
|
1364
|
+
return self.parse_transactions(results, currency, since, limit, params)
|
1365
|
+
|
1366
|
+
async def fetch_deposits_withdrawals(self, code: Str = None, since: Int = None, limit: Int = None, params={}) -> List[Transaction]:
|
1367
|
+
"""
|
1368
|
+
fetch history of deposits and withdrawals
|
1369
|
+
:see: https://docs.alpaca.markets/reference/listcryptofundingtransfers
|
1370
|
+
:param str [code]: unified currency code for the currency of the deposit/withdrawals, default is None
|
1371
|
+
:param int [since]: timestamp in ms of the earliest deposit/withdrawal, default is None
|
1372
|
+
:param int [limit]: max number of deposit/withdrawals to return, default is None
|
1373
|
+
:param dict [params]: extra parameters specific to the exchange API endpoint
|
1374
|
+
:returns dict: a list of `transaction structure <https://docs.ccxt.com/#/?id=transaction-structure>`
|
1375
|
+
"""
|
1376
|
+
return await self.fetch_transactions_helper('BOTH', code, since, limit, params)
|
1377
|
+
|
1378
|
+
async def fetch_deposits(self, code: Str = None, since: Int = None, limit: Int = None, params={}) -> List[Transaction]:
|
1379
|
+
"""
|
1380
|
+
fetch all deposits made to an account
|
1381
|
+
:see: https://docs.alpaca.markets/reference/listcryptofundingtransfers
|
1382
|
+
:param str [code]: unified currency code
|
1383
|
+
:param int [since]: the earliest time in ms to fetch deposits for
|
1384
|
+
:param int [limit]: the maximum number of deposit structures to retrieve
|
1385
|
+
:param dict [params]: extra parameters specific to the exchange API endpoint
|
1386
|
+
:returns dict[]: a list of `transaction structures <https://docs.ccxt.com/#/?id=transaction-structure>`
|
1387
|
+
"""
|
1388
|
+
return await self.fetch_transactions_helper('INCOMING', code, since, limit, params)
|
1389
|
+
|
1390
|
+
async def fetch_withdrawals(self, code: Str = None, since: Int = None, limit: Int = None, params={}) -> List[Transaction]:
|
1391
|
+
"""
|
1392
|
+
fetch all withdrawals made from an account
|
1393
|
+
:see: https://docs.alpaca.markets/reference/listcryptofundingtransfers
|
1394
|
+
:param str [code]: unified currency code
|
1395
|
+
:param int [since]: the earliest time in ms to fetch withdrawals for
|
1396
|
+
:param int [limit]: the maximum number of withdrawal structures to retrieve
|
1397
|
+
:param dict [params]: extra parameters specific to the exchange API endpoint
|
1398
|
+
:returns dict[]: a list of `transaction structures <https://docs.ccxt.com/#/?id=transaction-structure>`
|
1399
|
+
"""
|
1400
|
+
return await self.fetch_transactions_helper('OUTGOING', code, since, limit, params)
|
1401
|
+
|
1402
|
+
def parse_transaction(self, transaction: dict, currency: Currency = None) -> Transaction:
|
1403
|
+
#
|
1404
|
+
# {
|
1405
|
+
# "id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
|
1406
|
+
# "tx_hash": "string",
|
1407
|
+
# "direction": "INCOMING",
|
1408
|
+
# "status": "PROCESSING",
|
1409
|
+
# "amount": "string",
|
1410
|
+
# "usd_value": "string",
|
1411
|
+
# "network_fee": "string",
|
1412
|
+
# "fees": "string",
|
1413
|
+
# "chain": "string",
|
1414
|
+
# "asset": "string",
|
1415
|
+
# "from_address": "string",
|
1416
|
+
# "to_address": "string",
|
1417
|
+
# "created_at": "2024-11-02T07:42:48.402Z"
|
1418
|
+
# }
|
1419
|
+
#
|
1420
|
+
datetime = self.safe_string(transaction, 'created_at')
|
1421
|
+
currencyId = self.safe_string(transaction, 'asset')
|
1422
|
+
code = self.safe_currency_code(currencyId, currency)
|
1423
|
+
fee = {
|
1424
|
+
'cost': self.safe_number(transaction, 'fees'),
|
1425
|
+
'currency': code,
|
1426
|
+
}
|
1427
|
+
return {
|
1428
|
+
'info': transaction,
|
1429
|
+
'id': self.safe_string(transaction, 'id'),
|
1430
|
+
'txid': self.safe_string(transaction, 'tx_hash'),
|
1431
|
+
'timestamp': self.parse8601(datetime),
|
1432
|
+
'datetime': datetime,
|
1433
|
+
'network': self.safe_string(transaction, 'chain'),
|
1434
|
+
'address': self.safe_string(transaction, 'to_address'),
|
1435
|
+
'addressTo': self.safe_string(transaction, 'to_address'),
|
1436
|
+
'addressFrom': self.safe_string(transaction, 'from_address'),
|
1437
|
+
'tag': None,
|
1438
|
+
'tagTo': None,
|
1439
|
+
'tagFrom': None,
|
1440
|
+
'type': self.parse_transaction_type(self.safe_string(transaction, 'direction')),
|
1441
|
+
'amount': self.safe_number(transaction, 'amount'),
|
1442
|
+
'currency': code,
|
1443
|
+
'status': self.parse_transaction_status(self.safe_string(transaction, 'status')),
|
1444
|
+
'updated': None,
|
1445
|
+
'fee': fee,
|
1446
|
+
'comment': None,
|
1447
|
+
'internal': None,
|
1448
|
+
}
|
1449
|
+
|
1450
|
+
def parse_transaction_status(self, status: Str):
|
1451
|
+
statuses: dict = {
|
1452
|
+
'PROCESSING': 'pending',
|
1453
|
+
# 'FAILED': 'failed',
|
1454
|
+
# 'SUCCESS': 'ok',
|
1455
|
+
}
|
1456
|
+
return self.safe_string(statuses, status, status)
|
1457
|
+
|
1458
|
+
def parse_transaction_type(self, type):
|
1459
|
+
types: dict = {
|
1460
|
+
'INCOMING': 'deposit',
|
1461
|
+
'OUTGOING': 'withdrawal',
|
1462
|
+
}
|
1463
|
+
return self.safe_string(types, type, type)
|
1464
|
+
|
1056
1465
|
def sign(self, path, api='public', method='GET', params={}, headers=None, body=None):
|
1057
1466
|
endpoint = '/' + self.implode_params(path, params)
|
1058
1467
|
url = self.implode_hostname(self.urls['api'][api[0]])
|
ccxt/async_support/ascendex.py
CHANGED
@@ -125,7 +125,7 @@ class ascendex(Exchange, ImplicitAPI):
|
|
125
125
|
},
|
126
126
|
'version': 'v2',
|
127
127
|
'urls': {
|
128
|
-
'logo': 'https://
|
128
|
+
'logo': 'https://github.com/user-attachments/assets/55bab6b9-d4ca-42a8-a0e6-fac81ae557f1',
|
129
129
|
'api': {
|
130
130
|
'rest': 'https://ascendex.com',
|
131
131
|
},
|
@@ -2,7 +2,7 @@
|
|
2
2
|
|
3
3
|
# -----------------------------------------------------------------------------
|
4
4
|
|
5
|
-
__version__ = '4.4.
|
5
|
+
__version__ = '4.4.27'
|
6
6
|
|
7
7
|
# -----------------------------------------------------------------------------
|
8
8
|
|
@@ -598,9 +598,15 @@ class Exchange(BaseExchange):
|
|
598
598
|
async def watch_trades(self, symbol: str, since: Int = None, limit: Int = None, params={}):
|
599
599
|
raise NotSupported(self.id + ' watchTrades() is not supported yet')
|
600
600
|
|
601
|
+
async def un_watch_trades(self, symbol: str, params={}):
|
602
|
+
raise NotSupported(self.id + ' unWatchTrades() is not supported yet')
|
603
|
+
|
601
604
|
async def watch_trades_for_symbols(self, symbols: List[str], since: Int = None, limit: Int = None, params={}):
|
602
605
|
raise NotSupported(self.id + ' watchTradesForSymbols() is not supported yet')
|
603
606
|
|
607
|
+
async def un_watch_trades_for_symbols(self, symbols: List[str], params={}):
|
608
|
+
raise NotSupported(self.id + ' unWatchTradesForSymbols() is not supported yet')
|
609
|
+
|
604
610
|
async def watch_my_trades_for_symbols(self, symbols: List[str], since: Int = None, limit: Int = None, params={}):
|
605
611
|
raise NotSupported(self.id + ' watchMyTradesForSymbols() is not supported yet')
|
606
612
|
|
@@ -610,9 +616,15 @@ class Exchange(BaseExchange):
|
|
610
616
|
async def watch_ohlcv_for_symbols(self, symbolsAndTimeframes: List[List[str]], since: Int = None, limit: Int = None, params={}):
|
611
617
|
raise NotSupported(self.id + ' watchOHLCVForSymbols() is not supported yet')
|
612
618
|
|
619
|
+
async def un_watch_ohlcv_for_symbols(self, symbolsAndTimeframes: List[List[str]], params={}):
|
620
|
+
raise NotSupported(self.id + ' unWatchOHLCVForSymbols() is not supported yet')
|
621
|
+
|
613
622
|
async def watch_order_book_for_symbols(self, symbols: List[str], limit: Int = None, params={}):
|
614
623
|
raise NotSupported(self.id + ' watchOrderBookForSymbols() is not supported yet')
|
615
624
|
|
625
|
+
async def un_watch_order_book_for_symbols(self, symbols: List[str], params={}):
|
626
|
+
raise NotSupported(self.id + ' unWatchOrderBookForSymbols() is not supported yet')
|
627
|
+
|
616
628
|
async def fetch_deposit_addresses(self, codes: Strings = None, params={}):
|
617
629
|
raise NotSupported(self.id + ' fetchDepositAddresses() is not supported yet')
|
618
630
|
|
@@ -643,6 +655,9 @@ class Exchange(BaseExchange):
|
|
643
655
|
async def watch_order_book(self, symbol: str, limit: Int = None, params={}):
|
644
656
|
raise NotSupported(self.id + ' watchOrderBook() is not supported yet')
|
645
657
|
|
658
|
+
async def un_watch_order_book(self, symbol: str, params={}):
|
659
|
+
raise NotSupported(self.id + ' unWatchOrderBook() is not supported yet')
|
660
|
+
|
646
661
|
async def fetch_time(self, params={}):
|
647
662
|
raise NotSupported(self.id + ' fetchTime() is not supported yet')
|
648
663
|
|
@@ -743,13 +758,13 @@ class Exchange(BaseExchange):
|
|
743
758
|
async def fetch_payment_methods(self, params={}):
|
744
759
|
raise NotSupported(self.id + ' fetchPaymentMethods() is not supported yet')
|
745
760
|
|
746
|
-
async def fetch_borrow_rate(self, code: str, amount, params={}):
|
761
|
+
async def fetch_borrow_rate(self, code: str, amount: float, params={}):
|
747
762
|
raise NotSupported(self.id + ' fetchBorrowRate is deprecated, please use fetchCrossBorrowRate or fetchIsolatedBorrowRate instead')
|
748
763
|
|
749
|
-
async def repay_cross_margin(self, code: str, amount, params={}):
|
764
|
+
async def repay_cross_margin(self, code: str, amount: float, params={}):
|
750
765
|
raise NotSupported(self.id + ' repayCrossMargin is not support yet')
|
751
766
|
|
752
|
-
async def repay_isolated_margin(self, symbol: str, code: str, amount, params={}):
|
767
|
+
async def repay_isolated_margin(self, symbol: str, code: str, amount: float, params={}):
|
753
768
|
raise NotSupported(self.id + ' repayIsolatedMargin is not support yet')
|
754
769
|
|
755
770
|
async def borrow_cross_margin(self, code: str, amount: float, params={}):
|
@@ -758,10 +773,10 @@ class Exchange(BaseExchange):
|
|
758
773
|
async def borrow_isolated_margin(self, symbol: str, code: str, amount: float, params={}):
|
759
774
|
raise NotSupported(self.id + ' borrowIsolatedMargin is not support yet')
|
760
775
|
|
761
|
-
async def borrow_margin(self, code: str, amount, symbol: Str = None, params={}):
|
776
|
+
async def borrow_margin(self, code: str, amount: float, symbol: Str = None, params={}):
|
762
777
|
raise NotSupported(self.id + ' borrowMargin is deprecated, please use borrowCrossMargin or borrowIsolatedMargin instead')
|
763
778
|
|
764
|
-
async def repay_margin(self, code: str, amount, symbol: Str = None, params={}):
|
779
|
+
async def repay_margin(self, code: str, amount: float, symbol: Str = None, params={}):
|
765
780
|
raise NotSupported(self.id + ' repayMargin is deprecated, please use repayCrossMargin or repayIsolatedMargin instead')
|
766
781
|
|
767
782
|
async def fetch_ohlcv(self, symbol: str, timeframe='1m', since: Int = None, limit: Int = None, params={}):
|
@@ -1074,6 +1089,9 @@ class Exchange(BaseExchange):
|
|
1074
1089
|
async def watch_tickers(self, symbols: Strings = None, params={}):
|
1075
1090
|
raise NotSupported(self.id + ' watchTickers() is not supported yet')
|
1076
1091
|
|
1092
|
+
async def un_watch_tickers(self, symbols: Strings = None, params={}):
|
1093
|
+
raise NotSupported(self.id + ' unWatchTickers() is not supported yet')
|
1094
|
+
|
1077
1095
|
async def fetch_order(self, id: str, symbol: Str = None, params={}):
|
1078
1096
|
raise NotSupported(self.id + ' fetchOrder() is not supported yet')
|
1079
1097
|
|
ccxt/async_support/bequant.py
CHANGED
@@ -16,7 +16,7 @@ class bequant(hitbtc, ImplicitAPI):
|
|
16
16
|
'countries': ['MT'], # Malta
|
17
17
|
'pro': True,
|
18
18
|
'urls': {
|
19
|
-
'logo': 'https://
|
19
|
+
'logo': 'https://github.com/user-attachments/assets/0583ef1f-29fe-4b7c-8189-63565a0e2867',
|
20
20
|
'api': {
|
21
21
|
'public': 'https://api.bequant.io/api/3',
|
22
22
|
'private': 'https://api.bequant.io/api/3',
|
ccxt/async_support/bigone.py
CHANGED
@@ -93,7 +93,7 @@ class bigone(Exchange, ImplicitAPI):
|
|
93
93
|
},
|
94
94
|
'hostname': 'big.one', # or 'bigone.com'
|
95
95
|
'urls': {
|
96
|
-
'logo': 'https://
|
96
|
+
'logo': 'https://github.com/user-attachments/assets/4e5cfd53-98cc-4b90-92cd-0d7b512653d1',
|
97
97
|
'api': {
|
98
98
|
'public': 'https://{hostname}/api/v3',
|
99
99
|
'private': 'https://{hostname}/api/v3/viewer',
|