Open Serpent6877 opened 4 years ago
Requires a API key now and JSON format is now strings and ints.
Hello, I have same problem :( Can you provide solution?
Tried with "https://api.coinpaprika.com/v1/tickers/etc-ethereum-classic" but have error:
&{GET https://api.coinpaprika.com/v1/tickers/etc-ethereum-classic HTTP/1.1 1 1 map[Accept:[application/json] Content-Type:[application/json]]
exchange/exchange.go: Line 40:
type ExchangeReply []map[string]interface{}
storage/redis.go: Line 1315:
func (r *RedisClient) StoreExchangeData(ExchangeData []map[string]interface{}) {
tx := r.client.Multi()
defer tx.Close()
log.Printf("ExchangeData: %s", ExchangeData)
for _, coindata := range ExchangeData {
for key, value := range coindata {
cmd := tx.HSet(r.formatKey("exchange", coindata["symbol"]), fmt.Sprintf("%v", key), fmt.Sprintf("%v", value))
err := cmd.Err()
if err != nil {
log.Printf("Error while Storing %s : Key-%s , value-%s , Error : %v", coindata["symbol"], key, value, err)
}
}
}
log.Printf("Writing Exchange Data ")
return
}
Then in your API config:
"exchange": {
"enabled": true,
"url": "https://api.coingecko.com/api/v3/coins/markets?vs_currency=usd&ids=ethereum",
"timeout": "50s",
"refreshInterval": "900s"
},
In your ember templates use:
{{format-currency model.exchangedata.current_price decimals=3}} <i class="fa fa-caret-up"></i> (+{{format-percent model.exchangedata.price_change_percentage_24h}})
Or similar if you don't have the format-currency npm.
Many thanks for sharing that! But unfortunately the data doesn't even appear to me. Is that normalto be that?
2020/09/18 15:46:51 &{GET https://api.coingecko.com/api/v3/coins/markets?vs_currency=usd&ids=ethereum-classic HTTP/1.1 1 1 map[Accept:[application/json] Content-Type:[application/json]]
My ember themplate:
{{format-number stats.model.exchangedata.current_price style='currency' currency='USD'}}
Go into redis. Then do a "hgetall eth:exchange:eth" you should get all the data. Look for:
15) "current_price" 16) "5.18"
25) "symbol" 26) "eth"
And other data you will want to use in your site. Then look at your stats. http://
You should see exchange data:
"exchangedata":{"ath":"1448.18","ath_change_percentage":"-73.67712","ath_date":"2018-01-13T00:00:00.000Z","atl":"0.432979","atl_change_percentage":"87941.91954","atl_date":"2015-10-20T00:00:00.000Z","circulating_supply":"1.126549315615e+08","current_price":"382.65","fully_diluted_valuation":"\u003cnil\u003e","high_24h":"393.8","id":"ethereum","image":"https://assets.coingecko.com/coins/images/279/large/ethereum.png?1595348880","last_updated":"2020-09-18T16:34:56.855Z","low_24h":"379.34","market_cap":"4.3085909665e+10","market_cap_change_24h":"3.61962255e+08","market_cap_change_percentage_24h":"0.84721","market_cap_rank":"2","max_supply":"\u003cnil\u003e","name":"Ethereum","price_change_24h":"2.86","price_change_percentage_24h":"0.75216","roi":"map[currency:btc percentage:4604.829918446882 times:46.048299184468824]","symbol":"eth","total_supply":"\u003cnil\u003e","total_volume":"1.3522348787e+10"
hgetall eth:exchange:eth
When I do http:///api/stats, result:
{"candidatesTotal":0,"exchangedata":{},"hashrate":5054383666,"immatureTotal":8,"maturedTotal":0,"minersTotal":4,"nodes":[{"difficulty":"21845604165879","height":"11229137","lastBeat":"1600448453","name":"main"}],"now":1600448455000,"stats":{"currentRoundShares":12499,"lastBlockFound":1600438538,"lastNValue":11888,"nShares":11888,"roundShares":11888}}
//is there any way to PM you privately, after that will provide solution here
Sure. Find me on Discord. BradD#2334
I sent you a friend request a few days ago. I wrote to you, but you do not answer. eradev#8004
Additionally you need to have lowercase coin-name in your api config file. This name must match the coin in the "symbol" variable as listed above.
Requires a API key now and JSON format is now strings and ints.