fetch the history of changes, actions done by the user or operations that altered the balance of the user https://www.gate.com/docs/developers/apiv4/en/#query-spot-account-transaction-history https://www.gate.com/docs/developers/apiv4/en/#query-margin-account-balance-change
(self, code: Str = None, since: Int = None, limit: Int = None, params={})
| 7022 | return result |
| 7023 | |
| 7024 | def fetch_ledger(self, code: Str = None, since: Int = None, limit: Int = None, params={}) -> List[LedgerEntry]: |
| 7025 | """ |
| 7026 | fetch the history of changes, actions done by the user or operations that altered the balance of the user |
| 7027 | |
| 7028 | https://www.gate.com/docs/developers/apiv4/en/#query-spot-account-transaction-history |
| 7029 | https://www.gate.com/docs/developers/apiv4/en/#query-margin-account-balance-change-history |
| 7030 | https://www.gate.com/docs/developers/apiv4/en/#query-futures-account-change-history |
| 7031 | https://www.gate.com/docs/developers/apiv4/en/#query-futures-account-change-history-2 |
| 7032 | https://www.gate.com/docs/developers/apiv4/en/#query-account-change-history |
| 7033 | |
| 7034 | :param str [code]: unified currency code |
| 7035 | :param int [since]: timestamp in ms of the earliest ledger entry |
| 7036 | :param int [limit]: max number of ledger entries to return |
| 7037 | :param dict [params]: extra parameters specific to the exchange API endpoint |
| 7038 | :param int [params.until]: end time in ms |
| 7039 | :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) |
| 7040 | :returns dict: a `ledger structure <https://docs.ccxt.com/?id=ledger-entry-structure>` |
| 7041 | """ |
| 7042 | self.load_markets() |
| 7043 | paginate = False |
| 7044 | paginate, params = self.handle_option_and_params(params, 'fetchLedger', 'paginate') |
| 7045 | if paginate: |
| 7046 | return self.fetch_paginated_call_dynamic('fetchLedger', code, since, limit, params) |
| 7047 | type = None |
| 7048 | currency = None |
| 7049 | response = None |
| 7050 | request = {} |
| 7051 | type, params = self.handle_market_type_and_params('fetchLedger', None, params) |
| 7052 | if (type == 'spot') or (type == 'margin'): |
| 7053 | if code is not None: |
| 7054 | currency = self.currency(code) |
| 7055 | request['currency'] = currency['id'] # todo: currencies have network-junctions |
| 7056 | if (type == 'swap') or (type == 'future'): |
| 7057 | defaultSettle = 'usdt' if (type == 'swap') else 'btc' |
| 7058 | settle = self.safe_string_lower(params, 'settle', defaultSettle) |
| 7059 | params = self.omit(params, 'settle') |
| 7060 | request['settle'] = settle |
| 7061 | if since is not None: |
| 7062 | request['from'] = since |
| 7063 | if limit is not None: |
| 7064 | request['limit'] = limit |
| 7065 | request, params = self.handle_until_option('to', request, params) |
| 7066 | if type == 'spot': |
| 7067 | response = self.privateSpotGetAccountBook(self.extend(request, params)) |
| 7068 | elif type == 'margin': |
| 7069 | response = self.privateMarginGetAccountBook(self.extend(request, params)) |
| 7070 | elif type == 'swap': |
| 7071 | response = self.privateFuturesGetSettleAccountBook(self.extend(request, params)) |
| 7072 | elif type == 'future': |
| 7073 | response = self.privateDeliveryGetSettleAccountBook(self.extend(request, params)) |
| 7074 | elif type == 'option': |
| 7075 | response = self.privateOptionsGetAccountBook(self.extend(request, params)) |
| 7076 | # |
| 7077 | # spot |
| 7078 | # |
| 7079 | # [ |
| 7080 | # { |
| 7081 | # "id": "123456", |
nothing calls this directly
no test coverage detected