GithubHelp home page GithubHelp logo

jrcg0000 / easyfix Goto Github PK

View Code? Open in Web Editor NEW

This project forked from kizzx2/easyfix

0.0 0.0 0.0 18 KB

Easy to use, low-boilerplate FIX wrapper for QuickFIX with humanized outputs

License: MIT License

Python 100.00%

easyfix's Introduction

easyfix

Easy to use, low-boilerplate wrapper for QuickFIX (initiator only for now).

Motivation

Setting up a FIX application with QuickFIX is a lot of boilerplate. This is your easy fix.

This is mainly intended to experiment and explore with a FIX counterparty, or to be used in test cases. There is no effort made to make this suitable in a high performance setting.

Install

pip install easyfix

QuickFIX is not installed automatically, if you don't have it already:

pip install quickfix

Features

  • Minimalistic API for quick and no fuss FIX API exploration
  • Humanized output: converts enum fields to descriptions -- no more spending hours digging through FIX references
  • Automatically set your sequence number to the needed value if your counterparty tells you "MsgSeqNum too low". Just restarting your app if your connection gets hung usually fixes it.

Usage

More examples at example.py

Initiator

import quickfix as fix
import quickfix44 as fix44
import easyfix

# Enable verbose logging for troubleshooting
# easyfix.enable_logging()

# Finally, no need to create a whole class just to connect to a FIX server!
app = easyfix.InitiatorApp.create('example.cfg')
app.start()

while not app.logged_on:
    time.sleep(0.1)

print("Logged in!")

# Send message using normal QuickFIX messages
m = fix44.SecurityListRequest()
m.setField(fix.SecurityReqID(str(uuid.uuid4())))
m.setField(fix.SecurityListRequestType(fix.SecurityListRequestType_ALL_SECURITIES))
fix.Session.sendToTarget(m, app.session_id)

# Pull messages from a Queue
while m := app.incoming_messages.get():
    # Get field(s) by name
    #
    # Note that this does not consider repeating group hierarchies and dump
    # all fields matching the tag of the name
    #
    # Example output:
    #
    #   ["SecurityList"]
    #   ["BTC/USD", "ETH/BTC"]
    print(app.get_fields_by_name(m, 'MsgType'))
    print(app.get_fields_by_name(m, 'Symbol'))

    # Get "nicely" formatted FIX message dump. Enums are automatically converted to descriptions
    #
    # Example output:
    #
    #   BeginString=FIX.4.4|BodyLength=736|MsgType=SECURITY_LIST(y)|MsgSeqNum=1039|...
    print(app.humanize(m))

Verbose logging

You can get dump of FIX messages by enabling logging:

easyfix.enable_logging()

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.