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/__init__.py
CHANGED
ccxt/abstract/alpaca.py
CHANGED
@@ -20,10 +20,13 @@ class ImplicitAPI:
|
|
20
20
|
trader_private_get_v2_assets_symbol_or_asset_id = traderPrivateGetV2AssetsSymbolOrAssetId = Entry('v2/assets/{symbol_or_asset_id}', ['trader', 'private'], 'GET', {})
|
21
21
|
trader_private_get_v2_corporate_actions_announcements_id = traderPrivateGetV2CorporateActionsAnnouncementsId = Entry('v2/corporate_actions/announcements/{id}', ['trader', 'private'], 'GET', {})
|
22
22
|
trader_private_get_v2_corporate_actions_announcements = traderPrivateGetV2CorporateActionsAnnouncements = Entry('v2/corporate_actions/announcements', ['trader', 'private'], 'GET', {})
|
23
|
+
trader_private_get_v2_wallets = traderPrivateGetV2Wallets = Entry('v2/wallets', ['trader', 'private'], 'GET', {})
|
24
|
+
trader_private_get_v2_wallets_transfers = traderPrivateGetV2WalletsTransfers = Entry('v2/wallets/transfers', ['trader', 'private'], 'GET', {})
|
23
25
|
trader_private_post_v2_orders = traderPrivatePostV2Orders = Entry('v2/orders', ['trader', 'private'], 'POST', {})
|
24
26
|
trader_private_post_v2_watchlists = traderPrivatePostV2Watchlists = Entry('v2/watchlists', ['trader', 'private'], 'POST', {})
|
25
27
|
trader_private_post_v2_watchlists_watchlist_id = traderPrivatePostV2WatchlistsWatchlistId = Entry('v2/watchlists/{watchlist_id}', ['trader', 'private'], 'POST', {})
|
26
28
|
trader_private_post_v2_watchlists_by_name = traderPrivatePostV2WatchlistsByName = Entry('v2/watchlists:by_name', ['trader', 'private'], 'POST', {})
|
29
|
+
trader_private_post_v2_wallets_transfers = traderPrivatePostV2WalletsTransfers = Entry('v2/wallets/transfers', ['trader', 'private'], 'POST', {})
|
27
30
|
trader_private_put_v2_watchlists_watchlist_id = traderPrivatePutV2WatchlistsWatchlistId = Entry('v2/watchlists/{watchlist_id}', ['trader', 'private'], 'PUT', {})
|
28
31
|
trader_private_put_v2_watchlists_by_name = traderPrivatePutV2WatchlistsByName = Entry('v2/watchlists:by_name', ['trader', 'private'], 'PUT', {})
|
29
32
|
trader_private_patch_v2_orders_order_id = traderPrivatePatchV2OrdersOrderId = Entry('v2/orders/{order_id}', ['trader', 'private'], 'PATCH', {})
|
ccxt/abstract/bingx.py
CHANGED
@@ -36,6 +36,7 @@ class ImplicitAPI:
|
|
36
36
|
swap_v1_private_get_market_markpriceklines = swapV1PrivateGetMarketMarkPriceKlines = Entry('market/markPriceKlines', ['swap', 'v1', 'private'], 'GET', {'cost': 1})
|
37
37
|
swap_v1_private_get_trade_batchcancelreplace = swapV1PrivateGetTradeBatchCancelReplace = Entry('trade/batchCancelReplace', ['swap', 'v1', 'private'], 'GET', {'cost': 5})
|
38
38
|
swap_v1_private_get_trade_fullorder = swapV1PrivateGetTradeFullOrder = Entry('trade/fullOrder', ['swap', 'v1', 'private'], 'GET', {'cost': 2})
|
39
|
+
swap_v1_private_get_positionmargin_history = swapV1PrivateGetPositionMarginHistory = Entry('positionMargin/history', ['swap', 'v1', 'private'], 'GET', {'cost': 2})
|
39
40
|
swap_v1_private_post_trade_cancelreplace = swapV1PrivatePostTradeCancelReplace = Entry('trade/cancelReplace', ['swap', 'v1', 'private'], 'POST', {'cost': 2})
|
40
41
|
swap_v1_private_post_positionside_dual = swapV1PrivatePostPositionSideDual = Entry('positionSide/dual', ['swap', 'v1', 'private'], 'POST', {'cost': 5})
|
41
42
|
swap_v1_private_post_trade_closeposition = swapV1PrivatePostTradeClosePosition = Entry('trade/closePosition', ['swap', 'v1', 'private'], 'POST', {'cost': 2})
|
ccxt/abstract/hyperliquid.py
CHANGED
@@ -2,5 +2,5 @@ from ccxt.base.types import Entry
|
|
2
2
|
|
3
3
|
|
4
4
|
class ImplicitAPI:
|
5
|
-
public_post_info = publicPostInfo = Entry('info', 'public', 'POST', {'cost':
|
5
|
+
public_post_info = publicPostInfo = Entry('info', 'public', 'POST', {'cost': 20, 'byType': {'l2Book': 2, 'allMids': 2, 'clearinghouseState': 2, 'orderStatus': 2, 'spotClearinghouseState': 2, 'exchangeStatus': 2}})
|
6
6
|
private_post_exchange = privatePostExchange = Entry('exchange', 'private', 'POST', {'cost': 1})
|
ccxt/abstract/okx.py
CHANGED
@@ -189,6 +189,7 @@ class ImplicitAPI:
|
|
189
189
|
private_get_finance_staking_defi_orders_history = privateGetFinanceStakingDefiOrdersHistory = Entry('finance/staking-defi/orders-history', 'private', 'GET', {'cost': 3.3333333333333335})
|
190
190
|
private_get_finance_staking_defi_eth_balance = privateGetFinanceStakingDefiEthBalance = Entry('finance/staking-defi/eth/balance', 'private', 'GET', {'cost': 1.6666666666666667})
|
191
191
|
private_get_finance_staking_defi_eth_purchase_redeem_history = privateGetFinanceStakingDefiEthPurchaseRedeemHistory = Entry('finance/staking-defi/eth/purchase-redeem-history', 'private', 'GET', {'cost': 1.6666666666666667})
|
192
|
+
private_get_finance_staking_defi_eth_product_info = privateGetFinanceStakingDefiEthProductInfo = Entry('finance/staking-defi/eth/product-info', 'private', 'GET', {'cost': 3})
|
192
193
|
private_get_copytrading_current_subpositions = privateGetCopytradingCurrentSubpositions = Entry('copytrading/current-subpositions', 'private', 'GET', {'cost': 1})
|
193
194
|
private_get_copytrading_subpositions_history = privateGetCopytradingSubpositionsHistory = Entry('copytrading/subpositions-history', 'private', 'GET', {'cost': 1})
|
194
195
|
private_get_copytrading_instruments = privateGetCopytradingInstruments = Entry('copytrading/instruments', 'private', 'GET', {'cost': 4})
|
ccxt/abstract/phemex.py
CHANGED
@@ -24,6 +24,7 @@ class ImplicitAPI:
|
|
24
24
|
v1_get_exchange_public_products = v1GetExchangePublicProducts = Entry('exchange/public/products', 'v1', 'GET', {'cost': 5})
|
25
25
|
v1_get_api_data_public_data_funding_rate_history = v1GetApiDataPublicDataFundingRateHistory = Entry('api-data/public/data/funding-rate-history', 'v1', 'GET', {'cost': 5})
|
26
26
|
v2_get_public_products = v2GetPublicProducts = Entry('public/products', 'v2', 'GET', {'cost': 5})
|
27
|
+
v2_get_public_products_plus = v2GetPublicProductsPlus = Entry('public/products-plus', 'v2', 'GET', {'cost': 5})
|
27
28
|
v2_get_md_v2_orderbook = v2GetMdV2Orderbook = Entry('md/v2/orderbook', 'v2', 'GET', {'cost': 5})
|
28
29
|
v2_get_md_v2_trade = v2GetMdV2Trade = Entry('md/v2/trade', 'v2', 'GET', {'cost': 5})
|
29
30
|
v2_get_md_v2_ticker_24hr = v2GetMdV2Ticker24hr = Entry('md/v2/ticker/24hr', 'v2', 'GET', {'cost': 5})
|
ccxt/ace.py
CHANGED
@@ -108,7 +108,7 @@ class ace(Exchange, ImplicitAPI):
|
|
108
108
|
'1M': 31,
|
109
109
|
},
|
110
110
|
'urls': {
|
111
|
-
'logo': 'https://
|
111
|
+
'logo': 'https://github.com/user-attachments/assets/115f1e4a-0fd0-4b76-85d5-a49ebf64d1c8',
|
112
112
|
'api': {
|
113
113
|
'public': 'https://ace.io/polarisex',
|
114
114
|
'private': 'https://ace.io/polarisex/open',
|
ccxt/alpaca.py
CHANGED
@@ -5,10 +5,11 @@
|
|
5
5
|
|
6
6
|
from ccxt.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
|
+
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
|
+
self.load_markets()
|
688
|
+
symbol = self.symbol(symbol)
|
689
|
+
tickers = self.fetch_tickers([symbol], params)
|
690
|
+
return self.safe_dict(tickers, symbol)
|
691
|
+
|
692
|
+
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
|
+
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 = 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
|
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
|
+
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
|
+
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 = 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
|
+
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
|
+
self.load_markets()
|
1258
|
+
currency = self.currency(code)
|
1259
|
+
request: dict = {
|
1260
|
+
'asset': currency['id'],
|
1261
|
+
}
|
1262
|
+
response = 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
|
+
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
|
+
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 = 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
|
+
def fetch_transactions_helper(self, type, code, since, limit, params):
|
1334
|
+
self.load_markets()
|
1335
|
+
currency = None
|
1336
|
+
if code is not None:
|
1337
|
+
currency = self.currency(code)
|
1338
|
+
response = 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
|
+
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 self.fetch_transactions_helper('BOTH', code, since, limit, params)
|
1377
|
+
|
1378
|
+
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 self.fetch_transactions_helper('INCOMING', code, since, limit, params)
|
1389
|
+
|
1390
|
+
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 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/ascendex.py
CHANGED
@@ -124,7 +124,7 @@ class ascendex(Exchange, ImplicitAPI):
|
|
124
124
|
},
|
125
125
|
'version': 'v2',
|
126
126
|
'urls': {
|
127
|
-
'logo': 'https://
|
127
|
+
'logo': 'https://github.com/user-attachments/assets/55bab6b9-d4ca-42a8-a0e6-fac81ae557f1',
|
128
128
|
'api': {
|
129
129
|
'rest': 'https://ascendex.com',
|
130
130
|
},
|
ccxt/async_support/__init__.py
CHANGED
ccxt/async_support/ace.py
CHANGED
@@ -108,7 +108,7 @@ class ace(Exchange, ImplicitAPI):
|
|
108
108
|
'1M': 31,
|
109
109
|
},
|
110
110
|
'urls': {
|
111
|
-
'logo': 'https://
|
111
|
+
'logo': 'https://github.com/user-attachments/assets/115f1e4a-0fd0-4b76-85d5-a49ebf64d1c8',
|
112
112
|
'api': {
|
113
113
|
'public': 'https://ace.io/polarisex',
|
114
114
|
'private': 'https://ace.io/polarisex/open',
|