Appearance
TradingView chart service
The trade page uses the TradingView charting library. The candles it draws come from one of three places, depending on each market's Chart type setting. One of them is a small Node.js service, chart-udf, which you run next to the platform.
Where candles come from
Each market chooses its chart source in Admin → Markets → edit → Chart (see Markets → Chart):
| Chart type / setting | Candles come from | Served by |
|---|---|---|
| Internal | Trades on your own exchange | The platform, at /tradingview-chart |
| Internal + External chart data on | Binance, MEXC or Bybit, cached | The platform, at /tradingview-chart |
| From liquidity provider | Binance | chart-udf, at /chart.io |
| External custom market | TradingView's own widget for the symbol you name | TradingView |
So you need chart-udf running for every market whose chart type is From liquidity provider. The other types work without it.
The chart-udf service
| Folder | chart-udf/ |
| Start command | npm start (runs node ./src/app.js) |
| PM2 process | chart, a background service in config/pm.php (started by pm:watcher) |
| Port | 8081, or TRADINGVIEW_CHART_PORT |
| Address | https://yourdomain.com/chart.io (through Nginx) |
| Data source | api.binance.com (symbols and candles) |
| Configuration | The platform's main .env (read from the project root) |
It reloads Binance's symbol list every 30 seconds and keeps recent candles in memory.
Install and start it
bash
cd /var/www/exchange/chart-udf && npm ci && cd ..The scheduler's pm:watcher then starts it. To start it right away: php artisan pm:ecosystem && pm2w start storage/app/pm2/ecosystem.json --only chart. Admin → Market services shows it as Chart Data Server, with a health check on /chart.io/time.
Nginx proxy
The browser loads candles from https://yourdomain.com/chart.io/.... Nginx passes those requests to the service. This block goes in your exchange's server { }, as in the installation guide:
nginx
location /chart.io {
proxy_pass http://127.0.0.1:8081;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection 'upgrade';
proxy_set_header Host $host;
}Check it works:
bash
curl -s https://yourdomain.com/chart.io/time # prints a Unix timestamp
curl -s https://yourdomain.com/chart.io/config # prints the chart configurationBuilt-in HTTPS (optional)
You normally don't need this, because Nginx handles HTTPS. If you want the service itself to serve HTTPS (for example without Nginx in front), set:
ini
TRADINGVIEW_CHART_SSL="true"
TRADINGVIEW_CHART_PRIVATE_KEY="/etc/letsencrypt/live/yourdomain.com/privkey.pem"
TRADINGVIEW_CHART_CERT_FILE="/etc/letsencrypt/live/yourdomain.com/fullchain.pem"The service user must be able to read both files. Restart it with pm2w restart chart.
TRADINGVIEW_CHART_SSL must be set
The service reads TRADINGVIEW_CHART_SSL when it starts. If the variable is missing from .env, it crashes on start. Keep the line TRADINGVIEW_CHART_SSL="false" from .env.example.
External chart data and cache warming
With External chart data on, the platform loads candles from the source you pick (Binance, MEXC or Bybit) and caches them. This gives a new market a full price history from day one, even before anyone trades it.
The scheduler runs chart:warm-cache --all every 5 minutes, which refreshes the cache for every market with external chart data, so charts open quickly. You can also warm the cache by hand:
bash
php artisan chart:warm-cache --all
php artisan chart:warm-cache --symbol=BTCUSDT --exchange=mexcChart data requests are limited to 80 per minute per user or IP address, so one visitor can't overload the service.
Troubleshooting empty charts
| Symptom | Check |
|---|---|
| Chart area stays blank on a provider market | pm2w status: is chart online? Does curl https://yourdomain.com/chart.io/time answer? |
chart keeps restarting | pm2w logs chart. Most often TRADINGVIEW_CHART_SSL is missing, or the certificate paths are wrong. |
/chart.io returns 404 | The Nginx location /chart.io block is missing, or Nginx wasn't reloaded |
| "No data" on a provider market | The pair doesn't exist on Binance under that name. Use Internal with External chart data and set the external symbol. |
| "No data" on an internal market | Nobody has traded it yet. Turn on External chart data, or place a first trade. |
| External data chart is empty | The server can't reach the source exchange. Test with curl -I https://api.binance.com. Some hosting regions block Binance; choose MEXC or Bybit instead. |
