Skip to content

historicalpriceservice: New microservice for historical prices of a given stock #15

@ZiyadBouazara

Description

@ZiyadBouazara

HistoricalPriceService Fetches Data from External API

HistoricalPriceService:

  • Calls the external API to fetch the historical prices for the requested stock and timeframe.

  • Processes the data to ensure it aligns with the schema used by StockService.

  • Returns the fetched data to StockService.

StockService Updates Its Cache/Database

  • Upon receiving data from HistoricalPriceService:
  • StockService updates its database with the new data (avoiding duplicates and maintaining consistency).
  • Combines the new data with existing cached data to fulfill the frontend request.

Data Retrieval

  • Initial Data Fetch: Retrieve bulk historical data for various timeframes (1 month, 1 year, 5 years, etc.).
  • Ongoing Updates: Schedule periodic fetches (e.g., daily or hourly) to keep the historical data up-to-date.

To determine

  • What external API are we going to use ? CoinGecko ? Coinbase ? ...

  • What should the communication be between stockservice-go and historicalpriceservice ?

  • idea 1 : historicalpriceservice exposes an API endpoint, and stockservice-go queries it directly. Simple to do, but we need to secure thhis endpoint so that it isnt available to everyone, only to our backend

  • idea 2 : every hour or so, historicalpriceservice refetches the historical prices, and pushes them to stockservice-go directly through a POST endpoint. Again we need to secure this endpoint because it could be dangerous if anyone can call this.

  • for our API communication between backend services, use REST API (HTTP) with Json,
    OR gRPC and Protobuf ? (gRPC + protobuf is optimal and faster)

  • What language to use between : Go and Java

Metadata

Metadata

Assignees

Labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions