How olibanjoli/tradesim works
Project type and purpose
• TradeSim is a .NET/C# console-based bot application whose sole purpose is to drive a trade-simulation game via slash-style commands (e.g. “/sim start 1000”) over an external chat platform (Discord, Slack, etc.).
• It encapsulates core simulation logic in a “BotEngine” library and exposes it through an interaction module that listens for and replies to user commands.
File structure
Top-level
• TradeSim.sln – Visual Studio solution
• README.md – project overview and command list
“TradeSim” directory
• Program.cs – application entry point and DI/configuration bootstrap
• Settings.cs – configuration holder (API keys, thresholds, tick value)
• TradeSimInteractionModule.cs – adapter translating chat events into engine calls
• BotEngine/
– Engine.cs, EngineManager.cs – orchestrates simulation lifecycle
– User.cs, Order.cs, Scores.cs, ScoreEntry.cs, OrderType.cs – domain entities and value types
• TradeSim.csproj, .gitignore
Extract additional insights from README
• No external database: all state (orders, scores, 2× flags) lives in memory for the duration of a simulation.
• The bot lifecycle: Start → Tick → Pause/Close → Score reporting → Reset.
a. Main components
1. Chat Platform (Discord/Slack API)
2. Interaction Module (TradeSimInteractionModule)
3. Application Host (Program + Settings)
4. Core Engine (BotEngine library: EngineManager + Engine)
5. Domain Model (User, Order, Scores, ScoreEntry, OrderType)
6. In-Memory Data Store (transient state container)
7. (Optional) Logging/Monitoring
b. Relationships & data flow
– External users send slash commands → Chat Platform API
– API invokes Interaction Module ←→ parses commands & arguments
– Interaction Module calls EngineManager methods (Start, Tick, Pause, etc.)
– EngineManager updates Domain Model in the In-Memory Data Store
– EngineManager returns results/messages → Interaction Module
– Interaction Module issues chat replies back via Chat Platform API
– Settings.cs provides config values at startup to Program and Interaction Module
c. Architectural patterns & design principles
– Layered (Adapter → Application → Domain)
– Separation of concerns: Interaction (I/O) vs. Business logic vs. Configuration
– Hexagonal/Ports & Adapters style: BotEngine is the core, InteractionModule is a driver adapter
– Single Responsibility: EngineManager only orchestrates; Engine holds simulation rules
d. Key technologies/frameworks
– .NET (Core or Framework) console application
– C# 10+
– Any chat-bot library (Discord.Net, Slack SDK) referenced in Interaction Module
– In-process, in-memory state (no external DB)