protected internal override void OnReceiveRealData(string szTrCode) { string[] array = Enum.GetNames(typeof(C)), temp = new string[array.Length]; for (int i = 0; i < array.Length; i++) { temp[i] = GetFieldData(OutBlock, array[i]); } if (int.TryParse(string.Concat(temp[8], temp[9]), out int volume) && double.TryParse(temp[4], out double price)) { Send?.Invoke(this, new Datum(temp[0], price, volume)); SendTrend?.Invoke(this, API.Volume == 0 || API.OnReceiveBalance == false ? new Trends(API.Trend, API.AvgPurchase, API.OnReceiveBalance) : new Trends(API.Trend, API.Volume)); } }
protected internal override void OnReceiveRealData(string szTrCode) { string[] array = Enum.GetNames(typeof(C)), temp = new string[array.Length]; for (int i = 0; i < array.Length; i++) { temp[i] = GetFieldData(OutBlock, array[i]); } Send?.Invoke(this, new Datum(temp[0], temp[4])); if (int.TryParse(string.Concat(temp[8], temp[9]), out int volume)) { API.Volume += volume; SendTrend?.Invoke(this, new Trends(API.Trend, API.Volume)); } }
void OnReceiveRealData(object sender, _DKHOpenAPIEvents_OnReceiveRealDataEvent e) { var sb = new StringBuilder(512); int index = Array.FindIndex(Enum.GetNames(typeof(RealType)), o => o.Equals(e.sRealType)); if (index < 0) { return; } foreach (int fid in catalogReal[index]) { sb.Append(API.GetCommRealData(e.sRealKey, fid)).Append(';'); } var param = sb.ToString().Split(';'); switch (index) { case 0b1: if (e.sRealKey.Equals(Code)) { SendDatum?.Invoke(this, new Datum(param)); SendTrend?.Invoke(this, new Trends(Trend, Volume)); } return; case 0b10: if (e.sRealKey.Equals(Code)) { SendQuotes?.Invoke(this, new Quotes(new string[] { param[35], param[27], param[19], param[11], param[3], param[7], param[15], param[23], param[31], param[39] }, new string[] { param[36], param[28], param[20], param[12], param[4], param[8], param[16], param[24], param[32], param[40] }, new string[] { param[38], param[30], param[22], param[14], param[6], param[10], param[18], param[26], param[34], param[42] }, param[0], SellOrder, BuyOrder, string.Concat(param[44], ";", param[47]))); } return; case 0b1000: if (e.sRealKey.Equals(Code)) { SendCurrent?.Invoke(this, new Current(Quantity, param)); } return; case 0b1001: if (param[0].Equals("e") && DeadLine) { DeadLine = false; if (Temporary != null) { Temporary.SetStorage(Code); SendCount?.Invoke(this, new NotifyIconText(-106)); } else { OnReceiveBalance = false; } } else if (param[0].Equals("3") && DeadLine == false) { DeadLine = true; Delay.Milliseconds = 205; if (Temporary == null || Collector) { OnReceiveBalance = true; } } break; case 0xA: SendStocksDatum?.Invoke(this, new Stocks(e.sRealKey, param)); return; case 0xB: SendStocksQuotes?.Invoke(this, new StocksQuotes(e.sRealKey, param[0b100]));