Hi, I have a few algorithms in AFL that are sending orders to IBController which are getting to TWS.
From monioring reasons, I want to be able to have some log that shows all orders, including executions but with the additional information which algorithm sent the order.
Doing this on Amibroker side misses execution information. IBController / TWS does not have the algorithm name which gave the order.
Maybe using AFL static variables? Save the OrderId returned by the PlaceOrder function along with the algo name (as defined by you) in static variables. Retrieve these stored algo name + OrderId pairs from all algo's in your log/reporting programme and (i suppose) lookup any other needed order info via OrderId using IB Controller functions.
Although IB API has a field called „OrderRef” it is described as „intended for institutional clients only.” This in theory could allow doing what you are trying to do if IB allows you to use it.
Totaly WRONG. Amibroker and IBController allow you to get anything you want (algo name from AB and anything from TWS using IBController ). You can build your own database and store detail logs for any related activities. This job is not for beginners and usually takes few hundred or even thousand lines of AFL code ( no C++, no dll, no SQL - just AFL)
Thank you all for the answers. I will try to be precise about what I am trying to do.
I actually want to build a portfolio manager. I want to be able to analyze the performance of each algo separately and also their weighted result together. To do this, among other things, I need to get information about the buy, sell, percentage change, position size, entry and exit date, and quantity. And associate each transaction with the algo that executed it. Can this be done through an IB controller? Through the algo code? Through TWS? Through all three together? Is there another way?
Thanks.
But is it possible to see the performance of the different algorithms in these ways?
Thanks.
But is it possible to see the performance of the different algos in these ways?
How does TWS know to associate the transaction with a particular algo?
You can just keep if order numbers returned by PlaceOrder and assign an Algo name to them and store in static variables and/or in files. Totally doable in AFL.