Build notes

Real-Time Forex Data Feed for a Website: What Three Months Taught Me About Licensing

Batdorj Byambadorj · · 5 min read

I have traded forex for nineteen years, and somewhere in there I became a web developer. I put the two together and tried to build something small: a web page where you draw a trendline on a live chart, close the tab, and get a Telegram message when price reaches it.

The code worked. The project changed shape anyway, and the reason was not technical. It was permission — three separate permissions, stacked, and I found out about them in the wrong order. This is what I would tell anyone about to start the same thing.

What I built

  1. Ticks left a trading terminal over a socket.
  2. A Linux server turned them into candles on nine timeframes and kept five thousand of each.
  3. A websocket pushed the live bar to the browser.
  4. You dragged a trendline onto the chart.
  5. A few hundred milliseconds after price crossed it, a message arrived in Telegram.

Twenty symbols. It ran for weeks at a time without me touching it, and the gaps it did have came from the broker's side rather than mine. As a piece of engineering it did what I wanted.

Then I asked the question I should have asked in week one: am I allowed to show these prices to anyone?

First answer: the platform licence

The reply came in writing, and it was not really about my broker at all. The price feed inside a retail terminal is licensed to the person using that terminal. Streaming it onto a public chart breaks the licence of the platform software itself.

The important word is platform. The restriction does not live in one firm's policy, so moving to another broker on the same platform changes nothing — the same agreement is waiting there.

That one sentence killed the plan I had been quietly relying on: if this one says no, I will find one that says yes. There was nothing to shop for.

Second answer: a different platform

So I moved to a platform with a free, documented API for reading prices. Its terms carry no ban on redisplaying them, and the platform's own material lists price alert systems and charting tools as things people should build with it. My application was approved.

For about a week I thought the problem was solved.

Third answer: the broker's agreement

It was not, because platform permission and broker permission are two different permissions.

The platform decides whether you may connect. The prices still belong to the firm sending them, under the client agreement you signed — and those agreements tend to carry two clauses: the platform is for your personal use, and you may not supply any part of it to a third party.

A public chart supplies it to third parties.

One broker did not refuse. I wrote properly: here is the read-only connection, here is the label crediting you, here is a page that sends you clients. The request went to compliance, then to marketing, and came back with a figure — about two thousand dollars a month, which I could offset against commission from clients I referred.

I did that arithmetic once. At the rebate I would be earning, offsetting it meant sending them roughly five hundred lots of turnover every month. For a free tool with no users yet, that is not a price. It is a polite no with a spreadsheet attached.

Fourth answer: a licensed data vendor

There is a legitimate way to buy your way out of all this, so I asked what it costs. A licensed market data vendor quoted about a thousand dollars a month, half that for the first year on a twelve-month commitment. They confirmed in writing that the package covered both things I needed: showing prices publicly, and evaluating alerts on the server.

One detail there is worth more than the number. Their cheap individual plan does not cover public display. If you are reading a forty-dollar price list and picturing a public chart, you are reading the wrong page.

My budget at the time was about fifty dollars a month.

What I had actually got wrong

I spent three months treating market data as a technical problem. Getting ticks is a technical problem, and not a hard one. Being allowed to show them to a stranger is a commercial one, and it turns out to be the entire business. The feed in your terminal is free to look at and expensive to pass on, and no amount of good engineering moves that line.

The second mistake is cheaper to fix. Every answer I got came out of a plainly worded email. I could have sent the first one in week one instead of week twelve, and I would have built something different.

What I did instead

I did not find a better deal. I changed where the software runs.

The alert engine moved into the trader's own terminal, as an Expert Advisor. It reads the prices your broker already sends you, under the licence you already have, on your own computer, and evaluates your lines there. Nothing is redistributed, because there is no feed of mine to redistribute. The permission question does not get a better answer — it stops existing.

The web version is not gone. It is preserved in full under a git tag, three months of it, and if I ever buy properly licensed data it comes back in an afternoon.

What I would read before writing any code

Three documents decide whether a public price display is allowed. I reached all three after the system was already running.

  1. The platform licence — whether data from the terminal may be shown publicly at all.
  2. The broker's client agreement — the personal-use clause and the third-party clause.
  3. The vendor's plan, if you buy data — whether public display and server-side evaluation are both included, confirmed in writing rather than inferred from a price page.

Showing a real-time forex price on a public web page is a licensing question before it is a technical one. That is the whole of what three months bought me.

Batdorj Byambadorj

Batdorj Byambadorj has been trading forex for his own account since 2007, mostly gold. He is the sole developer of fx-alert and writes every article on this site himself.

About the author

← All articles