/// <summary> /// Creates a script of equity orders. /// </summary> public void Create() { // This list is used to randomize the type of instrument generated based on the allowable instrument types in this blotter. List <InstrumentType> instrumentTypes = new List <InstrumentType>(); if (this.generatorInfo.IsEquity) { instrumentTypes.Add(InstrumentType.Equity); } if (this.generatorInfo.IsFixedIncome) { instrumentTypes.Add(InstrumentType.FixedIncome); } // <script name="Emerging Markets Orders"> DataModel.BlotterRow blotterRow = DataModel.Blotter.BlotterKey.Find(generatorInfo.BlotterId); XElement elementRoot = new XElement("script", new XAttribute("name", String.Format("{0} Orders", blotterRow.EntityRow.Name))); xDocument.Add(elementRoot); // <client type="DataModelClient, Teraque.AssetNetwork.ClientDataModel" /> elementRoot.Add(new XElement("client", new XAttribute("type", "DataModelClient, Teraque.AssetNetwork.ClientDataModel"))); // This will generate the requested number of working orders for the selected instrument type(s). for (Int32 counter = 0; counter < generatorInfo.OrderCount; counter++) { this.instrumentTypeHandler[instrumentTypes[this.random.Next(instrumentTypes.Count)]](); } // At this point the script can be committed to the given file. xDocument.Save(generatorInfo.FileName); }
/// <summary> /// Copy the collection from the data model. /// </summary> /// <param name="blotterId">The identifier of the blotter to which the orders are associated.</param> void Copy(DataModel.BlotterRow blotterRow) { // The collection is hierarchical. That is, a blotter can have child blotters and those blotters can have children and so on. This HashSet is a flat // collection of the blotter and all its descendants and is used to quickly determine if any given change to the data model might affect one of the // WorkingOrder records or any of the properties of that WorkingOrder. this.blotterIdSet.Add(blotterRow.BlotterId); // In order to make merging results as fast as possible, the collection is sortred by the unique identifier of the WorkingOrder. When a row in the // client data model is updated, we will first find the blotter to which the change belongs and, if that blotter is part of the set constructed above, // we'll then find the working order affected using a binary search. The idea is to quickly find out if a given change to the data model applies to the // viewed collection and, if it does, which records are affected. foreach (DataModel.WorkingOrderRow workingOrderRow in blotterRow.GetWorkingOrderRows()) { Int32 index = this.BinarySearch(order => order.WorkingOrderId, workingOrderRow.WorkingOrderId); TType workingOrder = this.CreateInstanceCore(workingOrderRow); workingOrder.PropertyChanged += this.OnItemPropertyChanged; this.Insert(~index, workingOrder); } // This will recurse into each of the descendant blotters copying the data into the collection. The collection is a flattened view of all the working // orders; there is no attempt by design to make the report hierarchical even though the relationship between the blotters is. var childBlotterRows = from entityTreeRow in blotterRow.EntityRow.GetEntityTreeRowsByFK_Entity_EntityTree_ParentId() from childBlotterRow in entityTreeRow.EntityRowByFK_Entity_EntityTree_ChildId.GetBlotterRows() select childBlotterRow; foreach (DataModel.BlotterRow childBlotterRow in childBlotterRows) { this.Copy(childBlotterRow); } }
public WorkingOrderCollection(Guid blotterId) { // Initialize the object. this.blotterIdField = blotterId; // This is the view that provides filtering and sorting for this collection. It can be overridden in descendant classes to provide additional // functionality. this.workingOrderCollectionView = this.CreateView(); // Link the collection into the data model. DataModel.Entity.EntityRowChanged += this.OnEntityRowChanged; DataModel.Price.PriceRowChanged += this.OnPriceRowChanged; DataModel.Security.SecurityRowChanged += this.OnSecurityRowChanged; DataModel.DestinationOrder.DestinationOrderRowChanged += this.OnDestinationOrderRowChanged; DataModel.DestinationOrder.DestinationOrderRowDeleted += this.OnDestinationOrderRowDeleted; DataModel.Execution.ExecutionRowChanged += this.OnExecutionRowChanged; DataModel.Execution.ExecutionRowDeleted += this.OnExecutionRowDeleted; DataModel.SourceOrder.SourceOrderRowChanged += this.OnSourceOrderRowChanged; DataModel.SourceOrder.SourceOrderRowDeleted += this.OnSourceOrderRowDeleted; DataModel.WorkingOrder.WorkingOrderRowChanged += this.OnWorkingOrderRowChanged; // This will recursively create working order records for this and all the blotter's descendants from the data model. DataModel.BlotterRow blotterRow = DataModel.Blotter.BlotterKey.Find(blotterId); if (blotterRow != null) { this.Copy(blotterRow); } }
/// <summary> /// Copies the values from the data model into the BlotterItem instance. /// </summary> /// <param name="blotterRow">The source of the data.</param> internal void Copy(DataModel.BlotterRow blotterRow) { // Copy the members from the data model. this.Description = blotterRow.EntityRow.IsDescriptionNull() ? String.Empty : blotterRow.EntityRow.Description; this.Name = blotterRow.EntityRow.Name; this.BlotterId = blotterRow.BlotterId; }
/// <summary> /// Recursively discovers all the ancestor blotters of the current blotter. /// </summary> /// <param name="blotterRow">The current blotter row in the hierarchy.</param> void DiscoverBlotters(DataModel.BlotterRow blotterRow) { // Add the current blotter id to the set of all blotters handled by this control. this.blotterIdSet.Add(blotterRow.BlotterId); // This will recurse into the hierarchy and collect the ancestor blotter identifiers. var childBlotterRows = from entityTreeItem in blotterRow.EntityRow.GetEntityTreeRowsByFK_Entity_EntityTree_ParentId() from childBlotterRow in entityTreeItem.EntityRowByFK_Entity_EntityTree_ChildId.GetBlotterRows() select childBlotterRow; foreach (DataModel.BlotterRow childBlotterRow in childBlotterRows) { this.DiscoverBlotters(childBlotterRow); } }
/// <summary> /// Constructs a DestinationOrder collection from the selected blotter. /// </summary> /// <param name="blotterRow">The main blotter containing Working Orders that are to be executed.</param> List <DestinationOrderInfo> ConstructDestinationOrder(DataModel.BlotterRow blotterRow) { // This is the destinatinon broker that will execute the orders. DataModel.DestinationRow destinationRow = DataModel.Destination.DestinationKeyExternalId0.Find("ASSET NETWORK ECN"); Guid destinationId = destinationRow.DestinationId; // This list will collect the orders as the are generated recursively. List <DestinationOrderInfo> destinationOrders = new List <DestinationOrderInfo>(); // Recursively construct the batch of orders from the current blotter and its ancestors. this.ConstructDestinationOrder(destinationOrders, blotterRow, destinationId); // This is a batch of DestinationOrders that can be executed by the destination broker. return(destinationOrders); }
public void OnExecuteSlice(Object sender, ExecutedRoutedEventArgs executedRoutedEventArgs) { // Create a disposable channel to the middle tier. using (WebServiceClient webServiceClient = new WebServiceClient(Properties.Settings.Default.WebServiceEndpoint)) { try { // This will create a batch of DestinationOrder records and send it to the web service to be executed by the destination broker. DataModel.BlotterRow blotterRow = DataModel.Blotter.BlotterKey.Find(this.BlotterId); List <DestinationOrderInfo> destinationOrders = this.ConstructDestinationOrder(blotterRow); webServiceClient.CreateDestinationOrders(destinationOrders.ToArray()); } catch (Exception exception) { // Log communication problems. Log.Error("{0}, {1}", exception.Message, exception.StackTrace); } } }
/// <summary> /// Create an debt working order. /// </summary> void CreateDebt() { // All orders get a unique identifier. Guid workingOrderId = Guid.NewGuid(); // These records provide the starting point for generating the orders. DataModel.BlotterRow blotterRow = DataModel.Blotter.BlotterKey.Find(generatorInfo.BlotterId); DataModel.UserRow userRow = DataModel.User.UserKey.Find(generatorInfo.UserId); DataModel.CountryRow unitedStatesRow = DataModel.Country.CountryKeyExternalId0.Find("US"); DataModel.StatusRow statusRow = DataModel.Status.StatusKey.Find(StatusCode.New); // Generate the settlement currency DataModel.EntityRow usdEntityRow = DataModel.Entity.EntityKeyExternalId0.Find("USD"); DataModel.SecurityRow settlementCurrencyRow = DataModel.Security.SecurityKey.Find(usdEntityRow.EntityId); // The orders are an even mix of Buys and Sells. Most positions are long. Boolean isBuy = random.Next(2) == 0; Boolean isLong = random.Next(4) != 0; SideCode sideCode = isBuy && isLong ? SideCode.Buy : !isBuy && isLong ? SideCode.Sell : isBuy && !isLong ? SideCode.BuyCover : SideCode.SellShort; DataModel.SideRow sideRow = DataModel.Side.SideKey.Find(sideCode); // Find a random debt position that is unique to this blotter. DataModel.SecurityRow securityRow = null; while (securityRow == null) { // Select a random debt instrument for the next order. DataModel.DebtRow debtRow = DataModel.Debt[random.Next(DataModel.Debt.Count - 1)]; // Only generate orders for positions that are unique to this blotter. Position position = new Position(debtRow.DebtId, sideCode); if (!positionSet.Contains(position)) { securityRow = debtRow.SecurityRowByFK_Security_Debt_DebtId; positionSet.Add(position); } } // These orders will not match by default. We need to turn them on manually. DataModel.CrossingRow crossingRow = DataModel.Crossing.CrossingKey.Find(CrossingCode.NeverMatch); // Select a random Time In Force for this order. Most orders are Day orders but occationally we'll generate a GTC just to keep it interesting. TimeInForceCode timeInForce = random.Next(4) == 0 ? TimeInForceCode.GoodTillCancel : TimeInForceCode.Day; DataModel.TimeInForceRow timeInForceRow = DataModel.TimeInForce.TimeInForceKey.Find(timeInForce); // Generate the trade and settlement dates based on the current time and make sure it doesn't fall on a weekend. DateTime tradeDate = DateTime.Now; DateTime settlementDate = DateTime.Now; TimeSpan oneDay = TimeSpan.FromDays(1.0); for (Int32 dayIndex = 0; dayIndex < 3; dayIndex++) { settlementDate += oneDay; if (settlementDate.DayOfWeek == DayOfWeek.Saturday) { settlementDate += oneDay; } if (settlementDate.DayOfWeek == DayOfWeek.Sunday) { settlementDate += oneDay; } } // This will generate random matching preferences for the orders for demonstrating the matching box capabilities. Boolean isBrokerMatch = random.Next(20) == 0; Boolean isHedgeMatch = random.Next(15) == 0; Boolean isInstitutionMatch = true; // This randomizes the random matching patterns. Every now and then, don't match with anyone. if (random.Next(5) == 0) { isBrokerMatch = false; isHedgeMatch = false; isInstitutionMatch = false; } // <transaction> XElement elementTransaction = new XElement("transaction"); this.xDocument.Root.Add(elementTransaction); // <method name="StoreWorkingOrder"> XElement elementWorkingOrder = new XElement("method", new XAttribute("name", "StoreWorkingOrder")); elementTransaction.Add(elementWorkingOrder); // <parameter name="blotterKey" value="EMERGING MARKETS BLOTTER" /> elementWorkingOrder.Add( new XElement("parameter", new XAttribute("name", "blotterKey"), new XAttribute("value", blotterRow.EntityRow.ExternalId0))); // <parameter name="configurationId" value="US TICKER" /> elementWorkingOrder.Add(new XElement("parameter", new XAttribute("name", "configurationId"), new XAttribute("value", "CUSIP"))); // <parameter name="createdTime" value="5/6/2012 5:27:56 PM" /> elementWorkingOrder.Add(new XElement("parameter", new XAttribute("name", "createdTime"), new XAttribute("value", DateTime.Now.ToString("G")))); // <parameter name="crossingKey" value="NEVER MATCH" /> elementWorkingOrder.Add(new XElement("parameter", new XAttribute("name", "crossingKey"), new XAttribute("value", crossingRow.ExternalId0))); // <parameter name="externalId0" value="{bab88942-5c4e-440a-a352-c8e9b00fec12}" /> elementWorkingOrder.Add(new XElement("parameter", new XAttribute("name", "externalId0"), new XAttribute("value", workingOrderId.ToString("B")))); // <parameter name="isBrokerMatch" value="false" /> elementWorkingOrder.Add(new XElement("parameter", new XAttribute("name", "isBrokerMatch"), new XAttribute("value", isBrokerMatch))); // <parameter name="isHedgeMatch" value="false" /> elementWorkingOrder.Add(new XElement("parameter", new XAttribute("name", "isHedgeMatch"), new XAttribute("value", isHedgeMatch))); // <parameter name="isInstitutionMatch" value="true" /> elementWorkingOrder.Add(new XElement("parameter", new XAttribute("name", "isInstitutionMatch"), new XAttribute("value", isInstitutionMatch))); // <parameter name="modifiedTime" value="5/6/2012 5:27:56 PM" /> elementWorkingOrder.Add(new XElement("parameter", new XAttribute("name", "modifiedTime"), new XAttribute("value", DateTime.Now.ToString("G")))); // <parameter name="orderTypeKey" value="MKT" /> elementWorkingOrder.Add(new XElement("parameter", new XAttribute("name", "orderTypeKey"), new XAttribute("value", "MKT"))); // <parameter name="securityKeyBySecurityId" value="ODP" /> elementWorkingOrder.Add( new XElement("parameter", new XAttribute("name", "securityKeyBySecurityId"), new XAttribute("value", securityRow.EntityRow.ExternalId4))); // <parameter name="securityKeyBySettlementId" value="USD" /> elementWorkingOrder.Add( new XElement("parameter", new XAttribute("name", "securityKeyBySettlementId"), new XAttribute("value", settlementCurrencyRow.EntityRow.ExternalId0))); // <parameter name="settlementDate" value="5/9/2012 5:27:56 PM" /> elementWorkingOrder.Add(new XElement("parameter", new XAttribute("name", "settlementDate"), new XAttribute("value", settlementDate.ToString("G")))); // <parameter name="sideKey" value="SELL" /> elementWorkingOrder.Add(new XElement("parameter", new XAttribute("name", "sideKey"), new XAttribute("value", sideRow.ExternalId0))); // <parameter name="statusKey" value="NEW" /> elementWorkingOrder.Add(new XElement("parameter", new XAttribute("name", "statusKey"), new XAttribute("value", statusRow.ExternalId0))); // <parameter name="timeInForceKey" value="DAY" /> elementWorkingOrder.Add(new XElement("parameter", new XAttribute("name", "timeInForceKey"), new XAttribute("value", timeInForceRow.ExternalId0))); // <parameter name="tradeDate" value="5/6/2012 5:27:56 PM" /> elementWorkingOrder.Add(new XElement("parameter", new XAttribute("name", "tradeDate"), new XAttribute("value", tradeDate.ToString("G")))); // <parameter name="userKeyByCreatedUserId" value="DEV KAPOOR" /> elementWorkingOrder.Add( new XElement("parameter", new XAttribute("name", "userKeyByCreatedUserId"), new XAttribute("value", userRow.EntityRow.ExternalId0))); // <parameter name="userKeyByModifiedUserId" value="DEV KAPOOR" /> elementWorkingOrder.Add( new XElement("parameter", new XAttribute("name", "userKeyByModifiedUserId"), new XAttribute("value", userRow.EntityRow.ExternalId0))); // This will generate between one and three source orders for the working order. Source orders are a blocking concept. You can get several orders for // the same security on the same side for the same price. When this happens, it is much more efficient to block them as a single order and execute them // as a single order and allocate them back to the original orders when the order is done. Int32 sourceOrderCount = random.Next(1, 3); for (Int32 sourceOrderIndex = 0; sourceOrderIndex < sourceOrderCount; sourceOrderIndex++) { // This creates a unique identifier for the source order. Guid sourceOrderId = Guid.NewGuid(); // This generates a random quantity for the order between 100 and 10,000 shares. Decimal orderedQuantity = Convert.ToDecimal(random.Next(1, 100)) * 100.0M; // <method name="StoreSourceOrder"> XElement elementSourceOrder = new XElement("method", new XAttribute("name", "StoreSourceOrder")); elementTransaction.Add(elementSourceOrder); // <parameter name="configurationId" value="US TICKER" /> elementSourceOrder.Add(new XElement("parameter", new XAttribute("name", "configurationId"), new XAttribute("value", "CUSIP"))); // <parameter name="createdTime" value="2012-05-06T17:27:56.2658093-04:00" /> elementSourceOrder.Add(new XElement("parameter", new XAttribute("name", "createdTime"), new XAttribute("value", DateTime.Now))); // <parameter name="externalId0" value="{3c69e0a0-3316-4499-a7b1-6dda5a058837}" /> elementSourceOrder.Add(new XElement("parameter", new XAttribute("name", "externalId0"), new XAttribute("value", sourceOrderId.ToString("B")))); // <parameter name="modifiedTime" value="5/6/2012 5:27:56 PM" /> elementSourceOrder.Add(new XElement("parameter", new XAttribute("name", "modifiedTime"), new XAttribute("value", DateTime.Now.ToString("G")))); // <parameter name="orderedQuantity" value="4300.0" /> elementSourceOrder.Add(new XElement("parameter", new XAttribute("name", "orderedQuantity"), new XAttribute("value", orderedQuantity))); // <parameter name="orderTypeKey" value="MKT" /> elementSourceOrder.Add(new XElement("parameter", new XAttribute("name", "orderTypeKey"), new XAttribute("value", "MKT"))); // <parameter name="securityKeyBySecurityId" value="ODP" /> elementSourceOrder.Add( new XElement("parameter", new XAttribute("name", "securityKeyBySecurityId"), new XAttribute("value", securityRow.EntityRow.ExternalId4))); // <parameter name="securityKeyBySettlementId" value="USD" /> elementSourceOrder.Add( new XElement("parameter", new XAttribute("name", "securityKeyBySettlementId"), new XAttribute("value", settlementCurrencyRow.EntityRow.ExternalId0))); // <parameter name="settlementDate" value="2012-05-09T17:27:56.2528086-04:00" /> elementSourceOrder.Add(new XElement("parameter", new XAttribute("name", "settlementDate"), new XAttribute("value", settlementDate))); // <parameter name="sideKey" value="SELL" /> elementSourceOrder.Add(new XElement("parameter", new XAttribute("name", "sideKey"), new XAttribute("value", sideRow.ExternalId0))); // <parameter name="statusKey" value="NEW" /> elementSourceOrder.Add(new XElement("parameter", new XAttribute("name", "statusKey"), new XAttribute("value", statusRow.ExternalId0))); // <parameter name="timeInForceKey" value="DAY" /> elementSourceOrder.Add( new XElement("parameter", new XAttribute("name", "timeInForceKey"), new XAttribute("value", timeInForceRow.ExternalId0))); // <parameter name="tradeDate" value="5/6/2012 5:27:56 PM" /> elementSourceOrder.Add(new XElement("parameter", new XAttribute("name", "tradeDate"), new XAttribute("value", tradeDate.ToString("G")))); // <parameter name="userKeyByCreatedUserId" value="DEV KAPOOR" /> elementSourceOrder.Add( new XElement("parameter", new XAttribute("name", "userKeyByCreatedUserId"), new XAttribute("value", userRow.EntityRow.ExternalId0))); // <parameter name="userKeyByModifiedUserId" value="DEV KAPOOR" /> elementSourceOrder.Add( new XElement("parameter", new XAttribute("name", "userKeyByModifiedUserId"), new XAttribute("value", userRow.EntityRow.ExternalId0))); // <parameter name="workingOrderKey" value="{bab88942-5c4e-440a-a352-c8e9b00fec12}" /> elementSourceOrder.Add( new XElement("parameter", new XAttribute("name", "workingOrderKey"), new XAttribute("value", workingOrderId.ToString("B")))); } }
/// <summary> /// Collect the metadata from the data model. /// </summary> /// <param name="state">The generic thread start parameter.</param> protected virtual void CalculateMetadata() { // In order to prevent unnecessary updates to properties that are bound to visual elements, the calculations will fill in these fields first, then // update the bound properties. Int32 workingOrderCount = 0; Int32 filledOrderCount = 0; Int32 partialOrderCount = 0; Int32 newOrderCount = 0; Decimal executionQuantity = 0.0m; Decimal destinationOrderQuantity = 0.0m; Decimal sourceOrderQuantity = 0.0m; // Extract the created and modified times from the main blotter. The other properties are recursively calculated. DataModel.BlotterRow mainBlotterRow = DataModel.Blotter.BlotterKey.Find(this.BlotterId); this.CreatedTime = mainBlotterRow.EntityRow.CreatedTime; this.ModifiedTime = mainBlotterRow.EntityRow.ModifiedTime; // Recursively calculate the statistics for the displayed blotter. foreach (Guid blotterId in this.blotterIdSet) { // Run through all the working orders in the next blotter in the hierarchy and aggregate the statistics. DataModel.BlotterRow blotterRow = DataModel.Blotter.BlotterKey.Find(blotterId); foreach (DataModel.WorkingOrderRow workingOrderRow in blotterRow.GetWorkingOrderRows()) { // Aggregate the order totals. if (workingOrderRow.StatusCode == StatusCode.Filled) { filledOrderCount++; } if (workingOrderRow.StatusCode == StatusCode.PartiallyFilled) { partialOrderCount++; } if (workingOrderRow.StatusCode == StatusCode.New) { newOrderCount++; } workingOrderCount++; // Aggregate the total number of source orders. foreach (DataModel.SourceOrderRow sourceOrderRow in workingOrderRow.GetSourceOrderRows()) { sourceOrderQuantity += sourceOrderRow.OrderedQuantity; } // Aggregate the total number of destination orders and executed shares. foreach (DataModel.DestinationOrderRow destinationOrderRow in workingOrderRow.GetDestinationOrderRows()) { destinationOrderQuantity += (destinationOrderRow.OrderedQuantity - destinationOrderRow.CanceledQuantity); foreach (DataModel.ExecutionRow executionRow in destinationOrderRow.GetExecutionRows()) { executionQuantity += executionRow.ExecutionQuantity; } } } } // After aggregating all the totals we udpate the properties that are tied (for the most part) to the visual elements. this.FilledOrderCount = filledOrderCount; this.PartialOrderCount = partialOrderCount; this.NewOrderCount = newOrderCount; this.SourceOrderQuantity = sourceOrderQuantity; this.WorkingOrderCount = workingOrderCount; this.SourceOrderQuantity = sourceOrderQuantity; this.DestinationOrderQuantity = destinationOrderQuantity; this.ExecutionQuantity = executionQuantity; this.OrderedPercent = destinationOrderQuantity == 0.0m ? 0.0 : Convert.ToDouble(destinationOrderQuantity / sourceOrderQuantity); this.ExecutedPercent = executionQuantity == 0.0m ? 0.0 : Convert.ToDouble(executionQuantity / destinationOrderQuantity); }
/// <summary> /// Constructs a DestinationOrder collection from the selected blotter. /// </summary> /// <param name="destinationOrders">A collection of DestinationOrder records.</param> /// <param name="blotterRow">The main blotter containing Working Orders that are to be executed.</param> /// <param name="destinationRow">The destination broker.</param> void ConstructDestinationOrder(List <DestinationOrderInfo> destinationOrders, DataModel.BlotterRow blotterRow, Guid destinationId) { // For every Working Order in the blotter, construct a DestinationOrder record. foreach (DataModel.WorkingOrderRow workingOrderRow in blotterRow.GetWorkingOrderRows()) { // Our Destination Order will completely fill all obligations from the source of the orders. Decimal sourceOrderQuantity = 0.0M; foreach (DataModel.SourceOrderRow sourceOrderRow in workingOrderRow.GetSourceOrderRows()) { sourceOrderQuantity += sourceOrderRow.OrderedQuantity; } // The amount already committed to brokers is subtracted from the order amount. When this batch completes, the Working Order will be // completely filled. Decimal destinationOrderQuantity = 0.0M; foreach (DataModel.DestinationOrderRow destinationOrderRow in workingOrderRow.GetDestinationOrderRows()) { destinationOrderQuantity += destinationOrderRow.OrderedQuantity; } // If this Working Order has shares that still need to be executed, then construct a DestinationOrder record. if (sourceOrderQuantity > destinationOrderQuantity) { DestinationOrderInfo destinationOrderInfo = new DestinationOrderInfo(); destinationOrderInfo.BlotterId = workingOrderRow.BlotterId; destinationOrderInfo.DestinationId = destinationId; destinationOrderInfo.OrderedQuantity = sourceOrderQuantity - destinationOrderQuantity; destinationOrderInfo.OrderTypeCode = workingOrderRow.OrderTypeCode; destinationOrderInfo.SecurityId = workingOrderRow.SecurityId; destinationOrderInfo.SettlementId = workingOrderRow.SettlementId; destinationOrderInfo.SideCode = workingOrderRow.SideCode; destinationOrderInfo.TimeInForceCode = workingOrderRow.TimeInForceCode; destinationOrderInfo.WorkingOrderId = workingOrderRow.WorkingOrderId; destinationOrders.Add(destinationOrderInfo); } } // This will recurse into all the child blotters and constructor destination orders for all the working orders found there. var childBlotterRows = from entityTreeRow in blotterRow.EntityRow.GetEntityTreeRowsByFK_Entity_EntityTree_ParentId() from childBlotterRow in entityTreeRow.EntityRowByFK_Entity_EntityTree_ChildId.GetBlotterRows() select childBlotterRow; foreach (DataModel.BlotterRow childBlotterRow in childBlotterRows) { this.ConstructDestinationOrder(destinationOrders, childBlotterRow, destinationId); } }
/// <summary> /// Initialize a new instance of a BlotterItem class with the information from the data model. /// </summary> /// <param name="blotterRow">The source of the information for the BlotterRow.</param> internal BlotterItem(DataModel.BlotterRow blotterRow) { // This will populate the new item with information from the data model. this.Copy(blotterRow); }