public MonitorDatum_KtbSkel GetIndicator( RawMarketData spotRmdThisTurn, RawMarketData futureRmdThisTurn) { try { double spotMidPrice = (spotRmdThisTurn.AskPrice1 + spotRmdThisTurn.BidPrice1) / 2; double futureMidPrice = (futureRmdThisTurn.AskPrice1 + futureRmdThisTurn.BidPrice1) / 2; double spotMidRate = BondPriceRateMapManager.Ins().ConvertToRate(spotRmdThisTurn.Code, (int)spotMidPrice); double spotBidRate = BondPriceRateMapManager.Ins().ConvertToRate( spotRmdThisTurn.Code, (int)spotRmdThisTurn.BidPrice1); double spotAskRate = BondPriceRateMapManager.Ins().ConvertToRate( spotRmdThisTurn.Code, (int)spotRmdThisTurn.AskPrice1); double futureMidRate = BondPriceRateMapManager.Ins().ConvertToRate(futureRmdThisTurn.Code, (int)(futureMidPrice * 100)); double futureBidRate = BondPriceRateMapManager.Ins().ConvertToRate( futureRmdThisTurn.Code, (int)(futureRmdThisTurn.BidPrice1 * 100)); double futureAskRate = BondPriceRateMapManager.Ins().ConvertToRate( futureRmdThisTurn.Code, (int)(futureRmdThisTurn.AskPrice1 * 100)); double curSpotRate = spotMidRate; double curFutureRate = futureMidRate * (-1); String spotLog = String.Format("S {0:n0}({1:n5}) // {2:n0}({3:n5}) // {4:n0}({5:n5})", spotRmdThisTurn.AskPrice1, spotAskRate, spotMidPrice, spotMidRate, spotRmdThisTurn.BidPrice1, spotBidRate); String futureLog = String.Format("F {0:n2}({1:n5}) // {2:n2}({3:n5}) // {4:n2}({5:n5})", futureRmdThisTurn.AskPrice1, futureAskRate, futureMidPrice, futureMidRate, futureRmdThisTurn.BidPrice1, futureBidRate); double curIndicator = (curSpotRate + curFutureRate) * 10000; DateTime lastUpdated = DateTime.Now; MonitorDatum_KtbSkel datum = new MonitorDatum_KtbSkel(); datum.CurIndicator = curIndicator; datum.FutureLog = futureLog; datum.SpotLog = spotLog; datum.LastUpdated = lastUpdated; return datum; } catch (System.Exception ex) { logger.Error(ex.ToString()); Util.KillWithNotice(ex.ToString()); } return null; }
public MonitorDatum_KtbSkel GetIndicator(RawMarketData spotRmdThisTurn, RawMarketData futureRmdThisTurn) { try { double spotAvgRate = _spotDayData.RateAvg; double futureAvgRate = _futureDayData.RateAvg; double spotMidPrice = (spotRmdThisTurn.AskPrice1 + spotRmdThisTurn.BidPrice1) / 2; double futureMidPrice = (futureRmdThisTurn.AskPrice1 + futureRmdThisTurn.BidPrice1) / 2; double spotMidRate = BondPriceRateMapManager.Ins().ConvertToRate(_spotDayData.Code, (int)spotMidPrice); double futureMidRate = BondPriceRateMapManager.Ins().ConvertToRate(_futureDayData.Code, (int)(futureMidPrice * 100)); double curSpotRate = spotMidRate - spotAvgRate; double curFutureRate = futureAvgRate - futureMidRate; String spotLog = String.Format("{0:n2} bp = mid({1:n4}%) - 10일평균({2:n4}%)", curSpotRate * 10000, spotMidRate * 100, spotAvgRate * 100); String futureLog = String.Format("{0:n2} bp = - mid({2:n4}%) + 10일평균({1:n4}%)", curFutureRate * 10000, futureAvgRate * 100, futureMidRate * 100); double curIndicator = (curSpotRate + curFutureRate) * 10000; DateTime lastUpdated = DateTime.Now; MonitorDatum_KtbSkel datum = new MonitorDatum_KtbSkel(); datum.CurIndicator = curIndicator; datum.FutureLog = futureLog; datum.SpotLog = spotLog; datum.LastUpdated = lastUpdated; return datum; } catch (System.Exception ex) { logger.Error(ex.ToString()); Util.KillWithNotice(ex.ToString()); } return null; }
public double GetIndicator() { if (IsOverSpotBidAskSpread(SpotRmdThisTurn)) { this.CurIndicator = double.MinValue; return this.CurIndicator; } if (!Util.IsValidFullRMD(SpotRmdThisTurn)) { this.CurIndicator = double.MinValue; return this.CurIndicator; } if (!Util.IsValidFullRMD(FutureRmdThisTurn)) { this.CurIndicator = double.MinValue; return this.CurIndicator; } MonitorDatum_KtbSkel datum = _policy.GetIndicator(SpotRmdThisTurn, FutureRmdThisTurn); this.CurIndicator = datum.CurIndicator; this.LastValidIndicator = datum.CurIndicator; this.SpotLog = datum.SpotLog; this.FutureLog = datum.FutureLog; this.LastUpdated = datum.LastUpdated; _datumThisTurn = datum; return this.CurIndicator; }