What the FIX? A steamy look at how Newton works under the hood

Dustin Walper
Newton Crypto
Published in
5 min readFeb 20, 2019

In addition to charging no trading or funding fees, Newton also offers some of the best crypto prices in Canada. How the $#% is that even possible?

Check out our website or download Newton on the app store.

Don’t reinvent the wheel

When you peek under the hood of most crypto trading platforms, one thing becomes painfully obvious: they’re not very good.

The concept of cryptocurrency originally emerged from the computer science world as a fascinating blend of applied cryptographic techniques. Most early crypto enthusiasts didn’t come from Wall Street, and had little familiarity with the way traditional electronic trading systems worked. Rather than using systems that were battle-tested, many companies opted to write their own order systems using a mix of technologies (like NodeJS, for example) that are not typically used for high-volume trading applications.

Traditional trading systems are optimized, not for milliseconds, but for micro and even nano-seconds.

Wall Street firms have poured an inordinate amount of time and energy into developing rock-solid systems for trading everything from potatoes to complex derivatives. They’ve standardized on a protocol, called FIX (Financial Information eXchange, a truly imaginative name), and built blazingly fast trading systems around it using Java, C++, and C. They’ve optimized not for milliseconds, as is typical on the web, but for micro and even nano-seconds.

But what, exactly, is FIX?

Here’s what a raw FIX message might look like (taken from the NYSE guide) for placing a market order to buy 100 shares of AXU:

8=FIX.4.2|9=137|35=D|34=47|49=LEH_LZJ02|52=20100303–15:38:27|56=CCGA 115=LZJ|11=NF 0045/03032010|54=1|38=100|55=AXU| 40=1| 59=0| 1=ABC123ZYX| 21=1|207=A|47=A|10=122|

In contrast, a typical JSON format for a web API might look something like this:

{ “symbol”: “AXU”, “volume”:100, “order_type”: “market”, “date”: “2010:03:03”, “side”: “buy”, … }

FIX is designed to pack a standardized set of information into as small a format as possible. For example, the fix “tag” for specifying the symbol AXU is just an integer: 55. Both parties have a copy of the schema that defines how that integer is interpreted, meaning there’s no need to pass extraneous schema information along with the message itself.

FIX is also a stateful protocol, since sequencing matters a lot when it comes to trading. Each message comes with a sequence number (47 in this case, where 34 is the sequence “tag”), which is carefully tracked by both the client and the server as messages fly back and forth over a TCP socket connection. This is unlike RESTful web APIs which are meant to be stateless by design.

There’s nothing inherently special about FIX itself — in fact, the protocol is quite old — but setting an industry-wide standard has allowed developers to build hyper-optimized systems that scale to crazy volumes. Order execution systems built around FIX can handle 100s of thousands or even millions of FIX messages per second on a single machine.

Why speed matters

If you’re a market-maker, like Newton, you set a price you’re willing to buy and a price at which you’re willing to sell every asset, and the difference between two prices is called the spread. Market makers earn their profit on the spread (as well as some other techniques which we’ll discuss shortly).

The slower your system, the larger your spread needs to be.

Cryptocurrency prices are very volatile and can easily shoot up or down by several percentage points in a matter of seconds. The slower your system, the larger your spread needs to be to account for the risk that market prices will shoot up or down after you’ve given a price to your customers. The higher the spread, the more expensive it is for your customers to trade with you.

When you see a price on Newton, that price is good for up to 3BTC (which is represented in our internal order book), with further blocks available at increasing order sizes (usually 5BTC and 8BTC, or their ETH/LTC equivalent) with slightly wider spreads.

We interface with dozens of external crypto venues for liquidity, as well as our OTC desk, internal liquidity, and customer liquidity. We then use hyper-optimized, proprietary market-making algorithms written to distill this down into a price we offer to our customers. These price updates stream in hundreds or even thousands of times per second, allowing us to offer a very narrow spread between the buy and the sell price.

We can only do this because every piece of the chain is built with speed in mind. Slower speed = wider spreads, which is why most brokerages have spreads 2–3x wider than what Newton offers (our spread averages +/- 50 basis points, or 0.5%). Doing this with anything other than a battle-hardened order system would take years of unnecessary effort.

A crash course in arbitrage

One surprising result of this market-making wizardry is that we can sometimes make money when our spread is close to zero. This is because we are continuously looking for arbitrage opportunities — whether they are between USD/crypto prices on multiple global exchanges, or differences between those prices and the current CAD/USD exchange rate, or more complex forms of arbitrage that take advantage of futures. These opportunities rarely last for more than a fraction of a second.

But why is arbitrage good for customers? Skillfully done, arbitrage allows us to keep our spreads even tighter than they might otherwise be given prevailing market conditions. We set a fixed profit target and, if there are arbitrage opportunities, can often pass them on to customers by narrowing our spread even further while still hitting our target.

What the future holds

Our order system currently supports a range of order types commonly seen on stock exchanges (e.g. limit orders, stop orders, etc.), and we’re in the process of opening up these order types to Newton users to allow them to engage in more advanced trading strategies.

In the near future we’ll be opening up an advanced API so users can write their own blazingly fast trading algorithms in their language of choice. We may even offer a few sample bots built by our in-house algorithmic traders. With no trading fees and super-tight spreads, we hope users can cook up trading strategies that simply wouldn’t be profitable anywhere else.

What other advanced features would you like to see? Head over to the Newton subreddit and let us know!

--

--

Dustin Walper
Newton Crypto

CEO @ Newton. Founder @ Akira (acquired by Telus Health). Co-Founder @Myplanet.