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

2 lines
5.1 KiB
JSON
Raw 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":29737.733661544353,"ars":482992.0576847001,"aud":11909.083120440264,"bch":33.38939623106484,"bdt":686435.825992477,"bhd":3052.4408925589955,"bmd":8095.865638011639,"bnb":447.42498131132714,"brl":33973.49056335204,"btc":1.0,"cad":10770.529152304092,"chf":8017.651480082802,"clp":6417583.259568359,"cny":56962.51062904988,"czk":186532.80032847245,"dkk":54611.02597516125,"eos":2625.1996127062725,"eth":46.30756277128346,"eur":7307.587392569718,"gbp":6263.7712441296035,"hkd":63361.07803605232,"huf":2437260.3503234047,"idr":113658578.86366026,"ils":28110.059875022114,"inr":581104.954710677,"jpy":878241.5283779115,"krw":9474186.762883117,"kwd":2457.953382894158,"lkr":1451476.6944985148,"ltc":147.17764652439055,"mmk":12276458.59050864,"mxn":157745.51319696513,"myr":33723.328315137434,"nok":73919.30120786528,"nzd":12630.060434833318,"php":412223.4002195826,"pkr":1261966.2105007921,"pln":31386.456698725444,"rub":516701.6230282524,"sar":30360.961494224146,"sek":78027.18391192055,"sgd":11029.362072616914,"thb":244420.8060296636,"try":46147.243723230094,"twd":246632.45889225203,"uah":195582.93374510246,"usd":8095.865638011639,"vef":2011722564.2894442,"vnd":187451397.8769113,"xag":471.370523519991,"xau":5.491344703606915,"xdr":5886.050536922535,"xlm":126226.86768614998,"xrp":32338.763084294602,"zar":119758.9020368509},"market_cap":{"aed":536925789662.0078,"ars":8721126622799.587,"aud":214993230987.64774,"bch":603145132.8718755,"bdt":12393852945152.863,"bhd":55112950276.81427,"bmd":146173851045.95633,"bnb":8069562575.040651,"brl":613403948529.2512,"btc":18058775.0,"cad":194516467063.8744,"chf":144785199461.0198,"clp":115857415095711.94,"cny":1028479215959.3489,"czk":3368167110571.1367,"dkk":986119641838.593,"eos":47362660343.0749,"eth":834881213.8173289,"eur":131953912642.35466,"gbp":113092515946.4908,"hkd":1143920014822.8933,"huf":44007835435061.79,"idr":2051934847845294.5,"ils":507537536909.2167,"inr":10491950179817.375,"jpy":15862731500313.05,"krw":171059949186530.47,"kwd":44379258220.658554,"lkr":26206949031136.875,"ltc":2660325666.65285,"mmk":221656004387641.53,"mxn":2848592157028.2905,"myr":608887176531.9319,"nok":1334790467520.1284,"nzd":228006504250.86572,"php":7443249821227.297,"pkr":22785267089002.48,"pln":566719821025.2997,"rub":9329253695306.072,"sar":548178398889.3755,"sek":1408776800748.5935,"sgd":199092731818.5716,"thb":4413592261082.244,"try":833269884841.5155,"twd":4453040344437.87,"uah":3531322270240.796,"usd":146173851045.95633,"vef":36322395603696830,"vnd":3384688469578368,"xag":8512844964.182701,"xau":99193575.31978594,"xdr":106274821359.85637,"xlm":2281320453520.52,"xrp":583446527953.1724,"zar":2162554421914.3018},"total_volume":{"aed":86108153638.4696,"ars":1398544851555.271,"aud":34483769701.4642,"bch":96681855.22416703,"bdt":1987633699334.181,"bhd":8838603921.209757,"bmd":23442272034.865948,"bnb":1295557337.0497513,"brl":98373150367.11145,"btc":2896005.038733083,"cad":31186989216.112743,"chf":23215796244.73709,"clp":18582661731791.32,"cny":164939826037.3168,"czk":540121692261.5999,"dkk":158130900913.4299,"eos":7601490219.642489,"eth":134087512.35435177,"eur":21159744891.37511,"gbp":18137285873.37578,"hkd":183467425740.0729,"huf":7057295996096.396,"idr":329108145311632.75,"ils":81395084845.85982,"inr":1682639144253.6147,"jpy":2543023530910.265,"krw":27433318848801.867,"kwd":7117214443.4175005,"lkr":4202875028575.5767,"ltc":426165475.2614542,"mmk":35547536825741.08,"mxn":45676