I have recently undertaken the task of developing an automated trading application. After a bit of work on it, I have run into several unforeseen obstacles. I am designing it in C++ in MSVC++ 2005. This is my plan so far (please pardon the huge explaination):
I plan to have three segments of the application (or solution as MS calls it), one is a QuoteRetriever, one is a Trader, and the last is a Backtester. I use IB for a broker and MySQL to store quotes. Since each of these individual projects all have in common the use of an IB interface (either for quote downloading or for transmitting orders), as well as a MySQL interface (for storing the quotes, or for using them for backtesting/signal generation), I decided to write libraries that include useful functions, IB.dll and MySQL.dll.
One of my motives for doing this was to abstract out those components, so incase in the future I decide to change databases or switch brokers, all that is required is a change of the dll, while having all the same function calls in the main applications. I am fairly new to writing dlls, but have written some basic functions with ease. One problem I am facing right now is how to get the IB data into MySQL without having the IB dll directly access the MySQL dll. My goal was to have the QuoteRetriever app load both these libraries, and be a gateway between IB and MySQL. However, recieving data involves the use of callbacks within the IB dll and I am finding it difficult to get the data back to the QuoteRetriever for insertion with the MySQL dll. I attempted to pass a copy of the MySQL object to the IB class, but this had some problems, aside from the fact that giving the IB dll direct access to MySQL eliminated the need for a QuoteRetriever parent application.
The problems I am having writing the QuoteRetreiver application will be the same if I tried to write either of the others, all of them need to use the two libraries in a similar fashion. Is there something here that I am missing, surely this cant be that difficult. I know it would be a lot easier to simplly write one executable for each function, and just integrate each of the components, instead of subdividing them in a way I have. Another thing, how would the Trader app know when to scan for new signals, ideally it would scan everytime there is a new tick, but the challenge then involves letting it know when new data is present.
If anyone could help me get unstuck from this problem I would greatly appreciate it. Also, if you could help me get on the right track by describing how you implemented your solution that would be a great help. Thanks in advance for any help/insight you can provide!
-- Paccc
I plan to have three segments of the application (or solution as MS calls it), one is a QuoteRetriever, one is a Trader, and the last is a Backtester. I use IB for a broker and MySQL to store quotes. Since each of these individual projects all have in common the use of an IB interface (either for quote downloading or for transmitting orders), as well as a MySQL interface (for storing the quotes, or for using them for backtesting/signal generation), I decided to write libraries that include useful functions, IB.dll and MySQL.dll.
One of my motives for doing this was to abstract out those components, so incase in the future I decide to change databases or switch brokers, all that is required is a change of the dll, while having all the same function calls in the main applications. I am fairly new to writing dlls, but have written some basic functions with ease. One problem I am facing right now is how to get the IB data into MySQL without having the IB dll directly access the MySQL dll. My goal was to have the QuoteRetriever app load both these libraries, and be a gateway between IB and MySQL. However, recieving data involves the use of callbacks within the IB dll and I am finding it difficult to get the data back to the QuoteRetriever for insertion with the MySQL dll. I attempted to pass a copy of the MySQL object to the IB class, but this had some problems, aside from the fact that giving the IB dll direct access to MySQL eliminated the need for a QuoteRetriever parent application.
The problems I am having writing the QuoteRetreiver application will be the same if I tried to write either of the others, all of them need to use the two libraries in a similar fashion. Is there something here that I am missing, surely this cant be that difficult. I know it would be a lot easier to simplly write one executable for each function, and just integrate each of the components, instead of subdividing them in a way I have. Another thing, how would the Trader app know when to scan for new signals, ideally it would scan everytime there is a new tick, but the challenge then involves letting it know when new data is present.
If anyone could help me get unstuck from this problem I would greatly appreciate it. Also, if you could help me get on the right track by describing how you implemented your solution that would be a great help. Thanks in advance for any help/insight you can provide!
-- Paccc
