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

Method fetch_ledger

python/ccxt/bitget.py:7051–7151  ·  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.bitget.com/api-doc/spot/account/Get-Account-Bills https://www.bitget.com/api-doc/contract/account/Get-Account-Bill :param str [code]: unified curre

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

Source from the content-addressed store, hash-verified

7049 return self.parse_orders(orders, market, since, limit)
7050
7051 def fetch_ledger(self, code: Str = None, since: Int = None, limit: Int = None, params={}) -> List[LedgerEntry]:
7052 """
7053 fetch the history of changes, actions done by the user or operations that altered the balance of the user
7054
7055 https://www.bitget.com/api-doc/spot/account/Get-Account-Bills
7056 https://www.bitget.com/api-doc/contract/account/Get-Account-Bill
7057
7058 :param str [code]: unified currency code, default is None
7059 :param int [since]: timestamp in ms of the earliest ledger entry, default is None
7060 :param int [limit]: max number of ledger entries to return, default is None
7061 :param dict [params]: extra parameters specific to the exchange API endpoint
7062 :param int [params.until]: end time in ms
7063 :param str [params.symbol]: *contract only* unified market symbol
7064 :param str [params.productType]: *contract only* 'USDT-FUTURES', 'USDC-FUTURES', 'COIN-FUTURES', 'SUSDT-FUTURES', 'SUSDC-FUTURES' or 'SCOIN-FUTURES'
7065 :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)
7066 :returns dict: a `ledger structure <https://docs.ccxt.com/?id=ledger-entry-structure>`
7067 """
7068 self.load_markets()
7069 symbol = self.safe_string(params, 'symbol')
7070 params = self.omit(params, 'symbol')
7071 market = None
7072 if symbol is not None:
7073 market = self.market(symbol)
7074 marketType = None
7075 marketType, params = self.handle_market_type_and_params('fetchLedger', market, params)
7076 paginate = False
7077 paginate, params = self.handle_option_and_params(params, 'fetchLedger', 'paginate')
7078 if paginate:
7079 cursorReceived = None
7080 if marketType != 'spot':
7081 cursorReceived = 'endId'
7082 return self.fetch_paginated_call_cursor('fetchLedger', symbol, since, limit, params, cursorReceived, 'idLessThan')
7083 currency = None
7084 request = {}
7085 if code is not None:
7086 currency = self.currency(code)
7087 request['coin'] = currency['id']
7088 request, params = self.handle_until_option('endTime', request, params)
7089 if since is not None:
7090 request['startTime'] = since
7091 if limit is not None:
7092 request['limit'] = limit
7093 response = None
7094 if marketType == 'spot':
7095 response = self.privateSpotGetV2SpotAccountBills(self.extend(request, params))
7096 else:
7097 if symbol is not None:
7098 request['symbol'] = self.safe_string(market, 'id')
7099 productType = None
7100 productType, params = self.handle_product_type_and_params(market, params)
7101 request['productType'] = productType
7102 response = self.privateMixGetV2MixAccountBill(self.extend(request, params))
7103 #
7104 # spot
7105 #
7106 # {
7107 # "code": "00000",
7108 # "msg": "success",

Callers

nothing calls this directly

Calls 15

safe_stringMethod · 0.80
handle_until_optionMethod · 0.80
safe_valueMethod · 0.80
parse_ledgerMethod · 0.80
load_marketsMethod · 0.45
omitMethod · 0.45
marketMethod · 0.45

Tested by

no test coverage detected