Skip to content
/ vanta Public

Vanta is a set of tools for crypto-native quantitative trading, offering real-time market data collection, volatility-adjusted position sizing, momentum strategy signals, and advanced order book analysis.

Notifications You must be signed in to change notification settings

owizdom/vanta

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Vanta

Vanta is a set of tools for crypto-native quantitative trading, offering real-time market data collection, volatility-adjusted position sizing, momentum strategy signals, and advanced order book analysis. Highlighting dynamic position sizing strategies, Kelly Criterion optimization, and real-time market insights, Vanta facilitates risk reduction and strategy enhancement for cryptocurrency markets. With its technical analysis tools and Binance API integration, the project offers a robust platform for quantitative trading and in-depth crypto market analysis.

Screenshot

Screenshot 2025-12-22 at 09 18 05

The interactive CLI provides an intuitive menu-driven interface for accessing all trading tools and analysis features.

Key Differences from Traditional Equity Platforms

Market Structure (Implemented)

  • 24/7 Trading: No market open/close times - markets operate continuously
    • Vanta handles continuous market data with millisecond timestamps
  • High Volatility: Crypto markets exhibit 2-5x the volatility of equity markets
    • Position sizing algorithms account for higher volatility
    • Volatility-adjusted sizing adapts to market regime changes

Data Sources (Implemented)

  • REST API Integration: Real-time data via Binance REST API
    • Current price, historical klines (OHLCV), and order book depth
    • No API key required for public endpoints
  • Order Book Analysis: Order book data is critical for crypto trading
    • Real-time order book fetching and display
    • Spread and mid-price calculations
    • Market depth analysis

Position Sizing (Implemented)

  • Volatility-Adjusted Sizing: Position sizing adapts to volatility regimes
    • Accounts for 2-5x higher crypto volatility than equities
    • Dynamically adjusts position size based on current market volatility
  • Kelly Criterion: Optimal bet sizing for crypto markets
    • Maximizes expected value in high-volatility environments
  • Risk-Based Sizing: Traditional risk percentage with crypto-specific considerations

Strategies (Implemented)

  • Momentum Strategy: Trend-following adapted for crypto markets
    • Shorter lookback periods optimized for crypto volatility
    • Real-time signal generation using live market data
    • Works with 24/7 continuous markets

Architecture

Vanta/
├── includes/              # Header files
│   ├── crypto_data.hpp              # Core data structures (CryptoPricePoint, CryptoPriceHistory, OrderBookSnapshot)
│   ├── crypto_position_sizing.hpp   # Position sizing algorithms
│   └── strategies.hpp               # Strategy interfaces
├── src/                   # Implementation files
│   ├── api_client.cpp              # Binance REST API client
│   ├── crypto_data.cpp             # Data structure implementations
│   └── crypto_position_sizing.cpp  # Position sizing implementations
├── strategies/            # Strategy implementations
│   └── momentum_strategy.cpp      # Momentum strategy
├── config/                # Configuration files
│   └── api_endpoints.hpp          # API endpoint configurations
├── main.cpp               # Main interactive CLI application
└── vanta                  # Compiled executable

Core Modules

1. Data Layer (crypto_data.hpp)

  • CryptoPricePoint: OHLCV data with millisecond timestamps
  • OrderBookSnapshot: Full order book state with bid/ask levels
  • CryptoPriceHistory: Historical data management with technical indicators (SMA, volatility)

Features:

  • Timestamps in milliseconds (24/7 markets, no market hours)
  • Volume in base currency
  • Real-time data fetching from Binance REST API
  • Order book depth analysis
  • Technical indicator calculations (Simple Moving Averages, volatility)

2. Position Sizing (crypto_position_sizing.hpp)

  • CryptoPositionSizing: Multiple position sizing methods for crypto markets

Features:

  • Risk-based sizing: Calculates position size based on risk percentage and stop loss
  • Volatility-adjusted sizing: Adapts position size based on current market volatility
  • Kelly Criterion: Optimal bet sizing using Kelly formula for expected value maximization

Crypto Adaptations:

  • Accounts for higher crypto volatility (2-5x more volatile than equities)
  • Volatility-adjusted sizing adapts to market regime changes
  • Kelly Criterion optimized for crypto market characteristics

3. Strategies (strategies.hpp)

  • MomentumStrategy: Trend-following strategy with configurable short/long windows

Features:

  • Generates trading signals based on moving average crossovers
  • Configurable short and long window periods
  • Real-time signal generation using live market data
  • Signal strength indicators (strong buy/sell, weak buy/sell, neutral)

Implementation:

  • Uses Simple Moving Averages (SMA) for trend detection
  • Adapted for 24/7 crypto markets
  • Works with real-time price data from Binance API

Getting Started

Quick Start

  1. Compile the program:

    cd /Users/Apple/Desktop/idk/Vanta
    g++ -std=c++17 -I. -Iincludes -Iconfig -Isrc -o vanta main.cpp -lcurl
  2. Run the interactive CLI:

    ./vanta
  3. Use the menu to explore features:

    • Option 1: View real-time price history (e.g., enter BTCUSDT)
    • Option 7: View live order book (e.g., enter BTCUSDT)
    • Option 4: Calculate position sizing with real-time prices
    • Option 8: Generate momentum strategy signals

Interactive Menu Features

The program provides an interactive menu with the following options:

  1. View Price History - Fetch and display real-time OHLCV data from Binance
  2. Calculate Moving Averages - Compute SMAs with configurable windows
  3. Calculate Volatility - Analyze market volatility with 24h statistics
  4. Position Sizing Calculator - Calculate optimal position sizes using real-time prices
  5. Volatility-Adjusted Position Sizing - Position sizing that adapts to volatility
  6. Kelly Criterion Calculator - Optimal bet sizing using Kelly formula
  7. View Order Book - Display formatted order book table with bids/asks
  8. Momentum Strategy Signal - Generate trading signals from momentum indicators
  9. Run All Tests - Execute all features with default parameters

Usage Example

// The program uses an interactive CLI. Example workflow:

// 1. Run the program
./vanta

// 2. Select option 1 (View Price History)
// 3. Enter symbol: BTCUSDT
// 4. View real-time price data fetched from Binance

// 5. Select option 7 (View Order Book)
// 6. Enter symbol: BTCUSDT
// 7. View formatted order book with best bid/ask prices

Programmatic Usage (Future)

For programmatic usage, you can use the API client directly:

#include "src/api_client.cpp"
#include "includes/crypto_data.hpp"

int main() {
    APIClient api;
    
    // Fetch current price
    double price = api.getCurrentPrice("BTCUSDT");
    std::cout << "BTC/USDT: $" << price << std::endl;
    
    // Fetch price history
    CryptoPriceHistory history = api.fetchKlines("BTCUSDT", "1h", 24);
    std::cout << "Data points: " << history.size() << std::endl;
    
    // Fetch order book
    OrderBookSnapshot orderBook = api.fetchOrderBook("BTCUSDT", 20);
    std::cout << "Spread: $" << orderBook.getSpread() << std::endl;
    
    return 0;
}

Extensibility

Adding New Exchanges

  1. Implement IExchangeWebSocket for market data
  2. Implement IExchangeAdapter for order execution
  3. Add exchange-specific fee structures to ExchangeInfo

Adding On-Chain Data

The architecture supports future integration of:

  • Gas price monitoring (Ethereum)
  • MEV (Maximal Extractable Value) opportunities
  • Liquidation event feeds (DeFi protocols)
  • On-chain metrics (exchange flows, whale movements)

These can be integrated as additional data sources in the MarketDataAggregator.

Adding New Strategies

  1. Inherit from IStrategy
  2. Implement generateSignal() method
  3. Add strategy-specific parameters
  4. Register with StrategyManager

Building

Prerequisites

  • C++17 compiler (g++ or clang++)
  • libcurl - HTTP client library for API requests

Installation

macOS:

brew install curl

Linux (Ubuntu/Debian):

sudo apt-get install libcurl4-openssl-dev

Linux (Fedora/RHEL):

sudo dnf install libcurl-devel

Compilation

cd /Users/Apple/Desktop/idk/Vanta
g++ -std=c++17 -I. -Iincludes -Iconfig -Isrc -o vanta main.cpp -lcurl

Running

./vanta

Dependencies

  • C++17 or later
  • libcurl - For HTTP requests to Binance API
  • Standard C++ Library - No external JSON libraries needed (uses string parsing)

Current Implementation Status

Implemented:

  • Real-time data fetching from Binance REST API
  • Price history management (CryptoPriceHistory)
  • Order book data structures and display
  • Position sizing algorithms (risk-based, volatility-adjusted, Kelly Criterion)
  • Momentum strategy implementation
  • Interactive CLI with menu system

Stubbed (Interfaces Defined):

  • WebSocket market data ingestion
  • Exchange execution adapters
  • Advanced risk management (VaR, liquidation risk)
  • Slippage modeling
  • Backtesting engine

Data Sources

Real-Time Data (Currently Implemented)

  • Binance REST API:
    • Current price: /api/v3/ticker/price
    • 24h ticker stats: /api/v3/ticker/24hr
    • Historical klines (OHLCV): /api/v3/klines
    • Order book depth: /api/v3/depth
    • No API key required for public endpoints
    • Rate limits: 1200 requests per minute (weighted)

Historical Data (Available but not yet integrated)

  • Syve API: Free OHLC historical data with 5 req/s rate limit

Future Data Sources (Architecture Ready)

  • Binance WebSocket: Real-time streams (architecture supports this)
  • Coinbase Pro: WebSocket feeds for US markets
  • OKX: WebSocket for derivatives markets

See API_REFERENCE.md for complete API documentation.

Implementation Status

Current Implementation

The project currently implements:

  • Data Layer: Complete with real-time Binance API integration
  • Position Sizing: All algorithms implemented (risk-based, volatility-adjusted, Kelly)
  • Strategies: Momentum strategy fully implemented
  • Interactive CLI: Full menu system with real-time data
  • Order Book: Real-time order book fetching and display

Architecture Design

The codebase follows a modular, extensible architecture:

  • Header files define interfaces and data structures
  • Implementation files contain the actual logic
  • Exchange-agnostic: Easy to add new exchanges (Binance currently implemented)
  • Strategy-agnostic: Easy to add new strategies (Momentum implemented)
  • Extensible: Ready for WebSocket, on-chain data, and advanced features

Future Enhancements

The architecture is designed to support:

  • WebSocket-based real-time data (interfaces defined)
  • Multiple exchange integrations (Binance REST implemented)
  • Advanced risk management (interfaces defined)
  • Backtesting engine (interfaces defined)
  • On-chain data integration (architecture ready)

Crypto-Specific Considerations

  1. Volatility: All position sizing and risk management accounts for higher volatility
  2. Leverage: Built-in support for margin and futures trading
  3. Correlation: Risk management includes correlation-aware hedging
  4. Exchange Risk: Limits exposure to individual exchanges
  5. Liquidation: Calculates liquidation prices for leveraged positions
  6. 24/7 Markets: No market hours - strategies run continuously
  7. Order Book Depth: Slippage models use order book depth, not just volume

Future Enhancements

  • On-chain data integration (gas prices, MEV, liquidations)
  • DeFi protocol integration (lending rates, yield farming)
  • Cross-chain arbitrage detection
  • Options trading support
  • Machine learning signal generation
  • Real-time portfolio optimization

License

[License information]

About

Vanta is a set of tools for crypto-native quantitative trading, offering real-time market data collection, volatility-adjusted position sizing, momentum strategy signals, and advanced order book analysis.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages