fetch the history of changes, actions done by the user or operations that altered the balance of the user https://bybit-exchange.github.io/docs/v5/account/transaction-log https://bybit-exchange.github.io/docs/v5/account/contract-transaction-log :param str [code]: u
(self, code: Str = None, since: Int = None, limit: Int = None, params={})
| 5877 | } |
| 5878 | |
| 5879 | def fetch_ledger(self, code: Str = None, since: Int = None, limit: Int = None, params={}) -> List[LedgerEntry]: |
| 5880 | """ |
| 5881 | fetch the history of changes, actions done by the user or operations that altered the balance of the user |
| 5882 | |
| 5883 | https://bybit-exchange.github.io/docs/v5/account/transaction-log |
| 5884 | https://bybit-exchange.github.io/docs/v5/account/contract-transaction-log |
| 5885 | |
| 5886 | :param str [code]: unified currency code, default is None |
| 5887 | :param int [since]: timestamp in ms of the earliest ledger entry, default is None |
| 5888 | :param int [limit]: max number of ledger entries to return, default is None |
| 5889 | :param dict [params]: extra parameters specific to the exchange API endpoint |
| 5890 | :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) |
| 5891 | :param str [params.subType]: if inverse will use v5/account/contract-transaction-log |
| 5892 | :returns dict: a `ledger structure <https://docs.ccxt.com/?id=ledger-entry-structure>` |
| 5893 | """ |
| 5894 | self.load_markets() |
| 5895 | paginate = False |
| 5896 | paginate, params = self.handle_option_and_params(params, 'fetchLedger', 'paginate') |
| 5897 | if paginate: |
| 5898 | return self.fetch_paginated_call_cursor('fetchLedger', code, since, limit, params, 'nextPageCursor', 'cursor', None, 50) |
| 5899 | request = { |
| 5900 | # 'coin': currency['id'], |
| 5901 | # 'currency': currency['id'], # alias |
| 5902 | # 'start_date': self.iso8601(since), |
| 5903 | # 'end_date': self.iso8601(until), |
| 5904 | # 'wallet_fund_type': 'Deposit', # Withdraw, RealisedPNL, Commission, Refund, Prize, ExchangeOrderWithdraw, ExchangeOrderDeposit |
| 5905 | # 'page': 1, |
| 5906 | # 'limit': 20, # max 50 |
| 5907 | # v5 transaction log |
| 5908 | # 'accountType': '', Account Type. UNIFIED |
| 5909 | # 'category': '', Product type. spot,linear,option |
| 5910 | # 'currency': '', Currency |
| 5911 | # 'baseCoin': '', BaseCoin. e.g., BTC of BTCPERP |
| 5912 | # 'type': '', Types of transaction logs |
| 5913 | # 'startTime': 0, The start timestamp(ms) |
| 5914 | # 'endTime': 0, The end timestamp(ms) |
| 5915 | # 'limit': 0, Limit for data size per page. [1, 50]. Default: 20 |
| 5916 | # 'cursor': '', Cursor. Used for pagination |
| 5917 | } |
| 5918 | enableUnified = self.is_unified_enabled() |
| 5919 | currency = None |
| 5920 | currencyKey = 'coin' |
| 5921 | if enableUnified[1]: |
| 5922 | currencyKey = 'currency' |
| 5923 | if since is not None: |
| 5924 | request['startTime'] = since |
| 5925 | else: |
| 5926 | if since is not None: |
| 5927 | request['start_date'] = self.yyyymmdd(since) |
| 5928 | if code is not None: |
| 5929 | currency = self.currency(code) |
| 5930 | request[currencyKey] = currency['id'] |
| 5931 | if limit is not None: |
| 5932 | request['limit'] = limit |
| 5933 | subType = None |
| 5934 | subType, params = self.handle_sub_type_and_params('fetchLedger', None, params) |
| 5935 | response: dict |
| 5936 | if enableUnified[1]: |
nothing calls this directly
no test coverage detected