Git Product home page Git Product logo

examples's Introduction

QuickFIX/Go Examples

Build Status GoDoc Go Report Card

About

๐Ÿ‘‹ Hi! The code in this project showcases common scenarios for FIX applications. The project is structured as an all-in-one cli application that you can easily install on your machine and use it to explore the mechanics behind sending/receiving simple FIX messages. You can also use the cli app as a rudimentary message validator against your own FIX application.

If you are interested in modifying the examples to suit your own purposes, take a look at the sub-applications descriptions below, navigate to their READMEs to get a better sense of the typical ins and outs of FIX apps, then clone the repo and have at it, otherwise, install the cli app.

  • TradeClient is a simple FIX initiator console-based trading client
  • Executor is a FIX acceptor service that fills every limit order it receives
  • OrderMatch is a primitive matching engine and FIX acceptor service

An initiator service with a web UI for visualizing the quickfix messaging interface can be found in the trader ui repo

All examples have been ported from the original QuickFIX

Usage

This project builds a cli tool qf with 3 commands corresponding to each example. The generalized usage is of the form:

qf [GLOBAL FLAGS] [COMMAND] [COMMAND FLAGS] [ARGS]

The examples are meant to be run in pairs- the TradeClient as a client of either the Executor or OrderMatcher. By default, the examples will load the default configurations named after the example apps provided in the config/ root directory. i.e., running qf tradeclient will load the config/tradeclient.cfg configuration. Each example can be run with a custom configuration as a command line argument (qf tradeclient my_trade_client.cfg).

Installation

In order to use this awesome tool, you'll need to get it on your machine!

From Homebrew

If you're on macOS, the easiest way to get the examples is through the homebrew tap.

brew tap quickfixgo/qf
brew install qf

Run the command qf help in your shell for the list of possible example subcommands.

From Release

  1. Head over to the official releases page
  2. Determine the appropriate distribution for your operating system (mac | windows | linux)
  3. Download and untar the distribution. Shortcut for macs:
curl -sL https://github.com/quickfixgo/examples/releases/download/v{VERSION}/qf_{VERSION}_Darwin_x86_64.tar.gz | tar zx
  1. Move the binary into your local $PATH.
  2. Run the command qf help in your shell for the list of possible example subcommands.

From Source

To build and run the examples, you will first need Go installed on your machine

Next, clone this repository with git clone [email protected]:quickfixgo/examples.git. This project uses go modules, so you just need to type make build. This will compile the examples executable in the ./bin dir in your local copy of the repo. If this exits with exit status 0, then everything is working! You may need to pull the module deps with go mod download.

make build

Run the command ./bin/qf help in your shell for the list of possible example subcommands.

From Snapcraft

Linux OS users can install the examples through the snap store.

sudo snap install quickfixgo-qf

Run the command qf help in your shell for the list of possible example subcommands.

From Scoop

Windows users can install the examples via the Scoop package manager.

scoop bucket add auth0 https://github.com/auth0/scoop-auth0-cli.git
scoop install auth0

Run the command qf help in your shell for the list of possible example subcommands.

Docker Image

The quickfix examples are also available as a docker image here. To pull and run the latest, use the following command:

docker run -it quickfixgo/qf

To run a specific example, you can do something like this:

docker run -it -p 5001:5001 quickfixgo/qf ordermatch

Note: The docker image comes pre-loaded with the default configs. If you want to supply your own, you can specify a volume binding to your local directory in the run command.

Licensing

This software is available under the QuickFIX Software License. Please see the LICENSE for the terms specified by the QuickFIX Software License.


Sponsored by Connamara

examples's People

Contributors

ackleymi avatar cbusbey avatar dependabot[bot] avatar magnaibayarmn avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

examples's Issues

can't seem to figure out how to send orders

I've been able to logon with the client, but can't figure out the structure yet to send orders.

Two minor changes I spotted that needed fixing:
func (e TradeClient) FromApp(msg quickfix.Message, sessionID quickfix.SessionID) (reject quickfix.MessageRejectError) {
fmt.Println("FromApp: ", msg.String()) //This message is in a FIX Message object. not printable directly yet
return
}

and

func (s logonState) FixMsgIn(session *Session, msg Message) (nextState sessionState) {
msgType := new(fix.StringValue)
if err := msg.Header.GetField(tag.MsgType, msgType); err == nil && msgType.Value == "A" {
if err := session.handleLogon(msg); err != nil {
session.log.OnEvent(err.Error())
return latentState{}
}

    return inSession{}
}

session.log.OnEventf("Invalid Session State: Received Msg %v while waiting for Logon", msg.String())
return latentState{}

}

thanks

bug report

Describe the bug
A clear and concise description of what the bug is.

To Reproduce
Steps to reproduce the behavior.
Or even better, a unit test or reproducer.

Expected behavior
A clear and concise description of what you expected to happen.

system information:

  • OS: [e.g. Linux]
  • Go version [e.g. Go 1.16.5]
  • QF/Go Version [e.g. v0.6.0]

Additional context
Add any other context about the problem here.

Example of user / password login?

Is there a Golang example of using user and password? Git history suggests there used to be, but it was removed at some point.

We've been using this happily with v.0.6.0, but in v0.7.0 it has no effect and login never occurs (no error). Our previously working code:

func (e *client) ToAdmin(message *quickfix.Message, sessionID quickfix.SessionID) {
	if msgType, err := message.Header.GetString(tag.MsgType); err == nil && msgType == "A" {
		message.Body.SetBool(tag.ResetSeqNumFlag, true)
		message.Body.SetField(tag.Username, quickfix.FIXString(e.username))
		message.Body.SetField(tag.Password, quickfix.FIXString(e.password))
	}
}

Other examples I can find on the 'net (old StackOverflow questions, QF Java docs etc.) suggest this ought to still work, but it would nice to be sure.

Repeating group fields out of order

Describe the bug

"Repeating group fields out of order (group 268: template is wrong or delimiter 269 not found: expected 2 groups, but found 1)"

To Reproduce
First, I send a fix message with msgType = V to subscribe to the exchange rate data in both bid and offer directions

Then I successfully received the msgType = W message returned by the bank, and the message has data in both bid and offer directions, and the message is correct

However, when the program runs to "marketdatasnapshotfullrefresh.FromMessage(message)" and parses out the message data of msgType = W, and then calls "marketDataMsg.GetNoMDEntries() ", an error occurs, and the error message is as shown above.

Expected behavior
Logically, there should be no error, and the exchange rate data in both bid and offer directions can be successfully obtained.

system information:

  • OS: Mac
  • Go version: Go 1.16.5
  • QF/Go Version v0.6.0

Additional context
I read the ParseMessage() method of the message. In this method, the message data is directly parsed into the Body field, and the Body is a map data structure. It does not support repeating groups. Is it caused by this?

MacosX/Brew install is Broken

Describe the bug

(base) welcome@Traianos-MBP ~ % brew tap quickfixgo/qf
Running `brew update --preinstall`...
==> Auto-updated Homebrew!
Updated 3 taps (hashicorp/tap, homebrew/core and homebrew/cask).
==> New Formulae
micro_inetd                                                                                                     wb32-dfu-updater_cli
==> Updated Formulae
Updated 122 formulae.
==> Updated Casks
Updated 56 casks.

==> Tapping quickfixgo/qf
Cloning into '/usr/local/Homebrew/Library/Taps/quickfixgo/homebrew-qf'...
remote: Enumerating objects: 3, done.
remote: Counting objects: 100% (3/3), done.
remote: Compressing objects: 100% (2/2), done.
remote: Total 3 (delta 0), reused 0 (delta 0), pack-reused 0
Receiving objects: 100% (3/3), done.
Error: Invalid formula: /usr/local/Homebrew/Library/Taps/quickfixgo/homebrew-qf/qf.rb
qf: Calling bottle :unneeded is disabled! There is no replacement.
Please report this issue to the quickfixgo/qf tap (not Homebrew/brew or Homebrew/core):
  /usr/local/Homebrew/Library/Taps/quickfixgo/homebrew-qf/qf.rb:9

Error: Cannot tap quickfixgo/qf: invalid syntax in tap!
(base) welcome@Traianos-MBP ~ % 

To Reproduce
Steps to reproduce the behavior.
Or even better, a unit test or reproducer.

Expected behavior
A clear and concise description of what you expected to happen.

system information:

  • OS: [e.g. Linux]
  • Go version [e.g. Go 1.16.5]
  • QF/Go Version [e.g. v0.6.0]

Additional context
Add any other context about the problem here.

Market data example?

I need to run a FIX service that allows clients to subscribe to receive market data - no need for order entry, the plan is to pull the orderbook from a db - preferable redis or pg - it would be very helpful to have a market data example. I am working on adding this to some of the existing examples but I keep getting "58=Unsupported Message Type"

Add Dockerfiles and publish docker images of examples

Adding Dockerfiles to the project would allow project managers to publish publicly-available docker images of the examples contained in this project.

  • Users requiring one of the examples would not need to clone and build the project, instead, by just running a single docker command a user could boot up an example.
  • https://goreleaser.com/ is a good resource, it allows pushing images to docker easily, and would also support publishing homebrew taps and go binaries to the project's release page.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.