Skip to main content

Chart to Code

PyPI version

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 install it this way to self-host the model.

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

Make sure you're in the chart-to-code directory and run:

streamlit run app/trading_assistant.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.

Metadata

Release files for chart-to-code 0.1.5

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for chart-to-code 0.1.5
File Size Uploaded
chart_to_code-0.1.5.tar.gz 10.8 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for chart-to-code 0.1.5
File Interpreter ABI Platform
chart_to_code-0.1.5-py3-none-any.whl Python 3 none any Details

Total release size: 25.4 kB

Release files / chart_to_code-0.1.5.tar.gz

Download URL chart_to_code-0.1.5.tar.gz
Size 10.8 kB
Tags Source
SHA-256 checksum
How to use checksums
050d5c4596354237dad32c584dd9b838cdd9a6b67b796801e1ddac909719b0c8
BLAKE2b-256 checksum
How to use checksums
9d81753d67541d040daabdec60826601cea8c435ce989a50491fc85a4281e7df
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.12.0

Release files / chart_to_code-0.1.5-py3-none-any.whl

Download URL chart_to_code-0.1.5-py3-none-any.whl
Size 14.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
01b481c1a6e5e8c58dc2ab4e53012b63744a26f5376f4d2ac5cfdef9a5674a2d
BLAKE2b-256 checksum
How to use checksums
d7ae937546a717fe4adbd112ebefc4de1a0a6cc64c25f312d14672e4c7011c02
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.12.0

Release history Release notifications | RSS feed

This release

0.1.5 This release

2 release files

0.1.4

2 release files

0.1.3

2 release files

0.1.2

2 release files

0.1.1

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page