Documentation on how to integrate other live data/live trading entity?
Michale last edited by backtrader
I would like to integrate some local broker's APIs in my country.
The broker prvides APIs by registering an OCX:
and provides some C++ and C# sample codes.
Are there any documents/tips on this?
Thanks for this great platform.
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
OCXin play I guess you'll have to play with
comtypes. Although there are, at least, 2 major
COMWindows implementations, you are basically on your own.
Visual Chart(https://www.visualchart.com) is also Windows based and uses
COMand the following still holds:
OutOfMemoryErrorexceptions 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
pywin32from scratch or installing a
DLLfrom a non-trusted source, not to mention the lack of proper support for
GCCbased compilers under Windows that Python exhibits)
comtypesbeing pure Python was more up to the task of being a target. It still failed to properly decode complex arrays, so a fork of
comptypeswas 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
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
Oandastore and associated broker and feeds.