blockbook/fiat/mock_data/22-11-2019.json

1 line
5.1 KiB
JSON
Raw Permalink Normal View History

Add fiat rates functionality (#316) * Add initial commit for fiat rates functionality * templates.go: use bash from current user's environment * bitcoinrpc.go: add FiatRates and FiatRatesParams to config * blockbook.go: add initFiatRatesDownloader kickoff * bitcoin.json: add coingecko API URL * rockdb.go: add FindTicker and StoreTicker functions * rocksdb_test.go: add a simple test for storing and getting FiatRate tickers * rocksdb: add FindLastTicker and convertDate, make FindTicker return strings * rocksdb: add ConvertDate function and CoinGeckoTicker struct, update tests * blockbook.go, fiat: finalize the CoinGecko downloader * coingecko.go: do not stop syncing when encountered an error * rocksdb_test: fix the exported function name * worker.go: make getBlockInfoFromBlockID a public function * public.go: apiTickers kickoff * rocksdb_test: fix the unittest comment * coingecko.go: update comments * blockbook.go, fiat: reword CoinGecko -> FiatRates, fix binary search upper bound, remove assignment of goroutine call result * rename coingecko -> fiat_rates * fiat_rates: export only the necessary methods * blockbook.go: update log message * bitcoinrpc.go: remove fiatRates settings * use CurrencyRatesTicker structure everywhere, fix time format string, update tests, use UTC time * add /api/v2/tickers tests, store rates as strings (json.Number) * fiat_rates: add more tests, metrics and tickers-list endpoint, make the "currency" parameter mandatory * public, worker: move FiatRates API logic to worker.go * fiat_rates: add a future date test, fix comments, add more checks, store time as a pointer * rocksdb_test: remove unneeded code * fiat_rates: add a "ping" call to check server availability * fiat_rates: do not return empty ticker, return nil instead if not found add a test for non-existent ticker * rocksdb_test: remove Sleep from tests * worker.go: do not propagate all API errors to the client * move InitTestFiatRates from rocksdb.go to public_test.go * public.go: fix FiatRatesFindLastTicker result check * fiat_rates: mock API server responses * remove commented-out code * fiat_rates: add comment explaining what periodSeconds attribute is used for * websocket.go: implement fiatRates websocket endpoints & add tests * fiatRates: add getFiatRatesTickersList websocket endpoint & test * fiatRates: make websocket getFiatRatesByDate accept an array of dates, add more tests * fiatRates: remove getFiatRatesForBlockID from websocket endpoints * fiatRates: remove "if test", use custom startTime instead Update tests and mock data * fiatRates: finalize websocket functionality add "date" parameter to TickerList return data timestamps where needed fix sync bugs (nil timestamp, duplicate save) * fiatRates: add FiatRates configs for different coins * worker.go: make GetBlockInfoFromBlockID private again * fiatRates: wait & retry on errors, remove Ping function * websocket.go: remove incorrect comment * fiatRates: move coingecko-related code to a separate file, use interface * fiatRates: if the new rates are the same as previous, try five more times, and only then store them * coingecko: fix getting actual rates, add a timestamp parameter to get uncached responses * vertcoin_testnet.json: remove fiat rates parameters * fiat_rates: add timestamp to log message about skipping the repeating rates
2019-12-17 02:40:02 -07:00
{"id":"bitcoin","symbol":"btc","name":"Bitcoin","localization":{"en":"Bitcoin","de":"Bitcoin","es":"Bitcoin","fr":"Bitcoin","it":"Bitcoin","pl":"Bitcoin","ro":"Bitcoin","hu":"Bitcoin","nl":"Bitcoin","pt":"Bitcoin","sv":"Bitcoin","vi":"Bitcoin","tr":"Bitcoin","ru":"биткоина","ja":"ビットコイン","zh":"比特币","zh-tw":"比特幣","ko":"비트코인","ar":"بيتكوين","th":"บิตคอยน์","id":"Bitcoin"},"image":{"thumb":"https://assets.coingecko.com/coins/images/1/thumb/bitcoin.png?1547033579","small":"https://assets.coingecko.com/coins/images/1/small/bitcoin.png?1547033579"},"market_data":{"current_price":{"aed":28035.679772629657,"ars":455975.92278356064,"aud":11242.023660019182,"bch":33.7483287902988,"bdt":647296.9519021783,"bhd":2877.7787238679057,"bmd":7632.494765498649,"bnb":454.38160859138037,"brl":32004.577050688924,"btc":1.0,"cad":10134.64789197728,"chf":7577.578965660877,"clp":6088438.929707239,"cny":53650.33220564306,"czk":176064.87038406474,"dkk":51541.93185162167,"eos":2702.457481762241,"eth":47.35816140456382,"eur":6897.386297149177,"gbp":5908.00889818188,"hkd":59688.78043936735,"huf":2307617.389787238,"idr":107442628.81392431,"ils":26414.69053433299,"inr":547635.3233044049,"jpy":828835.8421129878,"krw":8981385.56540522,"kwd":2317.3933256902314,"lkr":1371578.7340592865,"ltc":150.51551045178746,"mmk":11576409.193776581,"mxn":147997.88975040163,"myr":31823.686924746547,"nok":69791.7992730364,"nzd":11915.530263116301,"php":388189.40886026394,"pkr":1185305.8751410455,"pln":29644.4875492805,"rub":486228.079036091,"sar":28621.16844609101,"sek":73412.31132752451,"sgd":10402.327115898055,"thb":230471.15540126187,"try":43490.718423287806,"twd":232501.04791412465,"uah":184490.35082571974,"usd":7632.494765498649,"vef":1896580628.6955354,"vnd":177318106.98911732,"xag":446.02452345840845,"xau":5.21078050135358,"xdr":5544.7555748075,"xlm":125542.05293968241,"xrp":31338.87101002938,"zar":112082.42238187103},"market_cap":{"aed":505952466029.5935,"ars":8228063686842.731,"aud":202906746120.7657,"bch":610302833.79301,"bdt":11681596156197.934,"bhd":51934508235.10716,"bmd":137741605692.4732,"bnb":8208811080.573547,"brl":577564326829.1097,"btc":18060475.0,"cad":182927050731.8614,"chf":136752620963.6013,"clp":109834974835741.86,"cny":968213294733.5328,"czk":3177872948714.952,"dkk":930200055102.5531,"eos":48834956976.25193,"eth":855479661.9732217,"eur":124481359054.06459,"gbp":106626741157.78348,"hkd":1077223378894.6129,"huf":41647543632679.81,"idr":1939126324938642.2,"ils":476698903812.6255,"inr":9882973293887.5,"jpy":14957705316159.902,"krw":162084679666504.06,"kwd":41821381803.56006,"lkr":24752517095323.91,"ltc":2718657573.4072695,"mmk":208916381798492.3,"mxn":2670451606202.2573,"myr":574313624934.7668,"nok":1259581556794.9636,"nzd":215062993789.54813,"php":7005804182301.389,"pkr":21390900288155.363,"pln":535015393864.2815,"rub":8774828990639.0205,"sar":516518624602.2619,"sek":1324936091931.084,"sgd":187713296046.46274,"thb":4159796491912.691,"try":784893129459.0262,"twd":4195747188740.0435,"uah":3329448357091.939,"usd":137741605692.4732,"vef":34227086837012150,"vnd":3200663218868120.5,"xag":8055064362.341162,"xau":94058232.86316237,"xdr":100064731062.59404,"xlm":2269248253100.4473,"xrp":566093764804.5127,"zar":2022682035850.9631},"total_volume":{"aed":96938279018.82988,"ars":1576616710817.6833,"aud":38871268152.918,"bch":116690764.74068807,"bdt":2238142718151.254,"bhd":9950424571.517105,"bmd":26390689050.100677,"bnb":1571104089.9267807,"brl":110661437324.88211,"btc":3458209.3682739506,"cad":35042322250.70604,"chf":26200808042.38517,"clp":21051845239481.676,"cny":185505431470.96753,"czk":608775163260.6022,"dkk":178215267527.76758,"eos":9344220633.428228,"eth":163749147.56075427,"eur":23848922615.61833,"gbp":20427976766.120914,"hkd":206384425112.9548,"huf":7978991778122.924,"idr":371501729758266.6,"ils":91333424478.36926,"inr":1893545161079.935,"jpy":2865845264861.2,"krw":31054715525924.953,"kwd":8012793790.76967,"lkr":4742473986606.729,"ltc":520433771.07914567,"mmk":40027464772158.91,"mxn":51172865