public void RMDJsonTest() { RawMarketData rmd = new RawMarketData("testCode", Detail.ProductType.KospiFuture); RawMarketDataJson rmdJson = new RawMarketDataJson(rmd); Serializer serializer = new Serializer(typeof(RawMarketDataJson)); string jsonText = serializer.Serialize(rmdJson); RawMarketDataJson rmdJson2 = (RawMarketDataJson)serializer.Deserialize(jsonText); }
private void button1_Click(object sender, EventArgs e) { //Json생성 try { String code = textCode.Text; long askCount1 = Convert.ToInt64(Util.RemoveComma(textAskCount1.Text)); double askPrice1 = Convert.ToDouble(Util.RemoveComma(textAskPrice1.Text)); long bidCount1 = Convert.ToInt64(Util.RemoveComma(textBidCount1.Text)); double bidPrice1 = Convert.ToDouble(Util.RemoveComma(textBidPrice1.Text)); if (radioButton1.Checked) { code = code + "_normal"; } else if (radioButton2.Checked) { code = code + "_small"; } else { code = code + "_retail"; } RawMarketData rmd = new RawMarketData(code, Detail.ProductType.BondSpot); rmd.AskCount1 = askCount1; rmd.AskPrice1 = askPrice1; rmd.BidCount1 = bidCount1; rmd.BidPrice1 = bidPrice1; rmd.LastUpdatedTime = DateTime.Now; RawMarketDataJson rmdj = new RawMarketDataJson(rmd); textJsonText.Text = Util.GetJsonText(typeof(RawMarketDataJson), rmdj); } catch (System.Exception ex) { logger.Warn(ex.ToString()); } }
public void AssignValue(RawMarketDataJson rmdj) { // 가격, 수량, 시간 정보만 update한다. Trace.Assert(rmdj.Code.CompareTo(this.Code) == 0); this.AskCount1 = rmdj.AskCount1; this.AskCount2 = rmdj.AskCount2; this.AskCount3 = rmdj.AskCount3; this.AskCount4 = rmdj.AskCount4; this.AskCount5 = rmdj.AskCount5; this.BidCount1 = rmdj.BidCount1; this.BidCount2 = rmdj.BidCount2; this.BidCount3 = rmdj.BidCount3; this.BidCount4 = rmdj.BidCount4; this.BidCount5 = rmdj.BidCount5; this.AskPrice1 = rmdj.AskPrice1; this.AskPrice2 = rmdj.AskPrice2; this.AskPrice3 = rmdj.AskPrice3; this.AskPrice4 = rmdj.AskPrice4; this.AskPrice5 = rmdj.AskPrice5; this.BidPrice1 = rmdj.BidPrice1; this.BidPrice2 = rmdj.BidPrice2; this.BidPrice3 = rmdj.BidPrice3; this.BidPrice4 = rmdj.BidPrice4; this.BidPrice5 = rmdj.BidPrice5; this.LastUpdatedTime = DateTime.Now; }
public static String GetRmdTextFormString(RawMarketDataJson rmd) { String str = ""; str += String.Format("{0, 15:n0} [{1, 6:n0}]", rmd.AskCount5 / 1000, rmd.AskPrice5); str += "\r\n"; str += String.Format("{0, 15:n0} [{1, 6:n0}]", rmd.AskCount4 / 1000, rmd.AskPrice4); str += "\r\n"; str += String.Format("{0, 15:n0} [{1, 6:n0}]", rmd.AskCount3 / 1000, rmd.AskPrice3); str += "\r\n"; str += String.Format("{0, 15:n0} [{1, 6:n0}]", rmd.AskCount2 / 1000, rmd.AskPrice2); str += "\r\n"; str += String.Format("{0, 15:n0} [{1, 6:n0}]", rmd.AskCount1 / 1000, rmd.AskPrice1); str += "\r\n"; str += String.Format(" [{1, 6:n0}] {0, 15:n0}", rmd.BidCount1 / 1000, rmd.BidPrice1); str += "\r\n"; str += String.Format(" [{1, 6:n0}] {0, 15:n0}", rmd.BidCount2 / 1000, rmd.BidPrice2); str += "\r\n"; str += String.Format(" [{1, 6:n0}] {0, 15:n0}", rmd.BidCount3 / 1000, rmd.BidPrice3); str += "\r\n"; str += String.Format(" [{1, 6:n0}] {0, 15:n0}", rmd.BidCount4 / 1000, rmd.BidPrice4); str += "\r\n"; str += String.Format(" [{1, 6:n0}] {0, 15:n0}", rmd.BidCount5 / 1000, rmd.BidPrice5); str += "\r\n"; return str; }