How to Put a Self-Updating Trading Chart on Your Website With a Free API
You are building your website, alone or with an AI assistant, and you want your trading results on it: the growth chart of your account, a few numbers under it. And you want them to stay true next week without touching anything.
The first idea is usually a report: export it from the trading platform, turn it into a chart, upload it. That chart is out of date the day after. This guide shows the other way: your account connected once, and a free API that hands your site the figures, already computed, every time it asks.
🧭 Three Ways to Do It, Compared
| Export a report and upload it | Paste a widget | Read the API | |
|---|---|---|---|
| Stays up to date | No: only when you export again | Yes, on its own | Yes, on its own |
| Design | Whatever you build | Ours, with your theme and colours | Entirely yours |
| Code to write | A reader for the report, the maths, the chart | None | One request and your chart |
| Growth, drawdown, monthly returns | Yours to compute | Ready | Ready, as JSON |
| A visitor can check the numbers | No: the file is yours | Yes: the widget links to the account page | Yes: the line under the chart links to it |
| Price | Free | Free | Free |
If a ready-made chart is enough, the widget is the shortest road: see how to show your MT4 or MT5 results on your website. The rest of this page is the third column: your own chart, in your own design.
🔌 Step 1: Connect the Account, Once
Sign up free, open Add Account in the dashboard and pick your platform. Every connection is read-only: nothing here can open, change or close a trade.
| Platform | How it connects |
|---|---|
| MetaTrader 4 and 5 | The read-only investor password, or our small Expert Advisor on one chart |
| cTrader | One authorisation with your cTrader ID, nothing to install |
| TradeLocker | The login your broker or prop firm gave you |
Your history is imported and the statistics are computed for you. From here on they follow the account: this is the part you never have to do again.
🔑 Step 2: Publish the Account, or Create a Key
The API has two doors, and you choose one.
| Published account | Private account | |
|---|---|---|
| What you do | Set the visibility to Published in the account settings | Create a free Developer API Key under Settings in the dashboard |
| API key | Not needed | Sent with every request |
| Good for | A public track record: the account also gets a page a visitor can check | Numbers you want on your site without a public page |
A key starts with smt_live_ and is shown only once: copy it straight away, and keep it on your server.
📡 Step 3: One Request
curl "https://showmytrades.com/api/v1/accounts/YOUR-ACCOUNT-SLUG?include=equity_curve"
YOUR-ACCOUNT-SLUG is the last part of the address of your account page, https://showmytrades.com/account/YOUR-ACCOUNT-SLUG. The answer looks like this, shortened:
{
"name": "My EURUSD account",
"platform": "MT5",
"currency": "USD",
"balance": 20980.4,
"equity": 20911.15,
"performance": { "twr_percent": 109.88, "max_drawdown_percent": 7.86 },
"equity_curve": {
"daily_performance": [
{ "date": "2025-11-10", "twr_percent": 0.99, "cumulative_balance": 20197.7, "drawdown": 0 },
{ "date": "2025-11-11", "twr_percent": 1.42, "cumulative_balance": 20283.1, "drawdown": 0 }
]
},
"attribution": {
"required": true,
"text": "Data from ShowMyTrades",
"url": "https://showmytrades.com/account/YOUR-ACCOUNT-SLUG"
}
}
| Field | What it is |
|---|---|
performance.twr_percent | The growth of the account in percent, with deposits and withdrawals kept out of the result |
performance.max_drawdown_percent | The deepest fall from a peak, in percent |
equity_curve.daily_performance | One row per trading day: the growth so far, the balance, the equity, the drawdown |
attribution | The line to show next to the data, with its link |
🖥️ Step 4: A Small Function on Your Server
The request goes from your server, not from the visitor's browser: a key must stay secret, and browsers cannot call this API from another site anyway. The function asks the API every five minutes and keeps the answer, so your page stays fast.
import { createServer } from 'node:http'
const SLUG = 'YOUR-ACCOUNT-SLUG'
const KEY = process.env.SHOWMYTRADES_KEY // only for a private account
let cache = { at: 0, body: null }
async function tradingResults() {
if (Date.now() - cache.at < 5 * 60 * 1000) return cache.body
const response = await fetch(
`https://showmytrades.com/api/v1/accounts/${SLUG}?include=equity_curve`,
{ headers: KEY ? { Authorization: `Bearer ${KEY}` } : {} }
)
if (!response.ok) return cache.body // keep showing the last good answer
const account = await response.json()
cache = {
at: Date.now(),
body: JSON.stringify({
name: account.name,
growth: account.performance.twr_percent,
maxDrawdown: account.performance.max_drawdown_percent,
days: account.equity_curve.daily_performance.map(day => ({
date: day.date,
growth: day.twr_percent,
drawdown: day.drawdown
})),
attribution: account.attribution
})
}
return cache.body
}
createServer(async (request, response) => {
if (request.url !== '/trading-results.json') {
response.writeHead(404).end()
return
}
const body = await tradingResults()
response.writeHead(body ? 200 : 502, { 'Content-Type': 'application/json' }).end(body ?? '{}')
}).listen(3000)
This is plain Node.js, with nothing to install. The same few lines work in any language that can make an HTTPS request: for WordPress there is a ready shortcode in PHP.
🎨 Step 5: Draw the Chart
Your page reads the small file your server prepared and draws it. This example uses Chart.js. Any charting library does the same job.
<canvas id="growth"></canvas>
<p id="source"></p>
<script src="https://cdn.jsdelivr.net/npm/chart.js"></script>
<script>
fetch('/trading-results.json')
.then(response => response.json())
.then((data) => {
new Chart(document.getElementById('growth'), {
type: 'line',
data: {
labels: data.days.map(day => day.date),
datasets: [{ label: 'Growth %', data: data.days.map(day => day.growth) }]
}
})
// The line under the chart: text and link come ready in the answer.
const link = document.createElement('a')
link.href = data.attribution.url
link.textContent = data.attribution.text
document.getElementById('source').append(link)
})
</script>
That is the whole integration. From now on the chart follows the account: you trade, the statistics are recomputed, your server picks them up at its next request, and the visitor sees them.
➕ More Data in the Same Request
Add sections to include, separated by commas. It is still one request.
| You want to show | Ask for |
|---|---|
| The growth, balance or drawdown curve, day by day | equity_curve |
| Monthly and yearly returns, and "this month so far" | monthly |
| Results per instrument | by_symbol |
| Results per Expert Advisor, on MT4 and MT5 | by_magic_number |
| Profit factor, expectancy, Sharpe ratio and the other risk metrics | advanced |
| Growth after every single trade | twr |
The format is the same for MT4, MT5, cTrader and TradeLocker, so a site that shows several accounts needs one piece of code. For more accounts on one page, see how to show multiple trading accounts on one page.
🤝 What the API Asks in Return
On the free plan, one visible line next to the data: Data from ShowMyTrades, with a link. The example above prints it already. On the Pro and Ultra plans the line is optional.
It is worth keeping either way. For a published account the link leads to the account page on ShowMyTrades, where a visitor finds the same figures on a page you do not control. A chart you drew yourself, with nothing behind it, asks the reader to take your word. A chart with that link does not.
🤖 If an AI Assistant Is Building Your Site
Give it this page, or these lines:
Show my trading results on my site with the ShowMyTrades API. Do not parse an exported report.
1. The account is connected at https://showmytrades.com (free, read-only).
2. Published account: no API key. Private account: a Developer API Key, sent as
"Authorization: Bearer smt_live_..." from server-side code only.
3. GET https://showmytrades.com/api/v1/accounts/{slug}?include=equity_curve
4. Call it from the server, cache the answer for 5 minutes, draw equity_curve.daily_performance
(date, twr_percent).
5. Print attribution.text linked to attribution.url next to the chart.
Full steps: https://showmytrades.com/docs/api/show-trading-results-on-your-website
An assistant left alone often proposes a script that reads a MetaTrader report. It works on the day it is written. With the API the assistant writes less code, and the chart keeps working after it has finished.
❓ FAQ
Is the API really free? Yes. Connecting the account, the API and the widgets cost nothing. You can make 30 requests per minute with a free key, and 20 per minute per IP address without a key: far more than a site that asks every five minutes needs. The Pro and Ultra plans raise the limit and make the line "Data from ShowMyTrades" optional.
Do I need an API key? Not for a published account: the request works with no key at all. A private account needs a free Developer API Key, created in the dashboard.
How often is the data updated? The statistics follow the account as trades close. Asking every five minutes, as in the example, is plenty for a chart of daily results.
Can I call the API straight from the browser? No. Call it from your server and pass the result to your page, as in the example. A key in the browser would be visible to anyone, and browsers cannot call this API from another site.
Does it work with cTrader and TradeLocker too? Yes. The answer has the same format on every platform.
Can the API place or close trades? No. It is read-only, like the connection to your account.
I would rather not write any code. What then? Use a widget: one snippet to paste, and it updates on its own too.
🔗 Related Guides
- MT4 and MT5 account data as JSON: every endpoint, with examples in cURL, Python and JavaScript
- Your trading results in Google Sheets: the same data in a spreadsheet, on a timer
- How to add live trading results to WordPress: the widget, and a PHP shortcode for the API
- How to build a track record page: what to put around the chart
- Show your trading results on your website: the step-by-step in the API documentation
Connect your account free, make one request, and your site has a chart that keeps itself up to date.
A Free Economic Calendar API for Trading Bots
Where a trading robot can get the economic calendar: the sources people use, what breaks with each, and a free API with no key built for polling from Expert Advisors, cBots, Python and JavaScript.
MT4 and MT5 Account Data as JSON: a Free API for Your Trading Statistics
MetaTrader has no web API for your own account. How to read the balance, equity, growth, drawdown, monthly returns, closed trades and open positions of an MT4 or MT5 account as JSON, with a free REST API. Examples in cURL, Python and JavaScript.