Install and enable
Installing the Forex & Multi-Asset Trading addon, adding a market-data key, importing the instrument catalog, enabling instruments and switching on live trading — in the order that actually works.
The addon installs like every other Bicrypto extension: activate the licence
in the Extension Manager, install the release, run pnpm updator, switch it
on. What follows that is the part worth reading, because the order matters.
Instruments cannot be activated before a provider is active, a provider cannot
be activated before its credentials are in .env, and live trading cannot be
switched on before either of those exist.
Nothing here touches ScyllaDB. This addon stores everything in MySQL and uses Redis for provider cool-offs, the chart cache and the engine lease.
Before you start
- A working Bicrypto install — see Core install
- Shell access to the app server —
pnpm updatorruns there, credentials go in.env, and the backend has to be restarted to read them - A market-data provider account whose plan includes WebSocket streaming
- Decided which countries you will refuse — the geo-block list defaults to
US, CAand applies the moment the extension is live
1. Install and activate the extension
Four steps, in this order. Nothing the addon owns — its tables, its admin, its terminal, its scheduled jobs — exists until the last of them is done.
-
Open the Extension Manager. Admin → System → Extension Manager (
/admin/system/extension), heading Add-ons & Integrations. On the Extensions tab, or by searching for Forex, find the Forex & Multi-Asset Trading card — product ID62000000— and click it. Searching for Forex also turns up Forex Broker & Investments, the card beside it; that is a different product. Until its licence is activated the switch on the card is disabled and reads Activate license first.- The Forex & Multi-Asset Trading card — click it to open the product page
- Its switch stays disabled until the licence is activated
-
Activate the licence. On the product page press Activate License. Paste the purchase code from your MashDiv dashboard, optionally an email address for update notifications, and press Activate License. The screen confirms License Activated! and returns you to the product page a couple of seconds later. If the server has no outbound access, the License File tab on the same screen takes the licence certificate downloaded from your MashDiv dashboard instead.
- Paste the purchase code here
- Activate License — then wait for the redirect back to the product page
- The offline route, for a server with no outbound HTTPS
-
Install the release. Back on the product page, now licensed, the Overview tab has a release panel. If it offers Install v…, press it; if it says Up to date on a product you have only just licensed, press Check for Updates once, then install whatever it offers. The Releases tab holds the notes for the version you are being offered — read them first.
Install downloads the release, verifies it and extracts it over the project root. It runs no migrations, builds nothing and restarts nothing, so finish it from a shell on the server:
pnpm updatorThat is the finalise chain — stop, dependencies, schema, seed data, frontend build, start — and it is what makes the addon's tables exist. If the panel still says Up to date after the check there is nothing to download; go straight to the next step.
- Check for Updates, then Install v… when it is offered
- Releases — the notes for the version you are about to install
- The Enabled switch — step 4, not yet
-
Switch it on. Turn the Enabled switch on — in the product page heading, or on the card in the Extension Manager, which is usable now that the licence is verified. This is what makes Forex Trading appear under Admin → Extensions, puts the customer terminal at
/forex-trading/trade, and registers the sixforex_tradingscheduled jobs of step 8; none of that needs a restart. The desk itself is different: the tick engine, the risk engine and the reconciler are started when the backend boots and finds the addon on, so the restart step 2 asks for after the market-data key goes into.envis the one that brings them up.
Once pnpm updator has run, the addon's tables exist:
fx_provider market-data vendors (one active at a time)
fx_execution_provider A-book hedge venues (many may be enabled)
fx_instrument the tradable catalog
fx_symbol_group dealing-desk config per group of symbols
fx_session_calendar trading-hours calendars
fx_account_group account tiers (margin call, stop out, NBP)
fx_account customer trading accounts
fx_order orders, market and pending
fx_position open and closed positions
fx_deal the immutable money ledger
fx_routing_rule A-book placement-time routing overrides
fx_execution_alert the operator alert inbox
fx_economic_event economic calendar
fx_market_news terminal news feedThe addon's admin lives at /admin/forex-trading — reached from
Admin → Extensions — and its customer terminal at /forex-trading/trade.
Neither exists until the Enabled switch is on.
Every screen is permission-gated on keys of the form
view.forex_trading.*, edit.forex_trading.* and so on. Roles ship with no
grants at all, so an Admin-role user will get a 403 on every page until you
assign them under Users → Roles & Permissions. The full list is in the
settings reference.
2. Add a market-data credential
The A-book execution keys are pre-listed in .env.example. The market-data
keys are not — you add them by hand. If you copy the file expecting to find
APP_TWELVEDATA_API_KEY and it is absent, that is normal.
Pick one provider and add its variables to .env:
APP_TWELVEDATA_API_KEY=
APP_FINNHUB_API_KEY=
APP_TRADERMADE_API_KEY=
APP_POLYGON_API_KEY=Restart the backend afterwards — the provider manager reads
process.env and nothing reloads it.
Which one to choose, what each plan actually includes, and how to validate a key
before you write it into .env is covered in
Market data providers. Read that page before you pay
anyone: four of the five vendors paywall the WebSocket, and without a WebSocket
this addon cannot quote a tradable price.
3. Activate the provider
Go to Admin → Forex Trading → Market Data → Providers
(/admin/forex-trading/provider).
- Press Import Instrument Catalog
Activation is single-active by design: one feed owns the marks that fills are priced against, so turning one on turns every other one off. Before it commits, the endpoint does three things:
- Refuses if the adapter is not implemented in this release.
- Refuses if the credentials are absent from the environment.
- Runs a live credential check, then probes the quote stream for up to 12 seconds.
The stream probe does not block activation — a socket can be transiently down — but its verdict rides out on the response. If you see "WARNING: the quote stream did not connect", stop and fix that before going further. Everything downstream will look like it is working and will refuse every order.
4. Import the instrument catalog
On the same page, press Import Instrument Catalog.
- Press Import Instrument Catalog
Two separate things happen:
Seeding. The addon creates its curated catalog if it is missing — three
session calendars (FX 24/5, US Stocks RTH, CME Metals & Energy), seven symbol
groups (FX Majors, FX Crosses, Metals, Energy, US Stocks, Indices (ETF), Crypto
CFDs) and around 86 instruments: 7 FX majors, 21 crosses, gold, silver, WTI,
Brent, 50 US large caps, 4 index ETFs and 2 crypto CFDs. Everything is created
INACTIVE with correct contract specifications. Existing rows are never
modified, so re-running this is safe and never overwrites your tuning.
Linking. It then pulls the active provider's instrument list and writes the matching provider-side symbol onto each catalog row. Matching is keyed by asset class and pair, deliberately: matching on the pair alone once linked the WTI crude contract to a same-named US penny stock and quoted crude at $3.66 forever.
The response tells you what did not match. Pay attention to strandedActive —
those are instruments already live for customers that this provider cannot
quote. They will go silent.
5. Enable the instruments you want to offer
Admin → Forex Trading → Market Data → Instruments. Everything is INACTIVE
until you promote it.
- Status column — everything starts INACTIVE
The lifecycle is deliberately one-way in places, so that you cannot strand a customer holding an open position:
| From | Allowed next |
|---|---|
INACTIVE |
ACTIVE |
ACTIVE |
CLOSE_ONLY, HALTED, INACTIVE |
CLOSE_ONLY |
ACTIVE, HALTED, DELISTED |
HALTED |
ACTIVE, CLOSE_ONLY |
DELISTED |
nothing — terminal |
Activation is refused unless the instrument carries a symbol mapping for the currently active provider. A mapping for some other, now-inactive vendor does not count; that check exists because such instruments activate cleanly and then either stream nothing or fall through to a heuristic guess.
INACTIVE and DELISTED are refused while open positions exist. Take a market
away through CLOSE_ONLY and wait for it to empty.
Start small. Ten liquid FX pairs plus gold is a complete product; 86 instruments is a wide surface to watch on day one.
6. Review the desk configuration
- Leverage — the group's cap
- Spread markup in pips — your revenue on every fill
- Commission per lot
Market Data → Symbol Groups carries your economics. The seed defaults are conservative but they are defaults, not recommendations:
| Group | Leverage | Spread markup | Commission | Calendar |
|---|---|---|---|---|
| FX Majors | 100 | 1.0 pip | 0 | FX 24/5 |
| FX Crosses | 50 | 1.8 pips | 0 | FX 24/5 |
| Metals | 50 | 3.0 pips | 0 | CME Metals & Energy |
| Energy | 20 | 4.0 pips | 0 | CME Metals & Energy |
| US Stocks | 5 | 0 | 0.02 / lot | US Stocks RTH |
| Indices (ETF) | 20 | 1.0 pip | 0 | US Stocks RTH |
| Crypto CFDs | 10 | 10 pips | 0 | none (24/7) |
There are no account groups seeded. Without one, accounts fall back to a margin-call level of 100% and a stop-out level of 50%. If you want ESMA-style tiers, offshore leverage, or negative-balance protection turned off, create account groups before you take a live customer — see Instruments, groups and sessions.
7. Switch on live trading
Admin → Forex Trading → Settings (/admin/forex-trading/settings).
- Trading — the master switch and delayed-instrument policy
- fxTradingEnabled — turn this on last
- Risk & Data — quote staleness thresholds
- Accounts — which account currencies customers may pick
- Compliance — geo-block list and the risk disclosure
Until this is on, customers can still get a demo account and trade paper money — that is the funnel and it works out of the box. Live accounts cannot be created, funded or traded.
While you are on this screen, check the other tabs:
- Risk & Data — quote staleness thresholds (10s for FX, 30s for stocks).
- Accounts — which account currencies customers may pick. Defaults to
USD, EUR. The currency is fixed for the account's lifetime. - Compliance — the geo-block list (
US, CAby default) and the leveraged trading risk disclosure.
Full definitions are in the settings reference.
8. Confirm the scheduled jobs are running
Admin → System → Cron. Six jobs are registered under the forex_trading
category. Two of them move money:
| Job | Every | What breaks if it stops |
|---|---|---|
processFxSwaps |
1 hour | Overnight financing is never charged. Unsettled rollovers expire uncharged after 7 days. |
reconcileFxAccounts |
5 minutes | Expired pending orders linger, ledger drift goes undetected, equity and margin go stale. |
runFxExecutionReconciler |
60 seconds | A-book only. Broker fills stop being replayed; orphans go unnoticed. |
runFxHedgeMonitor |
60 seconds | A-book only. Hedge account margin is never checked. |
processFxAffiliateRebates |
10 minutes | IB rebates are not awarded. Silent no-op if you run none. |
syncFxCalendarAndNews |
15 minutes | Economic calendar and news stop refreshing. |
The tick engine, the risk engine, the external execution engine and the
reconciler are all single-owner and are arbitrated by a Redis lease named
forex-trading. In a clustered or multi-process deployment only the lease
holder streams quotes and evaluates stop-out. Other processes serve forex data
from the database only. If the leader dies, an operator has to restart the
loser — there is no automatic promotion, because tearing down the quote stream
on a still-serving process would make it refuse every open and close.
9. Smoke test on demo
Do this before you tell anyone the desk is open.
-
Open the terminal as an ordinary user at
/forex-trading/trade. A demo account is provisioned automatically on first visit with 10,000 units of paper money in the first configured account currency. -
Check the markets rail. Instruments should show live prices that move. A symbol showing a badge other than a live price is telling you its quoting state — see Troubleshooting.
-
Place a market buy of the minimum size on EUR/USD. It should fill instantly. Confirm the fill price is worse than the mid — that is your spread markup arriving.
-
Attach a stop loss and a take profit, then move them. Both are validated against the instrument's stops level, so a level too close to the market is refused with the exact distance required.
-
Close the position and open Admin → Forex Trading → Finance → Deals Ledger. You should see an
OPENdeal and aCLOSEdeal, each carrying the executed price, the raw feed bid and ask, and the balance the account was left with. -
Leave a position open past
17:00New York and confirm aSWAPdeal appears within the hour. If it does not, the swap cron is not running or a currency conversion leg is missing.
Production checklist
- Provider activated and the stream probe reported success
- Catalog imported;
strandedActiveempty - Only the instruments you intend to support are
ACTIVE - Symbol groups reviewed — spread markup, leverage, commission, swap policy
- At least one account group exists, with a
defaultForTypeforLIVE - Geo-block list saved deliberately (an empty saved list blocks nobody; a
deleted row resurrects the
US, CAdefault) - Risk disclosure decision made
- All six cron jobs green
-
fxTradingDelayedStocksTradableleft off unless your plan genuinely streams real-time equities - Notification templates reviewed under Admin → System → Notifications:
FxTradingDepositConfirmation,FxTradingWithdrawalStatus,FxTradingMarginCall,FxTradingStopOut - A Super Admin user exists with a working email — every execution alert fans out to Super Admin holders only
- Then, and only then,
fxTradingEnabledon
Next
- Market data providers — choosing and wiring the feed
- Instruments, groups and sessions — the catalog and your economics
- The trading terminal — what customers see
- Troubleshooting — when it does not quote