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. -
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 withcomtypes
. Although there are, at least, 2 majorCOM
Windows implementations, you are basically on your own.Visual Chart
(https://www.visualchart.com) is also Windows based and usesCOM
and the following still holds:-
win32com
(pywin32
) launchedOutOfMemoryError
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 aDLL
from a non-trusted source, not to mention the lack of proper support forGCC
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 ofcomptypes
was needed for full support.- See the fork: https://github.com/mementum/comtypes
- See the pull request (from Apr 9) quietly waiting for integration in the master: https://github.com/enthought/comtypes/pull/104
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 orCOM
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. -