(self, params={})
| 1822 | }) |
| 1823 | |
| 1824 | def fetch_currencies_from_cache(self, params={}): |
| 1825 | options = self.safe_dict(self.options, 'fetchCurrencies', {}) |
| 1826 | timestamp = self.safe_integer(options, 'timestamp') |
| 1827 | expires = self.safe_integer(options, 'expires', 1000) |
| 1828 | now = self.milliseconds() |
| 1829 | if (timestamp is None) or ((now - timestamp) > expires): |
| 1830 | promises = [ |
| 1831 | self.v2PublicGetCurrencies(params), |
| 1832 | self.v2PublicGetCurrenciesCrypto(params), |
| 1833 | ] |
| 1834 | promisesResult = promises |
| 1835 | fiatResponse = self.safe_dict(promisesResult, 0, {}) |
| 1836 | # |
| 1837 | # [ |
| 1838 | # "data": { |
| 1839 | # id: 'IMP', |
| 1840 | # name: 'Isle of Man Pound', |
| 1841 | # min_size: '0.01' |
| 1842 | # }, |
| 1843 | # ... |
| 1844 | # ] |
| 1845 | # |
| 1846 | cryptoResponse = self.safe_dict(promisesResult, 1, {}) |
| 1847 | # |
| 1848 | # { |
| 1849 | # asset_id: '9476e3be-b731-47fa-82be-347fabc573d9', |
| 1850 | # code: 'AERO', |
| 1851 | # name: 'Aerodrome Finance', |
| 1852 | # color: '#0433FF', |
| 1853 | # sort_index: '340', |
| 1854 | # exponent: '8', |
| 1855 | # type: 'crypto', |
| 1856 | # address_regex: '^(?:0x)?[0-9a-fA-F]{40}$' |
| 1857 | # } |
| 1858 | # |
| 1859 | fiatData = self.safe_list(fiatResponse, 'data', []) |
| 1860 | cryptoData = self.safe_list(cryptoResponse, 'data', []) |
| 1861 | exchangeRates = self.v2PublicGetExchangeRates(params) |
| 1862 | self.options['fetchCurrencies'] = self.extend(options, { |
| 1863 | 'currencies': self.array_concat(fiatData, cryptoData), |
| 1864 | 'exchangeRates': exchangeRates, |
| 1865 | 'timestamp': now, |
| 1866 | }) |
| 1867 | return self.safe_dict(self.options, 'fetchCurrencies', {}) |
| 1868 | |
| 1869 | def fetch_currencies(self, params={}) -> Currencies: |
| 1870 | """ |
no test coverage detected