How brianmwangi21/anti-charts works
Project Type and Purpose
• This project is a crypto market analysis and automated trading tool. It interacts with the Binance API to retrieve information on different crypto pairs, performs technical analysis (indicators and strategies), and optionally executes trades on Alpaca.
Analyzing the File Structure
• Top-level files and directories:
• .env.example, Dockerfile, Makefile, and go.mod indicate standard Go project settings with environment configurations and build automation.
• main.go sits at the root, suggesting it is the entry point.
• The pkg directory contains subdirectories like analysis and cli, which encapsulate the core functionalities:
○ pkg/analysis: Contains multiple Go files related to analysis (analyze.go, common.go, indicators.go, strategies.go, trades.go). These files are likely responsible for fetching data, processing it, and determining trade strategies.
○ pkg/cli: Contains files related to the command line interface (init.go), indicating that the program may have CLI interactions (e.g., configuration, triggering analysis/trading).
Key Components
a. Main Application Entry (main.go)
b. Environment/Configuration Management:
• .env file with API keys and trade settings
c. Analysis Component:
• pkg/analysis: Break down into submodules such as indicators, strategies, and trade decision logic.
d. CLI Component:
• pkg/cli: Handles command-line initialization and interactions.
e. External Services:
• Binance (for crypto pair info and market data)
• Alpaca (for executing trades, based on project settings)
f. Build and Deployment Tools:
• Dockerfile for containerization and Makefile for building and running the project.
Architectural Relationships and Interactions
• The Main Application (main.go) wires together all modules:
• It initializes configuration from .env.
• It starts the CLI interface (initialized through pkg/cli) if applicable.
• It dispatches tasks to the analysis engine found in pkg/analysis.
• The Analysis Engine interacts with external APIs:
• It makes network calls to Binance for price/market data.
• Based on analysis outcomes, it can invoke trading actions via Alpaca.
• The Modular structure (using pkg) signals a separation of concerns, where the CLI is decoupled from the analysis logic, but the business logic in analysis can be tested or extended independently.
Emphasizing Architectural Patterns
• That the design follows a modular structure, separating concerns between CLI front-end interactions and analysis business logic.
• Design principles like separation of concerns and abstraction in handling API integrations.
• If further extensions are foreseen, mention the possibility of using additional microservices architecture – although the current design is monolithic, its modular structure (inside pkg) lends itself to separation if needed.