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.
The interactive CLI provides an intuitive menu-driven interface for accessing all trading tools and analysis features.
- 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
- 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
- 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
- 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
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
- 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)
- 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
- 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
-
Compile the program:
cd /Users/Apple/Desktop/idk/Vanta g++ -std=c++17 -I. -Iincludes -Iconfig -Isrc -o vanta main.cpp -lcurl -
Run the interactive CLI:
./vanta
-
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
- Option 1: View real-time price history (e.g., enter
The program provides an interactive menu with the following options:
- View Price History - Fetch and display real-time OHLCV data from Binance
- Calculate Moving Averages - Compute SMAs with configurable windows
- Calculate Volatility - Analyze market volatility with 24h statistics
- Position Sizing Calculator - Calculate optimal position sizes using real-time prices
- Volatility-Adjusted Position Sizing - Position sizing that adapts to volatility
- Kelly Criterion Calculator - Optimal bet sizing using Kelly formula
- View Order Book - Display formatted order book table with bids/asks
- Momentum Strategy Signal - Generate trading signals from momentum indicators
- Run All Tests - Execute all features with default parameters
// 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 pricesFor 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;
}- Implement
IExchangeWebSocketfor market data - Implement
IExchangeAdapterfor order execution - Add exchange-specific fee structures to
ExchangeInfo
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.
- Inherit from
IStrategy - Implement
generateSignal()method - Add strategy-specific parameters
- Register with
StrategyManager
- C++17 compiler (g++ or clang++)
- libcurl - HTTP client library for API requests
macOS:
brew install curlLinux (Ubuntu/Debian):
sudo apt-get install libcurl4-openssl-devLinux (Fedora/RHEL):
sudo dnf install libcurl-develcd /Users/Apple/Desktop/idk/Vanta
g++ -std=c++17 -I. -Iincludes -Iconfig -Isrc -o vanta main.cpp -lcurl./vanta- C++17 or later
- libcurl - For HTTP requests to Binance API
- Standard C++ Library - No external JSON libraries needed (uses string parsing)
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
- 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)
- Current price:
- Syve API: Free OHLC historical data with 5 req/s rate limit
- Full history available
- Multiple timeframes (1m, 5m, 15m, 1h, 4h, 1d, etc.)
- Low latency (0-5 seconds)
- Documentation: https://syve.readme.io/reference/price_historical_ohlc
- Client implementation available in
src/syve_api_client.cpp
- 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.
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
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
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)
- Volatility: All position sizing and risk management accounts for higher volatility
- Leverage: Built-in support for margin and futures trading
- Correlation: Risk management includes correlation-aware hedging
- Exchange Risk: Limits exposure to individual exchanges
- Liquidation: Calculates liquidation prices for leveraged positions
- 24/7 Markets: No market hours - strategies run continuously
- Order Book Depth: Slippage models use order book depth, not just volume
- 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 information]