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/async_support/bybit.py
CHANGED
@@ -7,7 +7,7 @@ from ccxt.async_support.base.exchange import Exchange
|
|
7
7
|
from ccxt.abstract.bybit import ImplicitAPI
|
8
8
|
import asyncio
|
9
9
|
import hashlib
|
10
|
-
from ccxt.base.types import Balances, 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
|
10
|
+
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
|
11
11
|
from typing import List
|
12
12
|
from ccxt.base.errors import ExchangeError
|
13
13
|
from ccxt.base.errors import AuthenticationError
|
@@ -5497,15 +5497,15 @@ class bybit(Exchange, ImplicitAPI):
|
|
5497
5497
|
'comment': None,
|
5498
5498
|
}
|
5499
5499
|
|
5500
|
-
async def fetch_ledger(self, code: Str = None, since: Int = None, limit: Int = None, params={}):
|
5500
|
+
async def fetch_ledger(self, code: Str = None, since: Int = None, limit: Int = None, params={}) -> List[LedgerEntry]:
|
5501
5501
|
"""
|
5502
|
-
fetch the history of changes, actions done by the user or operations that altered balance of the user
|
5502
|
+
fetch the history of changes, actions done by the user or operations that altered the balance of the user
|
5503
5503
|
:see: https://bybit-exchange.github.io/docs/v5/account/transaction-log
|
5504
5504
|
:see: https://bybit-exchange.github.io/docs/v5/account/contract-transaction-log
|
5505
|
-
:param str code: unified currency code, default is None
|
5505
|
+
:param str [code]: unified currency code, default is None
|
5506
5506
|
:param int [since]: timestamp in ms of the earliest ledger entry, default is None
|
5507
|
-
:param int [limit]: max number of ledger
|
5508
|
-
:param boolean [params.paginate]: default False, when True will automatically paginate by calling self endpoint multiple times. See in the docs all the [
|
5507
|
+
:param int [limit]: max number of ledger entries to return, default is None
|
5508
|
+
: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)
|
5509
5509
|
:param str [params.subType]: if inverse will use v5/account/contract-transaction-log
|
5510
5510
|
:param dict [params]: extra parameters specific to the exchange API endpoint
|
5511
5511
|
:returns dict: a `ledger structure <https://docs.ccxt.com/#/?id=ledger-structure>`
|
@@ -5665,7 +5665,7 @@ class bybit(Exchange, ImplicitAPI):
|
|
5665
5665
|
data = self.add_pagination_cursor_to_result(response)
|
5666
5666
|
return self.parse_ledger(data, currency, since, limit)
|
5667
5667
|
|
5668
|
-
def parse_ledger_entry(self, item: dict, currency: Currency = None):
|
5668
|
+
def parse_ledger_entry(self, item: dict, currency: Currency = None) -> LedgerEntry:
|
5669
5669
|
#
|
5670
5670
|
# {
|
5671
5671
|
# "id": 234467,
|
@@ -5704,6 +5704,7 @@ class bybit(Exchange, ImplicitAPI):
|
|
5704
5704
|
#
|
5705
5705
|
currencyId = self.safe_string_2(item, 'coin', 'currency')
|
5706
5706
|
code = self.safe_currency_code(currencyId, currency)
|
5707
|
+
currency = self.safe_currency(currencyId, currency)
|
5707
5708
|
amount = self.safe_string_2(item, 'amount', 'change')
|
5708
5709
|
after = self.safe_string_2(item, 'wallet_balance', 'cashBalance')
|
5709
5710
|
direction = 'out' if Precise.string_lt(amount, '0') else 'in'
|
@@ -5714,26 +5715,26 @@ class bybit(Exchange, ImplicitAPI):
|
|
5714
5715
|
timestamp = self.parse8601(self.safe_string(item, 'exec_time'))
|
5715
5716
|
if timestamp is None:
|
5716
5717
|
timestamp = self.safe_integer(item, 'transactionTime')
|
5717
|
-
|
5718
|
-
|
5719
|
-
|
5720
|
-
|
5721
|
-
'id': id,
|
5722
|
-
'currency': code,
|
5718
|
+
return self.safe_ledger_entry({
|
5719
|
+
'info': item,
|
5720
|
+
'id': self.safe_string(item, 'id'),
|
5721
|
+
'direction': direction,
|
5723
5722
|
'account': self.safe_string(item, 'wallet_id'),
|
5723
|
+
'referenceId': self.safe_string(item, 'tx_id'),
|
5724
5724
|
'referenceAccount': None,
|
5725
|
-
'
|
5726
|
-
'
|
5727
|
-
'amount': self.
|
5728
|
-
'before': self.parse_number(before),
|
5729
|
-
'after': self.parse_number(after),
|
5730
|
-
'fee': self.parse_number(self.safe_string(item, 'fee')),
|
5731
|
-
'direction': direction,
|
5725
|
+
'type': self.parse_ledger_entry_type(self.safe_string(item, 'type')),
|
5726
|
+
'currency': code,
|
5727
|
+
'amount': self.parse_to_numeric(Precise.string_abs(amount)),
|
5732
5728
|
'timestamp': timestamp,
|
5733
5729
|
'datetime': self.iso8601(timestamp),
|
5734
|
-
'
|
5735
|
-
'
|
5736
|
-
|
5730
|
+
'before': self.parse_to_numeric(before),
|
5731
|
+
'after': self.parse_to_numeric(after),
|
5732
|
+
'status': 'ok',
|
5733
|
+
'fee': {
|
5734
|
+
'currency': code,
|
5735
|
+
'cost': self.parse_to_numeric(self.safe_string(item, 'fee')),
|
5736
|
+
},
|
5737
|
+
}, currency)
|
5737
5738
|
|
5738
5739
|
def parse_ledger_entry_type(self, type):
|
5739
5740
|
types: dict = {
|
ccxt/async_support/coinbase.py
CHANGED
@@ -7,7 +7,7 @@ from ccxt.async_support.base.exchange import Exchange
|
|
7
7
|
from ccxt.abstract.coinbase import ImplicitAPI
|
8
8
|
import asyncio
|
9
9
|
import hashlib
|
10
|
-
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
|
10
|
+
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
|
11
11
|
from typing import List
|
12
12
|
from ccxt.base.errors import ExchangeError
|
13
13
|
from ccxt.base.errors import AuthenticationError
|
@@ -2171,15 +2171,15 @@ class coinbase(Exchange, ImplicitAPI):
|
|
2171
2171
|
params['type'] = marketType
|
2172
2172
|
return self.parse_custom_balance(response, params)
|
2173
2173
|
|
2174
|
-
async def fetch_ledger(self, code: Str = None, since: Int = None, limit: Int = None, params={}):
|
2174
|
+
async def fetch_ledger(self, code: Str = None, since: Int = None, limit: Int = None, params={}) -> List[LedgerEntry]:
|
2175
2175
|
"""
|
2176
|
-
fetch the history of changes, actions done by the user or operations that altered balance of the user
|
2176
|
+
fetch the history of changes, actions done by the user or operations that altered the balance of the user
|
2177
2177
|
:see: https://docs.cloud.coinbase.com/sign-in-with-coinbase/docs/api-transactions#list-transactions
|
2178
|
-
:param str code: unified currency code, default is None
|
2178
|
+
:param str [code]: unified currency code, default is None
|
2179
2179
|
:param int [since]: timestamp in ms of the earliest ledger entry, default is None
|
2180
|
-
:param int [limit]: max number of ledger
|
2180
|
+
:param int [limit]: max number of ledger entries to return, default is None
|
2181
2181
|
:param dict [params]: extra parameters specific to the exchange API endpoint
|
2182
|
-
:param boolean [params.paginate]: default False, when True will automatically paginate by calling self endpoint multiple times. See in the docs all the [
|
2182
|
+
: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)
|
2183
2183
|
:returns dict: a `ledger structure <https://docs.ccxt.com/#/?id=ledger-structure>`
|
2184
2184
|
"""
|
2185
2185
|
await self.load_markets()
|
@@ -2205,8 +2205,28 @@ class coinbase(Exchange, ImplicitAPI):
|
|
2205
2205
|
pagination = self.safe_dict(response, 'pagination', {})
|
2206
2206
|
cursor = self.safe_string(pagination, 'next_starting_after')
|
2207
2207
|
if (cursor is not None) and (cursor != ''):
|
2208
|
+
lastFee = self.safe_dict(last, 'fee')
|
2208
2209
|
last['next_starting_after'] = cursor
|
2209
|
-
ledger[lastIndex] =
|
2210
|
+
ledger[lastIndex] = {
|
2211
|
+
'info': self.safe_dict(last, 'info'),
|
2212
|
+
'id': self.safe_string(last, 'id'),
|
2213
|
+
'timestamp': self.safe_integer(last, 'timestamp'),
|
2214
|
+
'datetime': self.safe_string(last, 'datetime'),
|
2215
|
+
'direction': self.safe_string(last, 'direction'),
|
2216
|
+
'account': self.safe_string(last, 'account'),
|
2217
|
+
'referenceId': None,
|
2218
|
+
'referenceAccount': None,
|
2219
|
+
'type': self.safe_string(last, 'type'),
|
2220
|
+
'currency': self.safe_string(last, 'currency'),
|
2221
|
+
'amount': self.safe_number(last, 'amount'),
|
2222
|
+
'before': None,
|
2223
|
+
'after': None,
|
2224
|
+
'status': self.safe_string(last, 'status'),
|
2225
|
+
'fee': {
|
2226
|
+
'cost': self.safe_number(lastFee, 'cost'),
|
2227
|
+
'currency': self.safe_string(lastFee, 'currency'),
|
2228
|
+
},
|
2229
|
+
}
|
2210
2230
|
return ledger
|
2211
2231
|
|
2212
2232
|
def parse_ledger_entry_status(self, status):
|
@@ -2229,7 +2249,7 @@ class coinbase(Exchange, ImplicitAPI):
|
|
2229
2249
|
}
|
2230
2250
|
return self.safe_string(types, type, type)
|
2231
2251
|
|
2232
|
-
def parse_ledger_entry(self, item: dict, currency: Currency = None):
|
2252
|
+
def parse_ledger_entry(self, item: dict, currency: Currency = None) -> LedgerEntry:
|
2233
2253
|
#
|
2234
2254
|
# crypto deposit transaction
|
2235
2255
|
#
|
@@ -2483,6 +2503,7 @@ class coinbase(Exchange, ImplicitAPI):
|
|
2483
2503
|
direction = 'in'
|
2484
2504
|
currencyId = self.safe_string(amountInfo, 'currency')
|
2485
2505
|
code = self.safe_currency_code(currencyId, currency)
|
2506
|
+
currency = self.safe_currency(currencyId, currency)
|
2486
2507
|
#
|
2487
2508
|
# the address and txid do not belong to the unified ledger structure
|
2488
2509
|
#
|
@@ -2515,7 +2536,7 @@ class coinbase(Exchange, ImplicitAPI):
|
|
2515
2536
|
numParts = len(parts)
|
2516
2537
|
if numParts > 3:
|
2517
2538
|
accountId = parts[3]
|
2518
|
-
return {
|
2539
|
+
return self.safe_ledger_entry({
|
2519
2540
|
'info': item,
|
2520
2541
|
'id': id,
|
2521
2542
|
'timestamp': timestamp,
|
@@ -2531,7 +2552,7 @@ class coinbase(Exchange, ImplicitAPI):
|
|
2531
2552
|
'after': None,
|
2532
2553
|
'status': status,
|
2533
2554
|
'fee': fee,
|
2534
|
-
}
|
2555
|
+
}, currency)
|
2535
2556
|
|
2536
2557
|
async def find_account_id(self, code, params={}):
|
2537
2558
|
await self.load_markets()
|
@@ -6,7 +6,7 @@
|
|
6
6
|
from ccxt.async_support.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
|
-
async def fetch_ledger(self, code: Str = None, since: Int = None, limit: Int = None, params={}):
|
1399
|
+
async 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/async_support/coinlist.py
CHANGED
@@ -7,7 +7,7 @@ from ccxt.async_support.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
|
-
async def fetch_ledger(self, code: Str = None, since: Int = None, limit: Int = None, params={}):
|
1983
|
+
async 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/async_support/coinmetro.py
CHANGED
@@ -5,7 +5,7 @@
|
|
5
5
|
|
6
6
|
from ccxt.async_support.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
|
-
async def fetch_ledger(self, code: Str = None, since: Int = None, limit: Int = None, params={}):
|
951
|
+
async 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/async_support/cryptocom.py
CHANGED
@@ -6,7 +6,7 @@
|
|
6
6
|
from ccxt.async_support.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
|
-
async def fetch_ledger(self, code: Str = None, since: Int = None, limit: Int = None, params={}):
|
2223
|
+
async 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 = {
|
@@ -6,7 +6,7 @@
|
|
6
6
|
from ccxt.async_support.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
|
-
async def fetch_ledger(self, code: Str = None, since: Int = None, limit: Int = None, params={}):
|
1622
|
+
async 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 = {
|
ccxt/async_support/delta.py
CHANGED
@@ -6,7 +6,7 @@
|
|
6
6
|
from ccxt.async_support.base.exchange import Exchange
|
7
7
|
from ccxt.abstract.delta import ImplicitAPI
|
8
8
|
import hashlib
|
9
|
-
from ccxt.base.types import Balances, Currencies, Currency, Greeks, Int, Leverage, MarginMode, MarginModification, Market, MarketInterface, Num, Option, Order, OrderBook, OrderSide, OrderType, Position, Str, Strings, Ticker, Tickers, Trade
|
9
|
+
from ccxt.base.types import Balances, Currencies, Currency, Greeks, Int, LedgerEntry, Leverage, MarginMode, MarginModification, Market, MarketInterface, Num, Option, Order, OrderBook, OrderSide, OrderType, Position, Str, Strings, Ticker, Tickers, Trade
|
10
10
|
from typing import List
|
11
11
|
from ccxt.base.errors import ExchangeError
|
12
12
|
from ccxt.base.errors import AuthenticationError
|
@@ -2104,13 +2104,13 @@ class delta(Exchange, ImplicitAPI):
|
|
2104
2104
|
result = self.safe_list(response, 'result', [])
|
2105
2105
|
return self.parse_trades(result, market, since, limit)
|
2106
2106
|
|
2107
|
-
async def fetch_ledger(self, code: Str = None, since: Int = None, limit: Int = None, params={}):
|
2107
|
+
async def fetch_ledger(self, code: Str = None, since: Int = None, limit: Int = None, params={}) -> List[LedgerEntry]:
|
2108
2108
|
"""
|
2109
|
-
fetch the history of changes, actions done by the user or operations that altered balance of the user
|
2109
|
+
fetch the history of changes, actions done by the user or operations that altered the balance of the user
|
2110
2110
|
:see: https://docs.delta.exchange/#get-wallet-transactions
|
2111
|
-
:param str code: unified currency code, default is None
|
2111
|
+
:param str [code]: unified currency code, default is None
|
2112
2112
|
:param int [since]: timestamp in ms of the earliest ledger entry, default is None
|
2113
|
-
:param int [limit]: max number of ledger
|
2113
|
+
:param int [limit]: max number of ledger entries to return, default is None
|
2114
2114
|
:param dict [params]: extra parameters specific to the exchange API endpoint
|
2115
2115
|
:returns dict: a `ledger structure <https://docs.ccxt.com/#/?id=ledger-structure>`
|
2116
2116
|
"""
|
@@ -2168,7 +2168,7 @@ class delta(Exchange, ImplicitAPI):
|
|
2168
2168
|
}
|
2169
2169
|
return self.safe_string(types, type, type)
|
2170
2170
|
|
2171
|
-
def parse_ledger_entry(self, item: dict, currency: Currency = None):
|
2171
|
+
def parse_ledger_entry(self, item: dict, currency: Currency = None) -> LedgerEntry:
|
2172
2172
|
#
|
2173
2173
|
# {
|
2174
2174
|
# "amount":"29.889184",
|
@@ -2205,7 +2205,7 @@ class delta(Exchange, ImplicitAPI):
|
|
2205
2205
|
after = self.safe_string(item, 'balance')
|
2206
2206
|
before = Precise.string_max('0', Precise.string_sub(after, amount))
|
2207
2207
|
status = 'ok'
|
2208
|
-
return {
|
2208
|
+
return self.safe_ledger_entry({
|
2209
2209
|
'info': item,
|
2210
2210
|
'id': id,
|
2211
2211
|
'direction': direction,
|
@@ -2221,7 +2221,7 @@ class delta(Exchange, ImplicitAPI):
|
|
2221
2221
|
'timestamp': timestamp,
|
2222
2222
|
'datetime': self.iso8601(timestamp),
|
2223
2223
|
'fee': None,
|
2224
|
-
}
|
2224
|
+
}, currency)
|
2225
2225
|
|
2226
2226
|
async def fetch_deposit_address(self, code: str, params={}):
|
2227
2227
|
"""
|
ccxt/async_support/digifinex.py
CHANGED
@@ -8,7 +8,7 @@ from ccxt.abstract.digifinex import ImplicitAPI
|
|
8
8
|
import asyncio
|
9
9
|
import hashlib
|
10
10
|
import json
|
11
|
-
from ccxt.base.types import Balances, CrossBorrowRate, CrossBorrowRates, Currencies, Currency, Int, LeverageTier, LeverageTiers, MarginModification, Market, Num, Order, OrderBook, OrderRequest, OrderSide, OrderType, Str, Strings, Ticker, Tickers, Trade, TradingFeeInterface, Transaction, TransferEntry
|
11
|
+
from ccxt.base.types import Balances, CrossBorrowRate, CrossBorrowRates, Currencies, Currency, Int, LedgerEntry, LeverageTier, LeverageTiers, MarginModification, Market, Num, Order, OrderBook, OrderRequest, OrderSide, OrderType, Str, Strings, Ticker, Tickers, Trade, TradingFeeInterface, Transaction, TransferEntry
|
12
12
|
from typing import List
|
13
13
|
from ccxt.base.errors import ExchangeError
|
14
14
|
from ccxt.base.errors import AuthenticationError
|
@@ -2384,7 +2384,7 @@ class digifinex(Exchange, ImplicitAPI):
|
|
2384
2384
|
types: dict = {}
|
2385
2385
|
return self.safe_string(types, type, type)
|
2386
2386
|
|
2387
|
-
def parse_ledger_entry(self, item: dict, currency: Currency = None):
|
2387
|
+
def parse_ledger_entry(self, item: dict, currency: Currency = None) -> LedgerEntry:
|
2388
2388
|
#
|
2389
2389
|
# spot and margin
|
2390
2390
|
#
|
@@ -2406,13 +2406,15 @@ class digifinex(Exchange, ImplicitAPI):
|
|
2406
2406
|
# }
|
2407
2407
|
#
|
2408
2408
|
type = self.parse_ledger_entry_type(self.safe_string_2(item, 'type', 'finance_type'))
|
2409
|
-
|
2409
|
+
currencyId = self.safe_string_2(item, 'currency_mark', 'currency')
|
2410
|
+
code = self.safe_currency_code(currencyId, currency)
|
2411
|
+
currency = self.safe_currency(currencyId, currency)
|
2410
2412
|
amount = self.safe_number_2(item, 'num', 'change')
|
2411
2413
|
after = self.safe_number(item, 'balance')
|
2412
2414
|
timestamp = self.safe_timestamp(item, 'time')
|
2413
2415
|
if timestamp is None:
|
2414
2416
|
timestamp = self.safe_integer(item, 'timestamp')
|
2415
|
-
return {
|
2417
|
+
return self.safe_ledger_entry({
|
2416
2418
|
'info': item,
|
2417
2419
|
'id': None,
|
2418
2420
|
'direction': None,
|
@@ -2428,16 +2430,16 @@ class digifinex(Exchange, ImplicitAPI):
|
|
2428
2430
|
'timestamp': timestamp,
|
2429
2431
|
'datetime': self.iso8601(timestamp),
|
2430
2432
|
'fee': None,
|
2431
|
-
}
|
2433
|
+
}, currency)
|
2432
2434
|
|
2433
|
-
async def fetch_ledger(self, code: Str = None, since: Int = None, limit: Int = None, params={}):
|
2435
|
+
async def fetch_ledger(self, code: Str = None, since: Int = None, limit: Int = None, params={}) -> List[LedgerEntry]:
|
2434
2436
|
"""
|
2435
|
-
fetch the history of changes, actions done by the user or operations that altered balance of the user
|
2437
|
+
fetch the history of changes, actions done by the user or operations that altered the balance of the user
|
2436
2438
|
:see: https://docs.digifinex.com/en-ww/spot/v3/rest.html#spot-margin-otc-financial-logs
|
2437
2439
|
:see: https://docs.digifinex.com/en-ww/swap/v2/rest.html#bills
|
2438
|
-
:param str code: unified currency code, default is None
|
2440
|
+
:param str [code]: unified currency code, default is None
|
2439
2441
|
:param int [since]: timestamp in ms of the earliest ledger entry, default is None
|
2440
|
-
:param int [limit]: max number of ledger
|
2442
|
+
:param int [limit]: max number of ledger entries to return, default is None
|
2441
2443
|
:param dict [params]: extra parameters specific to the exchange API endpoint
|
2442
2444
|
:returns dict: a `ledger structure <https://docs.ccxt.com/#/?id=ledger-structure>`
|
2443
2445
|
"""
|