TradeSim AI: The Ghost in the Trading Machine
#devchallenge #hf26challenge #hacktoberfest #mlh
This is a submission for the Hacktoberfest Open-Source AI Challenge Week 4: Ghost in the Machine
What I Built
TradeSim AI is an AI-powered paper trading and strategy backtesting platform that lets retail traders and finance students experiment with trading strategies using historical market data, without risking real money.
The idea behind Ghost in the Trading Machine is simple: what happens when an intelligent model becomes part of a system that makes decisions based on data, rules, and probabilities?
TradeSim AI combines traditional technical indicators, such as Simple Moving Averages (SMA) and the Relative Strength Index (RSI), with an open-weight language model that interprets the current market state and recommends a BUY, SELL, or HOLD action.
The trading engine handles the mechanics. The model provides another layer of decision-making. Together, they create a simulation where an AI's decisions can be observed, tested, and evaluated against changing market conditions.
No real money is involved. The goal isn't to build a machine that magically predicts the market, but to explore what happens when an AI becomes part of a financial decision-making system.
Demo
TradeSim AI currently runs locally, making it possible to experiment with simulated trades and observe portfolio performance.
GitHub repository: anupam99jain/paper-trader
The repository is the starting point for running the project and exploring its implementation.
Code
GitHub: anupam99jain/paper-trader
TradeSim AI is built around a modular simulated trading engine with the following features:
- Simulated order execution using virtual capital.
- Technical indicators, including 20-period SMA, 50-period SMA, and 14-period RSI.
- AI-assisted BUY/SELL/HOLD decisions.
- Portfolio value tracking throughout a simulation.
- Transaction fee handling.
- A modular design for experimenting with different indicators, strategies, and models.
The important part is that the AI doesn't execute real trades. Its recommendations are processed by the simulation engine, where their potential impact can be observed without financial risk.
How I Built It
The backend is written in Python, and the AI component uses Qwen 2.5 7B, an open-weight language model running locally through Ollama.
The trading workflow follows these steps:
- Market price data is retrieved for the simulation.
- The engine calculates technical indicators, including the 20-period SMA, 50-period SMA, and 14-period RSI.
- The current market state is assembled into a structured prompt.
- Qwen 2.5 7B receives the market context and returns a BUY, SELL, or HOLD decision.
- The engine processes the recommended action, simulates the trade, accounts for transaction fees, and updates the virtual portfolio.
This separation between the model and the trading engine is intentional. The model interprets the supplied context, while the engine manages portfolio state and simulated execution.
It also makes experimentation easier: different prompts, trading rules, indicators, or open-weight models can be tested without rebuilding the entire application.
The interesting question isn't whether the AI can produce a convincing trading recommendation. It's whether those recommendations hold up when evaluated across a longer simulation.
Why Does Open Innovation Matter?
An AI system shouldn't have to be a black box locked behind a proprietary API.
Using an open-weight model through Ollama gives developers greater control over inference, makes local experimentation possible, and reduces dependence on metered, proprietary AI services. It also makes the model component easier to replace as new open models become available.
For TradeSim AI, that matters because strategy development is inherently iterative. You need to run experiments, compare decisions, adjust your approach, and test again.
Local inference makes that workflow more accessible to students and independent developers. It also offers a way to explore AI-assisted financial tools while keeping the processing environment under your control.
Open innovation makes the underlying components available for inspection and experimentation, rather than requiring developers to treat an AI service as an inaccessible dependency.
That's the kind of machine I wanted to build: one whose behavior can be studied, questioned, and improved.
My Agent Session
The model's decision-making loop is integrated into the trading engine.
Rather than simply generating free-form market commentary, the model is asked to produce a trading action based on the supplied technical context. The engine then evaluates that action within the simulated trading workflow.
The repository contains the project code for exploring this interaction between the model and the trading system.
The Spirit of It
There's something fascinating about watching a machine turn a handful of market indicators into a decision.
A moving average crosses another. The RSI changes. A prompt is assembled, passed to a model running on your own machine, and a recommendation comes back: BUY, SELL, or HOLD.
For a moment, the trading engine feels like more than a collection of rules. There's an additional layer interpreting the signals, and you get to observe what happens when its judgment meets the mechanics of a simulation.
But that's also where the mystery ends and the real work begins.
An AI can sound confident and still make a poor decision. A promising trade can lose money. A strategy that performs well on one stretch of historical data can fail on another.
That's why TradeSim AI focuses on experimentation rather than promises. The point is not to trust the ghost blindly, but to inspect its decisions, measure the outcomes, and understand where it succeeds or fails.
The machine can make the decision. We still have to question it.
Simulated returns do not guarantee future performance in live markets.
Prize Categories
Open-source AI / local inference.
Top comments (0)