Python FIX protocol - embed login and request for streaming

I am trying to implement basic FIX queries with a quick fix of python (FIX 4.2), however the documentation is allowed for me to fully understand it (and I did quite a bit of research, links at the end of the question - so please be sure that this is not a question without which digging)

Entry Request --- A

8=FIX.4.2 | 9=108 | 35=A | 34=1 | 49=ACCOUNTXXX | 52=20161116-00:00:15.281 | 56=CNX | 553=ACCOUNTXXXSTR1 | 554=Stater123 | 98=0 | 108=60 | 141=Y | 10=133 |

this will be the expected login response

8=FIX.4.2 | 9=77 | 35=A | 49=CNX | 34=1 | 52=20161116-00:00:17.928 | 56= ACCOUNTXXXSTR1 | 98=0 | 108=60 | 141=Y | 10=140 |

Request for live broadcast in EUR / USD --- B

8=FIX.4.2 | 9=142 | 35=V | 34=8 | 49=ACCOUNTXXX | 52=20161116-12:19:48.269 | 56=CNX | 146=1 | 55=EUR/USD | 262=2016110213351833862 | 263=2 | 264=1 | 265=1 | 266=Y | 267=2 | 269=0 | 269=1 | 10=110 |

The answer will be like this, and I need to process it while maintaining the open socket / stream --- STREAM

8=FIX.4.2 | 9=227 | 35=X | 49=CNX | 34=241 | 52=20161116-12:20:03.651 | 56=ACCOUNTXXX | 262=2016110213351834170 | 268=2 | 279=0 | 269=0 | 278=141 | 55=EUR/USD | 270=1.76371 | 15=GBP | 271=1000000 | 346=1 | 279=0 | 269=1 | 278=142 | 55=EUR/USD | 270=1.76406 | 15=GBP | 271=1000000 | 346=1 | 10=223 | 

send a pulse every 60 seconds - C

8=FIX.4.2 | 9=59 | 35=0 | 34=3 | 49=ACCOUNTXXX | 52=20161116-00:01:15.868 | 56=CNX | 10=054 |

I wanted some tips and some basic code structure on how to configure Python code to send A, B, C and open a socket / stream to read data in STREAM and write it to the console

Where have I already looked?

https://github.com/quickfix/quickfix/blob/master/examples/executor/python/executor.py

https://futures.io/matlab-r-project-python/35213-python-quickfix.html

https://github.com/tianyilai/QuickFix-python-client/tree/master/spec

,

+4
1

A - QuickFix initiator.start(). , , - , PYTHON:

import quickfix

if len(sys.argv) <  2: return          # FAIL to have a mandatory number of args
fileName = sys.argv[1]                 # .SET fileName ( a configuration file )

try:
        settings     = quickfix.SessionSettings( fileName )
        application  = quickfix.MyApplication()
        storeFactory = quickfix.FileStoreFactory( settings )
        logFactory   = quickfix.FileLogFactory(   settings )
        acceptor     = quickfix.SocketAcceptor(   application, storeFactory, settings, logFactory )
        #                      .SocketInitiator( ... )  # Ref. below
        acceptor.start() #-------------------------------

        # while condition == true: do something
        #
        # pass; # onEoLife:

        acceptor.stop() #--------------------------------

except quickfix.ConfigError, e:
        print e

(Cit.:)... , FIX- acceptor, . ...
( ) acceptor SocketInitiator.

settings = quickfix.SessionSettings(fileName) , . . .

B - , 35 = V . MarketDataRequest, , . . . , , , , mssage fix.Session_sendToTarget(message).

C -. , QuickFix .. (, 60 ) fileName. . .

+2

Source: https://habr.com/ru/post/1660979/


All Articles