Algorithmic Trading Bot & Quantitative Backtesting Engine
TRASIS combines quantitative technical indicators (Simple & Weighted Moving Average crossovers) with financial news sentiment analysis to generate automated buy/sell signals and maximize risk-adjusted portfolio returns.
Algorithmic trading enables emotion-free, rules-driven trade execution by capitalizing on market trends and momentum shifts. TRASIS is designed to evaluate and execute systematic trading strategies across equity and cryptocurrency markets:
-
Dual Trend Indicators: Compares fast moving averages (
$MA_{\text{short}}$ ) and slow moving averages ($MA_{\text{long}}$ ) to identify bullish Golden Cross and bearish Death Cross inflection points. - Weighted Moving Averages (WMA): Assigns linearly decreasing weights to older data points, reducing lag and providing faster reaction times to sudden volatility spikes.
-
Sentiment-Augmented Signals: Integrates NLP sentiment scoring from financial news and community sentiment data (
BTC-sentiment.csv) to filter out false breakouts during high-noise macroeconomic events. - Autonomous Execution Agent: Simulates real-world trade execution with capital constraints, position sizing limits, and portfolio profit-and-loss (P&L) tracking.
flowchart LR
A["Market Data\n(OHLCV Price Feeds)"] --> B["Technical Signal Engine"]
S["Financial News Feeds"] --> S1["Sentiment Analyzer\n(Polarity & Volume)"]
subgraph Signal_Generation ["Technical Indicators"]
B --> C1["SMA Crossover\n(Fast vs Slow)"]
B --> C2["Weighted Moving Average (WMA)"]
B --> C3["Dynamic Window Tuning"]
end
C1 & C2 & S1 --> D["Signal Aggregator & Filter\n(Buy / Hold / Sell)"]
D --> E["Trade Execution Agent\n(Capital Allocation & P&L)"]
E --> F["Performance Metrics\n(Total Gains, ROI, Max Drawdown)"]
├── Implementation/
│ ├── agent/
│ │ ├── 2.moving-average-agent.ipynb # Baseline Moving Average agent
│ │ ├── 2a.moving-average-crossover agent .ipynb # SMA Fast/Slow Crossover strategy
│ │ ├── 2b.moving-average-weigthed agent.ipynb # Weighted Moving Average (WMA) agent
│ │ ├── 2c. weigthed moving-average-agent crossover.ipynb# WMA Crossover strategy
│ │ └── 2d.SMA with varying long window(paper code).ipynb# Sensitivity analysis across windows
│ └── dataset/ # Historical equities (GOOG, TSLA, INFY, AMD) & sentiment feeds
├── .github/
│ └── PULL_REQUEST_TEMPLATE.md
├── .gitignore
├── LICENSE
├── README.md
└── requirements.txt
- Python 3.8+
- Jupyter Notebook / Lab
git clone https://github.com/Pranav-Nexus/TRASIS.git
cd TRASIS
pip install -r requirements.txtLaunch Jupyter Notebook and open any strategy agent under Implementation/agent/:
jupyter notebook "Implementation/agent/2a.moving-average-crossover agent .ipynb"The agent will load historical OHLCV data, compute moving average vectors, plot trade entry/exit markers, and output total realized investment gains.
# Moving Average Crossover Signal Generation
signals['short_mavg'] = df['Close'].rolling(window=short_window, min_periods=1).mean()
signals['long_mavg'] = df['Close'].rolling(window=long_window, min_periods=1).mean()
# Position trigger: 1 for Buy (Golden Cross), -1 for Sell (Death Cross)
signals['signal'][short_window:] = np.where(
signals['short_mavg'][short_window:] > signals['long_mavg'][short_window:], 1.0, 0.0
)
signals['positions'] = signals['signal'].diff()Contributions to TRASIS (such as adding RSI, MACD, or Bollinger Bands, or hooking up live paper-trading APIs) are welcome! Please review our PR Template before submitting a pull request.
MIT License © Pranav H