Skip to main content

Validate TradingView webhook alert JSON for PickMyTrade — supports Rithmic, Tradovate, Interactive Brokers, TradeStation, Binance, Bybit, and more.

Project description

PickMyTrade Validation

Open-source alert JSON validation library used by PickMyTrade — a TradingView-to-broker automation platform that connects TradingView alerts to brokers like Rithmic, Tradovate, Interactive Brokers, TradeStation, Binance, Bybit, and more.

This package validates and describes webhook alert payloads before they reach the execution layer. It catches misconfigurations early so traders avoid rejected or unintended orders.

What it does

  • Validates alert JSON structure — checks required fields, data types, and allowed values for every supported broker.
  • Enforces broker-specific rules — for example, Rithmic only supports MKT and LMT orders; ProjectX only supports futures; Tradovate supports pyramiding and multi-target TP/SL.
  • Generates human-readable descriptions — translates raw JSON into plain English so you can confirm what an alert will do before it fires.
  • Handles TradingView placeholders — validates {{strategy.market_position}}, {{close}}, and other dynamic values used in TradingView alert messages.

Supported Brokers

Broker Instrument Types Trailing Stop Options
Rithmic FUT, FOP Yes Yes
Interactive Brokers STK, FUT, OPT, FOP, CASH Yes Yes
Tradovate FUT Yes Yes
TradeStation STOCKS, FUTURES, OPTIONS Yes Yes
Tradier STK, OPT No Yes
TradeLocker EQUITY_CFD, FOREX, CRYPTO Yes No
ProjectX (TopstepX) FUT Yes No
Binance CRYPTO, FUTURES Yes No
Bybit CRYPTO, FUTURES Yes No
MatchTrader CFD, FOREX Yes No

Installation

pip install git+https://github.com/bhavishyagoyal12/pickmytrade_validation.git

Quick Start

from pickmytrade_validation import validate_and_describe_alert_json

payload = {
    "token": "your_webhook_token",
    "symbol": "ES",
    "quantity": 2,
    "data": "BUY",
    "platform": "RITHMIC",
    "order_type": "MKT",
    "inst_type": "FUT"
}

result = validate_and_describe_alert_json(payload)

if not result["error"]:
    print(result["description"])
    # Output: MARKET BUY order on ES for 2 contract(s) via RITHMIC. No TP or SL configured.
else:
    print(result["invalid_fields"])

Validate with Stop Loss and Take Profit

result = validate_and_describe_alert_json({
    "token": "your_webhook_token",
    "symbol": "NQ",
    "quantity": 1,
    "data": "SELL",
    "platform": "TRADOVATE",
    "order_type": "LMT",
    "inst_type": "FUT",
    "price": 18500,
    "tp": 18400,
    "sl": 18550
})

Validate with TradingView Placeholders

result = validate_and_describe_alert_json({
    "token": "your_webhook_token",
    "symbol": "ES",
    "quantity": "{{strategy.market_position_size}}",
    "data": "{{strategy.order.action}}",
    "platform": "RITHMIC",
    "order_type": "LMT",
    "inst_type": "FUT",
    "price": "{{close}}"
})

API Reference

validate_and_describe_alert_json(payload, raw_payload=None, allow_placeholders=True)

Parameters:

  • payload (dict) — The alert JSON to validate.
  • raw_payload (str, optional) — Raw string payload to check for JSON formatting issues.
  • allow_placeholders (bool) — Set to False to reject TradingView {{...}} placeholders and require explicit values.

Returns a dict with:

  • error (bool) — True if validation failed.
  • missing_fields (list) — Fields that are required but absent.
  • invalid_fields (list) — Fields present but with invalid values.
  • warnings (list) — Non-blocking issues (e.g., broker ignoring unsupported parameters).
  • description (str) — Human-readable summary of what the alert will do.

Broker Capability Helpers

from pickmytrade_validation import (
    get_broker_capabilities,
    broker_supports_trailing,
    broker_supports_breakeven,
    broker_supports_options,
    get_allowed_inst_types
)

# Get full capability map for a broker
caps = get_broker_capabilities("TRADOVATE")

# Check individual capabilities
broker_supports_trailing("RITHMIC")      # True
broker_supports_breakeven("TRADOVATE")   # True
get_allowed_inst_types("BINANCE")        # ["CRYPTO", "FUTURE", "FUTURES"]

FAQ

What is PickMyTrade?

PickMyTrade is a trading automation platform that connects TradingView alerts to live broker accounts. When a TradingView strategy generates a signal, PickMyTrade receives the webhook and places the corresponding order on your broker — supporting futures, stocks, options, crypto, and forex across multiple brokers.

Learn more at pickmytrade.trade or pickmytrade.io. Full documentation is available at docs.pickmytrade.trade and docs.pickmytrade.io.

How does this validation package fit into PickMyTrade?

This package is the first layer of defense in the PickMyTrade pipeline. It validates the alert JSON payload structure and broker compatibility before any order is sent to a broker API. This prevents malformed alerts from reaching the execution layer.

Does this package execute trades?

No. This is a read-only validation and description library. It does not connect to any broker API or place orders. It only checks whether an alert JSON is valid and describes what it would do.

Which TradingView placeholders are supported?

  • Quantity: {{strategy.market_position_size}}, {{strategy.order.contracts}}
  • Side/Action: {{strategy.market_position}}, {{strategy.order.action}}
  • Price fields (tp, sl, price): Any {{...}} placeholder including {{close}}, {{open}}, {{plot("name")}}
  • Date: {{timenow}}, {{time}}

Can I use this outside of PickMyTrade?

Yes. This package is open-source and has zero dependencies. If you're building TradingView webhook integrations and need to validate alert payloads against broker-specific rules, you can use it standalone.

What order types are supported?

  • MKT — Market order
  • LMT — Limit order (requires price)
  • STP — Stop order (requires price, not supported on all brokers)
  • STPLMT — Stop-limit order (requires price, not supported on all brokers)

License

MIT

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pickmytrade_validation-0.1.0.tar.gz (19.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pickmytrade_validation-0.1.0-py3-none-any.whl (16.0 kB view details)

Uploaded Python 3

File details

Details for the file pickmytrade_validation-0.1.0.tar.gz.

File metadata

  • Download URL: pickmytrade_validation-0.1.0.tar.gz
  • Upload date:
  • Size: 19.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.9

File hashes

Hashes for pickmytrade_validation-0.1.0.tar.gz
Algorithm Hash digest
SHA256 dd0937edb994126867fb36376f310e8d4776a52c2118fd4d2dab6e9c3ba82a53
MD5 d2fd4536f63f542a5ee1025dc62fd60b
BLAKE2b-256 15cfe2e9f6801e6cb2d0781f0011f7ea0a00d3e77991f4c975fb4e9942c32758

See more details on using hashes here.

File details

Details for the file pickmytrade_validation-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for pickmytrade_validation-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 4acfeb56c7c8d99ba848deec8b2f1ff0539b7c1c16e213550e61b9ffebc071b5
MD5 0bb80ed381e7ce6735ccd927b8e6b088
BLAKE2b-256 00ee46663c22ab6fc93fd7633fce443d0074960aa2c97a99e946690a61cb9054

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page