Giter Club home page Giter Club logo

Comments (9)

edradev avatar edradev commented on July 24, 2024

Requires a API key now and JSON format is now strings and ints.

Hello, I have same problem :( Can you provide solution?

from ethash-mining-pool.

edradev avatar edradev commented on July 24, 2024

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]] 0 [] false api.coinpaprika.com map[] map[] map[] }
Failed to fetch data from exchange json: cannot unmarshal object into Go value of type exchange.ExchangeReply

from ethash-mining-pool.

Serpent6877 avatar Serpent6877 commented on July 24, 2024

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.

from ethash-mining-pool.

edradev avatar edradev commented on July 24, 2024

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]] 0 [] false api.coingecko.com map[] map[] map[] }
2020/09/18 15:46:51 ExchangeData: [map[ath:%!s(float64=44.34) ath_change_percentage:%!s(float64=-88.50359) ath_date:2018-01-14T00:00:00.000Z atl:%!s(float64=0.615038) atl_change_percentage:%!s(float64=728.88534) atl_date:2016-07-25T00:00:00.000Z circulating_supply:%!s(float64=1.1631979e+08) current_price:%!s(float64=5.11) fully_diluted_valuation: high_24h:%!s(float64=5.24) id:ethereum-classic image:https://assets.coingecko.com/coins/images/453/large/ethereum-classic-logo.png?1547034169 last_updated:2020-09-18T15:45:28.561Z low_24h:%!s(float64=5.09) market_cap:%!s(float64=5.93949208e+08) market_cap_change_24h:%!s(float64=-6.48725462643874e+06) market_cap_change_percentage_24h:%!s(float64=-1.08042) market_cap_rank:%!s(float64=35) max_supply: name:Ethereum Classic price_change_24h:%!s(float64=-0.05283968) price_change_percentage_24h:%!s(float64=-1.02372) roi:map[currency:usd percentage:%!s(float64=1035.2706997984462) times:%!s(float64=10.352706997984463)] symbol:etc total_supply:%!s(float64=2.107e+08) total_volume:%!s(float64=4.33797212e+08)]]
2020/09/18 15:46:51 Writing Exchange Data

from ethash-mining-pool.

edradev avatar edradev commented on July 24, 2024

My ember themplate:

{{format-number stats.model.exchangedata.current_price style='currency' currency='USD'}}

from ethash-mining-pool.

Serpent6877 avatar Serpent6877 commented on July 24, 2024

Go into redis. Then do a "hgetall eth:exchange:eth" you should get all the data. Look for:

  1. "current_price"

  2. "5.18"

  3. "symbol"

  4. "eth"

And other data you will want to use in your site. Then look at your stats. http:///api/stats

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"

from ethash-mining-pool.

edradev avatar edradev commented on July 24, 2024

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

from ethash-mining-pool.

edradev avatar edradev commented on July 24, 2024

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

from ethash-mining-pool.

Serpent6877 avatar Serpent6877 commented on July 24, 2024

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.

from ethash-mining-pool.

Related Issues (14)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.