BLKBOX DocsAlgo TradingAPI + Webhooks

Developer Runtime / Execution Access

Connect Signals.Control Execution.

Use BLKBOX API keys and webhook-based workflows to connect TradingView alerts, bots, and external strategy engines to your trading account. Start with demo execution, validate your signal payloads, then monitor every order inside BLKBOX.

Overview

What the algo trading layer is for.

Signal Routing

Convert external strategy decisions into structured BLKBOX execution instructions.

Account Control

Keep account visibility, balance, open positions, and order monitoring inside the BLKBOX environment.

Controlled Automation

Use private keys, demo testing, strategy references, and risk fields to make automation easier to audit.

Quick Start

From signal to execution in four steps.

01

Open a BLKBOX trading account

API execution must route into a real BLKBOX account context. Start with a demo account before connecting live automation.

02

Generate a private API key

Create the key from the Algo Trading page. Store it securely because private keys should not be exposed in browser code or public repositories.

03

Connect your signal source

Use TradingView alerts, a Python bot, a JavaScript service, or another external strategy engine to send structured execution signals.

04

Monitor execution inside BLKBOX

Watch account balance, open positions, pending orders, fills, rejected orders, and risk changes from the BLKBOX trading interface.

API Keys

Private keys connect your strategy to your account.

How keys should be used

Generate the API key from the Algo Trading page. Treat it like a password. Your strategy service should send it only from a trusted backend, bot runtime, VPS, automation server, or private local environment.

Server SidePrivate StorageNever Public

Key Lifecycle

Create/algo-trading
StoreSecret Manager / ENV
UseWebhook / Bot Runtime
RotateWhen Exposed

TradingView

Use alerts as execution signals.

Recommended TradingView flow

  1. 01 / Build or select your TradingView strategy.
  2. 02 / Create an alert from the strategy or indicator.
  3. 03 / Paste the BLKBOX webhook URL generated in the app.
  4. 04 / Paste a structured JSON message into the alert body.
  5. 05 / Test with demo before live execution.
TradingView alert message example
{
  "source": "tradingview",
  "symbol": "{{ticker}}",
  "side": "buy",
  "order_type": "market",
  "risk_mode": "percent",
  "risk_value": 0.5,
  "stop_loss": "{{plot_0}}",
  "take_profit": "{{plot_1}}",
  "strategy": "momentum-v1",
  "client_reference": "{{strategy.order.id}}"
}

Payloads

Use explicit fields so signals are easy to audit.

Field
Status
Description
symbol
Required

The market to route the signal into, such as EURUSD, NAS100, BTCUSD, or another supported BLKBOX market.

side
Required

The trade direction. Use buy or sell.

order_type
Required

The execution type. Start with market orders unless your backend endpoint supports pending order instructions.

risk_mode
Recommended

Defines how size is calculated. Common values are percent, fixed, or quantity, depending on your backend implementation.

risk_value
Recommended

The amount of risk, fixed notional value, or position quantity used by the strategy instruction.

stop_loss
Optional

Optional protective stop level. Recommended for automated strategies.

take_profit
Optional

Optional target level for the position.

strategy
Recommended

Human-readable strategy name used for tracking, debugging, logs, and audit history.

client_reference
Recommended

Unique external reference from TradingView, your bot, or your strategy runtime.

The generated webhook helper inside BLKBOX should remain the source of truth for the exact endpoint and final payload shape. This documentation explains the recommended structure and naming so the system stays readable and easy to debug.

Examples

Connect a bot, script, or service.

Bot payload example
{
  "symbol": "EURUSD",
  "side": "buy",
  "order_type": "market",
  "risk_mode": "fixed",
  "risk_value": 100,
  "stop_loss": 1.0825,
  "take_profit": 1.0915,
  "strategy": "python-breakout-v1",
  "client_reference": "signal-2026-05-11-001"
}
JavaScript execution example
const API_BASE = process.env.BLKBOX_API_BASE;
const API_KEY = process.env.BLKBOX_API_KEY;

async function sendSignal(signal) {
  const res = await fetch(`${API_BASE}/YOUR_WEBHOOK_OR_ORDER_ENDPOINT`, {
    method: "POST",
    headers: {
      "Content-Type": "application/json",
      "Authorization": `Bearer ${API_KEY}`,
    },
    body: JSON.stringify(signal),
  });

  if (!res.ok) {
    const error = await res.text();
    throw new Error(error || "BLKBOX execution request failed");
  }

  return res.json();
}

sendSignal({
  symbol: "EURUSD",
  side: "buy",
  order_type: "market",
  risk_mode: "percent",
  risk_value: 0.5,
  strategy: "momentum-v1",
});
Curl execution example
curl -X POST "$BLKBOX_API_BASE/YOUR_WEBHOOK_OR_ORDER_ENDPOINT" \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer $BLKBOX_API_KEY" \
  -d '{
    "symbol": "EURUSD",
    "side": "buy",
    "order_type": "market",
    "risk_mode": "percent",
    "risk_value": 0.5,
    "strategy": "momentum-v1"
  }'

Security

Protect the key before protecting the strategy.

Key rules

01

Never expose API keys in frontend code, public GitHub repositories, screenshots, logs, or TradingView public scripts.

02

Use a demo account first and only move to live automation after testing signal formatting, order routing, and risk behavior.

03

Rotate your key if you believe access was exposed.

04

Use separate keys for separate bots, services, or strategy environments when possible.

05

Keep position sizing and risk limits inside BLKBOX whenever the backend supports account-level controls.

Risk Warning

Automation does not remove market risk.

User Responsible

Automated strategies can fail, duplicate signals, execute during poor liquidity, use the wrong account, or behave differently in live markets. The user remains responsible for every API key, webhook, bot, signal, order, and account connected to BLKBOX.

Troubleshooting

Most automation issues are payload, account, or market-state issues.

Issue

The alert fired but no order appeared

Fix

Check that the webhook URL is correct, the API key is active, the account is available, and the payload includes symbol, side, and order type.

Issue

The order was rejected

Fix

Confirm the market is open, the symbol is supported, margin is available, and the requested size does not exceed account limits.

Issue

TradingView variables are being sent literally

Fix

Make sure the alert message is configured inside TradingView using supported placeholders like {{ticker}} and strategy order variables.

Issue

The bot works locally but fails in production

Fix

Check environment variables, server time, API base URL, outbound firewall rules, and whether your production service has the correct key.

Next Step

Generate a key and test in demo.

Start with one strategy, one market, and one account. Confirm the full route from signal creation to order monitoring before increasing automation scope.