private GTLTreeNode CreateReleaseNode(Release release) { // // Get the instrument on the release // Instrument instrument = controller.Cache.GetInstrument( release[DatabaseObject.INSTRUMENT_ID]); if (null == instrument) { log.Warn("Unknown instrument: " + release[DatabaseObject.INSTRUMENT_ID]); return(null); } // // Get the account on the release // Account account = controller.Cache.GetAccount( release[DatabaseObject.ACCOUNT_ID]); if (null == account) { log.Warn("Unknown account: " + release[DatabaseObject.ACCOUNT_ID]); return(null); } if (!controller.Cache.HasInvestmentSystem( release[DatabaseObject.INVESTMENT_SYSTEM_ID])) { log.Warn("Unknown investment_system: " + release[DatabaseObject.INVESTMENT_SYSTEM_ID]); return(null); } GTLTreeNode releaseNode = new GTLTreeNode(release.Id); releaseNode.Checked = false; releaseNode.Collapse(); releaseNode.Tag = release.Id; releaseNode.SubItems.AddRange(new GTLSubItem [] { new GTLSubItem(release.ReleaseStatus( )), new GTLSubItem(release.ReleaseType( )), new GTLSubItem(release[DatabaseObject.ORDER_ID]), new GTLSubItem(release[DatabaseObject.INVESTMENT_SYSTEM_ID]), new GTLSubItem(release[DatabaseObject.INSTRUMENT_ID]), new GTLSubItem(account[DatabaseObject.NAME]), // account_name new GTLSubItem(instrument[DatabaseObject.NAME]), // instrument_name new GTLSubItem(instrument[DatabaseObject.SYMBOL]), // symbol new GTLSubItem(release[DatabaseObject.CLIENT_ORDER_ID]), new GTLSubItem(release[DatabaseObject.SESSION_ID]), new GTLSubItem(release[DatabaseObject.COUNTERPARTY_ORDER_ID]), new GTLSubItem(release[DatabaseObject.RELEASE_QTY]), new GTLSubItem(release[DatabaseObject.EXECUTED_QTY]), new GTLSubItem(release[DatabaseObject.LIMIT_PRC]), new GTLSubItem(release[DatabaseObject.STOP_PRC]), new GTLSubItem(release[DatabaseObject.AVERAGE_PRC]), new GTLSubItem(release[DatabaseObject.EXECUTED_VAL]), new GTLSubItem(release.ToLocalTime(DatabaseObject.ADDED_DATETIME)), new GTLSubItem(release[DatabaseObject.ADDED_BY]), new GTLSubItem(release.ToLocalTime(DatabaseObject.UPDATED_DATETIME)), new GTLSubItem(release[DatabaseObject.UPDATED_BY]) }); return(releaseNode); }
private GTLTreeNode CreateExecutionNode(Execution execution) { // // Get the instrument on the execution // Instrument instrument = controller.Cache.GetInstrument( execution[DatabaseObject.INSTRUMENT_ID]); if (null == instrument) { log.Warn("Unknown instrument: " + execution[DatabaseObject.INSTRUMENT_ID]); return(null); } // // Get the account on the execution // Account account = controller.Cache.GetAccount( execution[DatabaseObject.ACCOUNT_ID]); if (null == account) { log.Warn("Unknown account: " + execution[DatabaseObject.ACCOUNT_ID]); return(null); } if (!controller.Cache.HasInvestmentSystem( execution[DatabaseObject.INVESTMENT_SYSTEM_ID])) { log.Warn("Unknown investment_system: " + execution[DatabaseObject.INVESTMENT_SYSTEM_ID]); return(null); } GTLTreeNode executionNode = new GTLTreeNode(execution.Id); executionNode.Checked = false; executionNode.Collapse(); executionNode.Tag = execution.Id; executionNode.SubItems.AddRange(new GTLSubItem [] { new GTLSubItem(execution.ExecutionStatus( )), new GTLSubItem(execution[DatabaseObject.ORDER_ID]), new GTLSubItem(execution[DatabaseObject.RELEASE_ID]), new GTLSubItem(execution[DatabaseObject.INVESTMENT_SYSTEM_ID]), new GTLSubItem(execution[DatabaseObject.INSTRUMENT_ID]), new GTLSubItem(account[DatabaseObject.NAME]), // account_name new GTLSubItem(instrument[DatabaseObject.NAME]), // instrument_name new GTLSubItem(instrument[DatabaseObject.SYMBOL]), // symbol new GTLSubItem(execution[DatabaseObject.CLIENT_ORDER_ID]), new GTLSubItem(execution[DatabaseObject.SESSION_ID]), new GTLSubItem(execution[DatabaseObject.COUNTERPARTY_EXECUTION_ID]), new GTLSubItem(execution.SideCode( )), new GTLSubItem(execution[DatabaseObject.EXECUTION_CCY]), new GTLSubItem(execution[DatabaseObject.EXECUTION_PRC]), new GTLSubItem(execution[DatabaseObject.EXECUTION_QTY]), new GTLSubItem(execution[DatabaseObject.EXECUTION_VAL]), new GTLSubItem(execution[DatabaseObject.LEAVES_QTY]), new GTLSubItem(execution[DatabaseObject.AVERAGE_PRC]), new GTLSubItem(execution.ToLocalTime(DatabaseObject.ADDED_DATETIME)), new GTLSubItem(execution[DatabaseObject.ADDED_BY]), new GTLSubItem(execution.ToLocalTime(DatabaseObject.UPDATED_DATETIME)), new GTLSubItem(execution[DatabaseObject.UPDATED_BY]) }); return(executionNode); }