Esempio n. 1
0
                internal static TimerEvent Decode(PacketBuffer buffer, bool isDecode) {
                        if (isDecode) {
				buffer.Position = 0;  //從第0索引開始
				int iLength = buffer[3];  //取得封包長度

				TimerEvent cTimer = new TimerEvent();
                                cTimer.QuoteDateTime = Time.GetDateTime(buffer);
                                
				cTimer.Trade = (byte)(buffer[0] & 0x03);
				++buffer.Position;

				if (iLength == 9) {  //表示有最後交易日期
					cTimer.TradeDate = Time.GetDate(buffer);
				} else {
					cTimer.TradeDate = cTimer.QuoteDateTime.Date;
				}
                                return cTimer;
                        } else {
                                return null;
                        }
                }
Esempio n. 2
0
                private void StockClient_onTimer(object sender, TimerEvent e) {
			OnQuoteDateTime(this.DataSource, e.QuoteDateTime);
                }
Esempio n. 3
0
		private void GetTradeDateFromLogin(object sender, TimerEvent e) {
			StockDecoder.TimerProc -= GetTradeDateFromLogin;
			__cTradeDate = e.TradeDate;
			Mitake.Stock.Util.Time.SetToday(__cTradeDate);

			Task.Factory.StartNew(() => {
				if (__bReset) {
					this.IsLogin = true;
					if (!__bReseted) {  //如果還沒有清盤完畢, 就執行清盤動作
						MitakeSymbolManager.Update(DateTime.UtcNow.AddHours(TIME_ZONE), false);
						OnReset(new QuoteResetEvent(this.DataSource));
						if (logger.IsInfoEnabled) logger.InfoFormat("[QuoteService.Reset] Service \"{0}\" data reset success...", this.DataSource);

						__bReseted = true;  //設定已經清盤完畢的旗標
					}
				} else {
					if (this.IsUpdate) {
						SymbolUpdate();  //回補股票代號(每天只回補一次股票代號)
					} else {
						this.IsLogin = true;
						OnLoginCompleted();
					}
				}
			});
		}