Skip to content

Abhilovescars/numatix-quantdev-assignment

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Numatix Quant Developer Assignment Overview

This project implements a deterministic, rule-based multi-timeframe trading system in Python with strict parity between backtesting and live trading.

A single strategy implementation is reused across environments, ensuring identical decision logic with different execution layers.

Strategy Summary

Multi-Timeframe Moving Average Pullback Strategy

Timeframes

15-minute candles → entries and exits

1-hour candles → trend confirmation

Indicators

Simple Moving Average (SMA) on 15m

Simple Moving Average (SMA) on 1h

Entry (BUY)

A BUY signal is generated when:

1h price is above the 1h SMA

1h SMA slope is positive

15m price is above the 15m SMA

Price is within a small distance of the 15m SMA (pullback)

No open position exists

Exit (SELL)

A SELL signal is generated when:

15m price closes below the 15m SMA

Signals

The strategy outputs exactly one of:

BUY / SELL / HOLD

No execution logic exists inside the strategy.

Architecture

All trading logic is implemented in a single strategy class:

strategy/ma_pullback_strategy.py

This class is reused without modification by:

the backtesting system

the live trading system

Execution logic is handled separately.

Backtesting

Implemented using backtesting.py

Operates on historical 15-minute data

Internally constructs 1-hour candles via resampling

Executes trades based on strategy signals

Logs completed trades to:

logs/backtest_trades.csv

Live Trading

Implemented using Binance Testnet REST API

Fetches real-time 15m and 1h candles

Invokes the same strategy class as the backtest

Places market orders on Binance Testnet when signals occur

Handles transient network failures via retry logic

Logs executed trades to:

logs/live_trades.csv

During the live execution window, no BUY or SELL signals were generated. This is expected behavior given the strategy’s trend and pullback constraints.

Backtest vs Live Parity Component Backtest Live Strategy logic Same class Same class Market data Historical Real-time Execution Simulated Binance Testnet Decision timing Candle close Candle close Trade logging CSV CSV

The only difference between systems is the execution layer.

Setup & Execution Requirements pandas yfinance backtesting python-binance python-dotenv

Environment Variables

Binance Testnet credentials must be set via .env:

BINANCE_TESTNET_API_KEY BINANCE_TESTNET_API_SECRET

Run Commands (from project root)

Backtest

python -m backtest.run_backtest

Live Trading

python -m live.run_live

Summary

This project demonstrates:

Deterministic multi-timeframe strategy design

Strict reuse of strategy logic across environments

Correct backtesting and live execution pipelines

Robust logging and execution handling

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages