Quickfix protocol in python
Quickfix official website: quickfixengine.
Quickfix python API install
Orignially, quickfix is a C++ implementation. So, quickfix module in python is an API to call class and functions of C-module.
For Windows
For windows, no offical guide for compilation yet. Easiest way is using offical built binary package (python 2.7):
x86 & amd64
Installation: pip install quickfix-1.14.3-cp27-none-win_amd64.whl
For Linux
Requirement: gcc, gcc-c++, python-devel (centOS 6)
Installation: pii install quickfix
. Then compilcation will start automatically.
Specail case in VPS or Cloud server. Since for a virtual instance, the memory may be small, say less than 1G. Swap is disable by default. Thus, an error might occur because of lack of memory.1
gcc: Intermal error: Killed (program cc1plus)
To temporarily increase the swap memory:1
2
3dd if=/dev/zero of=/var/swapfile bs=64M count=32 #Creating 4G memory
mkswap /var/swapfile
swapon /var/swapfile
To release aforementioned memory:1
2swapoff /var/swapfile
rm /var/swapfile
For Cygwin
The way is same as for linux: pip install quickfix
Usage of quickfix module
For python, an application should be built as shown in the doc.
Some usage to get message field:1
2
3
4
5
6
7
8
9
10import quickfix as fix
msgType = fix.MsgType() # Define msgType
sendingTime = fix.SendingTime() # Define sendingTime
message.getHeader().getField(msgType)
message.getHeader().getField(SendingTime)
# To obtain value
msgType.getValue()
sendingTime.getString()