Skip to content

Latest commit

 

History

344 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

AM Market

This repository contains the market data management ecosystem for the Asset Management (AM) platform. It orchestrates services responsible for fetching, processing, and parsing financial market data. The Flutter Market Data UI lives in am-modern-ui.

🏗️ Architecture Overview

The repository is structured into backend services:

Service Directory Description Port
Market Data Service am-market-data Core Backend. Spring Boot service that fetches live/historical data from external APIs (Upstox, Zerodha), processes it, and publishes to Kafka. 8092
Market Parser Service am-parser Data Processing. Python (FastAPI) service for parsing complex financial documents (e.g., mutual fund statements) and storing structured data in MongoDB. 9000
Market Analysis market-data-analysis-py Python (FastAPI) analysis API. 8010
News am-news Insight news feed for the product UI. Traefik /news

🚀 Getting Started

Prerequisites

  • Docker & Docker Compose
  • Access to am-infra (Global Infrastructure must be running: MongoDB, Postgres, Redis, Kafka)
  • am-scripts repository: The scripts in this repo rely on am-scripts being available in the parent directory (../am-scripts).
  • Base Images: Some services build on top of base images. You must build these locally first to avoid image not found errors during builds or deployments:
    docker compose -f docker-compose.base.yml build
    # This prepares: am-java-maven-base, am-python-base, am-flutter-base

Installation & Deployment

  1. Clone the repository:

    git clone <repository-url>
    cd am-market
  2. Configure Environment: The root .env file contains all critical configuration (Database connections, API keys, JWT secrets).

    • Ensure host.docker.internal is accessible for connecting to global infra.
  3. Deploy Services: Run the global Docker Compose to start all services:

    docker-compose --env-file .env up -d --build
  4. Access Applications:


🛠️ Local Development

For faster iteration during development, you can run services locally using Poetry scripts defined in pyproject.toml.

Important

Prerequisite: Run poetry install in the container/environment before running these scripts.


📦 Build & Run Commands

Available via poetry run <command>.

1. poetry run build (Build Market Data)

  • Usage: poetry run build [module_aliases...]
  • Default (No arguments): Builds all submodules in am-market-data (clean install).
  • Arguments:
    • [module_aliases]: Shorthand names like api, common, provider, scraper.
    • data: Builds am-common-investment-data (outside standard build).
  • Work Done: Identifies requested modules, verifies paths, and executes mvn clean install for the specific components.
  • Example: poetry run build api common

2. poetry run market (Run Market Data Backend)

  • Usage: poetry run market [port]
  • Default (No arguments): Runs on port 8092 using mvn spring-boot:run.
  • Arguments:
    • [port]: Custom port number (e.g., 8093).
  • Flags:
    • --run or --run-only: Skip Build and run the pre-built .jar instantly (java -jar). Faster startup, requires a previous build.
  • Work Done: Loads environment variables from .env and boots the Java Spring Boot service.

3. poetry run parser (Run Parser Service)

  • Usage: poetry run parser
  • Default: Runs on port 8022.
  • Work Done: Starts the Python FastAPI application for parsing operations.

4. poetry run analysis (Run Analysis Service)

  • Usage: poetry run analysis
  • Default: Runs on port 8010.
  • Work Done: Starts the Python FastAPI application for market analysis.

5. poetry run all (Run All Services)

  • Usage: poetry run all
  • Work Done: Spins up the Parser API, Analysis API, and Market Data backend concurrently in a single terminal session.

🚀 Deployment Commands

poetry run deploy-all (Build & Deploy Local Stack)

  • Usage: poetry run deploy-all [options]
  • Work Done: Coordinates orchestration of local deployments. Builds service containers and manages loading/installing into local cluster contexts (e.g., KIND) or Docker execution triggers.
  • If No Options Passed: Builds and deployes all active configured services into standard cluster layers.
  • Key Flags:
    • --skip-build / -k: Skip Docker builds (assumes image availability).
    • --build-only / -b: Only trigger container builds without starting deployment cycles.
    • --deploy-only / -d: Directly deploy using current artifacts, skipping build updates.
    • --services / -s: Target specific names (e.g., --services "am-market-data").
    • --namespace-prefix / -p: Customize prefix layers (Default: am).
    • --run-docker: Standard local container startup triggers instead of cluster templates.

📂 Repository Structure

am-market/
├── .env                       # Global environment configuration
├── docker-compose.yml         # Orchestrates backend services
├── am-market-data/            # Java/Spring Boot backend
├── am-parser/                 # Python/FastAPI parser
├── market-data-analysis-py/   # Python analysis API
└── am-news/                   # Insight news feed

🔌 Integration with AM-Infra

This repository relies on the global am-infra stack. It connects to:

  • MongoDB: Stores historical market data and parsed documents.
  • PostgreSQL: Manages user portfolios and relational data.
  • Redis: Caches live stock prices and tokens.
  • Kafka: Streams real-time updates (am-stock-price-update) to other microservices.
  • InfluxDB: Time-series storage for high-frequency market data.

About

No description, website, or topics provided.

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages