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

Method fetch_ledger

python/ccxt/bitmex.py:1378–1426  ·  view source on GitHub ↗

fetch the history of changes, actions done by the user or operations that altered the balance of the user https://www.bitmex.com/api/explorer/#not /User/User_getWalletHistory :param str [code]: unified currency code, default is None :param int [since]: timestamp in

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

Source from the content-addressed store, hash-verified

1376 }, currency)
1377
1378 def fetch_ledger(self, code: Str = None, since: Int = None, limit: Int = None, params={}) -> List[LedgerEntry]:
1379 """
1380 fetch the history of changes, actions done by the user or operations that altered the balance of the user
1381
1382 https://www.bitmex.com/api/explorer/#not /User/User_getWalletHistory
1383
1384 :param str [code]: unified currency code, default is None
1385 :param int [since]: timestamp in ms of the earliest ledger entry, default is None
1386 :param int [limit]: max number of ledger entries to return, default is None
1387 :param dict [params]: extra parameters specific to the exchange API endpoint
1388 :returns dict: a `ledger structure <https://docs.ccxt.com/?id=ledger-entry-structure>`
1389 """
1390 self.load_markets()
1391 request = {
1392 # 'start': 123,
1393 }
1394 #
1395 # if since is not None:
1396 # # date-based pagination not supported
1397 # }
1398 #
1399 if limit is not None:
1400 request['count'] = limit
1401 currency = None
1402 if code is not None:
1403 currency = self.currency(code)
1404 request['currency'] = currency['id']
1405 response = self.privateGetUserWalletHistory(self.extend(request, params))
1406 #
1407 # [
1408 # {
1409 # "transactID": "69573da3-7744-5467-3207-89fd6efe7a47",
1410 # "account": 24321,
1411 # "currency": "XBt",
1412 # "transactType": "Withdrawal", # "AffiliatePayout", "Transfer", "Deposit", "RealisedPNL", ...
1413 # "amount": -1000000,
1414 # "fee": 300000,
1415 # "transactStatus": "Completed", # "Canceled", ...
1416 # "address": "1Ex4fkF4NhQaQdRWNoYpqiPbDBbq18Kdd9",
1417 # "tx": "3BMEX91ZhhKoWtsH9QRb5dNXnmnGpiEetA",
1418 # "text": "",
1419 # "transactTime": "2017-03-21T20:05:14.388Z",
1420 # "walletBalance": 0, # balance after
1421 # "marginBalance": null,
1422 # "timestamp": "2017-03-22T13:09:23.514Z"
1423 # }
1424 # ]
1425 #
1426 return self.parse_ledger(response, currency, since, limit)
1427
1428 def fetch_deposits_withdrawals(self, code: Str = None, since: Int = None, limit: Int = None, params={}) -> List[Transaction]:
1429 """

Callers

nothing calls this directly

Calls 5

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

Tested by

no test coverage detected