Пример #1
0
        /// <summary>
        ///   取得陣列內的MitakeQuote類別資料
        /// </summary>
        /// <param name="serial">股票流水號</param>
        /// <returns>返回值: MitakeQuote類別</returns>
        internal MitakeQuote GetQuote(int serial)
        {
            MitakeQuote cMitakeQuote = null;
            int         iIndex       = 0;

            lock (__cKeys) {
                if (__cKeys.TryGetValue(serial, out iIndex))
                {
                    cMitakeQuote = __cQuotes[iIndex];

                    if (cMitakeQuote.SymbolId.Length == 0)
                    {
                        SetSymbolInformation(cMitakeQuote, MitakeSymbolManager.GetQuoteSymbolInformation(serial));
                    }
                }
                else
                {
                    MitakeSymbolInformation cSymbolInfo = MitakeSymbolManager.GetQuoteSymbolInformation(serial);

                    int iMarketType = ((cSymbolInfo == null) ? 0 : cSymbolInfo.市場別);
                    int iCapacity   = ((iMarketType == 2) ? 16384 : 1024);
                    cMitakeQuote        = new MitakeQuote(iCapacity);
                    cMitakeQuote.Serial = serial;

                    SetSymbolInformation(cMitakeQuote, cSymbolInfo);

                    iIndex = __cQuotes.Count;
                    __cKeys.Add(serial, iIndex);
                    __cQuotes.Add(cMitakeQuote);
                }
            }
            return(cMitakeQuote);
        }
Пример #2
0
        public IQuote GetQuote(string symbolId)
        {
            int iSerial = MitakeSymbolManager.ConvertToSerial(symbolId);

            switch (iSerial)
            {
            case 9998:                     //上櫃指數
            case 9999:                     //上市指數
                return(GetIndex(iSerial));

            default:
                return(GetQuote(iSerial));
            }
        }
Пример #3
0
		internal static void Update(DateTime date) {
			__cToday = date.Date;
			__cSymbolList.Clear();
			__cMitakeQuoteInformations.Clear();

			AbstractExchange cExchange = ProductManager.Manager.GetExchange(__sExchangeName);
			cExchange.Update(date); //更新交易所商品屬性資訊

			cExchange.UpdateTime = DateTime.Today.AddDays(-2);  //設定為兩天前(強迫更新)
			cExchange.Clear();  //如果要更新則全部清除

			//新增上櫃指數(Mitake股票清單內沒有這支指數需要自行新增)
			cExchange.AddProduct(MitakeSymbolManager.GetIndexSymbolInformation(9998));

			//新增上市指數(Mitake股票清單內沒有這支指數需要自行新增)
			cExchange.AddProduct(MitakeSymbolManager.GetIndexSymbolInformation(9999));
		}
Пример #4
0
        /// <summary>
        ///   取得陣列內的MitakeIndex類別資料
        /// </summary>
        /// <param name="serial">股票流水號</param>
        /// <returns>返回值: MitakeIndex類別</returns>
        internal MitakeIndex GetIndex(int serial)
        {
            MitakeIndex cMitakeIndex = null;

            if (!__cIndexs.TryGetValue(serial, out cMitakeIndex))
            {
                Product cProduct = MitakeSymbolManager.GetIndexSymbolInformation(serial);

                cMitakeIndex        = new MitakeIndex();
                cMitakeIndex.Serial = serial;

                if (cProduct != null)
                {
                    cMitakeIndex.SymbolId   = cProduct.SymbolId;
                    cMitakeIndex.SymbolName = cProduct.SymbolName;
                }

                lock (__cIndexs) {
                    __cIndexs.Add(serial, cMitakeIndex);
                }
            }
            return(cMitakeIndex);
        }
Пример #5
0
 public bool IsSymbolExist(string symbolId)
 {
     return(MitakeSymbolManager.IsExist(symbolId));
 }