Inspiration
Trading often feels like a black box where math meets human emotion. We were inspired by the challenge of bridging that gap. Specifically, the idea of quantifying something as abstract as "news sentiment" and fusing it with raw market data (order books) sounded like a complex puzzle we wanted to solve. We didn't just want to guess the price; we wanted to calculate it based on all available information.
What it does
Our bot is a Hybrid High-Frequency Trading System that operates on two simultaneous fronts: Market Making and Arbitrage Sniping. Dual-Listing Market Maker: It provides liquidity for dual-listed stocks (e.g., NVDA and NVDA_DUAL). It calculates a "Global Fair Value" by weighting the liquidity of both exchanges and using Order Book Imbalance (OBI) to predict short-term price movements. It actively manages inventory risk by "skewing" prices—lowering quotes when we hold too much stock to encourage selling, and vice-versa.
Arbitrage Sniper: Before placing passive quotes, the bot checks for crossed markets (where the Bid on one exchange is higher than the Ask on the other). If an opportunity arises, it switches modes to execute immediate IOC (Immediate-Or-Cancel) orders, locking in a risk-free profit. Sentiment-Aware Pricing: It continuously ingests social media feeds, analyzing them with a finetuned Large Language Model (LLM). Positive or negative news instantly applies an offset to our fair value calculations, allowing us to "ride the wave" of news before the rest of the market reacts.
How we built it
We built the system in Python using a multi-threaded architecture to ensure the heavy lifting of AI does not slow down the trade execution.
The Strategy: We implemented a custom DualListingStrategy class that handles the math of fair value calculation, volatility scaling, and inventory skew.
The AI & NLP: We used a DistilRoBERTa transformer model fine-tuned for financial sentiment. To make it fast enough for HFT, we quantized the model to Int8 and exported it to ONNX Runtime. This reduced inference time from ~50ms to sub-10ms.
Thread-Safe State: We used a shared SentimentManager with locking mechanisms to pass data between the News Thread and the Trading Thread safely.
Signal Optimizer: An adaptive learning module that observes how the market actually reacts to our news predictions and adjusts a scalar multiplier in real-time.
Challenges we ran into
Battling Rate Limits: We quickly learned that "High Frequency" doesn't mean "Unlimited Frequency." Our initial implementation tried to burst 20+ orders instantly, causing the exchange to disconnect us immediately. We had to engineer a robust Token Bucket Rate Limiter to smooth out our traffic and prevent the bot from crashing during high-volatility moments.
The Financial Learning Curve: Since we started with almost no trading knowledge, simply understanding the documentation was a challenge. We had to decipher what "crossing the spread," "order book imbalance," and "delta neutral" meant before we could even write the first line of code.
Accomplishments that we're proud of
Optimizing AI for Speed: We did not just paste a standard AI model. We successfully converted a financial sentiment model into ONNX Int8 format, reducing the inference time drastically. This allowed us to keep our "Hybrid" promise: combining smart news analysis with raw speed.
Building a Resilient System: Early versions of our bot would crash and die the moment the internet flickered or the exchange rejected an order. We are proud of the final architecture which includes auto-reconnection logic and safety checks (like SAFE_LIMIT), making the bot robust enough to run unattended.
What we learned
We honestly entered this challenge with almost no background in finance. Concepts like "Order Books," "Bid-Ask Spreads," and "Liquidity" were completely foreign to us. This project was a massive crash course where we had to not only learn the vocabulary of trading but immediately translate those abstract concepts into working, profitable code.
Log in or sign up for Devpost to join the conversation.