Institutional-Grade Triangular Arbitrage Detection Terminal
A real-time visualization platform that scans the Binance cryptocurrency market for triangular arbitrage opportunities using live WebSocket data streams.
๐ Try It Live โ
Experience the terminal in action: https://vaggelisgian.github.io/VectorCycle/
- Live Binance WebSocket Stream: Connects to
wss://stream.binance.com:9443/ws/!ticker@arr - Multi-Asset Support: Monitors BTC, ETH, SOL, BNB, USDT, USDC pairs
- Bid/Ask Spreads: Uses realistic order book pricing for accurate arbitrage detection
- Triangular Cycle Scanning: Finds profitable 3-hop trading paths (e.g., BTC โ ETH โ USDT โ BTC)
- Fee-Adjusted Calculations: Optional 0.075% trading fee inclusion
- Smart Filtering: Only logs unique opportunities to avoid spam
- Real-Time Spread Analysis: Calculates profit percentage accounting for market inefficiencies
- Network Graph: Interactive canvas rendering with nodes representing currencies
- Animated Particles: Golden particles flow along profitable arbitrage paths
- Live Terminal Log: Table-formatted log showing Time | Path | Spread
- Connection Monitoring: Real-time status indicator with auto-reconnection
Main Terminal View
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ VectorCycle โ LIVE DATA: CONNECTED (Binance) โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโค
โ โ
โ Network Graph (Canvas Visualization) โ
โ โ
โ [BTC] โโ [ETH] โโ [SOL] โโ [BNB] โ
โ โ โ โ โ โ
โ [USDT] โโโโโโโโโโโโโโโโโ [USDC] โ
โ โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโค
โ โ Include 0.075% Trading Fee โ Cycles: 120 โ
โ Scan Speed: โฌโฌโฌโฌโฌโโโโ 5x โ Profitable: 3 โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
git clone https://github.com/yourusername/VectorCycle.git
cd VectorCycleThen open index.html in any modern browser (Chrome, Firefox, Edge recommended).
- Fork this repository
- Go to Settings โ Pages
- Set source to
mainbranch - Your live URL:
https://yourusername.github.io/VectorCycle
VectorCycle/
โ
โโโ index.html # Main HTML structure
โโโ style.css # Institutional UI styling
โโโ market.js # BinanceStream WebSocket client
โโโ graph.js # ArbitrageDetector algorithm
โโโ renderer.js # Canvas network visualization
โโโ app.js # Main application controller
โโโ README.md # This file
The BinanceStream class connects to Binance's public WebSocket API and receives real-time ticker updates for all trading pairs.
For each pair (e.g., ETHBTC), the system:
- Stores the ask price for buying ETH with BTC
- Calculates the inverse bid price for selling ETH for BTC
The ArbitrageDetector scans all possible 3-hop paths:
Start โ Mid1 โ Mid2 โ Start
For each path, it calculates:
product = rate1 ร rate2 ร rate3
spread = (product - 1) ร 100If product > 1.0001, an arbitrage opportunity exists!
The NetworkRenderer draws:
- Nodes: Currency circles arranged in a circle
- Edges: Thin gray lines connecting all pairs
- Highlighted Paths: Cyan glowing lines for profitable cycles
- Particles: Golden dots flowing along arbitrage routes
| Control | Description |
|---|---|
| โ Include 0.075% Trading Fee | Toggle realistic trading fees in profit calculations |
| Scan Speed Slider | Adjust detection frequency (1x = slow, 10x = fast) |
| Cycles Counter | Total number of triangular paths analyzed |
| Profitable Counter | Number of unique arbitrage opportunities found |
14:23:45 BTC โ ETH โ USDT +0.127%
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
Time Path Spread
- Green Background: Profitable opportunity
- Timestamp: When the opportunity was detected
- Path: Trading sequence (excluding return to start)
- Spread: Profit percentage (after fees if enabled)
- 100% Vanilla JavaScript (No frameworks or build tools)
- HTML5 Canvas API for high-performance rendering
- WebSocket API for real-time data streaming
- CSS Grid Layout for responsive design
- Efficient Cycle Detection: O(nยณ) algorithm with early termination
- Smart Logging: Deduplicates paths to prevent log flooding
- Canvas Rendering: Runs at 60 FPS with requestAnimationFrame
- Minimal DOM Manipulation: Updates only changed elements
- Chrome/Edge 90+
- Firefox 88+
- Safari 14+
- Opera 76+
Edit market.js:
this.currencies = ['BTC', 'ETH', 'SOL', 'BNB', 'USDT', 'USDC'];Edit market.js:
this.feeRate = 0.00075; // 0.075% (Binance default)Edit graph.js:
const threshold = 1.0001; // 0.01% minimum profit- Check your internet connection
- Binance may block connections from certain regions
- Try using a VPN if the stream is geo-restricted
- This is normal! Real arbitrage windows are rare and brief
- Increase the scan speed slider
- Disable the fee toggle to see theoretical opportunities
- Ensure you're using a modern browser (check compatibility above)
- Try opening in an Incognito/Private window
- Clear browser cache and reload
Triangular arbitrage exploits price discrepancies between three currencies:
Example:
1. Start with 1 BTC
2. Trade BTC โ ETH at rate 0.04 = 25 ETH
3. Trade ETH โ USDT at rate 3,500 = 87,500 USDT
4. Trade USDT โ BTC at rate 0.0000115 = 1.006 BTC
Profit: 0.006 BTC (0.6%)
In efficient markets, these opportunities are extremely rare and exist for milliseconds.
- High-Frequency Trading Bots: Execute trades in microseconds
- Market Efficiency: Arbitrage itself corrects price discrepancies
- Trading Fees: Eat into small profit margins
- Slippage: Actual execution prices differ from quoted prices
MIT License - feel free to use this project for educational or commercial purposes.
Contributions are welcome! Here are some ideas:
- Add more cryptocurrency pairs
- Implement multi-hop (4+ currency) arbitrage detection
- Add historical profit tracking charts
- Create mobile-responsive layout
- Add sound alerts for opportunities
- Export opportunities to CSV
Pull requests and issues are appreciated!
Built with โก by a Lead Creative Technologist
- Binance for providing free public WebSocket streams
- Canvas API for enabling high-performance visualizations
- Inspired by institutional trading terminals (Bloomberg, Refinitiv)
This tool is for educational and research purposes only.
- Do NOT use this for actual trading without understanding the risks
- Cryptocurrency trading carries substantial risk of loss
- Past performance does not guarantee future results
- Always do your own research (DYOR)
Made with ๐ for the quantitative trading community