Trading Exchange

Spot trading interface for Binance-routed and internal MyExchange pairs, with conditional orders, risk gate and a pro chart for internal pairs

What the Trading Exchange Is

The Trading Exchange module renders the buy/sell panel users see on a pair page. It supports two execution targets โ€” BINANCE (orders routed to Binance Spot via your gateway credentials) and MYEXCHANGE (orders matched in-house) โ€” and ships with a real-time order book, TradingView charts for Binance pairs, a Pro chart (RSI / MACD / Bollinger Bands / crosshair) for internal pairs, a Conditional Order box on desktop and a mobile drawer with its own Conditional Order tab.

๐Ÿ“‹ Quick facts

  • One shortcode: [wpcrypto_trade_interface] โ€” renders the entire panel
  • Two exchange targets: BINANCE and MYEXCHANGE
  • Order types: Market and Limit (plus separate mobile-only limit-mobile / market-mobile variants the trade panel uses internally)
  • Conditional orders: stop-loss, take-profit, trailing-stop and OCO โ€” see Conditional Orders
  • Risk gate: every order passes the Risk Management policy check before submission
  • Full order history tracked automatically and surfaced in the user profile and admin screens

The Trade Interface Shortcode

Drop the full trading UI on any WordPress page with:

[wpcrypto_trade_interface symbol="BTCUSDT"]

The shortcode loads the pair post (see Pairs Manager) and renders:

  • Pair header (logo, symbol, last price, 24h change)
  • Chart (TradingView for BINANCE pairs, Pro chart for MYEXCHANGE pairs)
  • Live order book and recent trades
  • Buy and Sell forms (Market / Limit)
  • Conditional Order box (desktop) + Conditional Order tab inside the mobile drawer
  • User's open orders, fill history and a "repeat order" affordance

โš ๏ธ This is the only trade shortcode

Variants like [wpcrypto_trade_form], [wpcrypto_order_book], [wpcrypto_price_chart], [wpcrypto_exchange], [wpcrypto_pair] or [wpcrypto_trading_advanced] are not registered by the plugin. Everything ships inside [wpcrypto_trade_interface].

BINANCE vs MYEXCHANGE

Aspect BINANCE MYEXCHANGE
Execution venueRouted to Binance Spot via your API keysMatched by the internal order book / engine
ChartTradingView widgetIn-house Pro chart (RSI, MACD, Bollinger Bands, crosshair)
Order book / tapeMirrors Binance via WebSocketAggregated from internal resting orders + bot ladder if you run one
Conditional ordersNative Binance STOP_LOSS / TAKE_PROFIT / OCOCron-driven internal watcher (see Conditional Orders)
CommissionSingle commission_rate from the pair (no maker/taker split)Same โ€” single rate, same field

Order Types

Type When to use
marketFill immediately at the best available prices.
limitSit in the book at a chosen price until matched or cancelled.
market-mobile / limit-mobileSame types, but submitted from the mobile drawer; the engine handles them identically but tracks the source for analytics.

Conditional orders (stop-loss / take-profit / trailing-stop / OCO) are documented separately on the Conditional Orders page.

Trading Requires a Balance

The Trade interface will not accept any order โ€” buy or sell โ€” for a user whose tradable balance is zero. This is independent of how the order is routed: the platform always checks the user's internal balance before passing an order on, so an empty account is rejected at the form level with an Insufficient balance message.

Where that balance comes from depends on which Binance environment the platform is configured against:

Binance environment How a user gets a balance to trade with
Test API (Binance Testnet) The admin can manually credit any test balance from WP Crypto โ†’ Users โ†’ Edit user โ†’ Balance. No real funds move, no blockchain deposit is required. This is the recommended path while you are still configuring pairs, fees and risk policy.
Live API (Binance production) The user must hold a real balance โ€” either by completing a real on-chain deposit to their assigned wallet (see Wallet Generator), or by an admin manually crediting their account against a real Binance Spot balance the operator is holding. Orders are placed against the live market, so a real balance must exist somewhere on Binance.

๐Ÿงช Recommended first test

  1. Set the platform to use the Binance Test API in General Settings.
  2. From WP Crypto โ†’ Users, give your own account a test balance, for example 100 USDT.
  3. Open the DOGE/USDT trade page (or any pair you have configured).
  4. Place a small market buy, watch it fill, then place a market sell to close the position.
  5. Verify the trade appears in your order history and that the balance has been adjusted by the commission you configured.

This single flow exercises the order form, the risk check, the commission, the receipt and the order history โ€” without any real money at risk.

โš ๏ธ Live API specifics

When the platform is pointed at the live Binance API, every order is a real market order. Even if you have credited a user's internal balance manually, the order will be rejected by Binance if there is no corresponding real balance on the Binance account whose API keys are configured in General Settings. Always test on the testnet first.

Order Lifecycle

Trade orders follow a Binance-style lifecycle:

Status Meaning
NEWOrder accepted, waiting for fills. Default state on insert.
PARTIALLY_FILLEDSome quantity has filled; the rest is still working.
FILLEDOrder is completely filled.
CANCELEDOrder was cancelled by the user, the exchange or the system (single-L spelling matches Binance).
REJECTEDOrder was rejected by the venue (filter mismatch, insufficient balance, etc.).
EXPIREDTime-in-force window elapsed before the order filled.

Repeat-order, mid-trade cancel and partial-fill refund flows all operate against these states.

Commissions and VIP Tiers

Each pair has a single commission_rate; there is no separate maker / taker fee on the pair itself. VIP tiers (10 levels configured in General Settings) can override the base rate on a per-user basis โ€” the order receipt shows the effective commission rate and the VIP level used at fill time.

Bot service users (bot_alice, bot_bob) are exempt from commissions so the bot ladder does not drain itself; see Trading Bot Suite.

Risk and Conditional Orders

Every submission passes through wpcrypto_risk_check_policy() before the order is placed. If the user's cooldown, drawdown freeze, daily-loss limit or per-trade position cap is breached, the order is rejected with a friendly reason instead of going to the venue. Full policy details: Risk Management.

From the trade UI users can also place conditional orders that wait for a trigger before they execute โ€” stop-loss, take-profit, trailing-stop and OCO. On Binance pairs these are submitted as native Binance order types; on internal pairs a 30-second cron watcher evaluates them and dispatches the action order when the trigger fires. Full details: Conditional Orders.

Mobile Trading

On small screens the plugin renders a bottom drawer instead of the desktop grid. The drawer has its own tabs:

  • Market / Limit: standard buy/sell forms, sized for thumbs
  • Conditional Order: the same form as the desktop box, embedded as a drawer tab
  • Order book / Trade tape: compact list view of the live data

All forms reuse the same AJAX endpoints as the desktop UI; the mobile suffix (market-mobile / limit-mobile) is recorded for analytics.

Operator Notes

โš ๏ธ Things to know

  • One commission rate per pair โ€” no maker/taker split. VIP overrides happen at the user level.
  • The plugin does not import Binance trade history; user history is whatever your platform has recorded.
  • Balances are internal-only. The plugin does not sync your Binance spot balance into the user's view; users see your platform's ledger.
  • Conditional cron must run. Internal conditional orders rely on the 30-second cron. Use a real system cron or a remote tick service so triggers do not lag.

Troubleshooting

"Order rejected by risk policy"

The user has a cooldown, drawdown freeze, daily-loss lock or position-size limit blocking the order. Check Profile โ†’ Risk for the exact reason, or relax the policy in WP Crypto โ†’ Risk Management.

Order book is empty on an internal pair

No real users are quoting. Configure a market-making bot for the pair (see Trading Bot Suite) so the ladder fills up automatically.

Pro chart does not render

The Pro chart is only shown for MYEXCHANGE pairs. Binance pairs use the TradingView widget instead.

Commission on the receipt looks high

Check the user's VIP level and the pair's commission_rate. The receipt shows both โ€” use them to reproduce the fee exactly.

"Insufficient balance" โ€” I cannot place any order

The user's tradable balance for the quote asset (e.g. USDT for BTC/USDT) is zero. While testing, give the account a balance from WP Crypto โ†’ Users โ†’ Edit user โ†’ Balance โ€” this is safe and intended for testnet-driven dry runs. For live trading, a real Binance Spot balance must exist on the operator account whose API keys are configured in General Settings.

Live prices look frozen / nothing flashes / the chart does not move

The Live Crypto Prices module streams real-time data through a WebSocket and updates the DOM continuously. If you are seeing static values, the problem is almost always client-side caching, not the stream itself:

  • Hard-refresh the page: Ctrl + Shift + R (Windows / Linux) or Cmd + Shift + R (macOS).
  • Open the page in an Incognito / Private window to bypass extensions and cached assets.
  • Try a second browser. If prices move there but not in your main browser, the cache or an extension in the main browser is the culprit.

If after all three checks the prices are still frozen, capture a screenshot, note the browser + version, and contact support โ€” at that point the stream itself may be blocked upstream (corporate proxy, ad-blocker rule, etc.).

The platform receives HTTP 451 Unavailable For Legal Reasons when calling Binance

Binance geo-blocks some hosting providers' IP ranges โ€” most commonly US-labelled IPs. The server can be physically anywhere; what matters is the WHOIS label on the outbound IP. The fix is to put a thin proxy in front of Binance and point the plugin at it. Full step-by-step setup (free Cloudflare Worker) lives on the General Settings page under "Binance API Proxy URL".