chain-bot / prices

API-Scraper + API for crypto prices built in Go
MIT License
2 stars 2 forks source link

Cleanup secrets.go #29

Closed zahin-mohammad closed 3 years ago

zahin-mohammad commented 3 years ago

Currently we store API-Keys like this:

type APIKeys struct {
    BinanceApiKey            string
    CoinbaseProApiKey        string
    CoinbaseProApiSecret     string
    CoinbaseProApiPassphrase string
    KrakenApiKey             string
    KucoinApiKey             string
}

With more exchanges, this will get messy quickly. We should instead make a new struct/exchange.

javiercaamano commented 3 years ago

Hi Zahin, I´m a beguinner in github and I'm look for my first issue intervention, how can I help you?

zahin-mohammad commented 3 years ago

Hi Zahin, I´m a beguinner in github and I'm look for my first issue intervention, how can I help you?

Hey @javiercaamano, glad you are interested in coinprice. Something I am looking for in this issue is creating a new struct for each exchange. Something like:

type APIKeys struct {
    Binance            BinanceSecrets
    CoinbaseProApiKey        string
    CoinbaseProApiSecret     string
    CoinbaseProApiPassphrase string
    KrakenApiKey             string
    KucoinApiKey             string
}
type BinanceSecrets struct {
       BinanceApiKey string
}
...

When you change the secrets file, you'll also have to change where they are being used. You don't have to actually have a valid API key, as most (if not all) of the endpoints used in this project are public endpoints.

P.S. If you do work on this issue, I would love your help with https://github.com/mochahub/coinprice-scraper/issues/26 to document the setup process for this repo.