How jebin1999/triangular-arbitrage-histotical-opportunities- works
Project Type and Purpose
• This is a standalone Python-based analytics tool (not a full-stack web app) whose sole purpose is to detect triangular arbitrage opportunities in the Forex market by:
• Fetching historical FX data from Yahoo Finance
• Calculating cross-rates and discrepancies
• Reporting opportunities in the terminal and optionally exporting to CSV
High-Level Architectural Components
a. External Data Source
• Yahoo Finance API (via the yfinance library)
b. Data Ingestion / Fetcher Module
• fetch_historical_data() pulls price histories for each currency pair
c. Data Alignment & Joining
• A transform step that merges the three time series into a single DataFrame indexed by date
d. Analysis / Arbitrage Engine
• calculate_triangular_arbitrage() applies the cross-rate formula
• Iterates through merged data in list_past_arbitrage_opportunities()
e. In-Memory Storage
• Pandas DataFrame (stored_opportunities_df) holding detected opportunities
f. Output / Export Module
• Terminal printout of results
• Optional export to arbitrage_opportunities.csv
g. (Future) Notification Service
• SMS/WhatsApp/Telegram hooks for real-time alerts
Architectural Patterns & Design Principles
• Pipeline / ETL-style flow: ingest → transform → analyze → output
• Single responsibility per module (fetch, transform, analyze, export)
• In-memory data handling with pandas for simplicity and performance
• Modular code organization enables easy extension (e.g., adding real-time fetching or alerts)
Technologies & Frameworks
• Python 3.x
• pandas (data manipulation and in-memory store)
• yfinance (external API wrapper)
• CSV file writing (built-in I/O)
• (Optional) notification libraries for SMS/WhatsApp/Telegram