Skip to content

cindytrang/TradeMe-AI

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

🔧 TradeMe AI - Trading Intelligence Backend

A Python-based backend service combining financial valuation models with a proprietary AI engine to provide comprehensive investment analysis and AI-powered trading insights via REST API.

Tech Stack: FastAPI + Python + TradeMe AI Engine

🎯 Project Goal

Build an intelligent trading backend that:

  • Runs selective financial models (user chooses which models to apply)
  • Analyzes stocks using different valuation techniques
  • Leverages a AI engine for insights
  • Generates trading signals and recommendations
  • Serves results via FastAPI REST endpoints
  • Evolves iteratively from models → real data → web dashboard → production

Endgame: A production-ready trading intelligence platform that traders and apps can consume

🛠️ Overview

Framework Language Best For
FastAPI Python AI/data backend, high-performance APIs and docs
Next.js JavaScript Frontend + backend together, SSR support
React JavaScript Frontend dashboard, interactive UI

🏗️ Architecture

Backend Structure
├── Market Data (price feeds, news, financials)
│   └── Data Provider
│
├── Financial Models (selective analysis)
│   ├── Valuation Models
│   │   ├── DCF
│   │   ├── Reverse DCF
│   │   └── Comparable Analysis
│   │
│   ├── Accounting Models
│   │   └── 3 Statement Model
│   │
│   ├── Deal Models
│   │   ├── LBO
│   │   └── M&A Accretion/Dilution
│   │
│   └── Risk Models
│       ├── Portfolio Risk
│       └── Monte Carlo Simulation
│
├── Logic Layer
│   ├── Trading strategies
│   ├── Signal generation
│   └── Risk rules
│
└── TradeMe AI Engine
    ├── Analyze model outputs
    ├── Summarize insights
    ├── Explain trade decisions
    └── Generate trading signals

🚀 Quick Start

  1. Clone the repo
   git clone https://github.com/your-username/trademe.git
   cd trademe
  1. Create a virtual environment
   python3 -m venv venv
   source venv/bin/activate
  1. Install dependencies
   pip install -r requirements.txt
  1. Create your .env file
   cp .env.example .env

Then open .env and fill in your keys:

   AI_BASE_URL=
   AI_SERVICE_KEY=
   AI_MODEL=
  1. Run the platform
   python -m uvicorn src.main:app --reload
  1. Open your browser for FastAPI docs
   http://localhost:8000/docs

📊 Financial Models - Data Requirements

1. Discounted Cash Flow (DCF) Model

What it does: Values a company based on present value of future free cash flows

Required Data:

  • Free Cash Flow (FCF) - Historical or projected annual cash flows
  • Terminal Growth Rate - Long-term perpetual growth assumption (typically 2-3%)
  • WACC - Weighted Average Cost of Capital (discount rate)
  • Forecast Period - Number of years to project (typically 5-10 years)

Data Sources: Cash flow statements, income statements, balance sheets, market risk data

Best For: Long-term valuation, intrinsic value analysis, comparing against market price


2. Comparable Company Analysis

What it does: Values a company based on trading multiples of similar peer companies

Required Data:

  • Target Company Revenue - Annual revenue
  • Target Company Net Income - Net profitability
  • Peer Company Data (multiple peers needed):
    • Revenue
    • Net Income
    • Market Capitalization
    • (Optional) EBITDA, Book Value

Data Sources: Financial statements, market capitalization data, peer databases, industry reports

Best For: Relative valuation, market benchmarking, identifying over/undervalued stocks


3. Three Statement Model

What it does: Projects and analyzes income statement, balance sheet, and cash flow statements together

Required Data:

  • Income Statement Components:
    • Revenue
    • Cost of Goods Sold (COGS)
    • Operating Expenses
    • Tax Rate
  • Balance Sheet Components:
    • Total Assets
    • Total Liabilities
  • Optional: Interest expense, depreciation, capex

Data Sources: Income statements, balance sheets, tax filings, SEC reports

Best For: Financial health assessment, profitability analysis, operational metrics evaluation


4. LBO (Leveraged Buyout) Model

What it does: Analyzes leveraged buyout scenarios and projected investment returns

Required Data:

  • EBITDA - Earnings Before Interest, Taxes, Depreciation & Amortization
  • Purchase Price - Total acquisition cost
  • Debt Amount - Financing/leverage amount
  • Equity Investment - Equity check size
  • Growth Rate - Projected annual growth rate
  • Exit Year - Time horizon (typically 5 years)
  • Exit Multiple - EBITDA exit multiple assumption (target exit valuation)

Data Sources: Historical financials, transaction databases, comps for multiples

Best For: Private equity analysis, M&A scenarios, leveraged transaction evaluation


5. M&A Accretion/Dilution Model

What it does: Analyzes impact of mergers/acquisitions on earnings per share

Required Data:

  • Acquirer Earnings - Acquirer's annual net income
  • Target Earnings - Target company's net income
  • Acquisition Price - Total deal consideration
  • Acquirer Shares Outstanding - Current share count
  • Synergies - Projected cost/revenue synergies from deal

Data Sources: Income statements, share count data, deal structure documents

Best For: Merger impact analysis, deal evaluation, accretion/dilution assessment


6. Portfolio Risk Model

What it does: Calculates portfolio risk metrics including Value at Risk (VaR) and Sharpe Ratio

Required Data:

  • Portfolio Value - Total portfolio size
  • Holdings Data (for each position):
    • Weight in portfolio (%)
    • Expected Annual Returns
    • Volatility/Standard Deviation of returns
    • (Optional) Correlations between holdings
  • Confidence Level - Risk confidence interval (e.g., 95% or 99%)
  • Risk-Free Rate - Current risk-free rate (usually Treasury rate)

Data Sources: Historical price data, volatility calculations, portfolio positions, Treasury rates

Best For: Risk management, portfolio optimization, downside protection analysis


7. Monte Carlo Simulation Model

What it does: Simulates asset price paths to estimate probability distributions of future outcomes

Required Data:

  • Initial Value - Starting price or portfolio value
  • Mean Return - Expected annual return
  • Volatility - Standard deviation of returns
  • Time Horizon - Analysis period (e.g., 1 year, 5 years)
  • Number of Simulations - Simulation iterations for accuracy (more = better, 1000-10000 typical)

Data Sources: Historical prices, volatility metrics, return assumptions

Best For: Scenario analysis, probability of profit, confidence intervals, stress testing

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages