/// <summary> /// 取得成交資訊明細 /// </summary> /// <param name="time">即時時間</param> /// <param name="tick">成交資訊明細(ref)</param> /// <returns>返回值:false=新建立 true=已存在</returns> internal bool GetMitakeTick(DateTime time, ref MitakeIndexTick tick) { bool bRet = false; lock (__cKeys) { if (__cKeys.Contains(time)) { int iIndex = __cTicks.IndexOfKey(time); tick = __cTicks.Values[iIndex]; bRet = true; } else { if (tick == null) { tick = new MitakeIndexTick(); } tick.Time = time; __cKeys.Add(time); __cTicks.Add(time, tick); } } return(bRet); }
private void CloneIndex(MitakeIndexTick tick) { MitakeIndexClassify[] cClassifys = tick.Classifys; for (int i = 0; i < 64; i++) { this.Classifys[i].Clone(cClassifys[i]); } }
/// <summary> /// 大盤資訊類別 /// </summary> public MitakeIndex() { __cKeys = new HashSet <DateTime>(); __cTicks = new SortedList <DateTime, MitakeIndexTick>(4096); this.ReferPrices = new float[64]; this.即時資訊 = new MitakeIndexTick(); this.ComplementStatus = ComplementStatus.NotComplement; }
//計算單量 internal static void CalculateSingle(MitakeIndexTick current, MitakeIndexTick previous) { if (previous == null) { current.Single = current.Volume; current.成交張數單量 = current.成交張數; current.成交筆數單量 = current.成交筆數; } else { current.Single = current.Volume - previous.Volume; current.成交張數單量 = current.成交張數 - previous.成交張數; current.成交筆數單量 = current.成交筆數 - previous.成交筆數; } }
private void CloneTrust(MitakeIndexTick tick) { this.委買合計筆數 = tick.委買合計筆數; this.委買總跌停張數 = tick.委買總跌停張數; this.委買總跌停筆數 = tick.委買總跌停筆數; this.委買總漲停張數 = tick.委買總漲停張數; this.委買總漲停筆數 = tick.委買總漲停筆數; this.委賣合計筆數 = tick.委賣合計筆數; this.委賣總跌停張數 = tick.委賣總跌停張數; this.委賣總跌停筆數 = tick.委賣總跌停筆數; this.委賣總漲停張數 = tick.委賣總漲停張數; this.委賣總漲停筆數 = tick.委賣總漲停筆數; }
internal void Clone(MitakeIndexTick tick) { if (this.Flag < 15) { this.Flag |= tick.Flag; this.Ask = tick.Ask; this.Bid = tick.Bid; CloneIndex(tick); CloneVolume(tick); CloneTrust(tick); } }
internal MitakeIndexTick GetPreviousTick(DateTime time, int flag) { MitakeIndexTick cTick = null; int iIndex = __cTicks.IndexOfKey(time); if (iIndex > 0) { int iFlag = 0; while (iFlag == 0 && iIndex > 0) { cTick = __cTicks.Values[--iIndex]; iFlag = cTick.Flag & flag; } } return(cTick); }
private void CloneVolume(MitakeIndexTick tick) { if (this.Volume == 0 && tick.Volume > 0) { this.Volume = tick.Volume; } if (this.成交張數 == 0 && tick.成交張數 > 0) { this.成交張數 = tick.成交張數; } if (this.成交筆數 == 0 && tick.成交筆數 > 0) { this.成交筆數 = tick.成交筆數; } }
private void CloneVolume(MitakeIndexTick tick) { this.Volume = tick.Volume; this.成交張數 = tick.成交張數; this.成交筆數 = tick.成交筆數; }
internal void Clone(MitakeIndexTick tick, int flag) { this.Flag = tick.Flag; this.Ask = tick.Ask; this.Bid = tick.Bid; switch (flag) { case 1: //0x32 case 8: //0xb3 CloneIndex(tick); break; case 2: //0x33 CloneVolume(tick); break; case 4: //0x34 CloneTrust(tick); break; } }
/// <summary> /// 取得成交資訊明細 /// </summary> /// <param name="time">即時時間</param> /// <param name="tick">成交資訊明細(ref)</param> /// <returns>返回值:false=新建立 true=已存在</returns> internal bool GetMitakeTick(DateTime time, ref MitakeIndexTick tick) { bool bRet = false; lock (__cKeys) { if (__cKeys.Contains(time)) { int iIndex = __cTicks.IndexOfKey(time); tick = __cTicks.Values[iIndex]; bRet = true; } else { if (tick == null) { tick = new MitakeIndexTick(); } tick.Time = time; __cKeys.Add(time); __cTicks.Add(time, tick); } } return bRet; }
/// <summary> /// 大盤資訊類別 /// </summary> public MitakeIndex() { __cKeys = new HashSet<DateTime>(); __cTicks = new SortedList<DateTime, MitakeIndexTick>(4096); this.ReferPrices = new float[64]; this.即時資訊 = new MitakeIndexTick(); this.ComplementStatus = ComplementStatus.NotComplement; }