public SweepUnitPOrder(StringPacket sp) { Code = sp.Decode(); ReqCount = sp.DecodeLong(); ReqPrice = sp.DecodeDouble(); ContractedCount = sp.DecodeLong(); _State = sp.Decode(); }
public SortedList<DateTime, InfomaxDataRow> LoadData( String targetCode, String path, InfomaxDataRow.Type targetType) { SortedList<DateTime, InfomaxDataRow> data = new SortedList<DateTime, InfomaxDataRow>(); FileStream fs = new FileStream(path, FileMode.Open, FileAccess.Read, FileShare.Read); StreamReader sr = new StreamReader(fs); while (!sr.EndOfStream) { String line = sr.ReadLine(); StringPacket sp = new StringPacket(line); sp.Decode(); // skip sp.Decode(); // skip InfomaxDataRow.Type type = InfomaxDataRow.Type.Unknown; String strType = sp.Decode(); if (strType.CompareTo("CurPrice") == 0) { type = InfomaxDataRow.Type.CurPrice; } else if (strType.CompareTo("BidPrice") == 0) { type = InfomaxDataRow.Type.BidPrice1; } else if (strType.CompareTo("AskPrice") == 0) { type = InfomaxDataRow.Type.AskPrice1; } double value = sp.DecodeDouble(); DateTime dt = DateTime.ParseExact(sp.Decode(), "yyyyMMdd HH:mm:ss.fff", null); if (type == targetType) { InfomaxDataRow row = new InfomaxDataRow(); row.RowType = type; row.Value = value; row.CurDateTime = dt; data.Add(dt, row); } } sr.Close(); fs.Close(); return data; }
public SweepUnitDataRow(StringPacket sp, int id) { ID = id; Code = sp.Decode(); Exposure = sp.DecodeDouble(); _State = sp.Decode(); int count = sp.DecodeInt(); Orders = new ArrayList(); for (int i = 0; i < count; ++i) { Orders.Add(new SweepUnitPOrder(sp)); } }
public SortedList<DateTime, InfomaxDataRow> LoadData( String targetCode, String path, InfomaxDataRow.Type targetType) { SortedList<DateTime, InfomaxDataRow> data = new SortedList<DateTime, InfomaxDataRow>(); FileStream fs = new FileStream(path, FileMode.Open, FileAccess.Read, FileShare.Read); StreamReader sr = new StreamReader(fs); while (!sr.EndOfStream) { String line = sr.ReadLine(); StringPacket sp = new StringPacket(line); String code = sp.Decode(); if (code.CompareTo(targetCode) == 0) { InfomaxDataRow.Type type = InfomaxDataRow.ConvertStringToType(sp.Decode()); double value = sp.DecodeDouble(); DateTime dt = DateTime.ParseExact(sp.Decode(), "yyyyMMdd HH:mm:ss.fff", null); if (type == targetType) { InfomaxDataRow row = new InfomaxDataRow(); row.RowType = type; row.Value = value; row.CurDateTime = dt; data.Add(dt, row); } } } sr.Close(); fs.Close(); return data; }
RawMarketData Decode_Raw(String line) { StringPacket sp = new StringPacket(line); String code = sp.Decode(); //2011-07-13 09:00:00.000 DateTime curDateTime = DateTime.ParseExact(sp.Decode(), "yyyy-MM-dd HH:mm:ss.fff", null); if (curDateTime.Hour >= 15) { return null; } double askPrice = sp.DecodeDouble(); double curPrice = sp.DecodeDouble(); double bidPrice = sp.DecodeDouble(); RawMarketData rmd = new RawMarketData(code, Detail.ProductType.Unknown); rmd.CurPrice = curPrice; rmd.BidPrice1 = bidPrice; rmd.AskPrice1 = askPrice; rmd.LastUpdatedTime = curDateTime; return rmd; }
public PowerBaseResultData(String rawData, Account.OrderLineType pt, Boolean bReal) { try { StringPacket packet = new StringPacket(rawData, "|"); //0. DT Real packet.Decode(); // 1 없애고 //1. 주문번호 int tmp주문번호 = packet.DecodeInt(); // 주문 번호 //2. 주문처리유형 String tmp주문처리유형 = packet.Decode(); // 주문 처리 유형, 01 접수, 03 확인, 04 일부체결, 05 전량체결 //3. 계좌번호 String tmp계좌번호 = packet.Decode().Trim(); //4. 종목코드 String tmp종목코드 = packet.Decode().Trim(); //5. 현물잔고유형코드 packet.Decode(); // 현물 잔고 유형 코드 //6. 대출상세분류코드 packet.Decode(); // 대출 상세 분류 코드 //7. 대출일 packet.Decode(); // 대출일 //8. 매매구분 long tmp매매구분 = packet.DecodeLong(); // 2은 매수, 1는 매도 //9. 호가구분 String tmp호가구분 = packet.Decode(); // 00은 지정가, 03은 시장가, 취소인 경우 '' //10, 정정취소가능수량 long tmp정정취소가능수량 = packet.DecodeLong(); //11. 주문가격 double tmp주문가격 = packet.DecodeDouble(); // 주문한 가격 //12. 주문수량 long tmp주문수량 = packet.DecodeLong(); //13. 전체체결수량 long tmp전체체결수량 = packet.DecodeLong(); //14. 원주문번호 long tmp원주문번호 = packet.DecodeLong(); //15. 원주문미체결수량 long tmp원주문미체결수량 = packet.DecodeLong(); //16. 원주문정정취소수량 long tmp원주문정정취소수량 = packet.DecodeLong(); //17. 종목코드1 packet.Decode(); //18. 매매구분1 packet.Decode(); //19. 미결제수량1 packet.Decode(); //20. 청산가능수량1 packet.Decode(); //21. 종목코드2 packet.Decode(); //22. 매매구분2 packet.Decode(); //23. 미결제수량2 packet.Decode(); //24. 청산가능수량2 packet.Decode(); //25. 매입금액1 packet.Decode(); //26. 매입금액2 packet.Decode(); //27. 매매손익 packet.Decode(); //28. 전체매매손익 packet.Decode(); //29. 거래단위 packet.Decode(); //30. 시간 packet.Decode(); //31. 전략코드 packet.Decode(); //32. 그룹ID packet.Decode(); //33. 주문회차 packet.Decode(); //34. 정상,정정,취소 String tmp정상_정정_취소 = packet.Decode(); //정상,정정,취소(0:정상,1:정정,2:취소) //35. 체결가격 packet.Decode(); //36. 체결수량 packet.Decode(); //37. 평균단가 double tmp평균단가 = packet.DecodeDouble(); //38. 원주문회차번호 //39. 접속분류코드 //40. 통신매체코드 //41. 종목명 //42. 계좌명 //43. 비밀번호 //44. 신용거래코드 // 지정가 주문이 잘 나간 경우는 호가구분이 00(지정가), 주문처리유형이 01(접수) // 지정가 주문이 일부 체결되면 주문처리유형이 04(일부 체결)이 되고 모두 체결이 되면 05(전량 체결)이 됨 // 취소 주문이 잘 나간 경우는 호가구분이 ''(취소), 주문처리유형이 03(확인), 원주문 미체결수량 0 // 시장가의 경우 호가구분이 03(시장가), 주문처리유형이 05(전량체결) Update( tmp주문번호, tmp주문처리유형, tmp계좌번호, tmp종목코드, tmp정상_정정_취소, tmp매매구분, tmp호가구분, tmp주문가격, tmp주문수량, tmp전체체결수량, tmp원주문번호, tmp원주문미체결수량, tmp원주문정정취소수량, tmp정정취소가능수량, tmp평균단가, pt, bReal); } catch (Exception ex) { logger.Error(ex.ToString()); Util.KillWithNotice(ex.ToString()); } }
void FillElwRemains(String packet) { StringPacket sp = new StringPacket(packet + ":", ":"); String key = sp.Decode(); if (key.CompareTo("종목번호") == 0) { long index = sp.DecodeLong(); String code = sp.Decode(); RawPOrderData rpd = new RawPOrderData(); rpd.Code = code; _elwRemains.Add(index, rpd); } else if (key.CompareTo("금일보유수량") == 0) { long index = sp.DecodeLong(); long count = sp.DecodeLong(); _elwRemains[index].ReqCount = count; } else if (key.CompareTo("장부단가") == 0) { long index = sp.DecodeLong(); double price = sp.DecodeDouble(); _elwRemains[index].ReqPrice = price; } }