Documentation on how to integrate other live data/live trading entity?



  • Hi,
    I would like to integrate some local broker's APIs in my country.
    The broker prvides APIs by registering an OCX:

    regsvr32 XXXXQuote.ocx
    

    and provides some C++ and C# sample codes.

    Are there any documents/tips on this?
    Thanks for this great platform.


  • administrators

    There isn't documentation as such, given the differences found in different platforms.

    Oanda (https://www.oanda.com) was the last integration and was at the same time an effort to try to streamline the interfaces and make it as generic as possible. I would have a look at it.

    But being your provider Windows based and with OCX in play I guess you'll have to play with comtypes. Although there are, at least, 2 major COM Windows implementations, you are basically on your own. Visual Chart (https://www.visualchart.com) is also Windows based and uses COM and the following still holds:

    • win32com (pywin32) launched OutOfMemoryError exceptions because it wouldn't fully understand a type.

      Although the type was properly decoded, it was clearly going to be a headache and meant fiddling directly with C++ for any needed modification (the major problem being other people compiling pywin32 from scratch or installing a DLL from a non-trusted source, not to mention the lack of proper support for GCC based compilers under Windows that Python exhibits)

    • comtypes being pure Python was more up to the task of being a target. It still failed to properly decode complex arrays, so a fork of comptypes was needed for full support.

    Hopefully your provider is using simpler types and nothing breaks with the standard distributions.

    For implementation, the following pattern was chosen:

    • Store: is an entity which should be the only one talking to the data/broker provider, be it interfacing with sockets or COM

    Both the data feed and the broker rely on calling the store and receiving events from it (yes it has to run in a separate thread) to make the information available to the platform.

    The suggestion would be to look at the patterns in the Oanda store and associated broker and feeds.


Log in to reply
 

Looks like your connection to Backtrader Community was lost, please wait while we try to reconnect.