Skip to main content

A self-hosted trading assistant based on a trained vision-language-model and algorithmic trading concepts.

Project description

Chart to Code

PyPI version Documentation Status Python 3.10+ License: MIT

A self-hosted trading assistant powered by a trained vision-language model (VLM) for trend analysis and algorithmic trading decisions.

About

Chart-to-Code is a vision-language model trained specifically for financial chart analysis and trend trading. The system analyzes live market data, generates technical analysis charts, and provides trading signals through a trained VLM that understands price action, momentum indicators, and market trends.

Key Features

  • Custom-Trained VLM: Fine-tuned vision-language model specialized for financial chart analysis
  • Real-Time Market Analysis: Live data fetching from cryptocurrency exchanges via CCXT
  • Multi-Panel Chart Generation:
    • Price charts with moving averages (EMA13, EMA21, SMMA14)
    • Awesome Oscillator momentum analysis
    • Stochastic RSI indicators
  • Automated Trading Signals: AI-generated buy/sell/hold recommendations
  • Rule-Based Validation: Hybrid approach combining ML predictions with algorithmic rules
  • Interactive Web Interface: Streamlit-based dashboard for real-time analysis
  • Exchange Integration Ready: Framework prepared for future live trading connections

Technical Architecture

The system combines several components:

  • VLM Core: Custom-trained Qwen2.5-VL model for chart interpretation
  • Data Pipeline: Real-time market data via CCXT (Binance, others)
  • Chart Generation: Multi-panel technical analysis visualization
  • Signal Processing: Rule engine for trade signal validation
  • Web Interface: Streamlit app for user interaction

Installation

Basic Installation

git clone https://github.com/Ruby-xantho/chart-to-code.git
cd chart-to-code
pip install -e .

If you have access to a NVIDIA GPU like an A40, you can try this

pip install -e ".[gpu]"

Requirements

  • Python: 3.10+
  • For local hosting the model and running it with VLM inference: NVIDIA GPU with ≥32 GB VRAM (A40, A100, etc.)
  • Memory: ≥4 GB RAM for basic usage, ≥32 GB for model training and self hosting the model

Usage

Run the Trading Assistant

streamlit run app/streamlit_app.py

The web interface allows you to:

  1. Select cryptocurrency pairs for analysis
  2. View real-time technical analysis charts
  3. Get AI-powered trading signals
  4. Monitor multiple assets simultaneously

Supported Markets

Currently supports cryptocurrency markets via CCXT:

  • Bitcoin (BTC/USDT)
  • Ethereum (ETH/USDT)
  • Major altcoins (SOL, ADA, LINK, etc.)

Model Training

The VLM was trained on a custom dataset of:

  • 1000+ labeled chart examples
  • Multiple timeframes (1h, 4h, 1d)
  • Five signal categories: Sell Signal, Possible Buy Entry, Bullish, Bearish, Inconclusive
  • Rule-based ground truth labels for supervised learning

Project Structure

chart-to-code/
├── src/chart_to_code/     # Core package
├── app/                   # Streamlit web application
├── model_training/        # VLM training pipeline
├── exchange_bots/         # Trading bot implementations
├── validate_model/        # Model validation tools
└── tests/                 # Test suite

Future Development

  • Live Trading Integration: Connect to exchange APIs for automated execution
  • Additional Markets: Expand beyond crypto to forex, stocks, commodities
  • Advanced Strategies: Multi-timeframe analysis and complex trading logic
  • Portfolio Management: Risk management and position sizing
  • Backtesting Engine: Historical strategy performance analysis

Contributing

Contributions are welcome! Please read CONTRIBUTING.md for development setup and guidelines.

License

This project is licensed under the MIT License - see the LICENSE file for details.

Disclaimer

This software is for educational and research purposes. Trading involves significant risk of loss. Always do your own research and never invest more than you can afford to lose.


This package was created with Cookiecutter and the audreyfeldroy/cookiecutter-pypackage project template.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

chart_to_code-0.1.0.tar.gz (10.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

chart_to_code-0.1.0-py3-none-any.whl (13.9 kB view details)

Uploaded Python 3

File details

Details for the file chart_to_code-0.1.0.tar.gz.

File metadata

  • Download URL: chart_to_code-0.1.0.tar.gz
  • Upload date:
  • Size: 10.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.0

File hashes

Hashes for chart_to_code-0.1.0.tar.gz
Algorithm Hash digest
SHA256 c7d8e07cb29b5a3d3345e4d03c98372f73c505775aaed0c136f73c66581f973f
MD5 7475a7e647bd9404534f3a77a32066b0
BLAKE2b-256 8d5a07905d9e5bdbc8049f87dde5ebb4c6622a50ef1e66314cde33d8dd122db7

See more details on using hashes here.

File details

Details for the file chart_to_code-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: chart_to_code-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 13.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.0

File hashes

Hashes for chart_to_code-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 152ee5e1bdf0c4597bb400e4002e32e826b059174cc2e07ffa6c01669794e04d
MD5 390dad13e95eddac75d9fe2b90d79680
BLAKE2b-256 363dd2ab8a4f4eff9482094cbd4040b5b31ff3fd82924ba58306e7736c2d62fb

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page