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

Method fetch_transfers

python/ccxt/lighter.py:2347–2408  ·  view source on GitHub ↗

fetch a history of internal transfers made on an account https://apidocs.lighter.xyz/reference/transfer_history :param str code: unified currency code of the currency transferred :param int [since]: the earliest time in ms to fetch transfers for :param int

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

Source from the content-addressed store, hash-verified

2345 return self.parse_transfer(response)
2346
2347 def fetch_transfers(self, code: Str = None, since: Int = None, limit: Int = None, params={}) -> List[TransferEntry]:
2348 """
2349 fetch a history of internal transfers made on an account
2350
2351 https://apidocs.lighter.xyz/reference/transfer_history
2352
2353 :param str code: unified currency code of the currency transferred
2354 :param int [since]: the earliest time in ms to fetch transfers for
2355 :param int [limit]: the maximum number of transfers structures to retrieve
2356 :param dict [params]: extra parameters specific to the exchange API endpoint
2357 :param str [params.accountIndex]: account index
2358 :param boolean [params.paginate]: default False, when True will automatically paginate by calling self endpoint multiple times. See in the docs all the [availble parameters](https://github.com/ccxt/ccxt/wiki/Manual#pagination-params)
2359 :returns dict[]: a list of `transfer structures <https://docs.ccxt.com/?id=transfer-structure>`
2360 """
2361 self.load_markets()
2362 paginate = False
2363 paginate, params = self.handle_option_and_params(params, 'fetchTransfers', 'paginate')
2364 if paginate:
2365 return self.fetch_paginated_call_cursor('fetchTransfers', code, since, limit, params, 'cursor', 'cursor', None, 50)
2366 accountIndex = None
2367 accountIndex, params = self.handle_account_index(params, 'fetchTransfers', 'accountIndex', 'account_index')
2368 request = {
2369 'account_index': accountIndex,
2370 }
2371 apiKeyIndex = None
2372 apiKeyIndex, params = self.handle_api_key_index(params, 'fetchTransfers', 'apiKeyIndex', 'api_key_index')
2373 strAccountIndex = self.number_to_string(accountIndex)
2374 strApiKeyIndex = self.number_to_string(apiKeyIndex)
2375 self.load_account(self.options['chainId'], self.get_lighter_private_key(strAccountIndex, strApiKeyIndex), strApiKeyIndex, strAccountIndex, params)
2376 currency = None
2377 if code is not None:
2378 currency = self.currency(code)
2379 response = self.privateGetTransferHistory(self.extend(request, params))
2380 #
2381 # {
2382 # "code": 200,
2383 # "transfers": [
2384 # {
2385 # "id": "3085014",
2386 # "asset_id": 3,
2387 # "amount": "11.000000",
2388 # "fee": "0.000000",
2389 # "timestamp": 1766387292752,
2390 # "type": "L2TransferOutflow",
2391 # "from_l1_address": "0x15f43D1f2DeE81424aFd891943262aa90F22cc2A",
2392 # "to_l1_address": "0x15f43D1f2DeE81424aFd891943262aa90F22cc2A",
2393 # "from_account_index": 1077,
2394 # "to_account_index": 281474976710608,
2395 # "from_route": "spot",
2396 # "to_route": "spot",
2397 # "tx_hash": "d8e96178273d0938f9ede556edffc0aab8def9ec70c46a65791905291a2f5792af18625406102c80"
2398 # }
2399 # ],
2400 # "cursor": "eyJpbmRleCI6MzA4NDkxNX0="
2401 # }
2402 #
2403 rows = self.safe_list(response, 'transfers', [])
2404 cursor = self.safe_string(response, 'cursor')

Callers

nothing calls this directly

Calls 14

handle_account_indexMethod · 0.95
handle_api_key_indexMethod · 0.95
load_accountMethod · 0.95
safe_listMethod · 0.80
safe_stringMethod · 0.80
safe_dictMethod · 0.80
parse_transfersMethod · 0.80
load_marketsMethod · 0.45

Tested by

no test coverage detected