diff --git a/DataRetriever/FIXDataRetriever.cs b/DataRetriever/FIXDataRetriever.cs index 9edcb78..ea47a3f 100644 --- a/DataRetriever/FIXDataRetriever.cs +++ b/DataRetriever/FIXDataRetriever.cs @@ -170,8 +170,8 @@ private void HandleMarketDataSnapshot(MarketDataSnapshotFullRefresh snapshot) Size = size.ToDouble(), IsBid = type == '0', EntryID = entryId.ToString(), - LocalTimeStamp = DateTime.Now, - ServerTimeStamp = DateTime.Now, + LocalTimeStamp = HelperTimeProvider.Now, + ServerTimeStamp = HelperTimeProvider.Now, DecimalPlaces = decimalPlaces.Value, ProviderID = 12, //FXCM Symbol = symbol, @@ -202,7 +202,7 @@ private void HandleMarketDataSnapshot(MarketDataSnapshotFullRefresh snapshot) } private void HandleHeartBeat() { - var provider = new VisualHFT.ViewModel.Model.Provider() { LastUpdated = DateTime.Now, ProviderCode = 12, ProviderID = 12, ProviderName = "FXCM", Status = eSESSIONSTATUS.BOTH_CONNECTED }; + var provider = new VisualHFT.ViewModel.Model.Provider() { LastUpdated = HelperTimeProvider.Now, ProviderCode = 12, ProviderID = 12, ProviderName = "FXCM", Status = eSESSIONSTATUS.BOTH_CONNECTED }; var model = new List() { provider }; // Raise an event or further process the data as needed OnDataReceived?.Invoke(this, new DataEventArgs { DataType = "HeartBeats", ParsedModel = model, RawData = "" }); diff --git a/DataRetriever/KafkaDataRetriever.cs b/DataRetriever/KafkaDataRetriever.cs index 6e8f2bf..9991649 100644 --- a/DataRetriever/KafkaDataRetriever.cs +++ b/DataRetriever/KafkaDataRetriever.cs @@ -68,7 +68,7 @@ private void HandleMessage(string message) // Raise the OnDataReceived event OnDataReceived?.Invoke(this, new DataEventArgs { DataType = "Market", RawData = message, ParsedModel = model }); - var provider = new VisualHFT.ViewModel.Model.Provider() { LastUpdated = DateTime.Now, ProviderID = 2, ProviderName = "Kafka", Status = eSESSIONSTATUS.BOTH_CONNECTED }; + var provider = new VisualHFT.ViewModel.Model.Provider() { LastUpdated = HelperTimeProvider.Now, ProviderID = 2, ProviderName = "Kafka", Status = eSESSIONSTATUS.BOTH_CONNECTED }; // Raise the OnDataReceived event OnDataReceived?.Invoke(this, new DataEventArgs { DataType = "HeartBeats", RawData = message, ParsedModel = model }); } diff --git a/DataRetriever/ZeroMQDataRetriever.cs b/DataRetriever/ZeroMQDataRetriever.cs index f636879..6454301 100644 --- a/DataRetriever/ZeroMQDataRetriever.cs +++ b/DataRetriever/ZeroMQDataRetriever.cs @@ -63,7 +63,7 @@ private void HandleMessage(string message) - var provider = new VisualHFT.ViewModel.Model.Provider() { LastUpdated = DateTime.Now, ProviderID = 1, ProviderName = "ZeroMQ", Status = eSESSIONSTATUS.BOTH_CONNECTED }; + var provider = new VisualHFT.ViewModel.Model.Provider() { LastUpdated = HelperTimeProvider.Now, ProviderID = 1, ProviderName = "ZeroMQ", Status = eSESSIONSTATUS.BOTH_CONNECTED }; // Raise the OnDataReceived event OnDataReceived?.Invoke(this, new DataEventArgs { DataType = "HeartBeats", RawData = message, ParsedModel = model }); diff --git a/DataTradeRetriever/FIXTradesRetriever.cs b/DataTradeRetriever/FIXTradesRetriever.cs index 0ddba9f..11c618e 100644 --- a/DataTradeRetriever/FIXTradesRetriever.cs +++ b/DataTradeRetriever/FIXTradesRetriever.cs @@ -180,7 +180,7 @@ public ReadOnlyCollection Positions order.ProviderId = _providerId; order.ProviderName = _providerName; order.Executions = new List(); - order.LastUpdated = System.DateTime.Now; + order.LastUpdated = HelperTimeProvider.Now; parsedOrders.Add(order.ClOrdId, order); } else if (dicFIX[Tags.MsgType] == MsgType.ORDER_CANCEL_REPLACE_REQUEST) @@ -203,7 +203,7 @@ public ReadOnlyCollection Positions exec.Side = (int)order.Side; exec.Price = 0; exec.QtyFilled = 0; - order.LastUpdated = System.DateTime.Now; + order.LastUpdated = HelperTimeProvider.Now; order.Executions.Add(new VisualHFT.Model.Execution(exec, order.Symbol)); } else @@ -238,7 +238,7 @@ public ReadOnlyCollection Positions order.Executions.Add(new Execution(exec, order.Symbol)); order.Status = ParseOrderStatus(dicFIX[Tags.OrdStatus]); - order.LastUpdated = System.DateTime.Now; + order.LastUpdated = HelperTimeProvider.Now; if (order.Status == eORDERSTATUS.REPLACED) { diff --git a/Helpers/HelperActiveOrders.cs b/Helpers/HelperActiveOrders.cs index e411f05..6c80adf 100644 --- a/Helpers/HelperActiveOrders.cs +++ b/Helpers/HelperActiveOrders.cs @@ -80,7 +80,7 @@ private bool UpdateData(VisualHFT.Model.Order order) //Check provider if (!this.ContainsKey(order.ClOrdId)) { - order.CreationTimeStamp = DateTime.Now; + order.CreationTimeStamp = HelperTimeProvider.Now; return this.TryAdd(order.ClOrdId, order); } else diff --git a/Helpers/HelperCommon.cs b/Helpers/HelperCommon.cs index c608666..e454145 100644 --- a/Helpers/HelperCommon.cs +++ b/Helpers/HelperCommon.cs @@ -13,9 +13,9 @@ public class HelperCommon { public static DateTime GetCurrentSessionIni(DateTime? currentSessionDate) { - currentSessionDate = currentSessionDate.ToDate().AddHours(DateTime.Now.Hour).AddMinutes(DateTime.Now.Minute); + currentSessionDate = currentSessionDate.ToDate().AddHours(HelperTimeProvider.Now.Hour).AddMinutes(HelperTimeProvider.Now.Minute); if (!currentSessionDate.HasValue) - currentSessionDate = DateTime.Now; + currentSessionDate = HelperTimeProvider.Now; DateTime DateAt00 = currentSessionDate.ToDate(); DateTime DateAt500PM = DateAt00.AddHours(17); DateTime DateAt530PM = DateAt00.AddHours(17).AddMinutes(30); @@ -24,13 +24,13 @@ public static DateTime GetCurrentSessionIni(DateTime? currentSessionDate) else if (currentSessionDate > DateAt00 && currentSessionDate < DateAt500PM) return DateAt530PM.AddDays(-1); else - return DateTime.Now; + return HelperTimeProvider.Now; } public static DateTime GetCurrentSessionEnd(DateTime? currentSessionDate) { - currentSessionDate = currentSessionDate.ToDate().AddHours(DateTime.Now.Hour).AddMinutes(DateTime.Now.Minute); + currentSessionDate = currentSessionDate.ToDate().AddHours(HelperTimeProvider.Now.Hour).AddMinutes(HelperTimeProvider.Now.Minute); if (!currentSessionDate.HasValue) - currentSessionDate = DateTime.Now; + currentSessionDate = HelperTimeProvider.Now; DateTime DateAt00 = currentSessionDate.ToDate(); DateTime DateAt500PM = DateAt00.AddHours(17); DateTime DateAt530PM = DateAt00.AddHours(17).AddMinutes(30); @@ -39,7 +39,7 @@ public static DateTime GetCurrentSessionEnd(DateTime? currentSessionDate) else if (currentSessionDate > DateAt00 && currentSessionDate < DateAt500PM) return DateAt500PM; else - return DateTime.Now; + return HelperTimeProvider.Now; } public static int TimerMillisecondsToGetVariables = 1000 * 10; //10 seconds diff --git a/Helpers/HelperDataGrid.cs b/Helpers/HelperDataGrid.cs deleted file mode 100644 index 9c7da2a..0000000 --- a/Helpers/HelperDataGrid.cs +++ /dev/null @@ -1,246 +0,0 @@ -using System; -using System.Collections; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Windows; -using System.Windows.Controls; -using System.Data; -using System.IO; -using System.Windows.Data; -using VisualHFT.Model; - -namespace VisualHFT.Helpers -{ - public class HelperDataGrid - { - public static string ExportDataGrid(DataGrid dGrid) - { - if (true) - { - string strFormat = "CSV"; - StringBuilder strBuilder = new StringBuilder(); - if (dGrid.ItemsSource == null) return ""; - List lstFields = new List(); - if (dGrid.HeadersVisibility == DataGridHeadersVisibility.Column || - dGrid.HeadersVisibility == DataGridHeadersVisibility.All) - { - foreach (DataGridColumn dgcol in dGrid.Columns) - lstFields.Add(FormatField(dgcol.Header.ToString(), strFormat)); - BuildStringOfRow(strBuilder, lstFields, strFormat); - } - foreach (object data in dGrid.ItemsSource) - { - lstFields.Clear(); - foreach (DataGridColumn col in dGrid.Columns) - { - string strValue = ""; - Binding objBinding = null; - if (col is DataGridBoundColumn) - objBinding = (col as DataGridBoundColumn).Binding as Binding; - if (col is DataGridTemplateColumn) - { - //This is a template column... - // let us see the underlying dependency object - DependencyObject objDO = - (col as DataGridTemplateColumn).CellTemplate.LoadContent(); - FrameworkElement oFE = (FrameworkElement)objDO; - System.Reflection.FieldInfo oFI = oFE.GetType().GetField("TextProperty"); - if (oFI != null) - { - if (oFI.GetValue(null) != null) - { - if (oFE.GetBindingExpression( - (DependencyProperty)oFI.GetValue(null)) != null) - objBinding = - oFE.GetBindingExpression( - (DependencyProperty)oFI.GetValue(null)).ParentBinding; - } - } - } - if (objBinding != null) - { - if (objBinding.Path.Path != "") - { - Object objValue = GetNestedPropValue(objBinding.Path.Path, data); - if (objValue != null) - strValue = objValue.ToString(); - //System.Reflection.PropertyInfo pi = data.GetType().GetProperty(objBinding.Path.Path); - //if (pi != null) strValue = pi.GetValue(data, null).ToString(); - } - if (objBinding.Converter != null) - { - if (strValue != "") - strValue = objBinding.Converter.Convert(strValue, - typeof(string), objBinding.ConverterParameter, - objBinding.ConverterCulture).ToString(); - else - strValue = objBinding.Converter.Convert(data, - typeof(string), objBinding.ConverterParameter, - objBinding.ConverterCulture).ToString(); - } - } - lstFields.Add(FormatField(strValue, strFormat)); - } - BuildStringOfRow(strBuilder, lstFields, strFormat); - } - string strFilename = GetTempFile(); - StreamWriter sw = new StreamWriter(strFilename); - if (strFormat == "XML") - { - //Let us write the headers for the Excel XML - sw.WriteLine(""); - sw.WriteLine(""); - sw.WriteLine(""); - sw.WriteLine(""); - sw.WriteLine("Arasu Elango"); - sw.WriteLine("" + - DateTime.Now.ToLocalTime().ToLongDateString() + - ""); - sw.WriteLine("" + - DateTime.Now.ToLocalTime().ToLongDateString() + - ""); - sw.WriteLine("Atom8 IT Solutions (P) " + - "Ltd.,"); - sw.WriteLine("12.00"); - sw.WriteLine(""); - sw.WriteLine(""); - sw.WriteLine(""); - } - sw.Write(strBuilder.ToString()); - if (strFormat == "XML") - { - sw.WriteLine("
"); - sw.WriteLine("
"); - sw.WriteLine("
"); - } - sw.Close(); - return strFilename; - } - } - public static IEnumerable GetDataGridRows(System.Windows.Controls.DataGrid grid) - { - var itemsSource = grid.ItemsSource as IEnumerable; - if (null == itemsSource) yield return null; - foreach (var item in itemsSource) - { - var row = grid.ItemContainerGenerator.ContainerFromItem(item) as System.Windows.Controls.DataGridRow; - if (null != row) yield return row; - } - } - public static void FormatDecimals(System.Windows.Controls.DataGrid grid, string columnBrokerID, params string[] columnsDataToFormat) - { - //NO WORKING - var rows = GetDataGridRows(grid); - - foreach (DataGridRow r in rows) - { - var colBroker = grid.Columns.Where(x => x.SortMemberPath == columnBrokerID).FirstOrDefault(); - if (colBroker == null) - continue; - int brokerID = Convert.ToInt16((colBroker.GetCellContent(r) as TextBlock).Text); - string sFormat = "{0:F3}"; - - foreach (DataGridColumn column in grid.Columns.Where(x => columnsDataToFormat.Contains(x.SortMemberPath))) - { - if (column.GetCellContent(r) is TextBlock) - { - TextBlock cellContent = column.GetCellContent(r) as TextBlock; - cellContent.Text = string.Format(cellContent.Text, sFormat); - } - } - } - grid.UpdateLayout(); - } - - private static void BuildStringOfRow(StringBuilder strBuilder, - List lstFields, string strFormat) - { - switch (strFormat) - { - case "XML": - strBuilder.AppendLine(""); - strBuilder.AppendLine(String.Join("\r\n", lstFields.ToArray())); - strBuilder.AppendLine(""); - break; - case "CSV": - strBuilder.AppendLine(String.Join(",", lstFields.ToArray())); - break; - } - } - private static string FormatField(string data, string format) - { - switch (format) - { - case "XML": - return String.Format("{0}", data); - case "CSV": - return String.Format("\"{0}\"", - data.Replace("\"", "\"\"\"").Replace("\n", - "").Replace("\r", "")); - } - return data; - } - private static Object GetNestedPropValue(String name, Object obj) - { - foreach (String part in name.Split('.')) - { - if (obj == null) { return null; } - - Type type = obj.GetType(); - System.Reflection.PropertyInfo info = type.GetProperty(part); - if (info == null) { return null; } - - obj = info.GetValue(obj, null); - } - return obj; - } - private static string GetTempFile() - { - string sFileName = "export"; - string sFile = System.IO.Path.GetTempPath() + @"\" + sFileName + ".csv"; - long iCont = 1; - while (File.Exists(sFile)) - { - sFile = System.IO.Path.GetTempPath() + @"\" + sFileName + iCont.ToString() + ".csv"; - iCont++; - } - return sFile; - } - - } - - - public class PnLStyle : StyleSelector - { - public override Style SelectStyle(object item, DependencyObject container) - { - if (item is VisualHFT.Model.Position) - { - VisualHFT.Model.Position pos = item as VisualHFT.Model.Position; - if (pos.CloseProviderId < 0) //means that is an open position - return NullBackColorStyle; - else if (pos.GetPipsPnL >= 0) - { - return GreenBackColorStyle; - } - else if (pos.GetPipsPnL < 0) - { - return RedBackColorStyle; - } - } - return null; - } - public Style GreenBackColorStyle { get; set; } - public Style RedBackColorStyle { get; set; } - public Style NullBackColorStyle { get; set; } - } - -} diff --git a/Model/PositionManager.cs b/Model/PositionManager.cs index 75b3e39..68d0740 100644 --- a/Model/PositionManager.cs +++ b/Model/PositionManager.cs @@ -44,7 +44,7 @@ public PositionManager(List orders, PositionManagerCalcul PLRealized = CalculateRealizedPnL(); PLTot = PLRealized + PLOpen; - LastUpdated = DateTime.Now; + LastUpdated = HelperTimeProvider.Now; } private List Buys { get => _buys; @@ -149,7 +149,7 @@ public void AddOrder(VisualHFT.Model.Order newOrder) PLRealized = CalculateRealizedPnL(); PLOpen = CalculateOpenPnl(); PLTot = _plRealized + _plOpen; - LastUpdated = DateTime.Now; + LastUpdated = HelperTimeProvider.Now; UpdateUI(); } public void UpdateLastMidPrice(double newMidPrice) @@ -158,7 +158,7 @@ public void UpdateLastMidPrice(double newMidPrice) PLOpen = CalculateOpenPnl(); PLTot = _plRealized + _plOpen; UpdateUI(); - LastUpdated = DateTime.Now; + LastUpdated = HelperTimeProvider.Now; } } } diff --git a/ViewModel/vmMultiVenuePrices.cs b/ViewModel/vmMultiVenuePrices.cs index f27636c..da62271 100644 --- a/ViewModel/vmMultiVenuePrices.cs +++ b/ViewModel/vmMultiVenuePrices.cs @@ -151,7 +151,7 @@ private void LIMITORDERBOOK_OnDataReceived(OrderBook e) _latesPrice[e.ProviderID] = e.MidPrice; foreach (var key in _allDataSeries.Keys) { - _allDataSeries[key].Item1.Add(new PlotInfo() { Date = DateTime.Now, Value = _latesPrice[key] }); + _allDataSeries[key].Item1.Add(new PlotInfo() { Date = HelperTimeProvider.Now, Value = _latesPrice[key] }); _allDataSeries[key].Item2.ItemsSource = _allDataSeries[key].Item1.Select(x => new OxyPlot.DataPoint(x.Date.Ticks, x.Value)); } } diff --git a/ViewModel/vmOrderBook.cs b/ViewModel/vmOrderBook.cs index 31d4eda..75b0a72 100644 --- a/ViewModel/vmOrderBook.cs +++ b/ViewModel/vmOrderBook.cs @@ -284,7 +284,7 @@ private void LIMITORDERBOOK_OnDataReceived(OrderBook e) #region REAL TIME PRICES if (_realTimePrices != null && tobAsk != null && tobBid != null) { - DateTime maxDateIncoming = DateTime.Now;// Max(tobAsk.LocalTimeStamp, tobBid.LocalTimeStamp); + DateTime maxDateIncoming = HelperTimeProvider.Now;// Max(tobAsk.LocalTimeStamp, tobBid.LocalTimeStamp); var objToAdd = _realTimePrices.GetObjectPool().Get(); objToAdd.Date = maxDateIncoming; diff --git a/ViewModel/vmOrderBookFlowAnalysis.cs b/ViewModel/vmOrderBookFlowAnalysis.cs index 562cc08..53a0c11 100644 --- a/ViewModel/vmOrderBookFlowAnalysis.cs +++ b/ViewModel/vmOrderBookFlowAnalysis.cs @@ -86,7 +86,7 @@ private void LIMITORDERBOOK_OnDataReceived(OrderBook e) { //Imbalance PlotInfoPriceChart objWithHigherDate = _realTimeData.OrderBy(x => x.Date).LastOrDefault(); - var objToAdd = new PlotInfoPriceChart() { Date = DateTime.Now, Volume = _orderBook.ImbalanceValue, MidPrice = _orderBook.MidPrice }; + var objToAdd = new PlotInfoPriceChart() { Date = HelperTimeProvider.Now, Volume = _orderBook.ImbalanceValue, MidPrice = _orderBook.MidPrice }; if (objWithHigherDate == null || objToAdd.Date.Subtract(objWithHigherDate.Date).TotalMilliseconds > 10) { _realTimeData.Add(objToAdd); diff --git a/ViewModel/vmPosition.cs b/ViewModel/vmPosition.cs index 57db7f9..bb9241a 100644 --- a/ViewModel/vmPosition.cs +++ b/ViewModel/vmPosition.cs @@ -43,7 +43,7 @@ public vmPosition(Dictionary> dialogs) this._dialogs = dialogs; PositionsManager = new ObservableCollection(); FilterCommand = new RelayCommand(OnFilterChanged); - this.SelectedDate = DateTime.Now; //new DateTime(2022, 10, 6); + this.SelectedDate = HelperTimeProvider.Now; //new DateTime(2022, 10, 6); lock (_locker) { diff --git a/VisualHFT.Commons/Helpers/HelperProvider.cs b/VisualHFT.Commons/Helpers/HelperProvider.cs index a31e206..4367716 100644 --- a/VisualHFT.Commons/Helpers/HelperProvider.cs +++ b/VisualHFT.Commons/Helpers/HelperProvider.cs @@ -26,7 +26,7 @@ private void _timer_check_heartbeat_Elapsed(object sender, System.Timers.Elapsed { foreach (var x in this) { - if (DateTime.Now.Subtract(x.Value.LastUpdated).TotalMilliseconds > _MILLISECONDS_HEART_BEAT) + if (HelperTimeProvider.Now.Subtract(x.Value.LastUpdated).TotalMilliseconds > _MILLISECONDS_HEART_BEAT) { x.Value.Status = eSESSIONSTATUS.BOTH_DISCONNECTED; OnHeartBeatFail?.Invoke(this, x.Value); @@ -68,12 +68,12 @@ private bool UpdateData(VisualHFT.Model.Provider provider) //Check provider if (!this.ContainsKey(provider.ProviderCode)) { - provider.LastUpdated = DateTime.Now; + provider.LastUpdated = HelperTimeProvider.Now; return this.TryAdd(provider.ProviderCode, provider); } else { - this[provider.ProviderCode].LastUpdated = DateTime.Now; + this[provider.ProviderCode].LastUpdated = HelperTimeProvider.Now; this[provider.ProviderCode].Status = provider.Status; this[provider.ProviderCode].Plugin = provider.Plugin; if (provider.Status == eSESSIONSTATUS.BOTH_DISCONNECTED || provider.Status == eSESSIONSTATUS.PRICE_DSICONNECTED_ORDER_CONNECTED) diff --git a/VisualHFT.Commons/Model/Order.cs b/VisualHFT.Commons/Model/Order.cs index b33bcff..1e610bf 100644 --- a/VisualHFT.Commons/Model/Order.cs +++ b/VisualHFT.Commons/Model/Order.cs @@ -100,7 +100,7 @@ public void Update(Order order) GetQuantity = order.GetQuantity; - LastUpdated = DateTime.Now; + LastUpdated = HelperTimeProvider.Now; } public double PendingQuantity => Quantity - FilledQuantity; diff --git a/VisualHFT.Commons/Model/Position.cs b/VisualHFT.Commons/Model/Position.cs index b180a3c..f01e7a7 100644 --- a/VisualHFT.Commons/Model/Position.cs +++ b/VisualHFT.Commons/Model/Position.cs @@ -204,7 +204,7 @@ private Order GetOrder(bool isOpen) //*************o.TimeInForce = //o.UnrealizedPnL - o.LastUpdated = System.DateTime.Now; + o.LastUpdated = HelperTimeProvider.Now; o.FilledPercentage = 100 * (o.FilledQuantity / o.Quantity); return o; } diff --git a/VisualHFT.Commons/PluginManager/BasePluginDataRetriever.cs b/VisualHFT.Commons/PluginManager/BasePluginDataRetriever.cs index 460eca4..c049a19 100644 --- a/VisualHFT.Commons/PluginManager/BasePluginDataRetriever.cs +++ b/VisualHFT.Commons/PluginManager/BasePluginDataRetriever.cs @@ -137,7 +137,7 @@ public virtual string GetPluginUniqueID() public abstract object GetUISettings(); //using object type because this csproj doesn't support UI public virtual object GetCustomUI() { - throw new NotImplementedException(); + return null; } diff --git a/VisualHFT.Commons/PluginManager/BasePluginStudy.cs b/VisualHFT.Commons/PluginManager/BasePluginStudy.cs index 493c54f..81c00ef 100644 --- a/VisualHFT.Commons/PluginManager/BasePluginStudy.cs +++ b/VisualHFT.Commons/PluginManager/BasePluginStudy.cs @@ -92,7 +92,7 @@ public virtual string GetPluginUniqueID() public abstract object GetUISettings(); //using object type because this csproj doesn't support UI public virtual object GetCustomUI() { - throw new NotImplementedException(); + return null; } protected virtual void Dispose(bool disposing) diff --git a/VisualHFT.Plugins/Studies.LOBImbalance/LOBImbalanceStudy.cs b/VisualHFT.Plugins/Studies.LOBImbalance/LOBImbalanceStudy.cs index 144af94..f135fc3 100644 --- a/VisualHFT.Plugins/Studies.LOBImbalance/LOBImbalanceStudy.cs +++ b/VisualHFT.Plugins/Studies.LOBImbalance/LOBImbalanceStudy.cs @@ -64,7 +64,7 @@ private void CalculateStudy() var newItem = new BaseStudyModel(); newItem.Value = (decimal)_orderBook.ImbalanceValue; newItem.ValueFormatted = _orderBook.ImbalanceValue.ToString("N1"); - newItem.Timestamp = DateTime.Now; + newItem.Timestamp = HelperTimeProvider.Now; newItem.MarketMidPrice = (decimal)_orderBook.MidPrice; OnCalculated?.Invoke(this, newItem); } diff --git a/VisualHFT.Plugins/Studies.MarketRatios/OrderToTradeRatioStudy.cs b/VisualHFT.Plugins/Studies.MarketRatios/OrderToTradeRatioStudy.cs index 9271e91..3f12382 100644 --- a/VisualHFT.Plugins/Studies.MarketRatios/OrderToTradeRatioStudy.cs +++ b/VisualHFT.Plugins/Studies.MarketRatios/OrderToTradeRatioStudy.cs @@ -115,7 +115,7 @@ private void CalculateStudy() Value = t2oRatio, ValueFormatted = t2oRatio.ToString("N1"), MarketMidPrice = _lastMarketMidPrice, - Timestamp = DateTime.Now, + Timestamp = HelperTimeProvider.Now, }; OnCalculated?.Invoke(this, newItem); diff --git a/VisualHFT.Plugins/Studies.MarketRatios/TradeToOrderRatioStudy.cs b/VisualHFT.Plugins/Studies.MarketRatios/TradeToOrderRatioStudy.cs index 70fde39..378451f 100644 --- a/VisualHFT.Plugins/Studies.MarketRatios/TradeToOrderRatioStudy.cs +++ b/VisualHFT.Plugins/Studies.MarketRatios/TradeToOrderRatioStudy.cs @@ -113,7 +113,7 @@ private void CalculateStudy() Value = t2oRatio, ValueFormatted = Math.Min(t2oRatio, 0.99m).ToString("N1"), MarketMidPrice = _lastMarketMidPrice, - Timestamp = DateTime.Now, + Timestamp = HelperTimeProvider.Now, }; diff --git a/VisualHFT.Plugins/Studies.MarketResilience/MarketResilienceBiasStudy.cs b/VisualHFT.Plugins/Studies.MarketResilience/MarketResilienceBiasStudy.cs index 4a4a255..034d5d7 100644 --- a/VisualHFT.Plugins/Studies.MarketResilience/MarketResilienceBiasStudy.cs +++ b/VisualHFT.Plugins/Studies.MarketResilience/MarketResilienceBiasStudy.cs @@ -77,7 +77,7 @@ private void _MARKETRESILIENCE_OnTradeRecovered(object? sender, (BaseStudyModel Value = _valueBias, ValueFormatted = _valueFormatted, ValueColor = _valueColor, - Timestamp = DateTime.Now, + Timestamp = HelperTimeProvider.Now, MarketMidPrice = e.model.MarketMidPrice }; diff --git a/VisualHFT.Plugins/Studies.MarketResilience/MarketResilienceStudy.cs b/VisualHFT.Plugins/Studies.MarketResilience/MarketResilienceStudy.cs index 0948041..227d497 100644 --- a/VisualHFT.Plugins/Studies.MarketResilience/MarketResilienceStudy.cs +++ b/VisualHFT.Plugins/Studies.MarketResilience/MarketResilienceStudy.cs @@ -201,7 +201,7 @@ private void TriggerOnCalculatedEvent(OrderBook currentOrderBook) Value = _resilienceValue.HasValue ? _resilienceValue.Value : 0, ValueFormatted = _resilienceValue.HasValue ? _resilienceValue.Value.ToString("N1") : ".", Tooltip = _resilienceValue.HasValue ? "" : "Waiting for data...", - Timestamp = DateTime.Now, + Timestamp = HelperTimeProvider.Now, MarketMidPrice = (decimal)currentOrderBook.MidPrice }; OnCalculated?.Invoke(this, newItem); @@ -213,7 +213,7 @@ private void TriggerOnTradeRecovered(OrderBook currentOrderBook) Value = _resilienceValue.HasValue ? _resilienceValue.Value : 0, ValueFormatted = _resilienceValue.HasValue ? _resilienceValue.Value.ToString("N1") : ".", Tooltip = _resilienceValue.HasValue ? "" : "Waiting for data...", - Timestamp = DateTime.Now, + Timestamp = HelperTimeProvider.Now, MarketMidPrice = (decimal)currentOrderBook.MidPrice }; OnTradeRecovered?.Invoke(this, (newItem, CONDITION2_LEVELS_CONSUMED_AT_BID ? eLOBSIDE.BID : eLOBSIDE.ASK)); diff --git a/VisualHFT.Plugins/Studies.VPIN/VPINStudy.cs b/VisualHFT.Plugins/Studies.VPIN/VPINStudy.cs index b4b5e8a..68d5012 100644 --- a/VisualHFT.Plugins/Studies.VPIN/VPINStudy.cs +++ b/VisualHFT.Plugins/Studies.VPIN/VPINStudy.cs @@ -147,7 +147,7 @@ private void CalculateStudy(bool isNewBucket) var newItem = new BaseStudyModel(); newItem.Value = _lastVPIN; newItem.ValueFormatted = _lastVPIN.ToString("N1"); - newItem.Timestamp = DateTime.Now; + newItem.Timestamp = HelperTimeProvider.Now; newItem.MarketMidPrice = _lastMarketMidPrice; OnCalculated?.Invoke(this, newItem); }