Exemple #1
0
        /// <summary>
        ///    取得成交資訊明細
        /// </summary>
        /// <param name="serial">即時資訊序號</param>
        /// <param name="tick">即時成交資訊(ref)</param>
        /// <returns>返回值:false=新建立  true=已存在</returns>
        internal bool GetMitakeTick(int serial, ref MitakeQuoteTick tick)
        {
            bool bRet = false;

            lock (__cKeys) {
                if (__cKeys.Contains(serial))
                {
                    int iIndex = __cTicks.IndexOfKey(serial);
                    tick = __cTicks.Values[iIndex];
                    bRet = true;
                }
                else
                {
                    if (tick == null)
                    {
                        tick = new MitakeQuoteTick();
                    }

                    tick.Serial = serial;
                    __cKeys.Add(serial);
                    __cTicks.Add(serial, tick);
                }
            }
            return(bRet);
        }
Exemple #2
0
        /// <summary>
        ///   即時個股報價資訊
        /// </summary>
        public MitakeQuote(int capacity)
        {
            __cKeys  = new HashSet <int>();
            __cTicks = new SortedList <int, MitakeQuoteTick>(capacity);

            this.SymbolId         = string.Empty;
            this.SymbolName       = string.Empty;
            this.即時資訊             = new MitakeQuoteTick();
            this.委買委賣資訊           = new MitakeEntrust();
            this.ComplementStatus = ComplementStatus.NotComplement;
        }
Exemple #3
0
        internal MitakeQuoteTick GetPreviousTick(int serial)
        {
            MitakeQuoteTick cTick = null;

            int iIndex = __cTicks.IndexOfKey(serial);

            if (iIndex > 0)
            {
                cTick = __cTicks.Values[iIndex - 1];
            }
            return(cTick);
        }
Exemple #4
0
 /// <summary>
 ///    比較價位(比較委買委賣價位,判斷是買盤還是賣盤)
 /// </summary>
 /// <param name="current">目前即時成交資訊</param>
 /// <param name="old">上一筆即時成交資訊</param>
 internal static void ComparePrice(MitakeQuoteTick current, MitakeQuoteTick old) {
         if (old != null) {
                 if (current.Price > old.Price) {
                         current.買賣盤 = 1;
                 } else if (current.Price < old.Price) {
                         current.買賣盤 = 2;
                 } else {
                         if (current.Ask.Price > old.Ask.Price) {
                                 current.買賣盤 = 1;
                         } else if (current.Ask.Price < old.Ask.Price) {
                                 current.買賣盤 = 2;
                         } else {
                                 if (current.Price == current.Bid.Price) {
                                         current.買賣盤 = 2;
                                 } else if (current.Price == current.Ask.Price) {
                                         current.買賣盤 = 1;
                                 }
                         }
                 }
         }
 }
Exemple #5
0
 /// <summary>
 ///    比較價位(比較委買委賣價位,判斷是買盤還是賣盤)
 /// </summary>
 /// <param name="current">目前即時成交資訊</param>
 /// <param name="old">上一筆即時成交資訊</param>
 internal static void ComparePrice(MitakeQuoteTick current, MitakeQuoteTick old)
 {
     if (old != null)
     {
         if (current.Price > old.Price)
         {
             current.買賣盤 = 1;
         }
         else if (current.Price < old.Price)
         {
             current.買賣盤 = 2;
         }
         else
         {
             if (current.Ask.Price > old.Ask.Price)
             {
                 current.買賣盤 = 1;
             }
             else if (current.Ask.Price < old.Ask.Price)
             {
                 current.買賣盤 = 2;
             }
             else
             {
                 if (current.Price == current.Bid.Price)
                 {
                     current.買賣盤 = 2;
                 }
                 else if (current.Price == current.Ask.Price)
                 {
                     current.買賣盤 = 1;
                 }
             }
         }
     }
 }
Exemple #6
0
                //計算第一檔委買賣
                internal static void CalculateEntrust(MitakeQuote stock, MitakeQuoteTick tick) {
                        //if (Time.ConvertForTotalSeconds(Turnover.Time) <= 50400) {  //14:00以下的委買委賣量 才算有交割資料
			if (tick.Ask.Price > 0 && tick.Ask.Size > 0) {
				stock.委買委賣資訊.Ask[0] = tick.Ask;
			}

			if (tick.Bid.Price > 0 && tick.Bid.Size > 0) {
				stock.委買委賣資訊.Bid[0] = tick.Bid;
			}
                        //}
                }
Exemple #7
0
                /// <summary>
                ///    取得成交資訊明細
                /// </summary>
                /// <param name="serial">即時資訊序號</param>
                /// <param name="tick">即時成交資訊(ref)</param>
                /// <returns>返回值:false=新建立  true=已存在</returns>
                internal bool GetMitakeTick(int serial, ref MitakeQuoteTick tick) {
                        bool bRet = false;
                        lock (__cKeys) {
                                if (__cKeys.Contains(serial)) {
					int iIndex = __cTicks.IndexOfKey(serial);
					tick = __cTicks.Values[iIndex];
                                        bRet = true;
                                } else {
					if (tick == null) {
						tick = new MitakeQuoteTick();
					}

					tick.Serial = serial;
					__cKeys.Add(serial);
					__cTicks.Add(serial, tick);
				}
                        }
                        return bRet;
                }
Exemple #8
0
		/// <summary>
		///   即時個股報價資訊
		/// </summary>
		public MitakeQuote(int capacity) {
			__cKeys = new HashSet<int>();
			__cTicks = new SortedList<int, MitakeQuoteTick>(capacity);

			this.SymbolId = string.Empty;
			this.SymbolName = string.Empty;
			this.即時資訊 = new MitakeQuoteTick();
			this.委買委賣資訊 = new MitakeEntrust();
			this.ComplementStatus = ComplementStatus.NotComplement;
		}