public override void OnMessage(object sender, WebSocket4Net.MessageReceivedEventArgs args) { try { base.OnMessage(sender, args); dynamic obj = Newtonsoft.Json.JsonConvert.DeserializeObject(args.Message); foreach (dynamic item in obj) { if (item.channel == "ok_sub_spot_btc_usdt_ticker") { long timestamp = item.data.timestamp * 10000; var timeStr = StartDate.AddTicks(timestamp).DateTimeToDBString(); string price = item.data.buy; this.Insert(price, timeStr); } } } catch (Exception ex) { System.IO.File.AppendAllText(System.Environment.CurrentDirectory + $"/{DateTime.Now.ToString("yyyyMMdd")}.log", $"[{Platform}] throw a error : {ex.Message}\r\n"); } }
public override void OnMessage(object sender, WebSocket4Net.MessageReceivedEventArgs args) { try { base.OnMessage(sender, args); dynamic obj = Newtonsoft.Json.JsonConvert.DeserializeObject(args.Message); if (obj["event"] == "trade") { dynamic data = Newtonsoft.Json.JsonConvert.DeserializeObject(obj.data.Value); string timestamp = data.timestamp; var timeStr = StartDate.AddTicks(long.Parse(timestamp) * 10000000).DateTimeToDBString(); string price = data.price_str; this.Insert(price, timeStr); } } catch (Exception ex) { System.IO.File.AppendAllText(System.Environment.CurrentDirectory + $"/{DateTime.Now.ToString("yyyyMMdd")}.log", $"[{Platform}] throw a error : {ex.Message}\r\n"); } }
public override void OnMessage(object sender, WebSocket4Net.MessageReceivedEventArgs args) { try { base.OnMessage(sender, args); dynamic obj = Newtonsoft.Json.JsonConvert.DeserializeObject(args.Message); if (obj["event"] == "created") { string strData = obj.data; var data = Newtonsoft.Json.JsonConvert.DeserializeObject <QuoinexDetail>(strData); long created_at = data.created_at; string created_str = StartDate.AddTicks(created_at * 10000000).ToString("yyyy-MM-dd HH:mm:ss,ms"); string price = data.price; this.Insert(price, created_str); } } catch (Exception ex) { System.IO.File.AppendAllText(System.Environment.CurrentDirectory + $"/{DateTime.Now.ToString("yyyyMMdd")}.log", $"[{Platform}] throw a error : {ex.Message}\r\n"); } }
protected override void SetupForCellPassStackExamination() { base.SetupForCellPassStackExamination(); if (!_commonCellPassStackExaminationDone) { // Modify the cell pass iterator to obey the time range established by the StartDate/EndDate arguments _cellPassIterator.SetTimeRange(true, StartDate, EndDate); // Construct a reversing segment and cell pass iterator used to locate necessary cell passes earlier than the first cell pass // according to the primary cell pass iterator _cellPassIterator. Allow it's time range to be all of history prior to StartDate // Note that both the reversing and progressive sub grid operator are provide the same sub grid. This permits both iterators // to leverage the inherent cache of segment information within the sub grid. _reversingSegmentIterator = new SubGridSegmentIterator(_subGridAsLeaf, _subGridAsLeaf.Directory, _storageProxy) { IterationDirection = IterationDirection.Backwards }; _reversingCellPassIterator = new SubGridSegmentCellPassIterator_NonStatic(_reversingSegmentIterator, _maxNumberOfPassesToReturn); _reversingCellPassIterator.SetTimeRange(true, DateTime.MinValue, StartDate.AddTicks(-100)); _commonCellPassStackExaminationDone = true; } _segmentIterator.IterationDirection = IterationDirection.Forwards; _reversingSegmentIterator.SubGrid = _subGridAsLeaf; _reversingSegmentIterator.Directory = _subGridAsLeaf.Directory; }
public override void OnMessage(object sender, WebSocket4Net.MessageReceivedEventArgs args) { base.OnMessage(sender, args); try { dynamic obj = Newtonsoft.Json.JsonConvert.DeserializeObject(args.Message); long ticks = obj.E * 10000; string timeStr = StartDate.AddTicks(ticks).DateTimeToDBString(); string price = obj.p; this.Insert(price, timeStr); } catch (Exception ex) { System.IO.File.AppendAllText(System.Environment.CurrentDirectory + $"/{DateTime.Now.ToString("yyyyMMdd")}.log", $"[{Platform}] throw a error : {ex.Message}\r\n"); } }
public override void OnMessage(object sender, WebSocket4Net.MessageReceivedEventArgs args) { try { base.OnMessage(sender, args); object obj = null; obj = Newtonsoft.Json.JsonConvert.DeserializeObject(args.Message); if (obj is JArray arr && arr[1].Type == JTokenType.String) { string price = string.Empty; long timestamp = 0; switch (arr[1].Value <string>()) { case "te": timestamp = arr[3].Value <long>(); price = arr[4].Value <string>(); break; case "tu": timestamp = arr[4].Value <long>(); price = arr[5].Value <string>(); break; } if (!string.IsNullOrEmpty(price) && timestamp != 0) { var timeStr = StartDate.AddTicks(timestamp * 10000000L).DateTimeToDBString(); this.Insert(price, timeStr); } } } catch (Exception ex) { System.IO.File.AppendAllText(System.Environment.CurrentDirectory + $"/{DateTime.Now.ToString("yyyyMMdd")}.log", $"[{Platform}] throw a error : {ex.Message}\r\n"); } }
/// <summary> /// Convertit des ticks en date de début. /// </summary> /// <param name="ticks">Les ticks.</param> /// <returns>La date de début.</returns> public static DateTime ToDateTime(long ticks) { return(StartDate.AddTicks(ticks)); }