MCPcopy Create free account
hub / github.com/ccxt/ccxt / fetch_ledger

Method fetch_ledger

python/ccxt/cex.py:1354–1398  ·  view source on GitHub ↗

fetch the history of changes, actions done by the user or operations that altered the balance of the user https://trade.cex.io/docs/#rest-private-api-calls-transaction-history :param str [code]: unified currency code :param int [since]: timestamp in ms of the earli

(self, code: Str = None, since: Int = None, limit: Int = None, params={})

Source from the content-addressed store, hash-verified

1352 return self.parse_orders(orders)
1353
1354 def fetch_ledger(self, code: Str = None, since: Int = None, limit: Int = None, params={}) -> List[LedgerEntry]:
1355 """
1356 fetch the history of changes, actions done by the user or operations that altered the balance of the user
1357
1358 https://trade.cex.io/docs/#rest-private-api-calls-transaction-history
1359
1360 :param str [code]: unified currency code
1361 :param int [since]: timestamp in ms of the earliest ledger entry
1362 :param int [limit]: max number of ledger entries to return
1363 :param dict [params]: extra parameters specific to the exchange API endpoint
1364 :param int [params.until]: timestamp in ms of the latest ledger entry
1365 :returns dict: a `ledger structure <https://docs.ccxt.com/?id=ledger-entry-structure>`
1366 """
1367 self.load_markets()
1368 currency = None
1369 request = {}
1370 if code is not None:
1371 currency = self.currency(code)
1372 request['currency'] = currency['id']
1373 if since is not None:
1374 request['dateFrom'] = since
1375 if limit is not None:
1376 request['pageSize'] = limit
1377 until = None
1378 until, params = self.handle_param_integer_2(params, 'until', 'till')
1379 if until is not None:
1380 request['dateTo'] = until
1381 response = self.privatePostGetMyTransactionHistory(self.extend(request, params))
1382 #
1383 # {
1384 # "ok": "ok",
1385 # "data": [
1386 # {
1387 # "transactionId": "30367722",
1388 # "timestamp": "2024-10-14T14:08:49.987Z",
1389 # "accountId": "",
1390 # "type": "withdraw",
1391 # "amount": "-12.39060600",
1392 # "details": "Withdraw fundingId=1235039 clientId=up421412345 walletTxId=76337154166",
1393 # "currency": "USDT"
1394 # },
1395 # ...
1396 #
1397 data = self.safe_list(response, 'data', [])
1398 return self.parse_ledger(data, currency, since, limit)
1399
1400 def parse_ledger_entry(self, item: dict, currency: Currency = None) -> LedgerEntry:
1401 amount = self.safe_string(item, 'amount')

Callers

nothing calls this directly

Calls 7

safe_listMethod · 0.80
parse_ledgerMethod · 0.80
load_marketsMethod · 0.45
currencyMethod · 0.45
extendMethod · 0.45

Tested by

no test coverage detected