DZone
Thanks for visiting DZone today,
Edit Profile
  • Manage Email Subscriptions
  • How to Post to DZone
  • Article Submission Guidelines
Sign Out View Profile
  • Post an Article
  • Manage My Drafts
Over 2 million developers have joined DZone.
Log In / Join
Please enter at least three characters to search
Refcards Trend Reports
Events Video Library
Refcards
Trend Reports

Events

View Events Video Library

Zones

Culture and Methodologies Agile Career Development Methodologies Team Management
Data Engineering AI/ML Big Data Data Databases IoT
Software Design and Architecture Cloud Architecture Containers Integration Microservices Performance Security
Coding Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks
Culture and Methodologies
Agile Career Development Methodologies Team Management
Data Engineering
AI/ML Big Data Data Databases IoT
Software Design and Architecture
Cloud Architecture Containers Integration Microservices Performance Security
Coding
Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance
Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks

The software you build is only as secure as the code that powers it. Learn how malicious code creeps into your software supply chain.

Apache Cassandra combines the benefits of major NoSQL databases to support data management needs not covered by traditional RDBMS vendors.

Generative AI has transformed nearly every industry. How can you leverage GenAI to improve your productivity and efficiency?

Modernize your data layer. Learn how to design cloud-native database architectures to meet the evolving demands of AI and GenAI workloads.

Related

  • Enhancing Code Clarity With Python Namedtuples
  • What Is API-First?
  • Supervised Fine-Tuning (SFT) on VLMs: From Pre-trained Checkpoints To Tuned Models
  • Enhancing Business Decision-Making Through Advanced Data Visualization Techniques

Trending

  • Creating a Web Project: Caching for Performance Optimization
  • Manual Sharding in PostgreSQL: A Step-by-Step Implementation Guide
  • How to Merge HTML Documents in Java
  • Agile’s Quarter-Century Crisis
  1. DZone
  2. Data Engineering
  3. Data
  4. Building Custom Solutions vs. Buy-and-Build Software

Building Custom Solutions vs. Buy-and-Build Software

This article explores building custom solutions vs. buy-and-build software and describes the challenges of building a FIX engine.

By 
Rob Austin user avatar
Rob Austin
DZone Core CORE ·
Updated Mar. 09, 23 · Analysis
Likes (5)
Comment
Save
Tweet
Share
1.7K Views

Join the DZone community and get the full member experience.

Join For Free

The Challenges of Building a FIX Protocol

The first day I was introduced to FIX was when I worked at an investment bank in London as a developer, I was told to write a feed handler to retrieve market data. Bear in mind that at this time, I knew nothing about FIX, apart from googling it for about 10 mins on the internet. With a touch of overconfidence and slight arrogance, I set to work coding a direct socket connection to the remote FIX endpoint, thinking, “How hard could it be?”

So, What Is FIX? 

Financial Information eXchange (FIX) is both a market data format and a protocol: it is used by investment banks to place orders and receive market data and has become a global language in financial trading. The format of a FIX message controls how it is encoded. All FIX messages start with 8=FIX, which denotes the start of a FIX message. They then go on to list key and value pairs. The keys are represented as numbers (known as TagNumbers) followed by a = delimiter to delimit the values. Each key=value combination is then delimited by the \u0001 character, which is sometimes visually represented as either ^ or |. The value is often written in a semi-human-readable format. I say semi-human readable because most of the time it is human-readable, but all too often, FIX will use a single character to denote a state or type of message. These characters are not always that obvious. I agree that the character B for "Buy" and S for "Sell" makes sense, but other characters are used that make no sense. For example, D denotes a "New Order Single" message, which is a message that is often used when you wish to place an order with your counterparty. 

An example FIX message in FIX format

Image 1: An example FIX message in FIX format

When it comes to the FIX protocol, you have to be careful, as it turns out to be much more involved than just having the correct FIX message format and being able to decode the key=value pairs. The protocol also includes ensuring the counterparty has successfully logged in and that any missed messages are retransmitted. It also requires support for gap fills and sequence resets. 

Back again to the coding: The first challenge was to get past the login phase. It looked like this login message was mandatory! Over time, I managed to put together enough of a login message that the other end came back with a login reply, but it was not long before my colleagues started taunting me, saying, “Why don’t you just use Quick/FIX4J?”

Saving face and trying not to show that I knew nothing about QuickFIX, I quietly down my IDE and jumped back onto the web browser. While doing a bit of research about QuickFIX, I was thinking, “Perhaps using this open-source library could be simpler than implementing it all myself," and, “Maybe it’s going to take me longer to understand how to use this library.”

The library was extensive, and they clearly put a lot of work into it, but I was overwhelmed by how complicated it all looked. I thought, "Does it really need to be like this?"

At the time, I was working alongside a team of developers that I looked up to. These guys stood by the “no code is the fastest code” mantra. Everything they wrote was super optimal: they would work with raw byte buffers rather than create unwanted objects, and their Java code looked more like "C" code than any Java I had ever seen before.

So, I got back to my PC and proceeded to implement the lightweight raw byte buffer parser route. Over the next few weeks, I was starting to get end-to-end data going through the FIX adapter, and when I was finished, it screened.

Now looking back on those early days, I ponder,  "Did I make the right decision? Should I have implemented it myself?" The answer is, I think, yes. It was best to implement the custom simple, lightweight solution that I ended up with, but I only got away with it because I had an extremely simple FIX use case. I was only connecting a single session to a single counterparty with a single version of FIX and, apart from the login and heartbeat messages, just a single message.

My problem would have been if later this was to be upgraded to another FIX version, we had to support resend-requests, sequence resets, and gap fills, or offer production support and a dashboard where administering existing running sessions on the live system.

Example dashboard for FIX sessions

Image 2: Example dashboard for FIX sessions

At this point, it becomes a serious undertaking, and it starts to make more sense to turn to a tried and tested solution, already with all these bells and whistles, to use products with the ability to search historic FIX messages: 

Searching for all FIX messages with a given client order id

Image 3: Searching for all FIX messages with a given client order id

Or, to raise alerts when sessions disconnect:

Alerts being raised in FIX UI

Image 4: Alerts being raised in FIX UI

Not long after, I joined a company founded by Peter Lawrey. Peter is one of those super-optimal developers I mentioned earlier. He developed the widely used open-source software Chronicle Queue and Chronicle Map. Together, we set to work and built such a FIX engine that has all these bells and whistles, and in doing so, we also built a company that has grown to a team of over 20 people.

Looking back, developers can save time and effort using a buy-and-build software solution. As mentioned, I would have been stuck if we had wanted to provide production support with my simple solution. Moreover, I certainly would have needed more time to build a UI. The lesson learned was: “Sometimes time spent reinventing the wheel results in a revolutionary new rolling device. But sometimes it just amounts to time spent reinventing the wheel.”

Open-source software Communication protocol Software build Data (computing)

Published at DZone with permission of Rob Austin. See the original article here.

Opinions expressed by DZone contributors are their own.

Related

  • Enhancing Code Clarity With Python Namedtuples
  • What Is API-First?
  • Supervised Fine-Tuning (SFT) on VLMs: From Pre-trained Checkpoints To Tuned Models
  • Enhancing Business Decision-Making Through Advanced Data Visualization Techniques

Partner Resources

×

Comments
Oops! Something Went Wrong

The likes didn't load as expected. Please refresh the page and try again.

ABOUT US

  • About DZone
  • Support and feedback
  • Community research
  • Sitemap

ADVERTISE

  • Advertise with DZone

CONTRIBUTE ON DZONE

  • Article Submission Guidelines
  • Become a Contributor
  • Core Program
  • Visit the Writers' Zone

LEGAL

  • Terms of Service
  • Privacy Policy

CONTACT US

  • 3343 Perimeter Hill Drive
  • Suite 100
  • Nashville, TN 37211
  • support@dzone.com

Let's be friends:

Likes
There are no likes...yet! 👀
Be the first to like this post!
It looks like you're not logged in.
Sign in to see who liked this post!