Skip to content

Repository files navigation

CrossWAVE — Paper Trading Dashboard

Paper trading first. Flask dashboard for webhook-based crypto strategy signals, simulated execution workflows and optional Binance API integration.

Disclaimer: Educational and paper-trading use only. Not financial advice. Live trading with real funds carries significant risk.

CrossWAVE live dashboard

Dashboard overview mockup

Features

  • Paper trading by default — no Binance credentials required to explore the full flow
  • TradingView / webhook ingestion — receive LONG, SHORT, fractal and volatility signals via HTTP POST
  • Signal processor — validates payloads and routes actions to the trading adapter
  • Live Binance Futures adapter — optional real execution when PAPER_TRADING=false
  • CrossWAVE dashboard — balance chart, recent trades, orders, logs and payment summary

Architecture

flowchart LR
    TV[TradingView Alert] -->|POST /webhook| API[Flask API]
    API --> SP[Signal Processor]
    SP -->|paper| PT[Paper Trading Engine]
    SP -->|live| BA[Binance Adapter]
    PT --> CSV[(CSV / JSON State)]
    BA --> BN[Binance Futures API]
    CSV --> UI[Dashboard UI]
    BN --> UI
Loading

Flow: TradingView (or any alert provider) sends JSON to /webhook → Flask validates the signal → the processor opens/closes positions or updates stop-loss → state is persisted to CSV/JSON → the dashboard renders balance, trades and logs.

Quick start

python3 -m venv .venv
source .venv/bin/activate
pip install -r requirements.txt
cp .env.example .env
cp sample_data/balances.csv csv_files/balances.csv
cp sample_data/logs.csv csv_files/logs.csv
python app.py

Open http://localhost:8000.

Docker (optional)

docker build -t crypto-dashboard .
docker run --rm -p 8000:8000 crypto-dashboard

Configuration

Copy .env.example to .env:

Variable Description Default
PAPER_TRADING Simulate orders without Binance true
BINANCE_API_KEY Binance API key (live mode only)
BINANCE_API_SECRET Binance API secret (live mode only)
SYMBOL Futures pair BTCUSDT
QUANTITY Base order size (USDT) 100
LEVERAGE Futures leverage 1
BALANCE_START Starting balance for P&L 10000.00
TRADER_NAME Name shown in the UI Demo Trader

Defaults are intentionally conservative for portfolio/demo use. Increase leverage or switch symbols only when you understand the risk.

Webhook contract

All payloads use the field passphrase (correct spelling). The parser also accepts the legacy alias passhprase from older TradingView alerts — prefer passphrase in new integrations.

Request examples

Open long

{
  "passphrase": "LONG",
  "close": 67250.0,
  "fractal_long": 66800.0
}

Open short

{
  "passphrase": "SHORT",
  "close": 66800.0,
  "fractal_short": 67200.0
}

Update stop-loss (fractal long)

{
  "passphrase": "FR-Long",
  "value": 66950.0
}

Supported passphrases: LONG, SHORT, FR-Long, FR-Short, VOL-Long, VOL-Short.

HTTP response examples

Success (200)

HTTP/1.1 200 OK
Content-Type: application/json

{"code": "long succesful"}

Invalid passphrase (400)

HTTP/1.1 400 Bad Request
Content-Type: application/json

{"code": "nice try but no"}

Example with curl

curl -X POST http://localhost:8000/webhook \
  -H "Content-Type: application/json" \
  -d '{"passphrase":"LONG","close":67250.0,"fractal_long":66800.0}'

Tests

Payload validation is covered at two levels:

pytest -q
Test file What it covers
tests/test_signals.py Unit tests for payload parsing and response codes
tests/test_webhook.py HTTP integration tests for /webhook and /health

Example output:

tests/test_signals.py ...........
tests/test_webhook.py .....

Historical context

This project started as a personal futures bot (2021) wired to TradingView alerts on a specific altcoin pair with higher leverage. That configuration reflected a real strategy experiment — not a recommended default for public demos.

The current defaults (BTCUSDT, LEVERAGE=1, BALANCE_START=10000, paper mode on) were chosen so the repo reads as an educational dashboard rather than a live high-risk bot.

Project structure

├── app.py                  # Flask routes (dashboard + webhook)
├── config.py               # Environment-based configuration
├── functions/
│   ├── signals.py          # Webhook payload parsing
│   ├── signal_processor.py # Route signals to paper/live adapters
│   ├── paper_trading.py    # Simulated trading engine
│   └── orders.py           # Binance Futures order helpers
├── csv_files/              # Runtime data (gitignored)
├── sample_data/            # Safe demo CSV samples
├── templates/              # Jinja2 dashboard
├── static/                 # CSS / JS
├── tests/                  # Pytest suite
└── Dockerfile

GitHub metadata

Description: Flask trading dashboard for webhook-based crypto strategy signals, paper trading workflows and Binance API integration.

Suggested topics: flask, trading-bot, binance, webhook, crypto, paper-trading, tradingview, dashboard, python, futures-trading

License

MIT — use responsibly and never trade with money you cannot afford to lose.

About

Flask trading dashboard for webhook-based crypto strategy signals, paper trading workflows and Binance API integration.

Topics

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

Packages

Used by

Contributors

Languages