How thrasher-corp/gocryptotrader works
Main Components
• Frontend/UI Layer:
• Web GUI (found under the “web” directory with Angular code, assets, and nginx configuration).
• CLI tools (gctcli, gctscript, etc., under “cmd/gctcli”, “cmd/gen_cert”, and others).
• API & Communication:
• gRPC service and JSON RPC proxy (see “gctrpc”).
• REST & Websocket interfaces integrated in exchange adapters.
• Core Trading Engine:
• Core engine modules (in “engine”), which include the event manager, order manager, portfolio manager, and communication managers.
• Backtesting module (“backtester”) that allows simulation of trading strategies.
• Exchange Integration Layer:
• A large “exchanges” module which modularizes communication and market data retrieval from multiple cryptocurrency exchanges.
• Unified exchange API (various directories inside “exchanges” for Binance, Bitfinex, etc.).
• Data & Persistence:
• Database support (the “database” directory) featuring drivers (Postgres, SQLite3), migrations, and repository abstractions.
• Configuration & Auxiliary Services:
• Configuration management (the “config” directory) with encrypted config files.
• Communication services (Slack, SMS, Telegram – under “communications”).
• Logging and diagnostics (in “log”, “common”, etc.).
• Utility libraries (in “common”, “currency”, “sqlboiler_example.json”, etc.).
• Scripting & Extensions:
• Scripting support (“gctscript”) for defining and executing custom trading strategies.
• Plugin system for exchange strategies (“backtester/plugins/strategies”).
Relationships and Interactions
• The UI layer (web front end and CLI) acts as clients that send commands/queries.
• These commands are processed by the Core Trading Engine (order management, event manager, portfolio manager) and might route through the gRPC/JSON-RPC API (exposed via “gctrpc”).
• The Engine in turn relies on the Exchange Integration Layer to communicate with external exchanges through REST/websocket interfaces.
• All modules use a unified configuration system, and access the persistence layer (database) to store trade history, orders, and other data.
• Additionally, communications modules are used to send alerts or notifications (via Slack, SMS, Telegram) when key events occur (managed under “communications”).
• The backtesting module similarly leverages the engine’s simulation capabilities upon historical data (in “backtester”) to test trading strategies.
Architectural Patterns/Design Principles
• Modularity: Each major function (exchange integrations, engine components, communication, configuration) is placed in its own directory/module.
• Layer separation: Different layers – UI/CLI, API/Service, Business Logic (Engine), Data Access – are clearly separated.
• Interface-based design: Common interfaces unify interactions between disparate exchange implementations and utility components.
• Plug-in/Extension: The strategy and scripting modules show how third-party code or new trading strategies can be added.
• Configurability: Encrypted config files and versioned configuration support (observed in “config/versions”) enhance maintainability.
Additional Elements to Highlight
• That the project allows for plug-and-play extensions particularly in the exchange interfaces and trading strategies.
• A note regarding build configurations (like enabling Sonic for JSON processing) in a “Configuration Options” section.