SkillAgentSearch skills...

Z Trading

⚡ A c-based multi-venue trading framework for HFT and market making algorithms. Over 300 built-in strategies mainly in C, also in Python and R for quantitative trading with ML support. Build, train and trade algorithms for Forex, Commodities, Indexes, Stocks, Cryptos, Derivatives from one low-latency platform. Happy trading!

Install / Use

npx skills add alexcolls/z-trading

Installs into whichever agent you are using.

About this skill

Quality Score

0/100

Supported Platforms

Universal

README

⚡ Z-Trading

<div align="center">

Z-Trading C Python Zorro License: Apache 2.0

A professional High Frequency Trading (HFT) framework for multi-venue algorithmic trading

</div>

📖 Overview

Z-Trading is a comprehensive algorithmic trading framework designed for High Frequency Trading (HFT) and multi-venue execution. Built on top of the powerful Zorro Trading Platform, it combines the speed and efficiency of compiled C algorithms with the flexibility of Python for data analysis, risk management, and visualization.

The framework provides asynchronous low-latency operations perfect for ultra-fast Market Making (MM) and Market Taking (MT) strategies. With over 361 pre-built algorithms and support for 25+ brokers and exchanges (including traditional markets like Interactive Brokers, OANDA, FXCM, and crypto exchanges like Binance, Bitfinex, Bittrex, Deribit, Kraken), Z-Trading enables traders to develop, backtest, and deploy robust quantitative strategies across multiple asset classes including forex, stocks, indices, commodities, bonds, cryptocurrencies, and derivatives.

🚀 Trading Engine

Powered by the Zorro trading engine featuring:

  • Ultra-low latency (~750ns in HFT mode)
  • 300+ technical indicators and time series analysis functions
  • World's fastest optimizer (25 seconds for 12 parameters)
  • World's fastest tick-level backtester (0.3 seconds for 10 years)
  • Machine learning integration (Torch, Keras, TensorFlow, MxNet)
  • Support for 25+ brokers and exchanges

📚 See complete engine documentation →

🤖 Trading Algorithms

Includes 326 C strategies and 35 Python utilities covering:

  • Trend Following: ALMA, EMA, HMA, Laguerre, and more
  • Mean Reversion: Counter-trend and oscillator-based systems
  • Machine Learning: Neural networks and pattern recognition (Alice series)
  • Currency Strength: G12 multi-currency correlation system
  • Market Making: High-frequency FX market making strategies
  • Options Trading: Greeks calculation and volatility strategies
  • Portfolio Management: MVO, OptimalF, and correlation-based allocation
  • Economic Data: COT reports and fundamental analysis

📚 Browse all strategies and scripts →

✨ Features

  • High Frequency Trading - Ultra-low-latency C-based execution engine (~750ns latency)
  • 💹 Multi-Venue Support - 25+ brokers and exchanges including:
    • Traditional Markets: Interactive Brokers, OANDA, FXCM, Alpaca, Dukascopy, IG, Rithmic, TradeStation, Tradier
    • Crypto Exchanges: Binance, Bitfinex, Bittrex, Deribit, Kraken, Coinigy
    • Platform Connections: MetaTrader 4/5, IBKR TWS
  • 📊 361+ Algorithms - Pre-built trading strategies and indicators
  • 🐍 Python Bridge - Seamless integration between C and Python engines
  • 🤖 Machine Learning - Torch, Keras, TensorFlow, MxNet integration
  • 📈 Live Dashboards - Real-time monitoring via Google Sheets
  • 🗄️ MySQL Database - Store and analyze historical trading data
  • 💰 Risk Management - Advanced position sizing and portfolio optimization
  • 🌍 Multi-Asset Support - Trade forex, stocks, indices, commodities, bonds, cryptocurrencies, and derivatives (options, futures)
  • 🔄 Backtesting Engine - Test strategies with historical data
  • ⚙️ Low-Latency Operations - Async execution for maximum speed
  • 📉 Statistical Analysis - Volatility, correlation, and performance analytics
  • 🤖 AI Integration - Compatible with Keras and PyTorch models
  • 📊 Trade Profiling - Detailed performance metrics and visualization
  • 🔐 Secure Configuration - Environment-based credentials management

🌐 Broker & Data Connections

Open Source Interface

  • Open source interface for all API, REST, and FIX connections
  • User-written custom plugins available

Data Feeds

  • AlphaVantage - Market data API
  • CryptoCompare - Cryptocurrency data
  • IEX - Exchange data feed
  • DTN IQFeed - Professional real-time data
  • Stooq - Historical market data

Direct Broker Connections

  • Alpaca - Commission-free trading
  • Dukascopy - Swiss forex bank
  • Finvasia - Indian broker
  • FXCM - Forex and CFD trading
  • IG - Multi-asset broker
  • Interactive Brokers - Professional trading platform
  • Oanda - Forex and CFD broker
  • Rithmic - Professional futures trading
  • TDA/Schwab - US stocks and options
  • TradeStation - Advanced trading platform
  • Tradier - Brokerage API

Platform Connections

  • IBKR TWS - Interactive Brokers Trader Workstation
  • MT4 - MetaTrader 4 platform
  • MT5 - MetaTrader 5 platform

Digital Coin Exchanges

  • Binance - World's largest crypto exchange
  • Bitfinex - Advanced crypto trading
  • Bittrex - US crypto exchange
  • Coinigy - Multi-exchange platform
  • Deribit - Crypto options and futures
  • Kraken - Established crypto exchange

⚙️ Trading Engine Features

Execution & Time Frames

  • Time Frames: From 1 millisecond to 1 week
  • Multi-Connection: Simultaneous connection to multiple brokers and data feeds
  • Account Management: Account/asset lists with symbol mapping and individual parameters

Options & Derivatives

  • Options/Combos: Full support for complex strategies
  • Greeks Calculation: IV, Delta, Gamma, Theta, Vega, and all Greeks
  • Multi-Leg Strategies: Advanced options combinations

Position Management

  • NFA/FIFO Compliance: Regulatory compliance built-in
  • Virtual Hedging: For concurrent opposite positions
  • Automated Training: Background training and optimizing while live trading
  • Phantom Trades: Skip drawdown periods ("Equity Curve Trading")

High-Frequency Trading

  • Special HFT Mode: Optimized for high frequency trading backtests
  • Ultra-Low Latency: ~750ns execution latency

🧪 Test & Optimization

Performance Benchmarks

  • World's Fastest Optimizer: 25 seconds for 12 parameters*
  • World's Fastest Backtester: 0.3 seconds for 10 years at tick level*

Bar Types

  • Standard: Time-based bars
  • Range Bars: Price-range based
  • Renko: Trend-following brick charts
  • Point-and-Figure: Classic charting
  • User-Defined: Custom bar types

Optimization Methods

  • Ascent: Hill climbing optimization
  • Brute Force: Exhaustive parameter search
  • Genetic: Evolutionary algorithms
  • User-Defined: Custom optimization methods

Simulation Features

  • Precise Broker Simulation: Fees, leverage, swaps, slippage modeling
  • Oversampling & Detrending: On price, signal, or trade level
  • Individual Optimization: Per portfolio component
  • Capital Allocation: MVO (Mean-Variance Optimization) or OptimalF algorithms
  • Walk Forward Analysis: Rolling and anchored methods

*Performance benchmarks may vary based on hardware and strategy complexity

📦 Installation

Prerequisites

  • Zorro Trading Platform (version 1.68.62 or higher)
  • Python 3.6+ with pip or poetry
  • MySQL Server (optional, for database features)
  • OANDA Account (for live trading)
  • Google Cloud Service Account (for Sheets integration)

Quick Start

# Clone the repository
git clone https://github.com/alexcolls/z-trading.git
cd z-trading

# Install Python dependencies with Poetry (recommended)
poetry install

# Or with pip
pip install oandapyV20 pandas pygsheets gspread oauth2client sqlalchemy pymysql

# Configure environment variables
cp .env.sample .env
# Edit .env with your API credentials

Zorro Engine Setup

  1. Install Zorro: Extract the engine/ contents to your Zorro installation directory
  2. Copy Algorithms: Place C scripts from algos/ into Zorro's Strategy/ folder
  3. Configure APIs: Edit Zorro.ini with your broker credentials
  4. Verify Installation: Run engine/Zorro.exe and load a test strategy

⚙️ Configuration

Environment Variables

Create a .env.sample file in the root directory:

# OANDA API Credentials
OANDA_TOKEN=your_oanda_api_token
OANDA_ACCOUNT_ID=your_account_id

# Google Sheets API
GOOGLE_SERVICE_ACCOUNT_FILE=path/to/service_account.json
GOOGLE_SHEET_NAME=TradingDashboard

# MySQL Database
MYSQL_HOST=localhost
MYSQL_USER=your_username
MYSQL_PASSWORD=your_password
MYSQL_DATABASE=trading_db

# Risk Management
HARD_STOP_PERCENT=2.0
INITIAL_BALANCE=10000

Google Sheets Setup

  1. Create a Google Cloud Project and enable Google Sheets API
  2. Download service account JSON credentials
  3. Place credentials as algos/GS_main.json and algos/GS_trader1.json
  4. Share your Google Sheet with the service account email

MySQL Database Setup

-- Create databases for statistics and correlations
CREATE DATABASE OandaEurope_Statistics;
CREATE DATABASE OandaEurope_Correlations;

-- Import schema (example)
USE OandaEurope_Statistics;
CREATE TABLE AvgVolatilities (
    Symbol VARCHAR(20) PRIMARY KEY,
    -- Add your columns for different timeframes
);

🎯 Usage

Running C Algorithms with Zorro

// Example: Simple trend trading strategy
#include <profile.c>

function run()
{
    vars Price = series(price());
    vars Trend = series(LowPass(Price, 500));

    Stop = 4*ATR(100);

    if(valley(Trend))
        enterLong();
    else if(peak(Trend))
        enterShort();

    St

Related Skills

View on GitHub
GitHub Stars20
CategoryCustomer
Updated21d ago
Forks4

Languages

C

Security Score

90/100

Audited on Jul 17, 2026

No findings