fetch: price API key support, CoinGecko refactor, Mobula support #59

Closed
opened 2024-06-14 01:03:19 +00:00 by AaronFiore · 0 comments
AaronFiore commented 2024-06-14 01:03:19 +00:00 (Migrated from gitea.com)

CoinGecko no longer provides historical data beyond 365 days for free (demo) plan users (with or without API key). This currently breaks container fetch's year=all since CoinGecko is currently the only price source.

For docker-finance users who've already fetched historical data and don't plan on ever adding new assets, they can continue to run fetch on a daily basis without interruption (since every new day will be written locally and parsed out for its respective years). However, this is extremely rigid and unrealistic so the following should be considered:

Mobula provides historical data going back to an asset's genesis for all plans (including the free plan):

And, although API keys are optional, API key support should be implemented in docker-finance.


  • Implement API types and optional API key support
    • Container config fetch.yaml
      version: 1.0.0
      testprofile:
        testuser:
          price:
            mobula:
              key: "XXXXXXXXXXXXXXXXXXXXX"
              asset:
                - "bitcoin/BTC"
                ...
            coingecko:
              key: "XXXXXXXXXXXXXXXXXXXXX"
              asset:
                - "bitcoin/BTC"
                ...
      
    • Bash fetch
      • CLI optional api=<mobula|coingecko>
    • PHP fetch
  • Update CoinGecko PHP error handler message for server 401 ('Pro Plan required or invalid API key')
  • Update default container fetch.yaml.in
    • New price structure
    • Add note regarding option to use contract_address/ticker in place of asset/ticker (if using Mobula)
  • Update README.md
CoinGecko no longer provides historical data beyond 365 days for free (demo) plan users (with or without API key). This currently breaks container `fetch`'s `year=all` since CoinGecko is currently the only price source. For docker-finance users who've already fetched historical data and don't plan on ever adding new assets, they can continue to run `fetch` on a daily basis without interruption (since every new day will be written locally and parsed out for its respective years). However, this is extremely rigid and unrealistic so the following should be considered: [Mobula](https://mobula.io/) provides historical data going back to an asset's genesis for all plans (including the free plan): - https://docs.mobula.io/guides/query-historical-price-of-any-crypto - https://docs.mobula.io/api-reference/endpoint/market-history And, although API keys are optional, API key support should be implemented in docker-finance. --- - [x] Implement API types and optional API key support - [x] Container config `fetch.yaml` ``` version: 1.0.0 testprofile: testuser: price: mobula: key: "XXXXXXXXXXXXXXXXXXXXX" asset: - "bitcoin/BTC" ... coingecko: key: "XXXXXXXXXXXXXXXXXXXXX" asset: - "bitcoin/BTC" ... ``` - [x] Bash `fetch` - [x] CLI optional `api=<mobula|coingecko>` - [x] PHP `fetch` - [x] Remove `codenix-sv/coingecko-api` PHP API (appears abandoned) - [x] Implement simple replacement - [x] If API key unavailable, use public API https://docs.coingecko.com/v3.0.1/reference/authentication (since public free w/out key appears to have same limitations as public free w/ key) - [x] If API key available, use Pro API https://docs.coingecko.com/reference/introduction - [x] Remove from Dockerfiles - [x] `finance` image - [x] `dev-tools` image - [x] Support for Mobula - [x] Update CoinGecko PHP error handler message for server 401 ('Pro Plan required or invalid API key') - [x] Update default container `fetch.yaml.in` - [x] New `price` structure - [x] Add note regarding option to use `contract_address/ticker` in place of `asset/ticker` (if using Mobula) - [x] Update README.md
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Reference: EvergreenCrypto/docker-finance#59