private IAppRTBSynchronizer getSynchronizer_for_updatePreMergeRTBarSeries() { Series <DateTime, MarketDataElement> preMergeRTBarSeries = null; Series <DateTime, MarketDataElement> preMergeHistBarSeries = null; Series <DateTime, MarketDataElement> TimeBarSeries = null; DateTime RTBTime1 = new DateTime(2015, 10, 21, 9, 20, 0, DateTimeKind.Local); DateTime RTBTime2 = new DateTime(2015, 10, 21, 9, 21, 0, DateTimeKind.Local); DateTime RTBTime3 = new DateTime(2015, 10, 21, 9, 22, 0, DateTimeKind.Local); preMergeRTBarSeries = addMarketDataElementWithTimeOnlyToSeries(RTBTime1, preMergeRTBarSeries); preMergeRTBarSeries = addMarketDataElementWithTimeOnlyToSeries(RTBTime2, preMergeRTBarSeries); preMergeRTBarSeries = addMarketDataElementWithTimeOnlyToSeries(RTBTime3, preMergeRTBarSeries); AppMDManager appMDManager = new AppMDManager(null); appMDManager.setTimeBarSeries(TimeBarSeries); appMDManager.setRtbDataStartTime(RTBTime1); IAppRTBSynchronizer synchronizer = appMDManager.getAppRTBSynchronizer(); synchronizer.preMergeHistBarSeries = preMergeHistBarSeries; synchronizer.preMergeRTBarSeries = preMergeRTBarSeries; synchronizer.setNeedMergeFlag(true); synchronizer.setIsDataMerged(false); return(synchronizer); }
private IAppMDManager getAppRTBSynchronizer_for_reqHistDataIfValid(DateTime dt) { IAppMDManager appMDManager = new AppMDManager(new IBTradeApp()); appMDManager.setRtbDataStartTime(dt); IIBTradeAppBridge mock = new IBTradeAppMock(); appMDManager.injectParentUI(mock); return(appMDManager); }
private IAppRTBSynchronizer getSynchronizer_for_mergeRTBHistDataIfValid_positive3() { Series <DateTime, MarketDataElement> preMergeRTBarSeries = null; Series <DateTime, MarketDataElement> preMergeHistBarSeries = null; Series <DateTime, MarketDataElement> TimeBarSeries = null; DateTime histTime1 = new DateTime(2015, 10, 21, 9, 15, 0, DateTimeKind.Local); DateTime histTime2 = new DateTime(2015, 10, 21, 9, 16, 0, DateTimeKind.Local); DateTime histTime3 = new DateTime(2015, 10, 21, 9, 17, 0, DateTimeKind.Local); DateTime histTime4 = new DateTime(2015, 10, 21, 9, 18, 0, DateTimeKind.Local); DateTime histTime5 = new DateTime(2015, 10, 21, 9, 21, 0, DateTimeKind.Local); DateTime histTime6 = new DateTime(2015, 10, 21, 9, 22, 0, DateTimeKind.Local); DateTime histTime7 = new DateTime(2015, 10, 21, 9, 23, 0, DateTimeKind.Local); DateTime histTime8 = new DateTime(2015, 10, 21, 9, 24, 0, DateTimeKind.Local); DateTime RTBTime1 = new DateTime(2015, 10, 21, 9, 24, 0, DateTimeKind.Local); DateTime RTBTime2 = new DateTime(2015, 10, 21, 9, 25, 0, DateTimeKind.Local); DateTime RTBTime3 = new DateTime(2015, 10, 21, 9, 26, 0, DateTimeKind.Local); preMergeHistBarSeries = addMarketDataElementWithTimeOnlyToSeries(histTime1, preMergeHistBarSeries); preMergeHistBarSeries = addMarketDataElementWithTimeOnlyToSeries(histTime2, preMergeHistBarSeries); preMergeHistBarSeries = addMarketDataElementWithTimeOnlyToSeries(histTime3, preMergeHistBarSeries); preMergeHistBarSeries = addMarketDataElementWithTimeOnlyToSeries(histTime4, preMergeHistBarSeries); preMergeHistBarSeries = addMarketDataElementWithTimeOnlyToSeries(histTime5, preMergeHistBarSeries); preMergeHistBarSeries = addMarketDataElementWithTimeOnlyToSeries(histTime6, preMergeHistBarSeries); preMergeHistBarSeries = addMarketDataElementWithTimeOnlyToSeries(histTime7, preMergeHistBarSeries); preMergeHistBarSeries = addMarketDataElementWithTimeOnlyToSeries(histTime8, preMergeHistBarSeries); preMergeRTBarSeries = addMarketDataElementWithTimeOnlyToSeries(RTBTime1, preMergeRTBarSeries); preMergeRTBarSeries = addMarketDataElementWithTimeOnlyToSeries(RTBTime2, preMergeRTBarSeries); preMergeRTBarSeries = addMarketDataElementWithTimeOnlyToSeries(RTBTime3, preMergeRTBarSeries); AppMDManager appMDManager = new AppMDManager(null); appMDManager.setTimeBarSeries(TimeBarSeries); appMDManager.setRtbDataStartTime(RTBTime1); appMDManager.setHistDataEndTime(histTime7); IAppRTBSynchronizer synchronizer = appMDManager.getAppRTBSynchronizer(); synchronizer.preMergeHistBarSeries = preMergeHistBarSeries; synchronizer.preMergeRTBarSeries = preMergeRTBarSeries; synchronizer.setNeedMergeFlag(true); synchronizer.setIsDataMerged(false); return(synchronizer); }
public void test_isRTBarProcessStart() { //[Test: return ture, RTBDataStartTime is invalid Time and the message time is in 0 second.] DateTime validTime = new DateTime(2015, 11, 21, 9, 50, 0, DateTimeKind.Local); AppMDManager appMDManager = new AppMDManager(null); appMDManager.setRtbDataStartTime(AppConstant.INVALID_TIME); IBMessage validStartMessage = createMessage_for_isRTBarProcessStart(validTime); Assert.IsTrue(appMDManager.isRTBarProcessStart(validStartMessage)); Assert.AreEqual(validTime, appMDManager.getRtbDataStartTime()); //[Test: return false, RTBDataStartTime is invalid Time and the message time is not in 0 second.] DateTime invalidTime = new DateTime(2015, 11, 21, 9, 50, 5, DateTimeKind.Local); appMDManager = new AppMDManager(null); appMDManager.setRtbDataStartTime(AppConstant.INVALID_TIME); IBMessage invalidStartMessage = createMessage_for_isRTBarProcessStart(invalidTime); Assert.IsFalse(appMDManager.isRTBarProcessStart(invalidStartMessage)); Assert.AreEqual(AppConstant.INVALID_TIME, appMDManager.getRtbDataStartTime()); }