void m_ts_OrderFilled(object sender, OrderFilledEventArgs e) { string Tag = e.Fill.OrderTag; int RowIndex = TagList.IndexOf(Tag); DataRow RelevantRow = SummaryTable.Rows[RowIndex]; string Alias = RelevantRow.Field <string>("Alias"); if (!TA.Strategy.CheckIfStrategyExist(alias: Alias, conn: conn)) { TA.Strategy.GenerateDbStrategyFromAlias(alias: Alias, descriptionString: RelevantRow.Field <string>("DescriptionString"), conn: conn); } int TradeQuantity; if (e.Fill.BuySell == BuySell.Buy) { TradeQuantity = e.Fill.Quantity; } else { TradeQuantity = -e.Fill.Quantity; } if (e.Fill.IsAutospreaderSyntheticFill) { RelevantRow["Position"] = RelevantRow.Field <int>("Position") + TradeQuantity; RelevantRow["WorkingOrders"] = RelevantRow.Field <int>("WorkingOrders") - TradeQuantity; RelevantRow["WorkingOrderKey"] = ""; return; } Instrument Inst = AutoSpreaderList[RowIndex].InstrumentDictionary[e.Fill.InstrumentKey]; string TickerDB = TA.TickerConverters.ConvertFromTTAPIFields2DB(Inst.Product.ToString(), Inst.Name.ToString()); string TickerHead = TA.TickerheadConverters.ConvertFromTT2DB(Inst.Product.ToString()); TA.Strategy.LoadTrade2Strategy(ticker: TickerDB, trade_price: (decimal)TA.PriceConverters.FromTT2DB(ttPrice: Convert.ToDecimal(e.Fill.MatchPrice.ToString()), tickerHead: TickerHead), trade_quantity: TradeQuantity, instrument: "F", alias: Alias, conn: conn); IFSLogger.Log(Alias + ": " + TradeQuantity.ToString() + " " + TickerDB + " for " + TA.PriceConverters.FromTT2DB(ttPrice: Convert.ToDecimal(e.Fill.MatchPrice.ToString()), tickerHead: TickerHead).ToString()); }
void m_ts_OrderFilled(object sender, OrderFilledEventArgs e) { string Tag = e.Fill.OrderTag; int RowIndex = TagList.IndexOf(Tag); string Alias = SummaryTable.Rows[RowIndex].Field <string>("Alias"); //ASENameList[RowIndex]. if (!TA.Strategy.CheckIfStrategyExist(alias: Alias, conn: conn)) { TA.Strategy.GenerateDbStrategyFromAlias(alias: Alias, descriptionString: SummaryTable.Rows[RowIndex].Field <string>("DescriptionString"), conn: conn); } // ProducttKey and SeriesKey are seperately accesible if (e.Fill.IsAutospreaderSyntheticFill) { return; } Instrument Inst = AutoSpreaderList[RowIndex].InstrumentDictionary[e.Fill.InstrumentKey]; string TickerDB = TA.TickerConverters.ConvertFromTTAPIFields2DB(Inst.Product.ToString(), Inst.Name.ToString()); string TickerHead = TA.TickerheadConverters.ConvertFromTT2DB(Inst.Product.ToString()); decimal TradeQuantity; if (e.Fill.BuySell == BuySell.Buy) { TradeQuantity = e.Fill.Quantity; } else { TradeQuantity = -e.Fill.Quantity; } TA.Strategy.LoadTrade2Strategy(ticker: TickerDB, trade_price: (decimal)TA.PriceConverters.FromTT2DB(ttPrice: Convert.ToDecimal(e.Fill.MatchPrice.ToString()), tickerHead: TickerHead), trade_quantity: TradeQuantity, instrument: "F", alias: Alias, conn: conn); IFSLogger.Log(Alias + ": " + TradeQuantity.ToString() + " " + TickerDB + " for " + TA.PriceConverters.FromTT2DB(ttPrice: Convert.ToDecimal(e.Fill.MatchPrice.ToString()), tickerHead: TickerHead).ToString()); }