bro-n-bro / price-feed-api

0 stars 1 forks source link

API refactor #2

Open bro-n-bro-0 opened 1 week ago

bro-n-bro-0 commented 1 week ago

The new API service will consist of three main components:

  1. Token Tracking Service: This service will track new tokens. It should fetch the full list of available tokens from this source, process each token through this endpoint, and store only those tokens that have a coingecko_id field.

  2. Token Price Update Service: This service will update token prices and store them in the database. It will loop through the list of tokens already saved in the database, checking each token’s price. Since we are using the public CoinGecko API, the request rate should not exceed 10-15 requests per minute. Additionally, token price data should be updated no less frequently than every 12 hours.

  3. API Service: This is an API that will return data in the existing structure and format.

Infrastructure Requirements

All services, including the PostgreSQL database, should run independently within their own Docker containers, connected within a single Docker network. They should be deployed using a single docker-compose file for seamless startup.

bro-n-bro-0 commented 1 week ago

@iljagrabar14

regarding point 2 https://docs.coingecko.com/v3.0.1/reference/authentication

bro-n-bro-0 commented 3 days ago

Algo is needed to refactor

  1. get all networks by /v1/chains endpoint
  2. get all assets for each network with coingeco_id /v1/chain/{chain}/assets
  3. cleanup dublicates
bro-n-bro-0 commented 1 day ago

Following the recent improvements, the Skychart API is no longer required. The service should be updated to utilize the chain-registry repository directly. Here's the proposed workflow:

  1. Repository Sync:

    • Clone or update the chain-registry repository to ensure the latest data is available.
  2. No Changes Detected:

    • If there are no changes in the repository, simply verify token prices and store them in the database.
  3. Changes Detected:

    • If changes are identified:
      • Parse all files in the repository.
      • Extract tokens and their corresponding coingecko-id.
      • Remove duplicate entries.
      • Fetch and validate the latest prices for the tokens.
      • Store the updated data in the database.

This approach eliminates reliance on the Skychart API while ensuring up-to-date and accurate token information.

bro-n-bro-0 commented 1 day ago

Also, would be cool to force add BTC, ETH and USDT to the list @iljagrabar14