Skip to content
Pranav-NexusPublic

About

Algorithmic trading engine combining weighted moving average crossover strategies and financial news sentiment analysis.

Topics

Resources

Stars

0 stars

Watchers

1 watching

Forks

Latest commit

 

History

4 Commits

Folders and files

Repository files navigation

TRASIS 📈

Python Pandas License: MIT PRs Welcome

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.


📌 Overview

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:

  1. 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.
  2. Weighted Moving Averages (WMA): Assigns linearly decreasing weights to older data points, reducing lag and providing faster reaction times to sudden volatility spikes.
  3. 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.
  4. Autonomous Execution Agent: Simulates real-world trade execution with capital constraints, position sizing limits, and portfolio profit-and-loss (P&L) tracking.

🏗️ System Architecture

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)"]
Loading

📂 Repository Structure

├── 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

🚀 Quick Start

1. Requirements

  • Python 3.8+
  • Jupyter Notebook / Lab
git clone https://github.com/Pranav-Nexus/TRASIS.git
cd TRASIS

pip install -r requirements.txt

2. Running Backtests

Launch 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.


📊 Sample Strategy Logic

# 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()

🤝 Contributing

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.


📄 License

MIT License © Pranav H

About

Algorithmic trading engine combining weighted moving average crossover strategies and financial news sentiment analysis.

Topics

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages