private static string ReportToXml(CommissionReport commission) { XmlDocument xmlDoc = new XmlDocument(); xmlDoc.AppendChild(xmlDoc.CreateXmlDeclaration("1.0", null, null)); XmlElement rootNode = xmlDoc.CreateElement("REPORT"); xmlDoc.AppendChild(rootNode); XmlElement contractNode = xmlDoc.CreateElement("COMMISSION"); rootNode.AppendChild(contractNode); foreach (var property in commission.GetType().GetProperties()) { XmlElement fieldNode = xmlDoc.CreateElement(property.Name.Replace(" ", "").Replace("/", "").Replace("'", "").Replace("&", "n").Replace("-", "").Replace("%", "Pct")); fieldNode.AppendChild(xmlDoc.CreateTextNode(property.GetValue(commission).ToString())); contractNode.AppendChild(fieldNode); } using (StringWriter stringWriter = new StringWriter()) { XmlTextWriter xmlTextWriter = new XmlTextWriter(stringWriter); xmlDoc.WriteTo(xmlTextWriter); return(stringWriter.ToString()); } }
public virtual void commissionReport(CommissionReport commissionReport) { logger.Info("CommissionReport. " + commissionReport.ExecId + " - " + commissionReport.Commission + " " + commissionReport.Currency + " RPNL " + commissionReport.RealizedPNL + "\n"); Client.PushOrdersInfo(commissionReport.Map <CommissionReport, CommissionMessage>(), PushMessageType.CommissionPush); }
public static int SaveCommissionReport(CommissionReport commissionReport) { int result = -1; try { SqlConnection sqlConnection = new SqlConnection(connectionString); SqlCommand sqlCommand = new SqlCommand("SaveCommissionReport", sqlConnection); sqlCommand.CommandType = CommandType.StoredProcedure; sqlCommand.Parameters.AddWithValue("@execution_id", commissionReport.ExecId); sqlCommand.Parameters.AddWithValue("@commission", commissionReport.Commission); sqlCommand.Parameters.AddWithValue("@currency", commissionReport.Currency); sqlCommand.Parameters.AddWithValue("@realised_pnl", commissionReport.RealizedPNL); sqlCommand.Parameters.AddWithValue("@yield", commissionReport.Yield); sqlCommand.Parameters.AddWithValue("@yield_redemption_date", commissionReport.YieldRedemptionDate); sqlConnection.Open(); result = Convert.ToInt32(sqlCommand.ExecuteScalar()); sqlConnection.Close(); } catch (Exception ex) { string errorMessage = "SaveCommissionReport insert failed: " + ex; Console.Write(errorMessage); SaveErrorMessage(errorMessage, GlobalValues.ErrorMessageTypes.ApplicationError); } return(result); }
public void commissionReport(CommissionReport commissionReport) { CommissionUpdateReceived?.Invoke(this, new CommissionUpdate { ExecutionId = commissionReport.ExecId, Commission = commissionReport.Commission }); }
public virtual void commissionReport(CommissionReport commissionReport) { db.runNonQuery("insert into commissions values ('" + commissionReport.ExecId + "'," + db.getSqlDateTime(clientSocket.getCurrentLocalTime()) + "," + commissionReport.Commission.ToString() + ",'" + commissionReport.Currency + "'," + db.getSqlDouble(commissionReport.RealizedPNL) + "," + db.getSqlDouble(commissionReport.Yield) + ",'')"); if (verbose) { Console.WriteLine("Commission Report. Report: " + commissionReport.ToString()); } }
public virtual void commissionReport(CommissionReport commissionReport) { String str; str = "CommissionReport, id = " + commissionReport.ExecId + " commision = " + commissionReport.Commission; AddTextToResponseListWindow(str); }
void EWrapper.commissionReport(CommissionReport commissionReport) { var tmp = CommissionReport; if (tmp != null) { tmp(commissionReport); } }
void EWrapper.commissionReport(CommissionReport commissionReport) { var tmp = CommissionReport; if (tmp != null) { sc.Post((t) => tmp(commissionReport), null); } }
void EWrapper.commissionReport(CommissionReport commissionReport) { var tmp = CommissionReport; if (tmp != null) { FireEvent(t => tmp(commissionReport), null); } }
public virtual void commissionReport(CommissionReport commissionReport) { MyLogger.Instance.CreateEntry("CommissionReport. " + commissionReport.ExecId + " - " + commissionReport.Commission + " " + commissionReport.Currency + " RPNL " + commissionReport.RealizedPNL + "\n"); Console.WriteLine("CommissionReport. " + commissionReport.ExecId + " - " + commissionReport.Commission + " " + commissionReport.Currency + " RPNL " + commissionReport.RealizedPNL + "\n"); foreach (var tmpPosPair in PairPosDict.Values) { // save price and share to PosPair obj tmpPosPair.saveCommPNL(commissionReport.ExecId, commissionReport.Commission, commissionReport.RealizedPNL); } }
public void commissionReport(CommissionReport commissionReport) { try { if (m_commissionReportEventHandler != null) { m_commissionReportEventHandler(this, new TWSReportEventArgs(commissionReport)); } } catch (Exception ex) { Error("Exception in commissionReport callback", ex); } }
void EWrapper.commissionReport(CommissionReport commissionReport) { var tmp = CommissionReport; if (tmp != null) { new Task(() => tmp(commissionReport) ).RunSynchronously(scheduler); } }
public void commissionReport(CommissionReport commissionReport) { //find order by execId var orderStatus = OrderStatusDic.FirstOrDefault(o => o.Value.ExecId == commissionReport.ExecId); if (orderStatus.Equals(new KeyValuePair <int, IBOrderStatusWrapper>())) { Logger.Error("Received commission report with execId not found " + $"in orders list, execId is {commissionReport.ExecId}"); return; } orderStatus.Value.Data.Commission = commissionReport.Commission; Consumer.Enqueue(orderStatus.Value.Data); }
private void OnCommissionReportsChanged(PropertyChangedEventArgs eventArgs) { IList <CommissionReport> reports = service.CommissionReports; if (reports.IsNullOrEmpty()) { return; } CommissionReport lastReport = reports.Last(); double lastCommission = lastReport.Commission; double totalCommission = reports.Sum(report => report.Commission); IO.ShowMessage(Messages.CommissionFormat, lastCommission.ToCurrencyString(), totalCommission.ToCurrencyString()); }
public virtual void commissionReport(CommissionReport commissionReport) { //parentUI.HandleMessage(new CommissionMessage(commissionReport)); }
/// <inheritdoc/> public void commissionReport(CommissionReport commissionReport) { this.CommissionReportEvent?.Invoke(this, new CommissionReportEventArgs(commissionReport)); }
public CommissionMessage(CommissionReport commissionReport) { CommissionReport = commissionReport; }
private void OnCommissionReport(CommissionReport report) { CommissionReports.Add(report); PropertyChanged.RaiseEvent(CommissionReports, nameof(CommissionReports)); }
public CommissionMessage(CommissionReport commissionReport) { Type = MessageType.CommissionsReport; CommissionReport = commissionReport; }
/// <summary> /// Initializes a new instance of the <see cref="CommissionReportEventArgs"/> class /// </summary> public CommissionReportEventArgs(CommissionReport commissionReport) { CommissionReport = commissionReport; }
private void OnCommissionReport(CommissionReport commissionReport) { }
public virtual void commissionReport(CommissionReport commissionReport) { throw new NotImplementedException(); }
//! [execdetailsend] //! [commissionreport] public virtual void commissionReport(CommissionReport commissionReport) { Console.WriteLine("CommissionReport. " + commissionReport.ExecId + " - " + commissionReport.Commission + " " + commissionReport.Currency + " RPNL " + commissionReport.RealizedPNL); }
/// <inheritdoc/> public void commissionReport(CommissionReport commissionReport) { // Unimplemented because we don't care }
/// <summary> /// CommissionReport event invocator /// </summary> protected virtual void OnCommissionReport(CommissionReportEventArgs e) { CommissionReport?.Invoke(this, e); }
/// <summary> /// This callback returns the commission report portion of an execution and is triggered immediately after a trade execution, or by calling reqExecution(). /// </summary> /// <param name="commissionReport">The structure that contains commission details.</param> public override void commissionReport(CommissionReport commissionReport) { OnCommissionReport(new CommissionReportEventArgs(commissionReport)); }
public virtual void commissionReport(CommissionReport commissionReport) { CommissionReport?.Invoke(this, new CommissionReportArgs(commissionReport)); }
protected bool Equals(CommissionReport other) { return(ExecId == other.ExecId); }
public TWSReportEventArgs(CommissionReport commission) { RequestId = -1; Report = ReportToXml(commission); }
public void commissionReport(CommissionReport commissionReport) { }
private void ProcessCommissionReport() { var version = _enc.DecodeInt(); var commissionReport = new CommissionReport { ExecId = _enc.DecodeString(), Commission = _enc.DecodeDouble(), Currency = _enc.DecodeString(), RealizedPnl = _enc.DecodeDouble(), Yield = _enc.DecodeDouble(), YieldRedemptionDate = _enc.DecodeInt() }; OnCommissionReport(commissionReport); }
void EWrapper.commissionReport(CommissionReport commissionReport) { CommissionReport?.Invoke(commissionReport); }
/// <summary> /// Full Constructor /// </summary> /// <param name="accountName">Account Name</param> public CommissionReportEventArgs(CommissionReport report) { Report = report; }