Skip to content

sanprat/Signalcraft

Repository files navigation

SignalCraft (Pytrader) 🚀

www.zenalys.com

SignalCraft Banner

SignalCraft is a sophisticated algorithmic strategy building and backtesting platform. Built with a focus on speed, reliability, and precision, it empowers users to design, test, and refine strategies using real-time and historical market data.


✨ Features

  • ⚡ Real-time Market Data: Direct integration with Dhan WebSocket for sub-second quote updates.
  • 📊 Advanced Charting: Integrated TradingView Lightweight Charts for high-performance visualization.
  • 🤖 Strategy Engine: Multi-threaded backend for defining, evaluating, and backtesting algorithmic strategies.
  • 🛡️ Risk Management: Configurable risk parameters, position sizing, and drawdown controls for strategy evaluation.
  • 📈 Global Screeners: 12+ pre-configured screeners, including Minervini Trend Template and custom RSI indicators.
  • 🗄️ Historical Data: Optimized Parquet-based storage for lightning-fast backtesting on years of stock data.
  • 📱 Responsive Dashboard: Premium React-based UI for a seamless experience across desktop and mobile.

🛠️ Tech Stack


🚀 Getting Started

Prerequisites

  • Docker and Docker Compose
  • Dhan API Credentials (Client ID, Access Token)

Local Development

  1. Clone the repository:

    git clone https://github.com/sanprat/Signalcraft.git
    cd Signalcraft
  2. Set up Environment Variables: Create a .env file in the root directory (refer to .env.local.example in frontend/backend):

    DHAN_CLIENT_ID=your_id
    DHAN_ACCESS_TOKEN=your_token
  3. Run with Docker:

    docker-compose up --build
  4. Access the Application:

    • Frontend: http://localhost:3000
    • Backend API: http://localhost:8000/docs

🔑 Required Environment Variables

Set these in your root .env file. See .env.db.example for database-specific variables.

Variable Required Description
JWT_SECRET_KEY Yes Secret key for signing JWT tokens. Must be set in production. Use a long random string (openssl rand -hex 32). The app will refuse to start without it.
DB_TYPE No Database engine: postgres (default) or sqlite.
SQLITE_DB_PATH No Path to SQLite file (default: data/users.db). Only used when DB_TYPE=sqlite.
DB_HOST No PostgreSQL host (default: localhost).
DB_PORT No PostgreSQL port (default: 5432).
DB_USER No PostgreSQL user (default: signalcraft).
DB_PASSWORD No PostgreSQL password. Required when using DB_TYPE=postgres.
DB_NAME No PostgreSQL database name (default: signalcraft).
BACKEND_CORS_ORIGINS No Comma-separated allowed origins (default: http://localhost:3000,http://127.0.0.1:3000).
COOKIE_SECURE No Set to true to require HTTPS for cookies (default: false).
NTFY_URL No ntfy server URL for push notifications (e.g. https://ntfy.sh).
NTFY_TOPIC No ntfy topic to publish notifications to.
NTFY_USERNAME No ntfy authentication username (optional, for private topics).
NTFY_PASSWORD No ntfy authentication password.
NTFY_ALLOWED_HOSTS No Comma-separated allowed ntfy hostnames for SSRF protection (default: ntfy.sh). Add your self-hosted ntfy host if using one.
DHAN_CLIENT_ID Yes Dhan broker client ID.
DHAN_ACCESS_TOKEN Yes Dhan broker access token.

📂 Project Structure

├── backend/            # FastAPI application logic
│   ├── app/            # Core modules, routers, and models
│   └── strategies/     # Stored algorithmic strategies
├── frontend/           # Next.js application
│   ├── app/            # Pages and layouts
│   └── components/     # UI components
├── data-scripts/       # Utilities for data download and management
└── docker-compose.yml  # Orchestration for the full stack

🔒 Security

  • Never commit .env files to version control. They are already in .gitignore, but double-check before pushing.
  • Production deployments must set JWT_SECRET_KEY to a strong, unique value. The application will refuse to start without it.
  • Configure NTFY_ALLOWED_HOSTS explicitly if you use a self-hosted ntfy instance. The default only allows ntfy.sh.
  • Set COOKIE_SECURE=true in production when serving over HTTPS.
  • Report vulnerabilities responsibly — see SECURITY.md.

📝 License

This project is licensed under the MIT License.

See LICENSE for full details.


🤝 Contributing

Contributions are welcome! Please feel free to submit a Pull Request.


Built with ❤️ by sanprat

About

SignalCraft is a comprehensive algorithmic platform that empowers users to discover opportunities, build custom strategies, and validate them through rigorous backtesting. Built with modern technologies (FastAPI, Next.js, PostgreSQL, Redis) and designed for the Indian stock market, SignalCraft bridges the gap between idea and insight.

Resources

License

Security policy

Stars

1 star

Watchers

0 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors