-
Notifications
You must be signed in to change notification settings - Fork 2
Description
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
andhistoricalpriceservice
? -
idea 1 :
historicalpriceservice
exposes an API endpoint, andstockservice-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 tostockservice-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
) withJson
,
ORgRPC
andProtobuf
? (gRPC + protobuf is optimal and faster) -
What language to use between :
Go
andJava