public void GetEventPointsTest() { const String KTB_SPOT_10YR_PATH = @"C:\MadViperData\ktb\output\2011_07_13_38000_ktb_spot_market_data_KR1035027161_period.txt"; const String KTB_FUTURE_10YR_PATH = @"C:\MadViperData\ktb\output\2011_07_13_25412_future_market_data_167FC000_period.txt"; PeriodicMarketDataCollection spot = new PeriodicMarketDataCollection(KTB_SPOT_10YR_PATH); PeriodicMarketDataCollection future = new PeriodicMarketDataCollection(KTB_FUTURE_10YR_PATH); EventPointsFinder target = new EventPointsFinder(); //skip // List<EventPoint> eventPoints = target.GetEventPoints(spot, future, TradingDirection.Long); }
double GetAvgPrice(PeriodicMarketDataCollection data) { long count = 0; double sum = 0; foreach (RawMarketData rmd in data.Rmds) { if (rmd.CurPrice == 0 || rmd.CurPrice == double.MaxValue || rmd.CurPrice == double.MinValue) { continue; } ++count; sum += rmd.CurPrice; } return sum / count; }
private void button1_Click(object sender, EventArgs e) { try { String spotPath = textBox1.Text; String futurePath = textBox2.Text; String filePath = textBox3.Text; PeriodicMarketDataCollection spot = new PeriodicMarketDataCollection(spotPath); PeriodicMarketDataCollection future = new PeriodicMarketDataCollection(futurePath); EventPointsFileWriter writer = new EventPointsFileWriter(); writer.WriteTo(filePath, spot, future, TradingDirection.Long); } catch (System.Exception ex) { logger.Error(ex.ToString()); } }
void LoadPeriodicMarketData(DateTime targetDate) { String KTB_SPOT_PATH = String.Format("{0}{1}_38000_ktb_spot_market_data_{2}_period.txt", PATH, targetDate.ToString("yyyy_MM_dd"), SPOT_10YR); String KTB_FUTURE_PATH = String.Format("{0}{1}_25412_future_market_data_{2}_period.txt", PATH, targetDate.ToString("yyyy_MM_dd"), FUTURE_10YR); _dataSpot10yr = new PeriodicMarketDataCollection(KTB_SPOT_PATH); _dataFuture10yr = new PeriodicMarketDataCollection(KTB_FUTURE_PATH); _regression = new PairMarketDataRegression( 60 * 60 * 6, 1000, 60 * 60 * 6 * 3, new RegressionPolicyDefault()); }
PeriodicMarketDataCollection GetPeriodicCollection(String code, DateTime targetDate) { String dateStringWithUnderScore = targetDate.ToString("yyyy_MM_dd"); String origin = MarketDataConverter.GetSpotOrigin(dateStringWithUnderScore); String dest = MarketDataConverter.GetDest(code, origin); dest = String.Format("{0}\\{1}", DayDataToDBConst.kPATH, dest); PeriodicMarketDataCollection output = new PeriodicMarketDataCollection(dest); return output; }
void LoadMarketData() { _dataSpot10yr = new PeriodicMarketDataCollection(KTB_SPOT_PATH); _dataFuture10yr = new PeriodicMarketDataCollection(KTB_FUTURE_PATH); SetBasicInfo(); }