Beispiel #1
0
                internal static void Decode(MitakeIndex index, Mitake.Sockets.Data.PacketBuffer Buffer) {
                        int iSize = 0;
                        uint uValue = 0;
                        byte bMode = 0, bIType = 0, bFlag = 0;
			MitakeIndexTick cTick = null;

                        iSize = Buffer.Length - 2;
                        Buffer.Position = 7;          //移動至資料結構(時間欄位)

			DateTime cTime = Time.GetTime(Buffer); //取得時間
			bool bHave = index.GetMitakeTick(cTime, ref cTick);
			cTick.SetFlag(8);

			if (!bHave) {
				MitakeIndexTick cPrevTick = index.GetPreviousTick(cTime, 8);
				if (cPrevTick != null) {
					cTick.Clone(cPrevTick, 8);
				}
			}

                        do {
                                //取得價量旗標
                                bFlag = Buffer[0];
                                ++Buffer.Position;

                                //取得指數代號(有加權指數,不含金融 等......)
                                bIType = Buffer[0];
                                ++Buffer.Position;

                                //取得類股成交金額
                                bMode = BitConvert.GetValue(bFlag, 6, 2);
                                uValue = Volumn.GetVolumn(bMode, Buffer);

				cTick.Classifys[bIType].Amount = uValue;

                                //取得類股成交量
                                bMode = BitConvert.GetValue(bFlag, 4, 2);
                                
                                uValue = Volumn.GetVolumn(bMode, Buffer);
                                cTick.Classifys[bIType].Totals = uValue;
                       } while (Buffer.Position < iSize);//End While

                        ++index.UpdateCount;
		}
Beispiel #2
0
                internal static void Decode(MitakeIndex index, PacketBuffer Buffer) {
                        byte bMode = 0, bFlag = 0;
			MitakeIndexTick cTick = null;
                        
                        //移動至資料結構
                        Buffer.Position = 7;

			DateTime cTime = Time.GetTime(Buffer); //取得時間
			bool bHave = index.GetMitakeTick(cTime, ref cTick);
			cTick.SetFlag(2);

			MitakeIndexTick cPrevTick = index.GetPreviousTick(cTime, 2);
			if (!bHave) {
				if (cPrevTick != null) {
					cTick.Clone(cPrevTick, 2);
				}
			}

                        //取得format
                        bFlag = Buffer[0];
                        ++Buffer.Position;

                        //取得成交總額
                        bMode = BitConvert.GetValue(bFlag, 6, 2);

			uint uVolume = Volumn.GetVolumn(bMode, Buffer);
			
			cTick.Volume = uVolume;
			if (uVolume > index.成交總額) {
				index.成交總額 = uVolume;
			}

                        //取得成交張數
                        bMode = BitConvert.GetValue(bFlag, 4, 2);
                        cTick.成交張數 = Volumn.GetVolumn(bMode, Buffer);

                        //取得成交筆數
                        bMode = BitConvert.GetValue(bFlag, 2, 2);
                        cTick.成交筆數 = Volumn.GetVolumn(bMode, Buffer);

			CalculateSingle(cTick, cPrevTick);
			++index.UpdateCount;
		}
Beispiel #3
0
                internal static void Decode(MitakeIndex index, Mitake.Sockets.Data.PacketBuffer Buffer) {
			int iSize = 0;
                        byte bMode = 0, bType = 0, bFlag = 0;
                        MitakeIndexTick cTick = null;

                        iSize = Buffer.Length - 2;
                        Buffer.Position = 7;         //移動至資料結構(時間欄位)

			DateTime cTime = Time.GetTime(Buffer); //取得時間
			bool bHave = index.GetMitakeTick(cTime, ref cTick);
			cTick.SetFlag(4);

			if (!bHave) {
				MitakeIndexTick cPrevTick = index.GetPreviousTick(cTime, 4);
				if (cPrevTick != null) {
					cTick.Clone(cPrevTick, 4);
				}
			}

                        do {
                                //取得Format旗標
                                bFlag = Buffer[0];
                                ++Buffer.Position;

                                //取得委託張數大小(1~4 Byte 不固定)
                                bMode = BitConvert.GetValue(bFlag, 6, 2);

                                //取得委託代號(有委賣合計張數,委買合計張數 等......)
                                bType = BitConvert.GetValue(bFlag, 0, 6);

                                switch (bType) {
                                        case 0: //委買合計張數
						cTick.Bid = new DOMPrice(cTick.Price, Volumn.GetVolumn(bMode, Buffer));
                                                break;
                                        case 1: //委賣合計張數
						cTick.Ask = new DOMPrice(cTick.Price, Volumn.GetVolumn(bMode, Buffer));
                                                break;
                                        case 2: //委買合計筆數
                                                cTick.委買合計筆數 = Volumn.GetVolumn(bMode, Buffer);
                                                break;
                                        case 3: //委賣合計筆數
                                                cTick.委賣合計筆數 = Volumn.GetVolumn(bMode, Buffer);
                                                break;
                                        case 4: //委買總漲停張數
                                                cTick.委買總漲停張數 = Volumn.GetVolumn(bMode, Buffer);
                                                break;
                                        case 5: //委賣總漲停張數
                                                cTick.委賣總漲停張數 = Volumn.GetVolumn(bMode, Buffer);
                                                break;
                                        case 6: //委買總漲停筆數
                                                cTick.委買總漲停筆數 = Volumn.GetVolumn(bMode, Buffer);
                                                break;
                                        case 7: //委賣總漲停筆數
                                                cTick.委賣總漲停筆數 = Volumn.GetVolumn(bMode, Buffer);
                                                break;
                                        case 8: //委買總跌停張數
                                                cTick.委買總跌停張數 = Volumn.GetVolumn(bMode, Buffer);
                                                break;
                                        case 9: //委賣總跌停張數
                                                cTick.委賣總跌停張數 = Volumn.GetVolumn(bMode, Buffer);
                                                break;
                                        case 10: //委買總跌停筆數
                                                cTick.委買總跌停筆數 = Volumn.GetVolumn(bMode, Buffer);
                                                break;
                                        case 11: //委賣總跌停筆數
                                                cTick.委賣總跌停筆數 = Volumn.GetVolumn(bMode, Buffer);
                                                break;
                                        default:
                                                Buffer.Position += (bMode + 1);
                                                break;
                                }//End Switch
                        } while (Buffer.Position < iSize);//End While

			++index.UpdateCount;
                }
Beispiel #4
0
                internal static void Decode(MitakeIndex index, Mitake.Sockets.Data.PacketBuffer Buffer) {
			float fIndex = 0;
                        byte bMode = 0, bIType = 0, bFlag = 0;
			MitakeIndexTick cTick = null;

                        int iSize = Buffer.Length - 2;
                        Buffer.Position = 7;          //移動至資料結構(時間欄位)

			DateTime cTime = Time.GetTime(Buffer); //取得時間
			bool bHave = index.GetMitakeTick(cTime, ref cTick);
			cTick.SetFlag(1);

			if (!bHave) {
				MitakeIndexTick cPrevTick = index.GetPreviousTick(cTime, 1);
				if (cPrevTick != null) {
					cTick.Clone(cPrevTick, 1);
				}
			}

                        do {
                                //取得價量旗標
                                bFlag = Buffer[0];
                                ++Buffer.Position;

                                //取得指數大小(1~4 Byte 不固定)
                                bMode = BitConvert.GetValue(bFlag, 6, 2);

                                //取得指數代號(有加權指數,不含金融 等......)
                                bIType = BitConvert.GetValue(bFlag, 0, 6);
                                fIndex = (float)(Volumn.GetVolumn(bMode, Buffer) * 0.01);

				if (Time.ConvertForTotalSeconds(cTime) == 32400) { //09:00 開盤會送出昨日收盤價
                                        index.ReferPrices[bIType] = fIndex;  //昨天收盤指數
                                }
                                cTick.Classifys[bIType].IndexValue = fIndex;

                                if (index.Serial == 9999) {
                                        switch (bIType) {
                                                case 0: //加權指數
                                                        if (fIndex > 0) {
								cTick.Ask = new DOMPrice(fIndex, cTick.Ask.Size);
								cTick.Bid = new DOMPrice(fIndex, cTick.Bid.Size);

								if (cTime >= index.即時資訊.Time) {
									index.加權指數價差 = fIndex - index.ReferPrices[0];
									CalculatePrice(index, cTime, fIndex);
								}
                                                        }
                                                        break;
                                                case 9: //不含金融
                                                        if (fIndex > 0) {
                                                                if (cTime >= index.即時資訊.Time)
                                                                        index.不含金融價差 = fIndex - index.ReferPrices[9];
                                                        }
                                                        break;
                                                default:
                                                        break;
                                        }
                                }
                        } while (Buffer.Position < iSize);//End While

			if (cTime > index.即時資訊.Time) {
			        index.即時資訊 = cTick;
			}
			++index.UpdateCount;
                }