Support Board
Date/Time: Sun, 24 Nov 2024 13:01:03 +0000
Post From: ACSIL Trade Fill List
[2014-04-26 03:31:58] |
QnReally - Posts: 181 |
Here is what I have looked into so far. Method 1: Using the trades from sc.scGetTradeListEntry() The fills seem to be matched and trades seem to be split when appropriate. I can work with that probably. I tried various sequences of fills to test out how the data available via sc.scGetTradeListEntry() would show up. I ran into one minor issue. I entered the following fills in a succession: -1, -2, and -1. So that is a total of short 4 contracts. As I expected, I saw three rows in the Trade Activity Log. Then I executed +2. The first -1 entry got matched with +1 (one of the 2 long contracts) and that showed up as a completed trade. The -2 entry got matched with the remaining +1. I expected that trade to be split here into two -1's because in my other trials with different sequences of shorts and longs with various sizes, the trades seem to be getting split. I am using FIFO method in the General Trade Settings window for matching the fills. See this image: http://screencast.com/t/eZASw1xIF2p Because this trade is not being split, I don't have the ExitDateTime for the partially filled trade. This is making the sorting of the fills a guess work. Method 2: Using the orders with Filled status from sc.GetOrderByIndex() The orders are not indexed by the LastActivityTime, I believe the default index is sorted by the time the order was placed. So, in order to put together a time sequence of fills I would have to first get all the orders for the day and sort them by the LastActivityTime inside my study. Once I have that, I can take the current position and go backwards in time until the position becomes zero. That would be the start of my trade. However, this is grossly inefficient because I have to go through all these steps each time I call the study and I have to figure out how many orders there in total by looping through sc.GetOrderByIndex() until it gives me an error. I can make minor efficiency changes but the partially filled orders can cause problems if I don't process all the orders each time. I tried to save the buy fills into BuyPrice and BuyQuantity subgraphs and the sell fills into SellPrice and SellQuantity subgraphs in the study. This way the fills would automatically be time sequenced. However, this causes efficiency problems too because whenever I have an event that triggers processing of all orders again (such as partially filled orders or some old order getting filled much later), I have to first zero out all the subgraphs for each bar in the chart before populating them again. I would really appreciate any guidance you can provide. Thanks. Also, is there a technical issue or a licensing issue with your partners in providing access to the fills other than the fact that it would be considered as an enhancement? If you were to consider this enhancement, is it a lot of work to get it in and to test? The fills are much more atomic than the orders and trades and they will naturally be in a time sequence and that is the most basic information the exchange provides. I am making a case to add this enhancement in the future. If you have further questions or if you have suggestions, please let me know. Thanks. |