0% found this document useful (0 votes)
4 views3 pages

Trado Hackathon

The TRADO x IIT Ropar Hackathon challenges participants to create a real-time data processing and backtesting engine for a Bank Nifty options strategy. Participants will build a market data publisher using Node.js and TimescaleDB, and a backtesting engine that simulates trades based on specific entry and exit conditions. Deliverables include a working codebase, documentation of challenges faced, and sample outputs demonstrating the strategy results.

Uploaded by

Jagrat Phugat
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
4 views3 pages

Trado Hackathon

The TRADO x IIT Ropar Hackathon challenges participants to create a real-time data processing and backtesting engine for a Bank Nifty options strategy. Participants will build a market data publisher using Node.js and TimescaleDB, and a backtesting engine that simulates trades based on specific entry and exit conditions. Deliverables include a working codebase, documentation of challenges faced, and sample outputs demonstrating the strategy results.

Uploaded by

Jagrat Phugat
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 3

TRADO x IIT Ropar Hackathon

Backtest an Options Strategy on Bank Nifty


2-Part Hackathon Challenge
Hosted by Trado

Overview
Welcome to the TRADO x IIT Ropar Hackathon!
Your task is to build a real-time data processing engine and a backtesting engine to test a simple intraday Bank Nifty options
strategy using both live and recent historical data.
You’ll receive boilerplate code for both parts to get started quickly — focus on applying your logic, improving performance, and
managing real-world trading constraints.

Part 1: Real-Time Market Data Publisher


Build a service that connects to an MQTT broker, subscribes to index and options data, and stores it in a TimescaleDB
(PostgreSQL).

Objectives
Connect to EMQX MQTT broker
Subscribe to key indices: BANKNIFTY , NIFTY , FINNIFTY , MIDCPNIFTY
Calculate ATM strikes and subscribe to CE/PE options at ATM ± 5 strikes
Fetch token numbers via Trado API
Store all market data in PostgreSQL using TimescaleDB

Setup
Node.js 16+
PostgreSQL with TimescaleDB extension
Run:

1 createdb market_data
2 psql -d market_data -f scripts/db-schema.sql
3 npm install
4 npm start

Detailed setup & structure: README.md in Part 1 boilerplate

Part 2: Backtesting Engine


Use the data stored from Part 1 to build a backtesting engine that simulates trading based on a pre-defined strategy.

Strategy Rules
Entry at 9:25 AM:
Buy 1 lot ATM CE + 1 lot ATM PE
Exit Conditions:
Individual SL: Exit if a position loses 25%
Total P&L Target: Exit both if combined return is +25%
Total P&L SL: Exit both if combined return is -10%
Square-off all positions at 3:15 PM
Adjustment Logic:
If both exited before 2:00 PM, re-enter fresh ATM CE/PE
Only 1 adjustment allowed
Re-entries held till 3:15 PM without SL/Target

Tasks
Read historical data from TimescaleDB
Simulate trades based on above rules
Track open positions and calculate P&L
Ensure support for multiple indices
Backtest over past 3 trading days

DB Schema (Simplified)

1 topics(topic_id, topic_name, index_name, type, strike)


2 ltp_data(id, topic_id, ltp, received_at)

Setup
Install dependencies and set up .env
Run:

1 npm install
2 cp .env.sample .env
3 npm start

Full reference: README.md in Part 2 boilerplate

Tips for Success


Use async/await & batch inserts for efficiency
Implement robust reconnection to MQTT
Modularize your code and comment well
Focus on clarity of logic.

Deliverables
Submit:
Working codebase for both parts
A markdown on what were the challenges you faced during implementation of both the parts.
Sample output or logs showing strategy results
Let the market teach you. Best of luck!
Built by Traders. Built for Traders.

— Team Trado

You might also like