ccxt 4.4.3__py2.py3-none-any.whl → 4.4.4__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/async_support/__init__.py +1 -1
- ccxt/async_support/base/exchange.py +24 -13
- ccxt/async_support/base/ws/cache.py +1 -0
- ccxt/async_support/binance.py +40 -15
- ccxt/async_support/bingx.py +1 -0
- ccxt/async_support/bitfinex2.py +10 -9
- ccxt/async_support/bitget.py +13 -9
- ccxt/async_support/bitmex.py +14 -13
- ccxt/async_support/bitso.py +8 -7
- ccxt/async_support/bitstamp.py +12 -12
- ccxt/async_support/blofin.py +24 -26
- ccxt/async_support/bybit.py +24 -23
- ccxt/async_support/coinbase.py +31 -10
- ccxt/async_support/coinbaseexchange.py +14 -14
- ccxt/async_support/coinlist.py +9 -8
- ccxt/async_support/coinmetro.py +6 -6
- ccxt/async_support/cryptocom.py +10 -8
- ccxt/async_support/currencycom.py +9 -9
- ccxt/async_support/delta.py +8 -8
- ccxt/async_support/digifinex.py +11 -9
- ccxt/async_support/gate.py +9 -8
- ccxt/async_support/hashkey.py +12 -10
- ccxt/async_support/htx.py +16 -19
- ccxt/async_support/hyperliquid.py +70 -117
- ccxt/async_support/kraken.py +12 -10
- ccxt/async_support/kucoin.py +12 -11
- ccxt/async_support/luno.py +13 -12
- ccxt/async_support/mexc.py +34 -2
- ccxt/async_support/ndax.py +9 -8
- ccxt/async_support/okcoin.py +21 -30
- ccxt/async_support/okx.py +21 -29
- ccxt/async_support/woo.py +10 -9
- ccxt/async_support/woofipro.py +11 -9
- ccxt/async_support/xt.py +7 -6
- ccxt/async_support/zonda.py +9 -8
- ccxt/base/exchange.py +3 -1
- ccxt/binance.py +40 -15
- ccxt/bingx.py +1 -0
- ccxt/bitfinex2.py +10 -9
- ccxt/bitget.py +13 -9
- ccxt/bitmex.py +14 -13
- ccxt/bitso.py +8 -7
- ccxt/bitstamp.py +12 -12
- ccxt/blofin.py +24 -26
- ccxt/bybit.py +24 -23
- ccxt/coinbase.py +31 -10
- ccxt/coinbaseexchange.py +14 -14
- ccxt/coinlist.py +9 -8
- ccxt/coinmetro.py +6 -6
- ccxt/cryptocom.py +10 -8
- ccxt/currencycom.py +9 -9
- ccxt/delta.py +8 -8
- ccxt/digifinex.py +11 -9
- ccxt/gate.py +9 -8
- ccxt/hashkey.py +12 -10
- ccxt/htx.py +16 -19
- ccxt/hyperliquid.py +70 -117
- ccxt/kraken.py +12 -10
- ccxt/kucoin.py +12 -11
- ccxt/luno.py +13 -12
- ccxt/mexc.py +33 -2
- ccxt/ndax.py +9 -8
- ccxt/okcoin.py +21 -30
- ccxt/okx.py +21 -29
- ccxt/pro/__init__.py +1 -1
- ccxt/pro/bybit.py +51 -0
- ccxt/pro/mexc.py +78 -0
- ccxt/test/tests_async.py +1 -1
- ccxt/test/tests_sync.py +1 -1
- ccxt/woo.py +10 -9
- ccxt/woofipro.py +11 -9
- ccxt/xt.py +7 -6
- ccxt/zonda.py +9 -8
- {ccxt-4.4.3.dist-info → ccxt-4.4.4.dist-info}/METADATA +5 -5
- {ccxt-4.4.3.dist-info → ccxt-4.4.4.dist-info}/RECORD +79 -79
- {ccxt-4.4.3.dist-info → ccxt-4.4.4.dist-info}/LICENSE.txt +0 -0
- {ccxt-4.4.3.dist-info → ccxt-4.4.4.dist-info}/WHEEL +0 -0
- {ccxt-4.4.3.dist-info → ccxt-4.4.4.dist-info}/top_level.txt +0 -0
ccxt/bitstamp.py
CHANGED
@@ -6,7 +6,7 @@
|
|
6
6
|
from ccxt.base.exchange import Exchange
|
7
7
|
from ccxt.abstract.bitstamp import ImplicitAPI
|
8
8
|
import hashlib
|
9
|
-
from ccxt.base.types import Balances, Currencies, Currency, Int, Market, Num, Order, OrderBook, OrderSide, OrderType, Str, Strings, Ticker, Tickers, Trade, TradingFeeInterface, TradingFees, Transaction, TransferEntry
|
9
|
+
from ccxt.base.types import Balances, Currencies, Currency, Int, LedgerEntry, Market, Num, Order, OrderBook, OrderSide, OrderType, Str, Strings, Ticker, Tickers, Trade, TradingFeeInterface, TradingFees, Transaction, TransferEntry
|
10
10
|
from typing import List
|
11
11
|
from ccxt.base.errors import ExchangeError
|
12
12
|
from ccxt.base.errors import AuthenticationError
|
@@ -1831,7 +1831,7 @@ class bitstamp(Exchange, ImplicitAPI):
|
|
1831
1831
|
}
|
1832
1832
|
return self.safe_string(types, type, type)
|
1833
1833
|
|
1834
|
-
def parse_ledger_entry(self, item: dict, currency: Currency = None):
|
1834
|
+
def parse_ledger_entry(self, item: dict, currency: Currency = None) -> LedgerEntry:
|
1835
1835
|
#
|
1836
1836
|
# [
|
1837
1837
|
# {
|
@@ -1872,9 +1872,9 @@ class bitstamp(Exchange, ImplicitAPI):
|
|
1872
1872
|
if market is None:
|
1873
1873
|
market = self.get_market_from_trade(item)
|
1874
1874
|
direction = 'in' if (parsedTrade['side'] == 'buy') else 'out'
|
1875
|
-
return {
|
1876
|
-
'id': parsedTrade['id'],
|
1875
|
+
return self.safe_ledger_entry({
|
1877
1876
|
'info': item,
|
1877
|
+
'id': parsedTrade['id'],
|
1878
1878
|
'timestamp': parsedTrade['timestamp'],
|
1879
1879
|
'datetime': parsedTrade['datetime'],
|
1880
1880
|
'direction': direction,
|
@@ -1888,7 +1888,7 @@ class bitstamp(Exchange, ImplicitAPI):
|
|
1888
1888
|
'after': None,
|
1889
1889
|
'status': 'ok',
|
1890
1890
|
'fee': parsedTrade['fee'],
|
1891
|
-
}
|
1891
|
+
}, currency)
|
1892
1892
|
else:
|
1893
1893
|
parsedTransaction = self.parse_transaction(item, currency)
|
1894
1894
|
direction = None
|
@@ -1900,9 +1900,9 @@ class bitstamp(Exchange, ImplicitAPI):
|
|
1900
1900
|
currency = self.currency(currencyCode)
|
1901
1901
|
amount = self.safe_string(item, currency['id'])
|
1902
1902
|
direction = 'in' if Precise.string_gt(amount, '0') else 'out'
|
1903
|
-
return {
|
1904
|
-
'id': parsedTransaction['id'],
|
1903
|
+
return self.safe_ledger_entry({
|
1905
1904
|
'info': item,
|
1905
|
+
'id': parsedTransaction['id'],
|
1906
1906
|
'timestamp': parsedTransaction['timestamp'],
|
1907
1907
|
'datetime': parsedTransaction['datetime'],
|
1908
1908
|
'direction': direction,
|
@@ -1916,15 +1916,15 @@ class bitstamp(Exchange, ImplicitAPI):
|
|
1916
1916
|
'after': None,
|
1917
1917
|
'status': parsedTransaction['status'],
|
1918
1918
|
'fee': parsedTransaction['fee'],
|
1919
|
-
}
|
1919
|
+
}, currency)
|
1920
1920
|
|
1921
|
-
def fetch_ledger(self, code: Str = None, since: Int = None, limit: Int = None, params={}):
|
1921
|
+
def fetch_ledger(self, code: Str = None, since: Int = None, limit: Int = None, params={}) -> List[LedgerEntry]:
|
1922
1922
|
"""
|
1923
|
-
fetch the history of changes, actions done by the user or operations that altered balance of the user
|
1923
|
+
fetch the history of changes, actions done by the user or operations that altered the balance of the user
|
1924
1924
|
:see: https://www.bitstamp.net/api/#tag/Transactions-private/operation/GetUserTransactions
|
1925
|
-
:param str code: unified currency code, default is None
|
1925
|
+
:param str [code]: unified currency code, default is None
|
1926
1926
|
:param int [since]: timestamp in ms of the earliest ledger entry, default is None
|
1927
|
-
:param int [limit]: max number of ledger
|
1927
|
+
:param int [limit]: max number of ledger entries to return, default is None
|
1928
1928
|
:param dict [params]: extra parameters specific to the exchange API endpoint
|
1929
1929
|
:returns dict: a `ledger structure <https://docs.ccxt.com/#/?id=ledger-structure>`
|
1930
1930
|
"""
|
ccxt/blofin.py
CHANGED
@@ -6,7 +6,7 @@
|
|
6
6
|
from ccxt.base.exchange import Exchange
|
7
7
|
from ccxt.abstract.blofin import ImplicitAPI
|
8
8
|
import hashlib
|
9
|
-
from ccxt.base.types import Balances, Currency, Int, Leverage, Leverages, MarginMode, Market, Num, Order, OrderBook, OrderRequest, OrderSide, OrderType, Position, Str, Strings, Ticker, Tickers, Trade, TradingFeeInterface, Transaction, TransferEntry
|
9
|
+
from ccxt.base.types import Balances, Currency, Int, LedgerEntry, Leverage, Leverages, MarginMode, Market, Num, Order, OrderBook, OrderRequest, OrderSide, OrderType, Position, Str, Strings, Ticker, Tickers, Trade, TradingFeeInterface, Transaction, TransferEntry
|
10
10
|
from typing import List
|
11
11
|
from ccxt.base.errors import ExchangeError
|
12
12
|
from ccxt.base.errors import AuthenticationError
|
@@ -1413,17 +1413,17 @@ class blofin(Exchange, ImplicitAPI):
|
|
1413
1413
|
data = self.safe_list(response, 'data', [])
|
1414
1414
|
return self.parse_transactions(data, currency, since, limit, params)
|
1415
1415
|
|
1416
|
-
def fetch_ledger(self, code: Str = None, since: Int = None, limit: Int = None, params={}):
|
1416
|
+
def fetch_ledger(self, code: Str = None, since: Int = None, limit: Int = None, params={}) -> List[LedgerEntry]:
|
1417
1417
|
"""
|
1418
|
-
fetch the history of changes, actions done by the user or operations that altered balance of the user
|
1418
|
+
fetch the history of changes, actions done by the user or operations that altered the balance of the user
|
1419
1419
|
:see: https://blofin.com/docs#get-funds-transfer-history
|
1420
|
-
:param str code: unified currency code, default is None
|
1420
|
+
:param str [code]: unified currency code, default is None
|
1421
1421
|
:param int [since]: timestamp in ms of the earliest ledger entry, default is None
|
1422
|
-
:param int [limit]: max number of ledger
|
1422
|
+
:param int [limit]: max number of ledger entries to return, default is None
|
1423
1423
|
:param dict [params]: extra parameters specific to the exchange API endpoint
|
1424
1424
|
:param str [params.marginMode]: 'cross' or 'isolated'
|
1425
1425
|
:param int [params.until]: the latest time in ms to fetch entries for
|
1426
|
-
:param boolean [params.paginate]: default False, when True will automatically paginate by calling self endpoint multiple times. See in the docs all the [
|
1426
|
+
:param boolean [params.paginate]: default False, when True will automatically paginate by calling self endpoint multiple times. See in the docs all the [available parameters](https://github.com/ccxt/ccxt/wiki/Manual#pagination-params)
|
1427
1427
|
:returns dict: a `ledger structure <https://docs.ccxt.com/#/?id=ledger-structure>`
|
1428
1428
|
"""
|
1429
1429
|
self.load_markets()
|
@@ -1554,30 +1554,28 @@ class blofin(Exchange, ImplicitAPI):
|
|
1554
1554
|
}
|
1555
1555
|
return self.safe_string(types, type, type)
|
1556
1556
|
|
1557
|
-
def parse_ledger_entry(self, item: dict, currency: Currency = None):
|
1558
|
-
|
1559
|
-
|
1560
|
-
|
1561
|
-
toAccount = self.safe_string(item, 'toAccount')
|
1562
|
-
type = self.parse_ledger_entry_type(self.safe_string(item, 'type'))
|
1563
|
-
code = self.safe_currency_code(self.safe_string(item, 'currency'), currency)
|
1564
|
-
amountString = self.safe_string(item, 'amount')
|
1565
|
-
amount = self.parse_number(amountString)
|
1557
|
+
def parse_ledger_entry(self, item: dict, currency: Currency = None) -> LedgerEntry:
|
1558
|
+
currencyId = self.safe_string(item, 'currency')
|
1559
|
+
code = self.safe_currency_code(currencyId, currency)
|
1560
|
+
currency = self.safe_currency(currencyId, currency)
|
1566
1561
|
timestamp = self.safe_integer(item, 'ts')
|
1567
|
-
|
1568
|
-
return {
|
1569
|
-
'id': id,
|
1562
|
+
return self.safe_ledger_entry({
|
1570
1563
|
'info': item,
|
1564
|
+
'id': self.safe_string(item, 'transferId'),
|
1565
|
+
'direction': None,
|
1566
|
+
'account': None,
|
1567
|
+
'referenceId': self.safe_string(item, 'clientId'),
|
1568
|
+
'referenceAccount': None,
|
1569
|
+
'type': self.parse_ledger_entry_type(self.safe_string(item, 'type')),
|
1570
|
+
'currency': code,
|
1571
|
+
'amount': self.safe_number(item, 'amount'),
|
1571
1572
|
'timestamp': timestamp,
|
1572
1573
|
'datetime': self.iso8601(timestamp),
|
1573
|
-
'
|
1574
|
-
'
|
1575
|
-
'
|
1576
|
-
'
|
1577
|
-
|
1578
|
-
'clientId': referenceId, # balance before
|
1579
|
-
'status': status,
|
1580
|
-
}
|
1574
|
+
'before': None,
|
1575
|
+
'after': None,
|
1576
|
+
'status': 'ok',
|
1577
|
+
'fee': None,
|
1578
|
+
}, currency)
|
1581
1579
|
|
1582
1580
|
def parse_ids(self, ids):
|
1583
1581
|
"""
|
ccxt/bybit.py
CHANGED
@@ -6,7 +6,7 @@
|
|
6
6
|
from ccxt.base.exchange import Exchange
|
7
7
|
from ccxt.abstract.bybit import ImplicitAPI
|
8
8
|
import hashlib
|
9
|
-
from ccxt.base.types import Balances, CrossBorrowRate, Currencies, Currency, Greeks, Int, Leverage, LeverageTier, LeverageTiers, Market, MarketInterface, Num, Option, OptionChain, Order, OrderBook, OrderRequest, CancellationRequest, OrderSide, OrderType, Position, Str, Strings, Ticker, Tickers, Trade, TradingFeeInterface, TradingFees, Transaction, TransferEntry
|
9
|
+
from ccxt.base.types import Balances, CrossBorrowRate, Currencies, Currency, Greeks, Int, LedgerEntry, Leverage, LeverageTier, LeverageTiers, Market, MarketInterface, Num, Option, OptionChain, Order, OrderBook, OrderRequest, CancellationRequest, OrderSide, OrderType, Position, Str, Strings, Ticker, Tickers, Trade, TradingFeeInterface, TradingFees, Transaction, TransferEntry
|
10
10
|
from typing import List
|
11
11
|
from ccxt.base.errors import ExchangeError
|
12
12
|
from ccxt.base.errors import AuthenticationError
|
@@ -5496,15 +5496,15 @@ class bybit(Exchange, ImplicitAPI):
|
|
5496
5496
|
'comment': None,
|
5497
5497
|
}
|
5498
5498
|
|
5499
|
-
def fetch_ledger(self, code: Str = None, since: Int = None, limit: Int = None, params={}):
|
5499
|
+
def fetch_ledger(self, code: Str = None, since: Int = None, limit: Int = None, params={}) -> List[LedgerEntry]:
|
5500
5500
|
"""
|
5501
|
-
fetch the history of changes, actions done by the user or operations that altered balance of the user
|
5501
|
+
fetch the history of changes, actions done by the user or operations that altered the balance of the user
|
5502
5502
|
:see: https://bybit-exchange.github.io/docs/v5/account/transaction-log
|
5503
5503
|
:see: https://bybit-exchange.github.io/docs/v5/account/contract-transaction-log
|
5504
|
-
:param str code: unified currency code, default is None
|
5504
|
+
:param str [code]: unified currency code, default is None
|
5505
5505
|
:param int [since]: timestamp in ms of the earliest ledger entry, default is None
|
5506
|
-
:param int [limit]: max number of ledger
|
5507
|
-
:param boolean [params.paginate]: default False, when True will automatically paginate by calling self endpoint multiple times. See in the docs all the [
|
5506
|
+
:param int [limit]: max number of ledger entries to return, default is None
|
5507
|
+
:param boolean [params.paginate]: default False, when True will automatically paginate by calling self endpoint multiple times. See in the docs all the [available parameters](https://github.com/ccxt/ccxt/wiki/Manual#pagination-params)
|
5508
5508
|
:param str [params.subType]: if inverse will use v5/account/contract-transaction-log
|
5509
5509
|
:param dict [params]: extra parameters specific to the exchange API endpoint
|
5510
5510
|
:returns dict: a `ledger structure <https://docs.ccxt.com/#/?id=ledger-structure>`
|
@@ -5664,7 +5664,7 @@ class bybit(Exchange, ImplicitAPI):
|
|
5664
5664
|
data = self.add_pagination_cursor_to_result(response)
|
5665
5665
|
return self.parse_ledger(data, currency, since, limit)
|
5666
5666
|
|
5667
|
-
def parse_ledger_entry(self, item: dict, currency: Currency = None):
|
5667
|
+
def parse_ledger_entry(self, item: dict, currency: Currency = None) -> LedgerEntry:
|
5668
5668
|
#
|
5669
5669
|
# {
|
5670
5670
|
# "id": 234467,
|
@@ -5703,6 +5703,7 @@ class bybit(Exchange, ImplicitAPI):
|
|
5703
5703
|
#
|
5704
5704
|
currencyId = self.safe_string_2(item, 'coin', 'currency')
|
5705
5705
|
code = self.safe_currency_code(currencyId, currency)
|
5706
|
+
currency = self.safe_currency(currencyId, currency)
|
5706
5707
|
amount = self.safe_string_2(item, 'amount', 'change')
|
5707
5708
|
after = self.safe_string_2(item, 'wallet_balance', 'cashBalance')
|
5708
5709
|
direction = 'out' if Precise.string_lt(amount, '0') else 'in'
|
@@ -5713,26 +5714,26 @@ class bybit(Exchange, ImplicitAPI):
|
|
5713
5714
|
timestamp = self.parse8601(self.safe_string(item, 'exec_time'))
|
5714
5715
|
if timestamp is None:
|
5715
5716
|
timestamp = self.safe_integer(item, 'transactionTime')
|
5716
|
-
|
5717
|
-
|
5718
|
-
|
5719
|
-
|
5720
|
-
'id': id,
|
5721
|
-
'currency': code,
|
5717
|
+
return self.safe_ledger_entry({
|
5718
|
+
'info': item,
|
5719
|
+
'id': self.safe_string(item, 'id'),
|
5720
|
+
'direction': direction,
|
5722
5721
|
'account': self.safe_string(item, 'wallet_id'),
|
5722
|
+
'referenceId': self.safe_string(item, 'tx_id'),
|
5723
5723
|
'referenceAccount': None,
|
5724
|
-
'
|
5725
|
-
'
|
5726
|
-
'amount': self.
|
5727
|
-
'before': self.parse_number(before),
|
5728
|
-
'after': self.parse_number(after),
|
5729
|
-
'fee': self.parse_number(self.safe_string(item, 'fee')),
|
5730
|
-
'direction': direction,
|
5724
|
+
'type': self.parse_ledger_entry_type(self.safe_string(item, 'type')),
|
5725
|
+
'currency': code,
|
5726
|
+
'amount': self.parse_to_numeric(Precise.string_abs(amount)),
|
5731
5727
|
'timestamp': timestamp,
|
5732
5728
|
'datetime': self.iso8601(timestamp),
|
5733
|
-
'
|
5734
|
-
'
|
5735
|
-
|
5729
|
+
'before': self.parse_to_numeric(before),
|
5730
|
+
'after': self.parse_to_numeric(after),
|
5731
|
+
'status': 'ok',
|
5732
|
+
'fee': {
|
5733
|
+
'currency': code,
|
5734
|
+
'cost': self.parse_to_numeric(self.safe_string(item, 'fee')),
|
5735
|
+
},
|
5736
|
+
}, currency)
|
5736
5737
|
|
5737
5738
|
def parse_ledger_entry_type(self, type):
|
5738
5739
|
types: dict = {
|
ccxt/coinbase.py
CHANGED
@@ -6,7 +6,7 @@
|
|
6
6
|
from ccxt.base.exchange import Exchange
|
7
7
|
from ccxt.abstract.coinbase import ImplicitAPI
|
8
8
|
import hashlib
|
9
|
-
from ccxt.base.types import Account, Balances, Conversion, Currencies, Currency, Int, Market, MarketInterface, Num, Order, OrderBook, OrderSide, OrderType, Str, Strings, Ticker, Tickers, Trade, TradingFees, Transaction
|
9
|
+
from ccxt.base.types import Account, Balances, Conversion, Currencies, Currency, Int, LedgerEntry, Market, MarketInterface, Num, Order, OrderBook, OrderSide, OrderType, Str, Strings, Ticker, Tickers, Trade, TradingFees, Transaction
|
10
10
|
from typing import List
|
11
11
|
from ccxt.base.errors import ExchangeError
|
12
12
|
from ccxt.base.errors import AuthenticationError
|
@@ -2170,15 +2170,15 @@ class coinbase(Exchange, ImplicitAPI):
|
|
2170
2170
|
params['type'] = marketType
|
2171
2171
|
return self.parse_custom_balance(response, params)
|
2172
2172
|
|
2173
|
-
def fetch_ledger(self, code: Str = None, since: Int = None, limit: Int = None, params={}):
|
2173
|
+
def fetch_ledger(self, code: Str = None, since: Int = None, limit: Int = None, params={}) -> List[LedgerEntry]:
|
2174
2174
|
"""
|
2175
|
-
fetch the history of changes, actions done by the user or operations that altered balance of the user
|
2175
|
+
fetch the history of changes, actions done by the user or operations that altered the balance of the user
|
2176
2176
|
:see: https://docs.cloud.coinbase.com/sign-in-with-coinbase/docs/api-transactions#list-transactions
|
2177
|
-
:param str code: unified currency code, default is None
|
2177
|
+
:param str [code]: unified currency code, default is None
|
2178
2178
|
:param int [since]: timestamp in ms of the earliest ledger entry, default is None
|
2179
|
-
:param int [limit]: max number of ledger
|
2179
|
+
:param int [limit]: max number of ledger entries to return, default is None
|
2180
2180
|
:param dict [params]: extra parameters specific to the exchange API endpoint
|
2181
|
-
:param boolean [params.paginate]: default False, when True will automatically paginate by calling self endpoint multiple times. See in the docs all the [
|
2181
|
+
:param boolean [params.paginate]: default False, when True will automatically paginate by calling self endpoint multiple times. See in the docs all the [available parameters](https://github.com/ccxt/ccxt/wiki/Manual#pagination-params)
|
2182
2182
|
:returns dict: a `ledger structure <https://docs.ccxt.com/#/?id=ledger-structure>`
|
2183
2183
|
"""
|
2184
2184
|
self.load_markets()
|
@@ -2204,8 +2204,28 @@ class coinbase(Exchange, ImplicitAPI):
|
|
2204
2204
|
pagination = self.safe_dict(response, 'pagination', {})
|
2205
2205
|
cursor = self.safe_string(pagination, 'next_starting_after')
|
2206
2206
|
if (cursor is not None) and (cursor != ''):
|
2207
|
+
lastFee = self.safe_dict(last, 'fee')
|
2207
2208
|
last['next_starting_after'] = cursor
|
2208
|
-
ledger[lastIndex] =
|
2209
|
+
ledger[lastIndex] = {
|
2210
|
+
'info': self.safe_dict(last, 'info'),
|
2211
|
+
'id': self.safe_string(last, 'id'),
|
2212
|
+
'timestamp': self.safe_integer(last, 'timestamp'),
|
2213
|
+
'datetime': self.safe_string(last, 'datetime'),
|
2214
|
+
'direction': self.safe_string(last, 'direction'),
|
2215
|
+
'account': self.safe_string(last, 'account'),
|
2216
|
+
'referenceId': None,
|
2217
|
+
'referenceAccount': None,
|
2218
|
+
'type': self.safe_string(last, 'type'),
|
2219
|
+
'currency': self.safe_string(last, 'currency'),
|
2220
|
+
'amount': self.safe_number(last, 'amount'),
|
2221
|
+
'before': None,
|
2222
|
+
'after': None,
|
2223
|
+
'status': self.safe_string(last, 'status'),
|
2224
|
+
'fee': {
|
2225
|
+
'cost': self.safe_number(lastFee, 'cost'),
|
2226
|
+
'currency': self.safe_string(lastFee, 'currency'),
|
2227
|
+
},
|
2228
|
+
}
|
2209
2229
|
return ledger
|
2210
2230
|
|
2211
2231
|
def parse_ledger_entry_status(self, status):
|
@@ -2228,7 +2248,7 @@ class coinbase(Exchange, ImplicitAPI):
|
|
2228
2248
|
}
|
2229
2249
|
return self.safe_string(types, type, type)
|
2230
2250
|
|
2231
|
-
def parse_ledger_entry(self, item: dict, currency: Currency = None):
|
2251
|
+
def parse_ledger_entry(self, item: dict, currency: Currency = None) -> LedgerEntry:
|
2232
2252
|
#
|
2233
2253
|
# crypto deposit transaction
|
2234
2254
|
#
|
@@ -2482,6 +2502,7 @@ class coinbase(Exchange, ImplicitAPI):
|
|
2482
2502
|
direction = 'in'
|
2483
2503
|
currencyId = self.safe_string(amountInfo, 'currency')
|
2484
2504
|
code = self.safe_currency_code(currencyId, currency)
|
2505
|
+
currency = self.safe_currency(currencyId, currency)
|
2485
2506
|
#
|
2486
2507
|
# the address and txid do not belong to the unified ledger structure
|
2487
2508
|
#
|
@@ -2514,7 +2535,7 @@ class coinbase(Exchange, ImplicitAPI):
|
|
2514
2535
|
numParts = len(parts)
|
2515
2536
|
if numParts > 3:
|
2516
2537
|
accountId = parts[3]
|
2517
|
-
return {
|
2538
|
+
return self.safe_ledger_entry({
|
2518
2539
|
'info': item,
|
2519
2540
|
'id': id,
|
2520
2541
|
'timestamp': timestamp,
|
@@ -2530,7 +2551,7 @@ class coinbase(Exchange, ImplicitAPI):
|
|
2530
2551
|
'after': None,
|
2531
2552
|
'status': status,
|
2532
2553
|
'fee': fee,
|
2533
|
-
}
|
2554
|
+
}, currency)
|
2534
2555
|
|
2535
2556
|
def find_account_id(self, code, params={}):
|
2536
2557
|
self.load_markets()
|
ccxt/coinbaseexchange.py
CHANGED
@@ -6,7 +6,7 @@
|
|
6
6
|
from ccxt.base.exchange import Exchange
|
7
7
|
from ccxt.abstract.coinbaseexchange import ImplicitAPI
|
8
8
|
import hashlib
|
9
|
-
from ccxt.base.types import Account, Balances, Currencies, Currency, Int, Market, Num, Order, OrderBook, OrderSide, OrderType, Str, Strings, Ticker, Tickers, Trade, TradingFees, Transaction
|
9
|
+
from ccxt.base.types import Account, Balances, Currencies, Currency, Int, LedgerEntry, Market, Num, Order, OrderBook, OrderSide, OrderType, Str, Strings, Ticker, Tickers, Trade, TradingFees, Transaction
|
10
10
|
from typing import List
|
11
11
|
from ccxt.base.errors import ExchangeError
|
12
12
|
from ccxt.base.errors import AuthenticationError
|
@@ -1326,7 +1326,7 @@ class coinbaseexchange(Exchange, ImplicitAPI):
|
|
1326
1326
|
}
|
1327
1327
|
return self.safe_string(types, type, type)
|
1328
1328
|
|
1329
|
-
def parse_ledger_entry(self, item: dict, currency: Currency = None):
|
1329
|
+
def parse_ledger_entry(self, item: dict, currency: Currency = None) -> LedgerEntry:
|
1330
1330
|
# {
|
1331
1331
|
# "id": "12087495079",
|
1332
1332
|
# "amount": "-0.0100000000000000",
|
@@ -1378,31 +1378,31 @@ class coinbaseexchange(Exchange, ImplicitAPI):
|
|
1378
1378
|
else:
|
1379
1379
|
referenceId = self.safe_string(details, 'order_id')
|
1380
1380
|
status = 'ok'
|
1381
|
-
return {
|
1381
|
+
return self.safe_ledger_entry({
|
1382
|
+
'info': item,
|
1382
1383
|
'id': id,
|
1383
|
-
'
|
1384
|
+
'timestamp': timestamp,
|
1385
|
+
'datetime': self.iso8601(timestamp),
|
1386
|
+
'direction': direction,
|
1384
1387
|
'account': account,
|
1385
1388
|
'referenceAccount': referenceAccount,
|
1386
1389
|
'referenceId': referenceId,
|
1387
|
-
'
|
1390
|
+
'type': type,
|
1391
|
+
'currency': code,
|
1388
1392
|
'amount': amount,
|
1389
1393
|
'before': before,
|
1390
1394
|
'after': after,
|
1395
|
+
'status': status,
|
1391
1396
|
'fee': None,
|
1392
|
-
|
1393
|
-
'timestamp': timestamp,
|
1394
|
-
'datetime': self.iso8601(timestamp),
|
1395
|
-
'type': type,
|
1396
|
-
'info': item,
|
1397
|
-
}
|
1397
|
+
}, currency)
|
1398
1398
|
|
1399
|
-
def fetch_ledger(self, code: Str = None, since: Int = None, limit: Int = None, params={}):
|
1399
|
+
def fetch_ledger(self, code: Str = None, since: Int = None, limit: Int = None, params={}) -> List[LedgerEntry]:
|
1400
1400
|
"""
|
1401
|
+
fetch the history of changes, actions done by the user or operations that altered the balance of the user
|
1401
1402
|
:see: https://docs.cloud.coinbase.com/exchange/reference/exchangerestapi_getaccountledger
|
1402
|
-
fetch the history of changes, actions done by the user or operations that altered balance of the user
|
1403
1403
|
:param str code: unified currency code, default is None
|
1404
1404
|
:param int [since]: timestamp in ms of the earliest ledger entry, default is None
|
1405
|
-
:param int [limit]: max number of ledger
|
1405
|
+
:param int [limit]: max number of ledger entries to return, default is None
|
1406
1406
|
:param dict [params]: extra parameters specific to the exchange API endpoint
|
1407
1407
|
:param int [params.until]: the latest time in ms to fetch trades for
|
1408
1408
|
:returns dict: a `ledger structure <https://docs.ccxt.com/#/?id=ledger-structure>`
|
ccxt/coinlist.py
CHANGED
@@ -7,7 +7,7 @@ from ccxt.base.exchange import Exchange
|
|
7
7
|
from ccxt.abstract.coinlist import ImplicitAPI
|
8
8
|
import hashlib
|
9
9
|
import math
|
10
|
-
from ccxt.base.types import Account, Balances, Currencies, Currency, Int, Market, Num, Order, OrderBook, OrderSide, OrderType, Str, Strings, Ticker, Tickers, Trade, TradingFees, Transaction, TransferEntry
|
10
|
+
from ccxt.base.types import Account, Balances, Currencies, Currency, Int, LedgerEntry, Market, Num, Order, OrderBook, OrderSide, OrderType, Str, Strings, Ticker, Tickers, Trade, 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
|
@@ -1980,13 +1980,13 @@ class coinlist(Exchange, ImplicitAPI):
|
|
1980
1980
|
}
|
1981
1981
|
return self.safe_string(types, type, type)
|
1982
1982
|
|
1983
|
-
def fetch_ledger(self, code: Str = None, since: Int = None, limit: Int = None, params={}):
|
1983
|
+
def fetch_ledger(self, code: Str = None, since: Int = None, limit: Int = None, params={}) -> List[LedgerEntry]:
|
1984
1984
|
"""
|
1985
|
-
fetch the history of changes, actions done by the user or operations that altered balance of the user
|
1985
|
+
fetch the history of changes, actions done by the user or operations that altered the balance of the user
|
1986
1986
|
:see: https://trade-docs.coinlist.co/?javascript--nodejs#get-account-history
|
1987
|
-
:param str code: unified currency code, default is None
|
1987
|
+
:param str [code]: unified currency code, default is None
|
1988
1988
|
:param int [since]: timestamp in ms of the earliest ledger entry, default is None
|
1989
|
-
:param int [limit]: max number of ledger
|
1989
|
+
:param int [limit]: max number of ledger entries to return(default 200, max 500)
|
1990
1990
|
:param dict [params]: extra parameters specific to the exchange API endpoint
|
1991
1991
|
:param int [params.until]: the latest time in ms to fetch entries for
|
1992
1992
|
:returns dict: a `ledger structure <https://docs.ccxt.com/#/?id=ledger-structure>`
|
@@ -2079,7 +2079,7 @@ class coinlist(Exchange, ImplicitAPI):
|
|
2079
2079
|
ledger = self.safe_value(response, 'transactions', [])
|
2080
2080
|
return self.parse_ledger(ledger, currency, since, limit)
|
2081
2081
|
|
2082
|
-
def parse_ledger_entry(self, item: dict, currency: Currency = None):
|
2082
|
+
def parse_ledger_entry(self, item: dict, currency: Currency = None) -> LedgerEntry:
|
2083
2083
|
#
|
2084
2084
|
# deposit transaction from wallet(funding) to pro(trading)
|
2085
2085
|
# {
|
@@ -2163,8 +2163,9 @@ class coinlist(Exchange, ImplicitAPI):
|
|
2163
2163
|
direction = 'in'
|
2164
2164
|
currencyId = self.safe_string(item, 'asset')
|
2165
2165
|
code = self.safe_currency_code(currencyId, currency)
|
2166
|
+
currency = self.safe_currency(currencyId, currency)
|
2166
2167
|
type = self.parse_ledger_entry_type(self.safe_string(item, 'type'))
|
2167
|
-
return {
|
2168
|
+
return self.safe_ledger_entry({
|
2168
2169
|
'info': item,
|
2169
2170
|
'id': id,
|
2170
2171
|
'timestamp': timestamp,
|
@@ -2180,7 +2181,7 @@ class coinlist(Exchange, ImplicitAPI):
|
|
2180
2181
|
'after': None,
|
2181
2182
|
'status': 'ok',
|
2182
2183
|
'fee': None,
|
2183
|
-
}
|
2184
|
+
}, currency)
|
2184
2185
|
|
2185
2186
|
def parse_ledger_entry_type(self, type):
|
2186
2187
|
types: dict = {
|
ccxt/coinmetro.py
CHANGED
@@ -5,7 +5,7 @@
|
|
5
5
|
|
6
6
|
from ccxt.base.exchange import Exchange
|
7
7
|
from ccxt.abstract.coinmetro import ImplicitAPI
|
8
|
-
from ccxt.base.types import Balances, Currencies, Currency, IndexType, Int, Market, Num, Order, OrderBook, OrderSide, OrderType, Str, Strings, Ticker, Tickers, Trade
|
8
|
+
from ccxt.base.types import Balances, Currencies, Currency, IndexType, Int, LedgerEntry, Market, Num, Order, OrderBook, OrderSide, OrderType, Str, Strings, Ticker, Tickers, Trade
|
9
9
|
from typing import List
|
10
10
|
from ccxt.base.errors import ExchangeError
|
11
11
|
from ccxt.base.errors import PermissionDenied
|
@@ -948,13 +948,13 @@ class coinmetro(Exchange, ImplicitAPI):
|
|
948
948
|
result[code] = account
|
949
949
|
return self.safe_balance(result)
|
950
950
|
|
951
|
-
def fetch_ledger(self, code: Str = None, since: Int = None, limit: Int = None, params={}):
|
951
|
+
def fetch_ledger(self, code: Str = None, since: Int = None, limit: Int = None, params={}) -> List[LedgerEntry]:
|
952
952
|
"""
|
953
|
-
fetch the history of changes, actions done by the user or operations that altered balance of the user
|
953
|
+
fetch the history of changes, actions done by the user or operations that altered the balance of the user
|
954
954
|
:see: https://documenter.getpostman.com/view/3653795/SVfWN6KS#4e7831f7-a0e7-4c3e-9336-1d0e5dcb15cf
|
955
|
-
:param str code: unified currency code, default is None
|
955
|
+
:param str [code]: unified currency code, default is None
|
956
956
|
:param int [since]: timestamp in ms of the earliest ledger entry, default is None
|
957
|
-
:param int [limit]: max number of ledger
|
957
|
+
:param int [limit]: max number of ledger entries to return(default 200, max 500)
|
958
958
|
:param dict [params]: extra parameters specific to the exchange API endpoint
|
959
959
|
:param int [params.until]: the latest time in ms to fetch entries for
|
960
960
|
:returns dict: a `ledger structure <https://docs.ccxt.com/#/?id=ledger-structure>`
|
@@ -1070,7 +1070,7 @@ class coinmetro(Exchange, ImplicitAPI):
|
|
1070
1070
|
ledger.append(rawLedgerEntry)
|
1071
1071
|
return self.parse_ledger(ledger, currency, since, limit)
|
1072
1072
|
|
1073
|
-
def parse_ledger_entry(self, item: dict, currency: Currency = None):
|
1073
|
+
def parse_ledger_entry(self, item: dict, currency: Currency = None) -> LedgerEntry:
|
1074
1074
|
datetime = self.safe_string(item, 'timestamp')
|
1075
1075
|
currencyId = self.safe_string(item, 'currencyId')
|
1076
1076
|
item = self.omit(item, 'currencyId')
|
ccxt/cryptocom.py
CHANGED
@@ -6,7 +6,7 @@
|
|
6
6
|
from ccxt.base.exchange import Exchange
|
7
7
|
from ccxt.abstract.cryptocom import ImplicitAPI
|
8
8
|
import hashlib
|
9
|
-
from ccxt.base.types import Account, Balances, Currency, Int, Market, Num, Order, OrderBook, OrderRequest, CancellationRequest, OrderSide, OrderType, Str, Strings, Ticker, Tickers, Trade, TradingFeeInterface, TradingFees, Transaction
|
9
|
+
from ccxt.base.types import Account, Balances, Currency, Int, LedgerEntry, Market, Num, Order, OrderBook, OrderRequest, CancellationRequest, OrderSide, OrderType, Str, Strings, Ticker, Tickers, Trade, TradingFeeInterface, TradingFees, Transaction
|
10
10
|
from typing import List
|
11
11
|
from ccxt.base.errors import ExchangeError
|
12
12
|
from ccxt.base.errors import AuthenticationError
|
@@ -2220,11 +2220,11 @@ class cryptocom(Exchange, ImplicitAPI):
|
|
2220
2220
|
currencyMap = self.safe_list(data, 'currency_map')
|
2221
2221
|
return self.parse_deposit_withdraw_fees(currencyMap, codes, 'full_name')
|
2222
2222
|
|
2223
|
-
def fetch_ledger(self, code: Str = None, since: Int = None, limit: Int = None, params={}):
|
2223
|
+
def fetch_ledger(self, code: Str = None, since: Int = None, limit: Int = None, params={}) -> List[LedgerEntry]:
|
2224
2224
|
"""
|
2225
2225
|
fetch the history of changes, actions done by the user or operations that altered the balance of the user
|
2226
2226
|
:see: https://exchange-docs.crypto.com/exchange/v1/rest-ws/index.html#private-get-transactions
|
2227
|
-
:param str code: unified currency code
|
2227
|
+
:param str [code]: unified currency code
|
2228
2228
|
:param int [since]: timestamp in ms of the earliest ledger entry
|
2229
2229
|
:param int [limit]: max number of ledger entries to return
|
2230
2230
|
:param dict [params]: extra parameters specific to the exchange API endpoint
|
@@ -2278,7 +2278,7 @@ class cryptocom(Exchange, ImplicitAPI):
|
|
2278
2278
|
ledger = self.safe_value(result, 'data', [])
|
2279
2279
|
return self.parse_ledger(ledger, currency, since, limit)
|
2280
2280
|
|
2281
|
-
def parse_ledger_entry(self, item: dict, currency: Currency = None):
|
2281
|
+
def parse_ledger_entry(self, item: dict, currency: Currency = None) -> LedgerEntry:
|
2282
2282
|
#
|
2283
2283
|
# {
|
2284
2284
|
# "account_id": "ce075cef-1234-4321-bd6e-gf9007351e64",
|
@@ -2301,6 +2301,8 @@ class cryptocom(Exchange, ImplicitAPI):
|
|
2301
2301
|
#
|
2302
2302
|
timestamp = self.safe_integer(item, 'event_timestamp_ms')
|
2303
2303
|
currencyId = self.safe_string(item, 'instrument_name')
|
2304
|
+
code = self.safe_currency_code(currencyId, currency)
|
2305
|
+
currency = self.safe_currency(currencyId, currency)
|
2304
2306
|
amount = self.safe_string(item, 'transaction_qty')
|
2305
2307
|
direction = None
|
2306
2308
|
if Precise.string_lt(amount, '0'):
|
@@ -2308,14 +2310,15 @@ class cryptocom(Exchange, ImplicitAPI):
|
|
2308
2310
|
amount = Precise.string_abs(amount)
|
2309
2311
|
else:
|
2310
2312
|
direction = 'in'
|
2311
|
-
return {
|
2313
|
+
return self.safe_ledger_entry({
|
2314
|
+
'info': item,
|
2312
2315
|
'id': self.safe_string(item, 'order_id'),
|
2313
2316
|
'direction': direction,
|
2314
2317
|
'account': self.safe_string(item, 'account_id'),
|
2315
2318
|
'referenceId': self.safe_string(item, 'trade_id'),
|
2316
2319
|
'referenceAccount': self.safe_string(item, 'trade_match_id'),
|
2317
2320
|
'type': self.parse_ledger_entry_type(self.safe_string(item, 'journal_type')),
|
2318
|
-
'currency':
|
2321
|
+
'currency': code,
|
2319
2322
|
'amount': self.parse_number(amount),
|
2320
2323
|
'timestamp': timestamp,
|
2321
2324
|
'datetime': self.iso8601(timestamp),
|
@@ -2326,8 +2329,7 @@ class cryptocom(Exchange, ImplicitAPI):
|
|
2326
2329
|
'currency': None,
|
2327
2330
|
'cost': None,
|
2328
2331
|
},
|
2329
|
-
|
2330
|
-
}
|
2332
|
+
}, currency)
|
2331
2333
|
|
2332
2334
|
def parse_ledger_entry_type(self, type):
|
2333
2335
|
ledgerType: dict = {
|
ccxt/currencycom.py
CHANGED
@@ -6,7 +6,7 @@
|
|
6
6
|
from ccxt.base.exchange import Exchange
|
7
7
|
from ccxt.abstract.currencycom import ImplicitAPI
|
8
8
|
import hashlib
|
9
|
-
from ccxt.base.types import Account, Balances, Currencies, Currency, Int, Leverage, Market, Num, Order, OrderBook, OrderSide, OrderType, Str, Strings, Ticker, Tickers, Trade, TradingFees, Transaction
|
9
|
+
from ccxt.base.types import Account, Balances, Currencies, Currency, Int, LedgerEntry, Leverage, Market, Num, Order, OrderBook, OrderSide, OrderType, Str, Strings, Ticker, Tickers, Trade, TradingFees, Transaction
|
10
10
|
from typing import List
|
11
11
|
from ccxt.base.errors import ExchangeError
|
12
12
|
from ccxt.base.errors import AuthenticationError
|
@@ -1619,13 +1619,13 @@ class currencycom(Exchange, ImplicitAPI):
|
|
1619
1619
|
}
|
1620
1620
|
return self.safe_string(types, type, type)
|
1621
1621
|
|
1622
|
-
def fetch_ledger(self, code: Str = None, since: Int = None, limit: Int = None, params={}):
|
1622
|
+
def fetch_ledger(self, code: Str = None, since: Int = None, limit: Int = None, params={}) -> List[LedgerEntry]:
|
1623
1623
|
"""
|
1624
|
-
fetch the history of changes, actions done by the user or operations that altered balance of the user
|
1624
|
+
fetch the history of changes, actions done by the user or operations that altered the balance of the user
|
1625
1625
|
:see: https://apitradedoc.currency.com/swagger-ui.html#/rest-api/getLedgerUsingGET
|
1626
|
-
:param str code: unified currency code, default is None
|
1626
|
+
:param str [code]: unified currency code, default is None
|
1627
1627
|
:param int [since]: timestamp in ms of the earliest ledger entry, default is None
|
1628
|
-
:param int [limit]: max number of ledger
|
1628
|
+
:param int [limit]: max number of ledger entries to return, default is None
|
1629
1629
|
:param dict [params]: extra parameters specific to the exchange API endpoint
|
1630
1630
|
:returns dict: a `ledger structure <https://docs.ccxt.com/#/?id=ledger-structure>`
|
1631
1631
|
"""
|
@@ -1668,19 +1668,20 @@ class currencycom(Exchange, ImplicitAPI):
|
|
1668
1668
|
#
|
1669
1669
|
return self.parse_ledger(response, currency, since, limit)
|
1670
1670
|
|
1671
|
-
def parse_ledger_entry(self, item: dict, currency: Currency = None):
|
1671
|
+
def parse_ledger_entry(self, item: dict, currency: Currency = None) -> LedgerEntry:
|
1672
1672
|
id = self.safe_string(item, 'id')
|
1673
1673
|
amountString = self.safe_string(item, 'amount')
|
1674
1674
|
amount = Precise.string_abs(amountString)
|
1675
1675
|
timestamp = self.safe_integer(item, 'timestamp')
|
1676
1676
|
currencyId = self.safe_string(item, 'currency')
|
1677
1677
|
code = self.safe_currency_code(currencyId, currency)
|
1678
|
+
currency = self.safe_currency(currencyId, currency)
|
1678
1679
|
feeCost = self.safe_string(item, 'commission')
|
1679
1680
|
fee = None
|
1680
1681
|
if feeCost is not None:
|
1681
1682
|
fee = {'currency': code, 'cost': feeCost}
|
1682
1683
|
direction = 'out' if Precise.string_lt(amountString, '0') else 'in'
|
1683
|
-
|
1684
|
+
return self.safe_ledger_entry({
|
1684
1685
|
'id': id,
|
1685
1686
|
'timestamp': timestamp,
|
1686
1687
|
'datetime': self.iso8601(timestamp),
|
@@ -1696,8 +1697,7 @@ class currencycom(Exchange, ImplicitAPI):
|
|
1696
1697
|
'status': self.parse_ledger_entry_status(self.safe_string(item, 'status')),
|
1697
1698
|
'fee': fee,
|
1698
1699
|
'info': item,
|
1699
|
-
}
|
1700
|
-
return result
|
1700
|
+
}, currency)
|
1701
1701
|
|
1702
1702
|
def parse_ledger_entry_status(self, status):
|
1703
1703
|
statuses: dict = {
|