Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

QuickFix Python API - possible to subclass MessageStoreFactory in Python?

How do you subclass the MessageStoreFactory class in Python when using the Python bindings for QuickFix?

When I attempt this the object is not "seen" as a MessageStoreFactory:

NotImplementedError: Wrong number of arguments for overloaded function  'new_SocketInitiatorBase'.
  Possible C/C++ prototypes are:
FIX::SocketInitiator(FIX::Application &,FIX::MessageStoreFactory &,FIX::SessionSettings const &)
FIX::SocketInitiator(FIX::Application &,FIX::MessageStoreFactory &,FIX::SessionSettings const &,FIX::LogFactory &)

This error seems to be returned by SWIG when the types are wrong. (I've only used Boost in the past - is subclassing of a C++ class in Python even possible in SWIG?)

Updated The Python bindings are the ones packaged for Ubuntu 12.04. I'm fairly sure I've got the arguments correct as the error only occurs when I swap out one of the QuickFix objects with the one below when I create a SocketInitiator:

class TestStoreFactory(quickfix.MessageStoreFactory):
    def __init__(self):
        logging.info("TestStoreFactory()")

    def create(self, sessionId):
        logging.info("Create %s"%sessionId)

    def destroy(self, messageStore):
        logging.info("Destroy %s" % messageStore)
like image 245
user611942 Avatar asked Jun 25 '26 23:06

user611942


1 Answers

Got around this problem by placing a call to the base class constructor.

class TestStoreFactory(quickfix.MessageStoreFactory):
    def __init__(self):
        quickfix.MessageStoreFactory.__init__(self)
        logging.info("TestStoreFactory()")
like image 145
user666412 Avatar answered Jun 28 '26 12:06

user666412



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!