Changeset 1548 in algoquant
- Timestamp:
- 1/31/2014 12:58:41 AM (10 months ago)
- Files:
-
- 108 edited
-
core/src/main/java/com/numericalmethod/algoquant/data/cache/CacheFactory.java (modified) (1 diff)
-
core/src/main/java/com/numericalmethod/algoquant/data/cache/processor/ProcessedCacheFactory.java (modified) (1 diff)
-
core/src/main/java/com/numericalmethod/algoquant/data/calendar/holiday/WebHolidayUpdater.java (modified) (1 diff)
-
core/src/main/java/com/numericalmethod/algoquant/data/historicaldata/DepthCacheUtils.java (modified) (1 diff)
-
core/src/main/java/com/numericalmethod/algoquant/data/historicaldata/bloomberg/BloombergTickData.java (modified) (1 diff)
-
core/src/main/java/com/numericalmethod/algoquant/data/historicaldata/bloomberg/IntradayTickDataDownloader.java (modified) (1 diff)
-
core/src/main/java/com/numericalmethod/algoquant/data/historicaldata/bloomberg/LocalhostSessionFactory.java (modified) (1 diff)
-
core/src/main/java/com/numericalmethod/algoquant/data/historicaldata/bloomberg/SessionFactory.java (modified) (1 diff)
-
core/src/main/java/com/numericalmethod/algoquant/data/historicaldata/gaincapital/GainCapitalFx.java (modified) (1 diff)
-
core/src/main/java/com/numericalmethod/algoquant/data/historicaldata/gaincapital/preprocess/GainCapitalFxRawCsvFile.java (modified) (6 diffs)
-
core/src/main/java/com/numericalmethod/algoquant/data/historicaldata/hkex/HSIReader.java (modified) (1 diff)
-
core/src/main/java/com/numericalmethod/algoquant/data/historicaldata/sgx/SGXTickData.java (modified) (1 diff)
-
core/src/main/java/com/numericalmethod/algoquant/data/historicaldata/taq/TAQData.java (modified) (1 diff)
-
core/src/main/java/com/numericalmethod/algoquant/data/historicaldata/yahoo/MultipleYahooEOD.java (modified) (1 diff)
-
core/src/main/java/com/numericalmethod/algoquant/data/historicaldata/yahoo/YahooEOD.java (modified) (2 diffs)
-
core/src/main/java/com/numericalmethod/algoquant/data/historicaldata/yahoo/YahooEODCsvZipFileWriter.java (modified) (1 diff)
-
core/src/main/java/com/numericalmethod/algoquant/data/historicaldata/yahoo/YahooEODWebDownloader.java (modified) (1 diff)
-
core/src/main/java/com/numericalmethod/algoquant/data/stock/market/MarketSnapshotUtils.java (modified) (1 diff)
-
core/src/main/java/com/numericalmethod/algoquant/execution/depth/SingleProductDepthCacheFactory.java (modified) (2 diffs)
-
core/src/main/java/com/numericalmethod/algoquant/execution/depth/returns/AR1GARCH11Returns.java (modified) (1 diff)
-
core/src/main/java/com/numericalmethod/algoquant/execution/depth/returns/AR1Returns.java (modified) (1 diff)
-
core/src/main/java/com/numericalmethod/algoquant/execution/depth/returns/ARCH1Returns.java (modified) (1 diff)
-
core/src/main/java/com/numericalmethod/algoquant/execution/depth/returns/ARIMA0d0Returns.java (modified) (1 diff)
-
core/src/main/java/com/numericalmethod/algoquant/execution/depth/returns/ARMA11Returns.java (modified) (1 diff)
-
core/src/main/java/com/numericalmethod/algoquant/execution/depth/returns/RandomWalkReturns.java (modified) (1 diff)
-
core/src/main/java/com/numericalmethod/algoquant/execution/product/fx/simulator/CrossRateCacheFactory.java (modified) (1 diff)
-
core/src/main/java/com/numericalmethod/algoquant/execution/product/fx/simulator/InvertedRateCacheFactory.java (modified) (1 diff)
-
core/src/main/java/com/numericalmethod/algoquant/execution/product/stock/usa/nasdaq/NASDAQ100.java (modified) (1 diff)
-
core/src/main/java/com/numericalmethod/algoquant/execution/simulation/DepthCachesLoader.java (modified) (1 diff)
-
core/src/main/java/com/numericalmethod/algoquant/execution/simulation/batch/BatchParameterizedSimulation.java (modified) (3 diffs)
-
core/src/main/java/com/numericalmethod/algoquant/execution/simulation/batch/montecarlo/MCSimulation.java (modified) (13 diffs)
-
core/src/main/java/com/numericalmethod/algoquant/execution/simulation/batch/montecarlo/MCSimulationTaskRunner.java (modified) (1 diff)
-
core/src/main/java/com/numericalmethod/algoquant/execution/simulation/batch/montecarlo/MarketSnapshotSimulatorFactory.java (modified) (1 diff)
-
core/src/main/java/com/numericalmethod/algoquant/execution/simulation/batch/montecarlo/depths/SingleDepthCacheFactoryAdaptor.java (modified) (1 diff)
-
core/src/main/java/com/numericalmethod/algoquant/execution/simulation/batch/montecarlo/tasks/AR1GARCH11Task.java (modified) (2 diffs)
-
core/src/main/java/com/numericalmethod/algoquant/execution/simulation/batch/montecarlo/tasks/AR1Task.java (modified) (2 diffs)
-
core/src/main/java/com/numericalmethod/algoquant/execution/simulation/batch/montecarlo/tasks/ARCH1Task.java (modified) (2 diffs)
-
core/src/main/java/com/numericalmethod/algoquant/execution/simulation/batch/montecarlo/tasks/ARMA11Task.java (modified) (2 diffs)
-
core/src/main/java/com/numericalmethod/algoquant/execution/simulation/batch/montecarlo/tasks/MCSimulationTask.java (modified) (2 diffs)
-
core/src/main/java/com/numericalmethod/algoquant/execution/simulation/batch/montecarlo/tasks/RandomWalkTask.java (modified) (2 diffs)
-
core/src/main/java/com/numericalmethod/algoquant/execution/simulation/template/SimTemplateYahooEOD.java (modified) (1 diff)
-
core/src/main/java/com/numericalmethod/algoquant/execution/simulator/SimMarketFactory.java (modified) (1 diff)
-
core/src/main/java/com/numericalmethod/algoquant/execution/simulator/SimpleSimulator.java (modified) (3 diffs)
-
core/src/main/java/com/numericalmethod/algoquant/execution/simulator/StrategyComponent.java (modified) (2 diffs)
-
core/src/main/java/com/numericalmethod/algoquant/execution/simulator/handler/ChannelMessageHandlerFactories.java (modified) (6 diffs)
-
core/src/main/java/com/numericalmethod/algoquant/execution/simulator/handler/ChannelMessageHandlerFactory.java (modified) (1 diff)
-
core/src/main/java/com/numericalmethod/algoquant/execution/strategy/StrategyFactory.java (modified) (1 diff)
-
core/src/main/java/com/numericalmethod/algoquant/execution/strategy/optimizer/StrategyOptimizer.java (modified) (1 diff)
-
core/src/main/java/com/numericalmethod/algoquant/framework/template/factormodel/CrossSectionalRegressionStrategyTemplate.java (modified) (1 diff)
-
core/src/main/java/com/numericalmethod/algoquant/model/analysis/cointegration/CointegratedPairsSearch.java (modified) (1 diff)
-
core/src/main/java/com/numericalmethod/algoquant/model/factormodel/regression/crosssectional/FixedEffectsCrossSectionalRegression.java (modified) (1 diff)
-
core/src/main/java/com/numericalmethod/algoquant/model/factormodel/regression/crosssectional/PanelCrossSectionalRegression.java (modified) (3 diffs)
-
core/src/main/java/com/numericalmethod/algoquant/model/infantino2010/strategy/Infantino2010StrategyFactory.java (modified) (1 diff)
-
core/src/main/java/com/numericalmethod/algoquant/model/portfoliooptimization/performance/PerformanceOptimizedPortfolio.java (modified) (2 diffs)
-
core/src/main/java/com/numericalmethod/algoquant/model/portfoliooptimization/performance/PerformanceOptimizedYahooEODPortfolio.java (modified) (1 diff)
-
core/src/main/java/com/numericalmethod/algoquant/model/signal/technical/crossover/strategy/SMA2CrossoverDynamic.java (modified) (3 diffs)
-
core/src/main/java/com/numericalmethod/algoquant/model/signal/technical/crossover/strategy/SMA2CrossoverFactory.java (modified) (1 diff)
-
core/src/main/java/com/numericalmethod/algoquant/model/volarb/MeanReversionStrategyFactory.java (modified) (1 diff)
-
core/src/test/java/com/numericalmethod/algoquant/data/cache/TestDepthCacheFactory.java (modified) (1 diff)
-
core/src/test/java/com/numericalmethod/algoquant/data/cache/conversion/Cache2MatrixTest.java (modified) (2 diffs)
-
core/src/test/java/com/numericalmethod/algoquant/data/cache/conversion/Cache2ReturnsMatrixTest.java (modified) (2 diffs)
-
core/src/test/java/com/numericalmethod/algoquant/data/cache/processor/filter/WeekdayFilterTest.java (modified) (1 diff)
-
core/src/test/java/com/numericalmethod/algoquant/data/cache/processor/sampler/DailyDataSamplerTest.java (modified) (1 diff)
-
core/src/test/java/com/numericalmethod/algoquant/data/cache/util/DailyDataFileMakerTest.java (modified) (2 diffs)
-
core/src/test/java/com/numericalmethod/algoquant/data/export/xml/BatchSimulationXmlWriterUtilsTest.java (modified) (1 diff)
-
core/src/test/java/com/numericalmethod/algoquant/data/historicaldata/bloomberg/BloombergTickDataTest.java (modified) (1 diff)
-
core/src/test/java/com/numericalmethod/algoquant/data/historicaldata/compustat/MockMarketData.java (modified) (1 diff)
-
core/src/test/java/com/numericalmethod/algoquant/data/historicaldata/gaincapital/GainCapitalFxTest.java (modified) (8 diffs)
-
core/src/test/java/com/numericalmethod/algoquant/data/historicaldata/gaincapital/preprocess/GainCapitalFxRawCsvFileTest.java (modified) (2 diffs)
-
core/src/test/java/com/numericalmethod/algoquant/data/historicaldata/sgx/SGXTickDataTest.java (modified) (7 diffs)
-
core/src/test/java/com/numericalmethod/algoquant/data/historicaldata/taq/TAQDataTest.java (modified) (3 diffs)
-
core/src/test/java/com/numericalmethod/algoquant/data/historicaldata/yahoo/YahooEODTest.java (modified) (5 diffs)
-
core/src/test/java/com/numericalmethod/algoquant/data/historicaldata/yahoo/YahooEODWebDownloaderTest.java (modified) (3 diffs)
-
core/src/test/java/com/numericalmethod/algoquant/execution/depth/SimulatedDepthCacheTest.java (modified) (1 diff)
-
core/src/test/java/com/numericalmethod/algoquant/execution/performance/measure/decomposition/PartialPerformanceMeasureTest.java (modified) (1 diff)
-
core/src/test/java/com/numericalmethod/algoquant/execution/product/fx/simulator/CrossRateCacheFactoryTest.java (modified) (2 diffs)
-
core/src/test/java/com/numericalmethod/algoquant/execution/product/fx/simulator/InvertedRateCacheFactoryTest.java (modified) (2 diffs)
-
core/src/test/java/com/numericalmethod/algoquant/execution/simulation/batch/montecarlo/MCSimulationTest.java (modified) (4 diffs)
-
core/src/test/java/com/numericalmethod/algoquant/execution/simulation/batch/sensitivity/SensitivityAnalyzerTest.java (modified) (1 diff)
-
core/src/test/java/com/numericalmethod/algoquant/execution/simulator/SimpleSimulatorTest.java (modified) (2 diffs)
-
core/src/test/java/com/numericalmethod/algoquant/execution/strategy/composite/CompositeStrategyTest.java (modified) (1 diff)
-
core/src/test/java/com/numericalmethod/algoquant/model/factormodel/regression/crosssectional/AbstractCrossSectionalRegressionTest.java (modified) (1 diff)
-
core/src/test/java/com/numericalmethod/algoquant/model/volarb/MeanReversionStrategyTest.java (modified) (1 diff)
-
demo/src/main/java/com/numericalmethod/algoquant/data/historicaldata/sgx/demo/DemoSiMSCITickData.java (modified) (1 diff)
-
demo/src/main/java/com/numericalmethod/algoquant/execution/simulation/batch/montecarlo/demo/DemoMCSimulation.java (modified) (2 diffs)
-
demo/src/main/java/com/numericalmethod/algoquant/execution/simulation/batch/montecarlo/demo/DemoMCSimulationTaskRunner.java (modified) (1 diff)
-
demo/src/main/java/com/numericalmethod/algoquant/execution/simulation/batch/sensitivity/demo/DemoSensitivityAnalyzer.java (modified) (2 diffs)
-
demo/src/main/java/com/numericalmethod/algoquant/execution/strategy/demo/DemoTimer.java (modified) (1 diff)
-
demo/src/main/java/com/numericalmethod/algoquant/execution/strategy/demo/DemoTutorialStrategy.java (modified) (1 diff)
-
demo/src/main/java/com/numericalmethod/algoquant/model/elliott2005/demo/Demo110.java (modified) (1 diff)
-
demo/src/main/java/com/numericalmethod/algoquant/model/elliott2005/demo/DemoElliott2005_010.java (modified) (1 diff)
-
demo/src/main/java/com/numericalmethod/algoquant/model/factormodel/regression/crosssectional/demo/CrossSectionalRegressionDemoParams.java (modified) (1 diff)
-
demo/src/main/java/com/numericalmethod/algoquant/model/factormodel/regression/crosssectional/demo/DemoCrossSectionalRegressionSensitivityAnalysis.java (modified) (1 diff)
-
demo/src/main/java/com/numericalmethod/algoquant/model/infantino2010/demo/Demo010.java (modified) (1 diff)
-
demo/src/main/java/com/numericalmethod/algoquant/model/kst1995/demo/Demo020.java (modified) (1 diff)
-
demo/src/main/java/com/numericalmethod/algoquant/model/signal/crossover/demo/DemoBatchParamSimulation.java (modified) (1 diff)
-
demo/src/main/java/com/numericalmethod/algoquant/model/signal/crossover/demo/DemoSMA2CrossoverDynamic_010.java (modified) (1 diff)
-
demo/src/main/java/com/numericalmethod/algoquant/model/signal/crossover/demo/DemoSMA2_010.java (modified) (1 diff)
-
demo/src/main/java/com/numericalmethod/algoquant/model/signal/crossover/demo/DemoSMA2_011.java (modified) (1 diff)
-
demo/src/main/java/com/numericalmethod/algoquant/model/signal/demo/DemoPairsTrading.java (modified) (1 diff)
-
demo/src/main/java/com/numericalmethod/algoquant/model/signal/volume/demo/DemoADL.java (modified) (1 diff)
-
demo/src/main/java/com/numericalmethod/algoquant/model/signal/volume/demo/DemoCMF.java (modified) (1 diff)
-
demo/src/main/java/com/numericalmethod/algoquant/model/volarb/demo/DemoFixedGrid001.java (modified) (1 diff)
-
demo/src/main/java/com/numericalmethod/algoquant/model/volarb/demo/DemoFixedGridOnSGXData001.java (modified) (1 diff)
-
demo/src/main/java/com/numericalmethod/algoquant/model/volarb/demo/DemoFixedGridPortfolio001.java (modified) (1 diff)
-
demo/src/main/java/com/numericalmethod/algoquant/model/volarb/demo/DemoPeriodic001.java (modified) (1 diff)
-
demo/src/main/java/com/numericalmethod/algoquant/model/volarb/demo/DemoRanged001.java (modified) (1 diff)
-
demo/src/main/java/com/numericalmethod/algoquant/model/volarb/demo/DemoRanged002.java (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
core/src/main/java/com/numericalmethod/algoquant/data/cache/CacheFactory.java
r1366 r1548 49 49 * @return the cache 50 50 */ 51 SequentialCache<T> getCache(DateTime begin, DateTime end);51 SequentialCache<T> newInstance(DateTime begin, DateTime end); 52 52 } -
core/src/main/java/com/numericalmethod/algoquant/data/cache/processor/ProcessedCacheFactory.java
r1366 r1548 45 45 46 46 @Override 47 public SequentialCache<U> getCache(DateTime begin, DateTime end) {48 return processor.doProcess(factory. getCache(begin, end));47 public SequentialCache<U> newInstance(DateTime begin, DateTime end) { 48 return processor.doProcess(factory.newInstance(begin, end)); 49 49 } 50 50 } -
core/src/main/java/com/numericalmethod/algoquant/data/calendar/holiday/WebHolidayUpdater.java
r1507 r1548 84 84 Stock yahooInstrument) { 85 85 YahooEODWebDownloader downloader = new YahooEODWebDownloader(yahooInstrument); 86 SequentialCache<StockEOD> cache = downloader. getCache(fromDate.toDateTime(), endDate.toDateTime());86 SequentialCache<StockEOD> cache = downloader.newInstance(fromDate.toDateTime(), endDate.toDateTime()); 87 87 return cache; 88 88 } -
core/src/main/java/com/numericalmethod/algoquant/data/historicaldata/DepthCacheUtils.java
r1495 r1548 122 122 return new CacheFactory<Depth>() { 123 123 @Override 124 public SequentialCache<Depth> getCache(DateTime begin, DateTime end) {125 return fromStockEODCache(product, factory. getCache(begin, end), conversionType);124 public SequentialCache<Depth> newInstance(DateTime begin, DateTime end) { 125 return fromStockEODCache(product, factory.newInstance(begin, end), conversionType); 126 126 } 127 127 }; -
core/src/main/java/com/numericalmethod/algoquant/data/historicaldata/bloomberg/BloombergTickData.java
r1366 r1548 54 54 55 55 @Override 56 public SequentialCache<Depth> getCache(final DateTime begin, final DateTime end) {56 public SequentialCache<Depth> newInstance(final DateTime begin, final DateTime end) { 57 57 return new SequentialCache<Depth>() { 58 58 @Override -
core/src/main/java/com/numericalmethod/algoquant/data/historicaldata/bloomberg/IntradayTickDataDownloader.java
r1366 r1548 75 75 DateTime end) 76 76 throws IOException { 77 Session session = sessionFactory.new Session();77 Session session = sessionFactory.newInstance(); 78 78 79 79 if (!session.start()) { -
core/src/main/java/com/numericalmethod/algoquant/data/historicaldata/bloomberg/LocalhostSessionFactory.java
r1366 r1548 37 37 38 38 @Override 39 public Session new Session() {39 public Session newInstance() { 40 40 SessionOptions sessionOptions = new SessionOptions(); 41 41 sessionOptions.setServerHost(HOST_NAME); -
core/src/main/java/com/numericalmethod/algoquant/data/historicaldata/bloomberg/SessionFactory.java
r1366 r1548 32 32 public interface SessionFactory { 33 33 34 public Session new Session();34 public Session newInstance(); 35 35 } -
core/src/main/java/com/numericalmethod/algoquant/data/historicaldata/gaincapital/GainCapitalFx.java
r1366 r1548 100 100 101 101 @Override 102 public SequentialCache<Depth> getCache(final DateTime begin, final DateTime end) {102 public SequentialCache<Depth> newInstance(final DateTime begin, final DateTime end) { 103 103 return new SequentialCache<Depth>() { 104 104 @Override -
core/src/main/java/com/numericalmethod/algoquant/data/historicaldata/gaincapital/preprocess/GainCapitalFxRawCsvFile.java
r1366 r1548 23 23 package com.numericalmethod.algoquant.data.historicaldata.gaincapital.preprocess; 24 24 25 import static com.numericalmethod.nmutils.NMUtils.*; 26 import java.io.File; 27 import java.io.FileInputStream; 28 import java.io.IOException; 29 import java.io.InputStreamReader; 30 import java.io.Reader; 25 import static com.numericalmethod.nmutils.NMUtils.getClassLogger; 26 import java.io.*; 31 27 import java.util.Arrays; 32 28 import org.slf4j.Logger; … … 100 96 static interface CellProcessorsFactory { 101 97 102 CellProcessor[] newCellProcessor(); 103 } 98 CellProcessor[] newInstance(); 99 } 100 104 101 static CellProcessorsFactory processors1 = new CellProcessorsFactory() { 105 102 @Override 106 public CellProcessor[] new CellProcessor() {103 public CellProcessor[] newInstance() { 107 104 return new CellProcessor[]{ 108 new Unique(new ParseLong()),//lTid109 null,//cDealable110 null,//CurrencyPair111 new StrMinMax(1, 60),//RateDateTime112 new ParseDouble(),//RateBid113 new ParseDouble()//RateAsk114 };105 new Unique(new ParseLong()),//lTid 106 null,//cDealable 107 null,//CurrencyPair 108 new StrMinMax(1, 60),//RateDateTime 109 new ParseDouble(),//RateBid 110 new ParseDouble()//RateAsk 111 }; 115 112 } 116 113 }; 117 114 static CellProcessorsFactory processors2 = new CellProcessorsFactory() { 118 115 @Override 119 public CellProcessor[] new CellProcessor() {116 public CellProcessor[] newInstance() { 120 117 return new CellProcessor[]{ 121 new Unique(new ParseLong()),//lTid122 null,//CurrencyPair123 new StrMinMax(1, 60),//RateDateTime124 new ParseDouble(),//RateBid125 new ParseDouble(),//RateAsk126 null//cDealable127 };118 new Unique(new ParseLong()),//lTid 119 null,//CurrencyPair 120 new StrMinMax(1, 60),//RateDateTime 121 new ParseDouble(),//RateBid 122 new ParseDouble(),//RateAsk 123 null//cDealable 124 }; 128 125 } 129 126 }; … … 160 157 161 158 MyBeanReader found = new MyBeanReader(new InputStreamReader(new FileInputStream(file), charsetName), 162 headers, cellProcessors.new CellProcessor());159 headers, cellProcessors.newInstance()); 163 160 found.getHeader(true);//skip the header 164 161 … … 189 186 190 187 trial.getHeader(false); 191 Row row = trial.read(Row.class, headers, processors2.new CellProcessor());188 Row row = trial.read(Row.class, headers, processors2.newInstance()); 192 189 long lTid = row.lTid;//check if we can read the first line 193 190 194 191 MyBeanReader found = new MyBeanReader(new InputStreamReader(new FileInputStream(file), charsetName), 195 headers, processors2.new CellProcessor());192 headers, processors2.newInstance()); 196 193 return found; 197 194 } catch (Exception ex) { … … 201 198 } 202 199 /* 203 * Gain Capital has changed the format, e.g., encoding, with or without headers, of the rate files multiple times. 200 * Gain Capital has changed the format, e.g., encoding, with or without headers, of the rate 201 * files multiple times. 204 202 * We need to guess what format a particular file has before reading it. 205 203 * Life is complicated...... 206 204 */ 205 207 206 private static Format[] formats = new Format[]{ 208 207 new Processor2Header(), … … 238 237 } 239 238 } 239 240 240 private static final Logger logger = getClassLogger(); 241 241 private final MyBeanReader reader; -
core/src/main/java/com/numericalmethod/algoquant/data/historicaldata/hkex/HSIReader.java
r1507 r1548 108 108 109 109 @Override 110 public SequentialCache<Double> getCache(final DateTime begin, final DateTime end) {110 public SequentialCache<Double> newInstance(final DateTime begin, final DateTime end) { 111 111 return new SequentialCache<Double>() { 112 112 @Override -
core/src/main/java/com/numericalmethod/algoquant/data/historicaldata/sgx/SGXTickData.java
r1507 r1548 125 125 126 126 @Override 127 public SequentialCache<Depth> getCache(final DateTime begin, final DateTime end) {127 public SequentialCache<Depth> newInstance(final DateTime begin, final DateTime end) { 128 128 return new SequentialCache<Depth>() { 129 129 @Override -
core/src/main/java/com/numericalmethod/algoquant/data/historicaldata/taq/TAQData.java
r1366 r1548 65 65 66 66 @Override 67 public SequentialCache<TAQTick> getCache(final DateTime begin, final DateTime end) {67 public SequentialCache<TAQTick> newInstance(final DateTime begin, final DateTime end) { 68 68 return new SequentialCache<TAQTick>() { 69 69 @Override -
core/src/main/java/com/numericalmethod/algoquant/data/historicaldata/yahoo/MultipleYahooEOD.java
r1507 r1548 62 62 dirOut); 63 63 64 SequentialCache<StockEOD> seq = source. getCache(begin, end);64 SequentialCache<StockEOD> seq = source.newInstance(begin, end); 65 65 66 66 SequentialCache<Double> doubleCache = transformer.doProcess(seq); -
core/src/main/java/com/numericalmethod/algoquant/data/historicaldata/yahoo/YahooEOD.java
r1507 r1548 80 80 81 81 @Override 82 public SequentialCache<StockEOD> getCache(DateTime begin, DateTime end) {82 public SequentialCache<StockEOD> newInstance(DateTime begin, DateTime end) { 83 83 final DateTime cacheBegin = roundTime(begin, stock.getExchange()); 84 84 final DateTime cacheEnd = roundTime(end, stock.getExchange()); … … 206 206 begin.toString(), end.toString())); 207 207 YahooEODWebDownloader webReader = new YahooEODWebDownloader(stock); 208 SequentialCache<StockEOD> webCache = webReader. getCache(begin, end);208 SequentialCache<StockEOD> webCache = webReader.newInstance(begin, end); 209 209 for (TimedEntry<StockEOD> entry : webCache) { 210 210 buffer.put(entry.getTime(), entry.getData()); -
core/src/main/java/com/numericalmethod/algoquant/data/historicaldata/yahoo/YahooEODCsvZipFileWriter.java
r1507 r1548 102 102 */ 103 103 public int saveFromWeb(YahooEODWebDownloader downloader, DateTime begin, DateTime end) throws IOException { 104 return save(downloader.getStock(), downloader. getCache(begin, end));104 return save(downloader.getStock(), downloader.newInstance(begin, end)); 105 105 } 106 106 -
core/src/main/java/com/numericalmethod/algoquant/data/historicaldata/yahoo/YahooEODWebDownloader.java
r1507 r1548 61 61 62 62 @Override 63 public SequentialCache<StockEOD> getCache(final DateTime begin, final DateTime end) {63 public SequentialCache<StockEOD> newInstance(final DateTime begin, final DateTime end) { 64 64 // URL 65 65 String inputURL = String.format("http://ichart.finance.yahoo.com/table.csv?s=%s&d=%d&e=%d&f=%d&g=d&a=%d&b=%d&c=%d&ignore=.csv", -
core/src/main/java/com/numericalmethod/algoquant/data/stock/market/MarketSnapshotUtils.java
r1547 r1548 95 95 histories = COMPANY_HISTORY_DB.getCompanyHistories(stockIds); 96 96 SequentialCache<Double> marketSeries = 97 new HSIReader(HSI_FILE_PATH). getCache(startTime, endTime);97 new HSIReader(HSI_FILE_PATH).newInstance(startTime, endTime); 98 98 SequentialCache<Double> rates = 99 99 new HKIBOR(HKMA_RATES_FILE_PATH) -
core/src/main/java/com/numericalmethod/algoquant/execution/depth/SingleProductDepthCacheFactory.java
r1526 r1548 31 31 32 32 /** 33 * 33 * 34 34 * @author Haksun Li 35 35 */ … … 38 38 /** 39 39 * Generates the next fresh depth cache for the given product using the specified parameters. 40 * 41 * @param product the product for which a depth cache is created42 * @param times the times for which updates are computed40 * 41 * @param product the product for which a depth cache is created 42 * @param times the times for which updates are computed 43 43 * @param initialPrice the initial price of the product 44 * @param params the model parameters44 * @param params the model parameters 45 45 * @return a fresh depth cache 46 46 */ 47 public SequentialCache<? extends Depth> newDepths( 48 Product product, 49 List<DateTime> times, 50 double initialPrice, 51 Vector params); 47 public SequentialCache<? extends Depth> newInstance(Product product, 48 List<DateTime> times, 49 double initialPrice, 50 Vector params); 52 51 } -
core/src/main/java/com/numericalmethod/algoquant/execution/depth/returns/AR1GARCH11Returns.java
r1541 r1548 89 89 90 90 @Override 91 public SequentialCache<? extends Depth> new Depths(91 public SequentialCache<? extends Depth> newInstance( 92 92 Product product, 93 93 List<DateTime> times, -
core/src/main/java/com/numericalmethod/algoquant/execution/depth/returns/AR1Returns.java
r1541 r1548 76 76 77 77 @Override 78 public SequentialCache<? extends Depth> new Depths(78 public SequentialCache<? extends Depth> newInstance( 79 79 Product product, 80 80 List<DateTime> times, -
core/src/main/java/com/numericalmethod/algoquant/execution/depth/returns/ARCH1Returns.java
r1541 r1548 81 81 82 82 @Override 83 public SequentialCache<? extends Depth> new Depths(83 public SequentialCache<? extends Depth> newInstance( 84 84 Product product, 85 85 List<DateTime> times, -
core/src/main/java/com/numericalmethod/algoquant/execution/depth/returns/ARIMA0d0Returns.java
r1541 r1548 77 77 78 78 @Override 79 public SequentialCache<? extends Depth> new Depths(79 public SequentialCache<? extends Depth> newInstance( 80 80 Product product, 81 81 List<DateTime> times, -
core/src/main/java/com/numericalmethod/algoquant/execution/depth/returns/ARMA11Returns.java
r1541 r1548 75 75 76 76 @Override 77 public SequentialCache<? extends Depth> new Depths(77 public SequentialCache<? extends Depth> newInstance( 78 78 Product product, 79 79 List<DateTime> times, -
core/src/main/java/com/numericalmethod/algoquant/execution/depth/returns/RandomWalkReturns.java
r1541 r1548 69 69 70 70 @Override 71 public SequentialCache<? extends Depth> new Depths(71 public SequentialCache<? extends Depth> newInstance( 72 72 Product product, 73 73 List<DateTime> times, -
core/src/main/java/com/numericalmethod/algoquant/execution/product/fx/simulator/CrossRateCacheFactory.java
r1366 r1548 76 76 77 77 @Override 78 public SequentialCache<Depth> getCache(DateTime begin, DateTime end) {78 public SequentialCache<Depth> newInstance(DateTime begin, DateTime end) { 79 79 List<SequentialCache<Depth>> cacheList = new ArrayList<SequentialCache<Depth>>(2); 80 cacheList.add(cacheFactory1. getCache(begin, end));81 cacheList.add(cacheFactory2. getCache(begin, end));80 cacheList.add(cacheFactory1.newInstance(begin, end)); 81 cacheList.add(cacheFactory2.newInstance(begin, end)); 82 82 83 83 VectorCache<Depth> vectorCache = new VectorCache<Depth>(cacheList); -
core/src/main/java/com/numericalmethod/algoquant/execution/product/fx/simulator/InvertedRateCacheFactory.java
r1366 r1548 57 57 58 58 @Override 59 public SequentialCache<Depth> getCache(DateTime begin, DateTime end) {59 public SequentialCache<Depth> newInstance(DateTime begin, DateTime end) { 60 60 61 final SequentialCache<Depth> cache = cacheFactory. getCache(begin, end);61 final SequentialCache<Depth> cache = cacheFactory.newInstance(begin, end); 62 62 63 63 return new SequentialCache<Depth>() { -
core/src/main/java/com/numericalmethod/algoquant/execution/product/stock/usa/nasdaq/NASDAQ100.java
r1513 r1548 109 109 Product product = it.next(); 110 110 YahooEOD yahoo = new YahooEOD(product.as(Stock.class), "./log", "./log"); 111 SequentialCache<StockEOD> cache = yahoo. getCache(begin, end);111 SequentialCache<StockEOD> cache = yahoo.newInstance(begin, end); 112 112 map.put(product, cache); 113 113 } -
core/src/main/java/com/numericalmethod/algoquant/execution/simulation/DepthCachesLoader.java
r1430 r1548 53 53 for (Product product : products) { 54 54 cacheMap.addCache(product, 55 dataSource.forProduct(product, dataFolder). getCache(begin, end));55 dataSource.forProduct(product, dataFolder).newInstance(begin, end)); 56 56 } 57 57 return cacheMap; -
core/src/main/java/com/numericalmethod/algoquant/execution/simulation/batch/BatchParameterizedSimulation.java
r1537 r1548 31 31 import com.numericalmethod.algoquant.execution.strategy.Strategy; 32 32 import com.numericalmethod.algoquant.execution.strategy.StrategyFactory; 33 import static com.numericalmethod.nmutils.collection.CollectionUtils.*; 34 import java.util.ArrayList; 35 import java.util.Collection; 36 import java.util.Map; 33 import static com.numericalmethod.nmutils.collection.CollectionUtils.newHashMap; 34 import java.util.*; 37 35 import java.util.Map.Entry; 38 36 … … 70 68 * @throws SimulationException when any error occurs during simulation runs 71 69 */ 72 public <S extends Strategy, P> Map<P, PerformanceReport> run( 73 StrategyFactory<S, P> factory, 74 Collection<P> params, 75 PerformanceAnalyzer analyzer) 70 public <S extends Strategy, P> Map<P, PerformanceReport> run(StrategyFactory<S, P> factory, 71 Collection<P> params, 72 PerformanceAnalyzer analyzer) 76 73 throws SimulationException { 77 74 Collection<P> paramsCopy = new ArrayList<P>(params); … … 86 83 depthCaches, 87 84 rates, 88 factory.new Strategy(param));85 factory.newInstance(param)); 89 86 tasks.add(task); 90 87 task2Param.put(task, param); // map task to param for later reference -
core/src/main/java/com/numericalmethod/algoquant/execution/simulation/batch/montecarlo/MCSimulation.java
r1539 r1548 37 37 import com.numericalmethod.algoquant.execution.simulator.Simulator; 38 38 import com.numericalmethod.algoquant.execution.strategy.Strategy; 39 import com.numericalmethod.suanshu.misc.parallel.LoopBody; 40 import com.numericalmethod.suanshu.misc.parallel.MultipleExecutionException; 41 import com.numericalmethod.suanshu.misc.parallel.ParallelExecutor; 39 import static com.numericalmethod.nmutils.collection.CollectionUtils.newHashMap; 40 import com.numericalmethod.suanshu.misc.parallel.*; 42 41 import com.numericalmethod.suanshu.stats.distribution.univariate.EmpiricalDistribution; 43 import static com.numericalmethod.nmutils.collection.CollectionUtils.*; 44 import java.util.ArrayList; 45 import java.util.Collection; 46 import java.util.Collections; 47 import java.util.List; 48 import java.util.Map; 42 import java.util.*; 49 43 import java.util.Map.Entry; 50 44 import org.joda.time.DateTime; … … 52 46 /** 53 47 * Runs a Monte Carlo simulation for a strategy using simulated order books. 54 * 48 * 55 49 * For most common use cases, you should consider {@link MCSimulationTaskRunner} 56 * 50 * 57 51 * @param <D> the type of the parameters used to generate depth caches 58 52 * @author Johannes Lehmann … … 63 57 /** 64 58 * The strategy factory that creates new strategy instances to be used by the simulation. 65 * 59 * 66 60 * Note that since multiple simulations will be run in parallel, it is important that each 67 61 * strategies generated are independent of each other. … … 71 65 /** 72 66 * Creates a new strategy instance. 73 * 67 * 74 68 * @return a new instance of the strategy 75 69 */ 76 Strategy new Strategy();70 Strategy newInstance(); 77 71 } 78 72 … … 84 78 /** 85 79 * Creates a new simulator instance with the given order books of products. 86 * 80 * 87 81 * @param depthCaches the depth caches for all products 88 * @param rates the exchange rate table82 * @param rates the exchange rate table 89 83 * @return a new simulator instance 90 84 */ 91 Simulator new Simulator(DepthCaches depthCaches, ExchangeRateTable rates);85 Simulator newInstance(DepthCaches depthCaches, ExchangeRateTable rates); 92 86 } 93 87 … … 104 98 /** 105 99 * Constructs a Monte Carlo simulator from a {@link SimTemplate}. 106 * 107 * @param template the template for the simulation we want to create100 * 101 * @param template the template for the simulation we want to create 108 102 * @param depthCacheFactory the factory to generate simulated depths 109 * @param times the times for which to generate depths110 * @param initialPrices the initial price of each product111 * @param simulatorFactory the factory to generate simulators103 * @param times the times for which to generate depths 104 * @param initialPrices the initial price of each product 105 * @param simulatorFactory the factory to generate simulators 112 106 */ 113 107 public MCSimulation(final SimTemplate template, … … 117 111 SimulatorFactory simulatorFactory) { 118 112 this(new StrategyFactory() { 119 120 113 @Override 121 public Strategy new Strategy() {114 public Strategy newInstance() { 122 115 return template.getStrategy(); 123 116 } … … 129 122 * Constructs a Monte Carlo simulator. Note that it is necessary that all of the input factory 130 123 * objects are thread-safe. 131 * 132 * @param strategyFactory the factory to generate the strategy133 * @param depthCacheFactory the factory to generate simulated depths134 * @param products the products that are to be included in the simulation135 * @param times the times for which to generate depths136 * @param initialPrices the initial price of each product137 * @param rates the exchange rate table138 * @param simulatorFactory the factory to generate simulators124 * 125 * @param strategyFactory the factory to generate the strategy 126 * @param depthCacheFactory the factory to generate simulated depths 127 * @param products the products that are to be included in the simulation 128 * @param times the times for which to generate depths 129 * @param initialPrices the initial price of each product 130 * @param rates the exchange rate table 131 * @param simulatorFactory the factory to generate simulators 139 132 * @param performanceAnalyzer the performance analyzer to generate performance reports 140 133 */ … … 159 152 /** 160 153 * Runs an MC simulation for the given parameter. 161 * 154 * 162 155 * @param param the parameter 163 156 * @param nSims the number of simulations to run … … 168 161 throws SimulationException { 169 162 final Collection<SimulationTask> tasks = 170 Collections.synchronizedList(new ArrayList<SimulationTask>(nSims));163 Collections.synchronizedList(new ArrayList<SimulationTask>(nSims)); 171 164 172 165 try { … … 175 168 public void run(int i) throws Exception { 176 169 DepthCaches depthCaches = 177 depthCacheFactory.newDepths(products, times, initialPrices, param);178 Simulator simulator = simulatorFactory.new Simulator(depthCaches, rates);179 Strategy strategy = strategyFactory.new Strategy();170 depthCacheFactory.newDepths(products, times, initialPrices, param); 171 Simulator simulator = simulatorFactory.newInstance(depthCaches, rates); 172 Strategy strategy = strategyFactory.newInstance(); 180 173 tasks.add(new SimulationTask(Long.toString(i), 181 174 simulator, … … 197 190 /** 198 191 * Runs an MC simulation with a null parameter. 199 * 192 * 200 193 * @param nSims the number of simulations to run 201 194 * @return an empirical distribution of each performance measure … … 209 202 /** 210 203 * Runs an MC simulation for each parameter in the given collection. 211 * 204 * 212 205 * @param params the parameters to run the simulation on 213 * @param nSims the number of simulations per parameter206 * @param nSims the number of simulations per parameter 214 207 * @return for each performance measure an empirical distribution for each parameter 215 208 * @throws SimulationException thrown if a simulation throws an exception -
core/src/main/java/com/numericalmethod/algoquant/execution/simulation/batch/montecarlo/MCSimulationTaskRunner.java
r1539 r1548 144 144 MCSimulation<T> mcSimulation = 145 145 new MCSimulation<T>(simTemplate, 146 task. depthCacheFactory(rng),146 task.getDepthCacheFactory(rng), 147 147 times, 148 148 initialPrices, 149 149 simulatorFactory); 150 150 Map<PerformanceMeasure, Map<T, EmpiricalDistribution>> result = 151 mcSimulation.runBatch(task. params(), nRunsPerParam);152 Chart chart = task. mcPlotter().plot(result);151 mcSimulation.runBatch(task.getParams(), nRunsPerParam); 152 Chart chart = task.getPlotter().plot(result); 153 153 return chart; 154 154 } -
core/src/main/java/com/numericalmethod/algoquant/execution/simulation/batch/montecarlo/MarketSnapshotSimulatorFactory.java
r1532 r1548 72 72 73 73 @Override 74 public final Simulator new Simulator(DepthCaches fakePrices, ExchangeRateTable rates) {74 public final Simulator newInstance(DepthCaches fakePrices, ExchangeRateTable rates) { 75 75 76 76 RandomAccessCache<MarketSnapshot> marketSnapshotsWithFakePrices = -
core/src/main/java/com/numericalmethod/algoquant/execution/simulation/batch/montecarlo/depths/SingleDepthCacheFactoryAdaptor.java
r1539 r1548 58 58 for (Product product : products) { 59 59 depthCaches.addCache(product, singleProductDepthCacheFactory 60 .new Depths(product, times, initialPrices.get(product), params));60 .newInstance(product, times, initialPrices.get(product), params)); 61 61 } 62 62 return depthCaches; -
core/src/main/java/com/numericalmethod/algoquant/execution/simulation/batch/montecarlo/tasks/AR1GARCH11Task.java
r1539 r1548 63 63 64 64 @Override 65 public DepthCacheFactory<Vector> depthCacheFactory(RandomStandardNormalNumberGenerator rng) {65 public DepthCacheFactory<Vector> getDepthCacheFactory(RandomStandardNormalNumberGenerator rng) { 66 66 return new SingleDepthCacheFactoryAdaptor(new AR1GARCH11Returns(rng)); 67 67 } 68 68 69 69 @Override 70 public List<Vector> params() {70 public List<Vector> getParams() { 71 71 List<Vector> params = new ArrayList<Vector>(); 72 72 for (double phi : phiValues) { … … 77 77 78 78 @Override 79 public MCPlotter<Vector> mcPlotter() {79 public MCPlotter<Vector> getPlotter() { 80 80 return new MCVectorMeanPlotter(title(), "phi", 1); 81 81 } -
core/src/main/java/com/numericalmethod/algoquant/execution/simulation/batch/montecarlo/tasks/AR1Task.java
r1539 r1548 56 56 57 57 @Override 58 public DepthCacheFactory<Vector> depthCacheFactory(RandomStandardNormalNumberGenerator rng) {58 public DepthCacheFactory<Vector> getDepthCacheFactory(RandomStandardNormalNumberGenerator rng) { 59 59 return new SingleDepthCacheFactoryAdaptor(new AR1Returns(rng)); 60 60 } 61 61 62 62 @Override 63 public List<Vector> params() {63 public List<Vector> getParams() { 64 64 List<Vector> params = new ArrayList<Vector>(phi.size()); 65 65 for (int i = 0; i < phi.size(); i++) { … … 70 70 71 71 @Override 72 public MCPlotter<Vector> mcPlotter() {72 public MCPlotter<Vector> getPlotter() { 73 73 return new MCVectorMeanPlotter("AR(1)", "phi", 1); 74 74 } -
core/src/main/java/com/numericalmethod/algoquant/execution/simulation/batch/montecarlo/tasks/ARCH1Task.java
r1539 r1548 56 56 57 57 @Override 58 public DepthCacheFactory<Vector> depthCacheFactory(RandomStandardNormalNumberGenerator rng) {58 public DepthCacheFactory<Vector> getDepthCacheFactory(RandomStandardNormalNumberGenerator rng) { 59 59 return new SingleDepthCacheFactoryAdaptor(new ARCH1Returns(rng)); 60 60 } 61 61 62 62 @Override 63 public List<Vector> params() {63 public List<Vector> getParams() { 64 64 List<Vector> params = new ArrayList<Vector>(); 65 65 for (double a1 : a1Values) { … … 70 70 71 71 @Override 72 public MCPlotter<Vector> mcPlotter() {72 public MCPlotter<Vector> getPlotter() { 73 73 return new MCVectorMeanPlotter(title(), "a1", 2); 74 74 } -
core/src/main/java/com/numericalmethod/algoquant/execution/simulation/batch/montecarlo/tasks/ARMA11Task.java
r1539 r1548 62 62 63 63 @Override 64 public DepthCacheFactory<Vector> depthCacheFactory(RandomStandardNormalNumberGenerator rng) {64 public DepthCacheFactory<Vector> getDepthCacheFactory(RandomStandardNormalNumberGenerator rng) { 65 65 return new SingleDepthCacheFactoryAdaptor(new ARMA11Returns(rng)); 66 66 } 67 67 68 68 @Override 69 public List<Vector> params() {69 public List<Vector> getParams() { 70 70 List<Vector> params = new ArrayList<Vector>(); 71 71 for (double mu : muValues) { … … 76 76 77 77 @Override 78 public MCPlotter<Vector> mcPlotter() {78 public MCPlotter<Vector> getPlotter() { 79 79 return new MCVectorMeanPlotter(title(), "mu", 1); 80 80 } -
core/src/main/java/com/numericalmethod/algoquant/execution/simulation/batch/montecarlo/tasks/MCSimulationTask.java
r1539 r1548 31 31 /** 32 32 * Represents a task that is executed by {@link MCSimulationTaskRunner}. 33 * 33 * 34 34 * @author Johannes Lehmann 35 35 * @param <T> the type of the parameter that is accepted by the {@link DepthCacheFactory}. … … 42 42 * @return the factory that creates the simulated depths for a given parameter 43 43 */ 44 DepthCacheFactory<T> depthCacheFactory(RandomStandardNormalNumberGenerator rng);44 DepthCacheFactory<T> getDepthCacheFactory(RandomStandardNormalNumberGenerator rng); 45 45 46 46 /** 47 47 * @return the parameters for which to run a Monte Carlo simulation 48 48 */ 49 List<T> params();49 List<T> getParams(); 50 50 51 51 /** 52 52 * @return the plotter that will be used to plot the result 53 53 */ 54 MCPlotter<T> mcPlotter(); 55 54 MCPlotter<T> getPlotter(); 56 55 } -
core/src/main/java/com/numericalmethod/algoquant/execution/simulation/batch/montecarlo/tasks/RandomWalkTask.java
r1539 r1548 56 56 57 57 @Override 58 public DepthCacheFactory<Vector> depthCacheFactory(RandomStandardNormalNumberGenerator rng) {58 public DepthCacheFactory<Vector> getDepthCacheFactory(RandomStandardNormalNumberGenerator rng) { 59 59 return new SingleDepthCacheFactoryAdaptor(new RandomWalkReturns(rng)); 60 60 } 61 61 62 62 @Override 63 public List<Vector> params() {63 public List<Vector> getParams() { 64 64 List<Vector> params = new ArrayList<Vector>(mu.size()); 65 65 for (int i = 0; i < mu.size(); i++) { … … 70 70 71 71 @Override 72 public MCPlotter<Vector> mcPlotter() {72 public MCPlotter<Vector> getPlotter() { 73 73 return new MCVectorMeanPlotter("Random Walk", "mu", 1); 74 74 } -
core/src/main/java/com/numericalmethod/algoquant/execution/simulation/template/SimTemplateYahooEOD.java
r1535 r1548 58 58 for (Product product : getProducts()) { 59 59 depthCaches.addCache(product, 60 DataSources.YAHOO.forProduct(product, dataFolder). getCache(begin, end));60 DataSources.YAHOO.forProduct(product, dataFolder).newInstance(begin, end)); 61 61 } 62 62 } -
core/src/main/java/com/numericalmethod/algoquant/execution/simulator/SimMarketFactory.java
r1366 r1548 39 39 * @return a {@code SimMarket} instance for the given product 40 40 */ 41 public SimMarket new SimMarket(Product product);41 public SimMarket newInstance(Product product); 42 42 } -
core/src/main/java/com/numericalmethod/algoquant/execution/simulator/SimpleSimulator.java
r1532 r1548 128 128 private SimMarketFactory simMarketFactory = new SimMarketFactory() { // default SimMarket 129 129 @Override 130 public SimMarket new SimMarket(Product product) {130 public SimMarket newInstance(Product product) { 131 131 return new SimpleSimMarket(product); 132 132 } … … 198 198 this.simMarketFactory = new SimMarketFactory() { 199 199 @Override 200 public SimMarket new SimMarket(Product product) {200 public SimMarket newInstance(Product product) { 201 201 return new SimpleSimMarket(product, model); 202 202 } … … 279 279 for (Product product : products) { 280 280 components.add(new MarketComponent( 281 simMarketFactory.new SimMarket(product),281 simMarketFactory.newInstance(product), 282 282 channelSimPrice.newChannelInput(), 283 283 channelBroker.newChannelInput(), -
core/src/main/java/com/numericalmethod/algoquant/execution/simulator/StrategyComponent.java
r1366 r1548 78 78 buildHandlerMap(EnumSet.allOf(ChannelMessageHandlerFactories.class), strategy); 79 79 for (ChannelMessageHandlerFactory factory : customMessageHandlerFactories) { 80 strategyMessageHandlers.put(factory.getSubscriberClass(), factory.new Handler(strategy));80 strategyMessageHandlers.put(factory.getSubscriberClass(), factory.newInstance(strategy)); 81 81 } 82 82 this.strategyMessageDispatcher = new SimpleMessageDispatcher(strategyMessageHandlers); … … 105 105 106 106 for (ChannelMessageHandlerFactories entry : handlersEnum) { 107 handlerMap.put(entry.getSubscriberClass(), entry.new Handler(handler));107 handlerMap.put(entry.getSubscriberClass(), entry.newInstance(handler)); 108 108 } 109 109 -
core/src/main/java/com/numericalmethod/algoquant/execution/simulator/handler/ChannelMessageHandlerFactories.java
r1518 r1548 43 43 DEPTH(Depth.class) { 44 44 @Override 45 public ChannelMessageHandler new Handler(UpdateHandler handler) {45 public ChannelMessageHandler newInstance(UpdateHandler handler) { 46 46 47 47 if (handler instanceof DepthHandler) { … … 57 57 EXECUTION(Execution.class) { 58 58 @Override 59 public ChannelMessageHandler new Handler(UpdateHandler handler) {59 public ChannelMessageHandler newInstance(UpdateHandler handler) { 60 60 61 61 if (handler instanceof ExecutionHandler) { … … 71 71 STOCK_EOD(StockEOD.class) { 72 72 @Override 73 public ChannelMessageHandler new Handler(UpdateHandler handler) {73 public ChannelMessageHandler newInstance(UpdateHandler handler) { 74 74 75 75 if (handler instanceof StockEODHandler) { … … 85 85 TIMER(TimerEvent.class) { 86 86 @Override 87 public ChannelMessageHandler new Handler(UpdateHandler handler) {87 public ChannelMessageHandler newInstance(UpdateHandler handler) { 88 88 89 89 if (handler instanceof TimerHandler) { … … 96 96 MARKET_SNAPSHOT(MarketSnapshot.class) { 97 97 @Override 98 public ChannelMessageHandler new Handler(UpdateHandler handler) {98 public ChannelMessageHandler newInstance(UpdateHandler handler) { 99 99 100 100 if (handler instanceof MarketSnapshotHandler) { … … 117 117 118 118 @Override 119 public abstract ChannelMessageHandler new Handler(UpdateHandler handler);119 public abstract ChannelMessageHandler newInstance(UpdateHandler handler); 120 120 } -
core/src/main/java/com/numericalmethod/algoquant/execution/simulator/handler/ChannelMessageHandlerFactory.java
r1366 r1548 46 46 * @return the new instance 47 47 */ 48 ChannelMessageHandler new Handler(UpdateHandler handler);48 ChannelMessageHandler newInstance(UpdateHandler handler); 49 49 } -
core/src/main/java/com/numericalmethod/algoquant/execution/strategy/StrategyFactory.java
r1366 r1548 39 39 * @return the new strategy instance 40 40 */ 41 S new Strategy(P param);41 S newInstance(P param); 42 42 } -
core/src/main/java/com/numericalmethod/algoquant/execution/strategy/optimizer/StrategyOptimizer.java
r1401 r1548 129 129 130 130 try { 131 Strategy strategy = strategyFactory.new Strategy(x.toArray());131 Strategy strategy = strategyFactory.newInstance(x.toArray()); 132 132 if (strategy == null) { 133 133 LOGGER.debug("null stategy @ " + x); -
core/src/main/java/com/numericalmethod/algoquant/framework/template/factormodel/CrossSectionalRegressionStrategyTemplate.java
r1547 r1548 137 137 return new StrategyFactory<Strategy, Double>() { 138 138 @Override 139 public Strategy new Strategy(Double factorOffset) {139 public Strategy newInstance(Double factorOffset) { 140 140 FactorModelWeightSignal weightSignal = 141 141 new SensitivityAnalysisWeightSignal(CrossSectionalRegressionSimTemplate -
core/src/main/java/com/numericalmethod/algoquant/model/analysis/cointegration/CointegratedPairsSearch.java
r1366 r1548 265 265 SequentialCache<VectorCache.Vector<Double>> noNullDataCache = 266 266 getNoNullDataCache( 267 processorChain.doProcess(param.getProductInfo1().getCacheFactory(). getCache(beginDate, endDate)),268 processorChain.doProcess(param.getProductInfo2().getCacheFactory(). getCache(beginDate, endDate)));267 processorChain.doProcess(param.getProductInfo1().getCacheFactory().newInstance(beginDate, endDate)), 268 processorChain.doProcess(param.getProductInfo2().getCacheFactory().newInstance(beginDate, endDate))); 269 269 270 270 return noNullDataCache; -
core/src/main/java/com/numericalmethod/algoquant/model/factormodel/regression/crosssectional/FixedEffectsCrossSectionalRegression.java
r1541 r1548 49 49 new Factory() { 50 50 @Override 51 public com.numericalmethod.suanshu.stats.regression.linear.panel.PanelRegression getPanelRegression(51 public com.numericalmethod.suanshu.stats.regression.linear.panel.PanelRegression newInstance( 52 52 ReturnPanelData returns) { 53 53 -
core/src/main/java/com/numericalmethod/algoquant/model/factormodel/regression/crosssectional/PanelCrossSectionalRegression.java
r1541 r1548 33 33 import com.numericalmethod.algoquant.model.util.returns.ReturnCalculator; 34 34 import com.numericalmethod.suanshu.stats.regression.linear.LinearModel; 35 import com.numericalmethod.suanshu.stats.regression.linear.panel.PanelRegression; 35 36 import java.util.Arrays; 36 37 import java.util.Iterator; … … 46 47 public static interface Factory { 47 48 48 public com.numericalmethod.suanshu.stats.regression.linear.panel.PanelRegression getPanelRegression(49 public PanelRegression newInstance( 49 50 ReturnPanelData returns); 50 51 } … … 100 101 // run the regression to compute the premiums 101 102 com.numericalmethod.suanshu.stats.regression.linear.panel.PanelRegression regression = 102 factory. getPanelRegression(panel);103 factory.newInstance(panel); 103 104 LinearModel lm = regression.getLinearModel(panel.getRows().get(0).subject()); // any stock will have the same beta 104 105 Premiums premiums = -
core/src/main/java/com/numericalmethod/algoquant/model/infantino2010/strategy/Infantino2010StrategyFactory.java
r1366 r1548 102 102 103 103 @Override 104 public Infantino2010Strategy new Strategy(Param param) {104 public Infantino2010Strategy newInstance(Param param) { 105 105 return new Infantino2010Strategy( 106 106 param.getInfoSet(), -
core/src/main/java/com/numericalmethod/algoquant/model/portfoliooptimization/performance/PerformanceOptimizedPortfolio.java
r1542 r1548 90 90 91 91 @Override 92 public Strategy new Strategy(double[] params) {92 public Strategy newInstance(double[] params) { 93 93 Map<Product, Double> weights = newHashMap(); 94 94 … … 159 159 160 160 public Strategy getStrategy(double[] params) { 161 return strategyFactory.new Strategy(params);161 return strategyFactory.newInstance(params); 162 162 } 163 163 } -
core/src/main/java/com/numericalmethod/algoquant/model/portfoliooptimization/performance/PerformanceOptimizedYahooEODPortfolio.java
r1507 r1548 86 86 product, 87 87 DepthCacheUtils.fromStockEODCache(product, 88 cacheFactories.get(product). getCache(begin, end)));88 cacheFactories.get(product).newInstance(begin, end))); 89 89 } 90 90 -
core/src/main/java/com/numericalmethod/algoquant/model/signal/technical/crossover/strategy/SMA2CrossoverDynamic.java
r1541 r1548 88 88 89 89 @Override 90 public Strategy new Strategy(double[] params) {90 public Strategy newInstance(double[] params) { 91 91 int fastLag = Math.round((float) params[0]); 92 92 int slowLag = Math.round((float) params[1]); … … 186 186 performanceMeasureFactory); 187 187 188 DepthCaches depthCaches = DepthCaches.newInstanceWithSingleCache(productParams.product, cacheFactory. getCache(begin, end));188 DepthCaches depthCaches = DepthCaches.newInstanceWithSingleCache(productParams.product, cacheFactory.newInstance(begin, end)); 189 189 StrategyOptimizer.Minimizer.Result optimalParams = optimizer.findOptimalParams( 190 190 depthCaches, … … 197 197 } 198 198 SMA2Crossover sma = getSMA2CrossoverInstance(optimalParams.optimizer.toArray()); 199 sma.initialize(cacheFactory. getCache(begin, end));// calibrate using only the last "period" data199 sma.initialize(cacheFactory.newInstance(begin, end));// calibrate using only the last "period" data 200 200 201 201 return sma; -
core/src/main/java/com/numericalmethod/algoquant/model/signal/technical/crossover/strategy/SMA2CrossoverFactory.java
r1541 r1548 32 32 33 33 @Override 34 public SMA2Crossover new Strategy(SMA2CrossoverParam param) {34 public SMA2Crossover newInstance(SMA2CrossoverParam param) { 35 35 return new SMA2Crossover( 36 36 param.getProductParams(), -
core/src/main/java/com/numericalmethod/algoquant/model/volarb/MeanReversionStrategyFactory.java
r1431 r1548 32 32 33 33 @Override 34 public MeanReversionStrategy new Strategy(MeanReversionStrategyParam param) {34 public MeanReversionStrategy newInstance(MeanReversionStrategyParam param) { 35 35 return new MeanReversionStrategy( 36 36 param.getBasket(), -
core/src/test/java/com/numericalmethod/algoquant/data/cache/TestDepthCacheFactory.java
r1366 r1548 42 42 43 43 @Override 44 public SequentialCache<Depth> getCache(DateTime begin, DateTime end) { // Note: this method will always return all the input depths without checking begin/end time44 public SequentialCache<Depth> newInstance(DateTime begin, DateTime end) { // Note: this method will always return all the input depths without checking begin/end time 45 45 return new SequentialCache<Depth>() { 46 46 @Override -
core/src/test/java/com/numericalmethod/algoquant/data/cache/conversion/Cache2MatrixTest.java
r1507 r1548 55 55 56 56 @SuppressWarnings("unchecked") 57 Cache2Matrix instance = new Cache2Matrix(STOCK_EOD.doProcess(GOOGsrc. getCache(begin, end)));57 Cache2Matrix instance = new Cache2Matrix(STOCK_EOD.doProcess(GOOGsrc.newInstance(begin, end))); 58 58 59 59 // System.out.println(instance); … … 89 89 @SuppressWarnings("unchecked") 90 90 Cache2Matrix instance = new Cache2Matrix( 91 STOCK_EOD.doProcess(AAPLsrc. getCache(begin, end)),92 STOCK_EOD.doProcess(GOOGsrc. getCache(begin, end)));91 STOCK_EOD.doProcess(AAPLsrc.newInstance(begin, end)), 92 STOCK_EOD.doProcess(GOOGsrc.newInstance(begin, end))); 93 93 94 94 // System.out.println(instance); -
core/src/test/java/com/numericalmethod/algoquant/data/cache/conversion/Cache2ReturnsMatrixTest.java
r1507 r1548 60 60 @SuppressWarnings("unchecked") 61 61 Cache2ReturnsMatrix instance = new Cache2ReturnsMatrix( 62 STOCK_EOD.doProcess(VFINXsrc. getCache(begin, end)), STOCK_EOD.doProcess(GOOGsrc.getCache(begin, end)));62 STOCK_EOD.doProcess(VFINXsrc.newInstance(begin, end)), STOCK_EOD.doProcess(GOOGsrc.newInstance(begin, end))); 63 63 64 64 // System.out.println(instance); … … 91 91 @SuppressWarnings("unchecked") 92 92 Cache2ReturnsMatrix returns = new Cache2ReturnsMatrix( 93 STOCK_EOD.doProcess(GOOGsrc. getCache(begin, end)), STOCK_EOD.doProcess(AAPLsrc.getCache(begin, end)));93 STOCK_EOD.doProcess(GOOGsrc.newInstance(begin, end)), STOCK_EOD.doProcess(AAPLsrc.newInstance(begin, end))); 94 94 95 95 SampleCovariance instance = new SampleCovariance(returns); -
core/src/test/java/com/numericalmethod/algoquant/data/cache/processor/filter/WeekdayFilterTest.java
r1366 r1548 50 50 Product fxProduct = FxProductFactory.getInstance("NZD", "CHF", 0.0001); 51 51 GainCapitalFx source = new GainCapitalFx(fxProduct, "./test-data/gaincapital"); 52 SequentialCache<Depth> cache = source. getCache(begin, end);52 SequentialCache<Depth> cache = source.newInstance(begin, end); 53 53 54 54 DailyDataSampler<Depth> dailySampler = new DailyDataSampler<Depth>(hour); -
core/src/test/java/com/numericalmethod/algoquant/data/cache/processor/sampler/DailyDataSamplerTest.java
r1366 r1548 52 52 hour); 53 53 54 Iterator<TimedEntry<Depth>> it = sampler.doProcess(source. getCache(begin, end)).iterator();54 Iterator<TimedEntry<Depth>> it = sampler.doProcess(source.newInstance(begin, end)).iterator(); 55 55 TimedEntry<Depth> entry = it.next(); 56 56 assertEquals(new DateTime(2008, 6, 2, 12, 0, 0, 0, GainCapitalFx.TIME_ZONE), entry.getTime()); -
core/src/test/java/com/numericalmethod/algoquant/data/cache/util/DailyDataFileMakerTest.java
r1366 r1548 49 49 50 50 Product fxProduct = FxProductFactory.getInstance("EUR", "USD", 0.0001); 51 SequentialCache<Depth> cache = new GainCapitalFx(fxProduct, "./test-data/gaincapital"). getCache(51 SequentialCache<Depth> cache = new GainCapitalFx(fxProduct, "./test-data/gaincapital").newInstance( 52 52 JodaTimeUtils.getDate(2000, 5, 30, GainCapitalFx.TIME_ZONE), 53 53 JodaTimeUtils.getDate(2000, 6, 2, GainCapitalFx.TIME_ZONE)); … … 81 81 Product fxProduct = FxProductFactory.getInstance("EUR", "USD", 0.0001); 82 82 SequentialCache<Depth> cache = new GainCapitalFx(fxProduct, 83 "C:/Numerical Method/data/processed/gaincapital/extracted-from-raw-arrange-by-dates"). getCache(83 "C:/Numerical Method/data/processed/gaincapital/extracted-from-raw-arrange-by-dates").newInstance( 84 84 JodaTimeUtils.getDate(2000, 5, 30, GainCapitalFx.TIME_ZONE), 85 85 JodaTimeUtils.getDate(2010, 10, 1, GainCapitalFx.TIME_ZONE)); -
core/src/test/java/com/numericalmethod/algoquant/data/export/xml/BatchSimulationXmlWriterUtilsTest.java
r1537 r1548 73 73 for (Product product : products) { 74 74 caches.addCache(product, 75 DataSources.YAHOO.forProduct(product, "./log"). getCache(begin, end));75 DataSources.YAHOO.forProduct(product, "./log").newInstance(begin, end)); 76 76 } 77 77 -
core/src/test/java/com/numericalmethod/algoquant/data/historicaldata/bloomberg/BloombergTickDataTest.java
r1366 r1548 90 90 91 91 BloombergTickData data = new BloombergTickData(product1, outDir); 92 SequentialCache<Depth> loadedCache = data. getCache(begin, end);92 SequentialCache<Depth> loadedCache = data.newInstance(begin, end); 93 93 94 94 time = begin; -
core/src/test/java/com/numericalmethod/algoquant/data/historicaldata/compustat/MockMarketData.java
r1517 r1548 43 43 List<CompanyHistory> companyHistories = new CommonHistoriesFilter(MEASURES, START_TIME, END_TIME).filter(COMPANY_HISTORY_DB.getAllCompanyHistories()); 44 44 // TODO: hacking due to a wrong definition of CacheFactory, should always include the TimedEntry before the start time to cover the whole specified period 45 SequentialCache<Double> market = new HSIReader("./test-data/HSI.csv.zip"). getCache(START_TIME.minus(Period.weeks(1)), END_TIME);45 SequentialCache<Double> market = new HSIReader("./test-data/HSI.csv.zip").newInstance(START_TIME.minus(Period.weeks(1)), END_TIME); 46 46 SequentialCache<Double> rates = new HKIBOR("./test-data/HKMA/T060301.xls").getRatesForMaturity(HKIBOR.Maturity.TWELVE_MONTH); 47 47 -
core/src/test/java/com/numericalmethod/algoquant/data/historicaldata/gaincapital/GainCapitalFxTest.java
r1366 r1548 42 42 public void test_0010() { 43 43 Product fxProduct = FxProductFactory.getInstance("NZD", "CHF", 0.0001); 44 SequentialCache<Depth> instance = new GainCapitalFx(fxProduct, "./test-data/gaincapital"). getCache(44 SequentialCache<Depth> instance = new GainCapitalFx(fxProduct, "./test-data/gaincapital").newInstance( 45 45 JodaTimeUtils.getDate(2010, 8, 1, GainCapitalFx.TIME_ZONE), 46 46 new DateTime(2010, 8, 2, 23, 59, 59, 999, GainCapitalFx.TIME_ZONE)); … … 58 58 public void test_0020() { 59 59 Product fxProduct = FxProductFactory.getInstance("NZD", "CHF", 0.0001); 60 SequentialCache<Depth> instance = new GainCapitalFx(fxProduct, "./test-data/gaincapital"). getCache(60 SequentialCache<Depth> instance = new GainCapitalFx(fxProduct, "./test-data/gaincapital").newInstance( 61 61 JodaTimeUtils.getDate(2010, 8, 1, GainCapitalFx.TIME_ZONE), 62 62 new DateTime(2010, 8, 3, 12, 0, 0, 0, GainCapitalFx.TIME_ZONE)); … … 77 77 public void test_0030() { 78 78 Product fxProduct = FxProductFactory.getInstance("NZD", "CHF", 0.0001); 79 SequentialCache<Depth> instance = new GainCapitalFx(fxProduct, "./test-data/gaincapital"). getCache(79 SequentialCache<Depth> instance = new GainCapitalFx(fxProduct, "./test-data/gaincapital").newInstance( 80 80 JodaTimeUtils.getDate(2008, 5, 31, GainCapitalFx.TIME_ZONE), 81 81 JodaTimeUtils.getDate(2008, 6, 14, GainCapitalFx.TIME_ZONE)); … … 96 96 public void test_0040() { 97 97 Product fxProduct = FxProductFactory.getInstance("NZD", "CHF", 0.0001); 98 SequentialCache<Depth> instance = new GainCapitalFx(fxProduct, "./test-data/gaincapital"). getCache(98 SequentialCache<Depth> instance = new GainCapitalFx(fxProduct, "./test-data/gaincapital").newInstance( 99 99 JodaTimeUtils.getDate(2008, 5, 31, GainCapitalFx.TIME_ZONE), 100 100 new DateTime(2010, 8, 3, 12, 0, 0, 0, GainCapitalFx.TIME_ZONE)); … … 112 112 public void test_getCache_0010() { 113 113 Product fxProduct = FxProductFactory.getInstance("NZD", "CHF", 0.0001); 114 SequentialCache<Depth> instance1 = new GainCapitalFx(fxProduct, "./test-data/gaincapital"). getCache(114 SequentialCache<Depth> instance1 = new GainCapitalFx(fxProduct, "./test-data/gaincapital").newInstance( 115 115 JodaTimeUtils.getDate(2010, 8, 1, GainCapitalFx.TIME_ZONE), 116 116 new DateTime(2010, 8, 2, 23, 59, 59, 999, GainCapitalFx.TIME_ZONE)); 117 117 118 SequentialCache<Depth> instance2 = new GainCapitalFx(fxProduct, "./test-data/gaincapital"). getCache(118 SequentialCache<Depth> instance2 = new GainCapitalFx(fxProduct, "./test-data/gaincapital").newInstance( 119 119 JodaTimeUtils.getDate(2010, 8, 1, GainCapitalFx.TIME_ZONE), 120 120 new DateTime(2010, 8, 2, 0, 0, 0, 0, GainCapitalFx.TIME_ZONE)); … … 137 137 DateTime begin = new DateTime(2010, 8, 1, 18, 0, GainCapitalFx.TIME_ZONE); 138 138 DateTime end = new DateTime(2010, 8, 2, 23, 59, 59, 999, GainCapitalFx.TIME_ZONE); 139 SequentialCache<Depth> instance = new GainCapitalFx(fxProduct, "./test-data/gaincapital"). getCache(139 SequentialCache<Depth> instance = new GainCapitalFx(fxProduct, "./test-data/gaincapital").newInstance( 140 140 begin, end); 141 141 … … 154 154 DateTime begin = new DateTime(2010, 8, 1, 23, 59, 55, GainCapitalFx.TIME_ZONE); 155 155 DateTime end = new DateTime(2010, 8, 2, 23, 59, 59, 999, GainCapitalFx.TIME_ZONE); 156 SequentialCache<Depth> instance = new GainCapitalFx(fxProduct, "./test-data/gaincapital"). getCache(156 SequentialCache<Depth> instance = new GainCapitalFx(fxProduct, "./test-data/gaincapital").newInstance( 157 157 begin, end); 158 158 … … 171 171 DateTime begin = new DateTime(2010, 8, 1, 23, 59, 55, GainCapitalFx.TIME_ZONE); 172 172 DateTime end = new DateTime(2010, 8, 2, 0, 0, 0, GainCapitalFx.TIME_ZONE); 173 SequentialCache<Depth> instance = new GainCapitalFx(fxProduct, "./test-data/gaincapital"). getCache(173 SequentialCache<Depth> instance = new GainCapitalFx(fxProduct, "./test-data/gaincapital").newInstance( 174 174 begin, end); 175 175 -
core/src/test/java/com/numericalmethod/algoquant/data/historicaldata/gaincapital/preprocess/GainCapitalFxRawCsvFileTest.java
r1366 r1548 51 51 } 52 52 } 53 CellProcessor[] processors = GainCapitalFxRawCsvFile.processors1.new CellProcessor();53 CellProcessor[] processors = GainCapitalFxRawCsvFile.processors1.newInstance(); 54 54 Row row = trial.read(Row.class, headers, processors); 55 55 assertEquals(1283399047, row.getLTid().longValue()); … … 69 69 } 70 70 } 71 CellProcessor[] processors = GainCapitalFxRawCsvFile.processors2.new CellProcessor();71 CellProcessor[] processors = GainCapitalFxRawCsvFile.processors2.newInstance(); 72 72 Row row = trial.read(Row.class, headers, processors); 73 73 assertEquals(905536420, row.getLTid().longValue()); -
core/src/test/java/com/numericalmethod/algoquant/data/historicaldata/sgx/SGXTickDataTest.java
r1507 r1548 50 50 SGXTickData instance = new SGXTickData("./test-data/sgx/SiMSCI", sgxOptions); 51 51 52 SequentialCache<Depth> cache = instance. getCache(52 SequentialCache<Depth> cache = instance.newInstance( 53 53 JodaTimeUtils.getDate(2011, 1, 1, TimeZoneUtils.SINGAPORE), 54 54 JodaTimeUtils.getDate(2011, 2, 28, TimeZoneUtils.SINGAPORE)); … … 70 70 SGXTickData instance = new SGXTickData("./test-data/sgx/SiMSCI", sgxOptions); 71 71 72 SequentialCache<Depth> cache = instance. getCache(72 SequentialCache<Depth> cache = instance.newInstance( 73 73 JodaTimeUtils.getDate(2011, 1, 1, TimeZoneUtils.SINGAPORE), 74 74 JodaTimeUtils.getDate(2011, 2, 28, TimeZoneUtils.SINGAPORE)); … … 90 90 SGXTickData instance = new SGXTickData("./test-data/sgx/SiMSCI", sgxOptions); 91 91 92 SequentialCache<Depth> cache = instance. getCache(92 SequentialCache<Depth> cache = instance.newInstance( 93 93 JodaTimeUtils.getDate(2009, 7, 1, TimeZoneUtils.SINGAPORE), 94 94 JodaTimeUtils.getDate(2009, 7, 2, TimeZoneUtils.SINGAPORE)); … … 105 105 SGXTickData instance = new SGXTickData("./test-data/sgx/SiMSCI", sgxOptions); 106 106 107 SequentialCache<Depth> cache = instance. getCache(107 SequentialCache<Depth> cache = instance.newInstance( 108 108 JodaTimeUtils.getDate(2011, 1, 1, TimeZoneUtils.SINGAPORE), 109 109 new DateTime(2011, 2, 28, Exchange.SGX.closeHour, Exchange.SGX.closeMinute, 0, 0, TimeZoneUtils.SINGAPORE)); … … 135 135 DateTime end = begin.plus(Period.months(6)); 136 136 137 SequentialCache<Depth> cache = sgx. getCache(begin, end);137 SequentialCache<Depth> cache = sgx.newInstance(begin, end); 138 138 139 139 TimedEntry<Depth> te = cache.iterator().next(); … … 146 146 SGXTickData instance = new SGXTickData("./test-data/sgx/SiMSCI", sgxOptions); 147 147 148 SequentialCache<Depth> cache = instance. getCache(148 SequentialCache<Depth> cache = instance.newInstance( 149 149 JodaTimeUtils.getDate(2011, 1, 1, TimeZoneUtils.SINGAPORE), 150 150 new DateTime(2011, 2, 28, Exchange.SGX.closeHour, Exchange.SGX.closeMinute, 0, 0, TimeZoneUtils.SINGAPORE)); … … 196 196 SGXTickData instance = new SGXTickData("./test-data/sgx/SiMSCI", sgxOptions); 197 197 198 SequentialCache<Depth> cache = instance. getCache(198 SequentialCache<Depth> cache = instance.newInstance( 199 199 JodaTimeUtils.getDate(2011, 1, 1, TimeZoneUtils.SINGAPORE), 200 200 JodaTimeUtils.getDate(2011, 2, 28, TimeZoneUtils.SINGAPORE)); -
core/src/test/java/com/numericalmethod/algoquant/data/historicaldata/taq/TAQDataTest.java
r1366 r1548 44 44 DateTime beginDate = new DateTime(2010, 1, 4, 4, 0, TAQData.TIME_ZONE); 45 45 DateTime endDate = new DateTime(2011, 3, 25, 9, 0, TAQData.TIME_ZONE); 46 SequentialCache<TAQTick> cache = taqData. getCache(beginDate, endDate);46 SequentialCache<TAQTick> cache = taqData.newInstance(beginDate, endDate); 47 47 48 48 List<TimedEntry<TAQTick>> itemList = new ArrayList<TimedEntry<TAQTick>>(); … … 76 76 DateTime beginDate = new DateTime(2010, 3, 11, 8, 45, 0, TAQData.TIME_ZONE); 77 77 DateTime endDate = new DateTime(2011, 1, 3, 8, 5, 0, TAQData.TIME_ZONE); 78 SequentialCache<TAQTick> cache = taqData. getCache(beginDate, endDate);78 SequentialCache<TAQTick> cache = taqData.newInstance(beginDate, endDate); 79 79 80 80 List<TimedEntry<TAQTick>> itemList = new ArrayList<TimedEntry<TAQTick>>(); … … 102 102 DateTime beginDate = new DateTime(2012, 3, 11, 8, 45, 0, TAQData.TIME_ZONE); 103 103 DateTime endDate = new DateTime(2013, 1, 3, 8, 5, 0, TAQData.TIME_ZONE); 104 SequentialCache<TAQTick> cache = taqData. getCache(beginDate, endDate);104 SequentialCache<TAQTick> cache = taqData.newInstance(beginDate, endDate); 105 105 106 106 List<TimedEntry<TAQTick>> itemList = new ArrayList<TimedEntry<TAQTick>>(); -
core/src/test/java/com/numericalmethod/algoquant/data/historicaldata/yahoo/YahooEODTest.java
r1507 r1548 59 59 DateTime end = JodaTimeUtils.getDate(2003, 1, 10, HK0005.getExchange().timeZone); 60 60 SequentialCache<StockEOD> instance = 61 new YahooEOD(HK0005, "./test-data/Yahoo", getTestFolderName()). getCache(begin, end);61 new YahooEOD(HK0005, "./test-data/Yahoo", getTestFolderName()).newInstance(begin, end); 62 62 63 63 int count = 0; … … 78 78 DateTime end = JodaTimeUtils.getDate(1984, 9, 10, AAPL.getExchange().timeZone); 79 79 SequentialCache<StockEOD> instance = 80 new YahooEOD(AAPL, "./test-data/Yahoo/partial", getTestFolderName()). getCache(begin, end);80 new YahooEOD(AAPL, "./test-data/Yahoo/partial", getTestFolderName()).newInstance(begin, end); 81 81 82 82 int count = 0; … … 99 99 DateTime end = JodaTimeUtils.getDate(1984, 10, 1, AAPL.getExchange().timeZone); 100 100 SequentialCache<StockEOD> instance = 101 new YahooEOD(AAPL, "./test-data/Yahoo/partial", getTestFolderName()). getCache(begin, end);101 new YahooEOD(AAPL, "./test-data/Yahoo/partial", getTestFolderName()).newInstance(begin, end); 102 102 103 103 int count = 0; … … 116 116 DateTime begin = JodaTimeUtils.getDate(1984, 9, 7, AAPL.getExchange().timeZone); 117 117 DateTime end = JodaTimeUtils.getDate(1984, 10, 1, AAPL.getExchange().timeZone); 118 SequentialCache<StockEOD> instance = new YahooEOD(AAPL). getCache(begin, end);118 SequentialCache<StockEOD> instance = new YahooEOD(AAPL).newInstance(begin, end); 119 119 120 120 int count = 0; … … 132 132 YahooEOD source = new YahooEOD(HK0005, "./test-data/Yahoo", getTestFolderName()); 133 133 134 SequentialCache<StockEOD> instance1 = source. getCache(134 SequentialCache<StockEOD> instance1 = source.newInstance( 135 135 JodaTimeUtils.getDate(2005, 1, 1, HK0005.getExchange().timeZone), 136 136 JodaTimeUtils.getDate(2005, 1, 10, HK0005.getExchange().timeZone)); 137 137 138 SequentialCache<StockEOD> instance2 = source. getCache(138 SequentialCache<StockEOD> instance2 = source.newInstance( 139 139 JodaTimeUtils.getDate(2004, 12, 20, HK0005.getExchange().timeZone), 140 140 JodaTimeUtils.getDate(2005, 1, 10, HK0005.getExchange().timeZone)); -
core/src/test/java/com/numericalmethod/algoquant/data/historicaldata/yahoo/YahooEODWebDownloaderTest.java
r1507 r1548 45 45 final DateTime endDate = JodaTimeUtils.getDate(2010, 11, 12, Exchange.HKEX.timeZone); 46 46 47 SequentialCache<StockEOD> instance = new YahooEODWebDownloader(HK0005.getInstance().as(Stock.class)). getCache(startDate, endDate);47 SequentialCache<StockEOD> instance = new YahooEODWebDownloader(HK0005.getInstance().as(Stock.class)).newInstance(startDate, endDate); 48 48 49 49 int count = 0; … … 60 60 final DateTime endDate = JodaTimeUtils.getDate(2010, 11, 12, Exchange.NASDAQ.timeZone); 61 61 62 SequentialCache<StockEOD> instance = new YahooEODWebDownloader(HK0005.getInstance().as(Stock.class)). getCache(startDate, endDate);62 SequentialCache<StockEOD> instance = new YahooEODWebDownloader(HK0005.getInstance().as(Stock.class)).newInstance(startDate, endDate); 63 63 64 64 int count = 0; … … 74 74 YahooEODWebDownloader source = new YahooEODWebDownloader(HK0005.getInstance().as(Stock.class)); 75 75 76 SequentialCache<StockEOD> instance1 = source. getCache(JodaTimeUtils.getDate(2010, 11, 5, Exchange.HKEX.timeZone),76 SequentialCache<StockEOD> instance1 = source.newInstance(JodaTimeUtils.getDate(2010, 11, 5, Exchange.HKEX.timeZone), 77 77 JodaTimeUtils.getDate(2010, 11, 12, Exchange.HKEX.timeZone)); 78 78 79 SequentialCache<StockEOD> instance2 = source. getCache(79 SequentialCache<StockEOD> instance2 = source.newInstance( 80 80 JodaTimeUtils.getDate(2010, 11, 5, Exchange.HKEX.timeZone), 81 81 JodaTimeUtils.getDate(2010, 11, 15, Exchange.HKEX.timeZone)); -
core/src/test/java/com/numericalmethod/algoquant/execution/depth/SimulatedDepthCacheTest.java
r1541 r1548 122 122 DateTime end = begin.plusDays(4); 123 123 YahooEOD yahoo = new YahooEOD(stock, "./log/Yahoo", "./log/Yahoo"); 124 SequentialCache<Depth> modelCache = DepthCacheUtils.fromStockEODCache(product, yahoo. getCache(begin, end));;124 SequentialCache<Depth> modelCache = DepthCacheUtils.fromStockEODCache(product, yahoo.newInstance(begin, end));; 125 125 126 126 SequentialCache<Depth> simulatedCache = new SimulatedDepthCache( -
core/src/test/java/com/numericalmethod/algoquant/execution/performance/measure/decomposition/PartialPerformanceMeasureTest.java
r1542 r1548 57 57 private final ProductParams params = new ProductParams(product, 1.0); 58 58 private final DepthCaches depthCaches = DepthCaches.newInstanceWithSingleCache( 59 product, DataSources.YAHOO.forProduct(product, "./log/Yahoo"). getCache(begin, end));59 product, DataSources.YAHOO.forProduct(product, "./log/Yahoo").newInstance(begin, end)); 60 60 private final Simulator simulator = new SimpleSimulator.Builder(depthCaches).build(); 61 61 -
core/src/test/java/com/numericalmethod/algoquant/execution/product/fx/simulator/CrossRateCacheFactoryTest.java
r1366 r1548 73 73 factory1, factory2); 74 74 75 Iterator<TimedEntry<Depth>> itr = crossRateFactory. getCache(null, null).iterator();75 Iterator<TimedEntry<Depth>> itr = crossRateFactory.newInstance(null, null).iterator(); 76 76 77 77 TimedEntry<Depth> testedTimeEntry = itr.next(); … … 124 124 DateTime begin = new DateTime(2009, 1, 1, 0, 0, GainCapitalFx.TIME_ZONE); 125 125 DateTime end = begin.plus(Period.days(10)); 126 SequentialCache<Depth> cache = chfdkk. getCache(begin, end);126 SequentialCache<Depth> cache = chfdkk.newInstance(begin, end); 127 127 128 128 int count = 0; -
core/src/test/java/com/numericalmethod/algoquant/execution/product/fx/simulator/InvertedRateCacheFactoryTest.java
r1366 r1548 65 65 product, factory); 66 66 67 Iterator<TimedEntry<Depth>> itr = invertedRateFactory. getCache(null, null).iterator();67 Iterator<TimedEntry<Depth>> itr = invertedRateFactory.newInstance(null, null).iterator(); 68 68 69 69 TimedEntry<Depth> testedTimeEntry = itr.next(); … … 106 106 DateTime end = begin.plus(Period.days(10)); 107 107 108 SequentialCache<Depth> chfeurCache = chfeur. getCache(begin, end);109 SequentialCache<Depth> eurchfCache = eurchf. getCache(begin, end);108 SequentialCache<Depth> chfeurCache = chfeur.newInstance(begin, end); 109 SequentialCache<Depth> eurchfCache = eurchf.newInstance(begin, end); 110 110 111 111 int countchfeur = 0; -
core/src/test/java/com/numericalmethod/algoquant/execution/simulation/batch/montecarlo/MCSimulationTest.java
r1539 r1548 75 75 StrategyFactory strategyFactory = new StrategyFactory() { 76 76 @Override 77 public Strategy new Strategy() {77 public Strategy newInstance() { 78 78 return new MockStrategyBuySellFixedQty(PRODUCT, 1.0); 79 79 } … … 115 115 SimulatorFactory simFactory = new SimulatorFactory() { 116 116 @Override 117 public Simulator new Simulator(DepthCaches depthCaches, ExchangeRateTable rates) {117 public Simulator newInstance(DepthCaches depthCaches, ExchangeRateTable rates) { 118 118 return new SimpleSimulator.Builder(depthCaches).useExchangeRates(rates).build(); 119 119 } … … 154 154 MCSimulation.StrategyFactory strategyFactory = new MCSimulation.StrategyFactory() { 155 155 @Override 156 public Strategy new Strategy() {156 public Strategy newInstance() { 157 157 return new MockStrategyBuySellFixedQty(product, 1.0); 158 158 } … … 161 161 MCSimulation.SimulatorFactory simFactory = new MCSimulation.SimulatorFactory() { 162 162 @Override 163 public Simulator new Simulator(DepthCaches depthCaches, ExchangeRateTable rates) {163 public Simulator newInstance(DepthCaches depthCaches, ExchangeRateTable rates) { 164 164 return new SimpleSimulator.Builder(depthCaches).useExchangeRates(rates).build(); 165 165 } -
core/src/test/java/com/numericalmethod/algoquant/execution/simulation/batch/sensitivity/SensitivityAnalyzerTest.java
r1537 r1548 53 53 new StrategyFactory<Strategy, Vector>() { 54 54 @Override 55 public synchronized Strategy new Strategy(Vector param) {55 public synchronized Strategy newInstance(Vector param) { 56 56 final double n = param.get(1); 57 57 return new Strategy() { -
core/src/test/java/com/numericalmethod/algoquant/execution/simulator/SimpleSimulatorTest.java
r1507 r1548 66 66 YahooEOD yahoo = new YahooEOD(stock, "./test-data/Yahoo", "./log/Yahoo"); 67 67 DEPTH_CACHES = DepthCaches.newInstanceWithSingleCache( 68 PRODUCT, DepthCacheUtils.fromStockEODCache(PRODUCT, yahoo. getCache(begin, end)));68 PRODUCT, DepthCacheUtils.fromStockEODCache(PRODUCT, yahoo.newInstance(begin, end))); 69 69 } 70 70 … … 181 181 182 182 @Override 183 public ChannelMessageHandler new Handler(UpdateHandler handler) {183 public ChannelMessageHandler newInstance(UpdateHandler handler) { 184 184 if (handler instanceof MessageTypeA.UpdateHandlerA) { 185 185 return new MessageTypeA.MessageHandlerA((MessageTypeA.UpdateHandlerA) handler); -
core/src/test/java/com/numericalmethod/algoquant/execution/strategy/composite/CompositeStrategyTest.java
r1542 r1548 51 51 private final ProductParams params = new ProductParams(product, 1.0); 52 52 private final DepthCaches depthCaches = DepthCaches.newInstanceWithSingleCache( 53 product, DataSources.YAHOO.forProduct(product, "./log/Yahoo"). getCache(begin, end));53 product, DataSources.YAHOO.forProduct(product, "./log/Yahoo").newInstance(begin, end)); 54 54 private Simulator simulator = new SimpleSimulator.Builder(depthCaches).build(); 55 55 -
core/src/test/java/com/numericalmethod/algoquant/model/factormodel/regression/crosssectional/AbstractCrossSectionalRegressionTest.java
r1541 r1548 94 94 throws ZipException, IOException, ParseException { 95 95 SequentialCache<Double> marketSeries = 96 new HSIReader(HSI_FILE_PATH). getCache(startTime, endTime);96 new HSIReader(HSI_FILE_PATH).newInstance(startTime, endTime); 97 97 SequentialCache<Double> rates = 98 98 new HKIBOR(HKMA_RATES_FILE_PATH) -
core/src/test/java/com/numericalmethod/algoquant/model/volarb/MeanReversionStrategyTest.java
r1507 r1548 75 75 DepthCaches depthCaches = new DepthCaches(); 76 76 depthCaches.addCache(productXOM, 77 DepthCacheUtils.fromStockEODCache(productXOM, yahooEODXOM. getCache(begin, end)));77 DepthCacheUtils.fromStockEODCache(productXOM, yahooEODXOM.newInstance(begin, end))); 78 78 depthCaches.addCache(productGOOG, 79 DepthCacheUtils.fromStockEODCache(productGOOG, yahooEODGOOG. getCache(begin, end)));79 DepthCacheUtils.fromStockEODCache(productGOOG, yahooEODGOOG.newInstance(begin, end))); 80 80 81 81 // create the strategy -
demo/src/main/java/com/numericalmethod/algoquant/data/historicaldata/sgx/demo/DemoSiMSCITickData.java
r1507 r1548 49 49 SGXTickData source = new SGXTickData(DATA_FOLDER, SGXOptions.SiMSCI); 50 50 51 SequentialCache<Depth> cache = source. getCache(51 SequentialCache<Depth> cache = source.newInstance( 52 52 JodaTimeUtils.getDate(2011, 1, 1, TimeZoneUtils.SINGAPORE), 53 53 new DateTime(2011, 2, 28, Exchange.SGX.closeHour, Exchange.SGX.closeMinute, 0, 0, TimeZoneUtils.SINGAPORE)); -
demo/src/main/java/com/numericalmethod/algoquant/execution/simulation/batch/montecarlo/demo/DemoMCSimulation.java
r1541 r1548 99 99 private static final StrategyFactory STRATEGY_FACTORY = new StrategyFactory() { 100 100 @Override 101 public Strategy new Strategy() {101 public Strategy newInstance() { 102 102 return new SMA2Crossover(new ProductParams(PRODUCT, 1.0), 1, 2); 103 103 } … … 129 129 private static final SimulatorFactory SIMULATOR_FACTORY = new SimulatorFactory() { 130 130 @Override 131 public Simulator new Simulator(DepthCaches depthCaches, ExchangeRateTable rates) {131 public Simulator newInstance(DepthCaches depthCaches, ExchangeRateTable rates) { 132 132 SimpleSimulator.Builder builder = new SimpleSimulator.Builder(depthCaches); 133 133 SimpleSimulator simulator = -
demo/src/main/java/com/numericalmethod/algoquant/execution/simulation/batch/montecarlo/demo/DemoMCSimulationTaskRunner.java
r1541 r1548 84 84 private static final SimulatorFactory SIMULATOR_FACTORY = new SimulatorFactory() { 85 85 @Override 86 public Simulator new Simulator(DepthCaches depthCaches, ExchangeRateTable rates) {86 public Simulator newInstance(DepthCaches depthCaches, ExchangeRateTable rates) { 87 87 return new SimpleSimulator.Builder(depthCaches).useExchangeRates(rates).build(); 88 88 } -
demo/src/main/java/com/numericalmethod/algoquant/execution/simulation/batch/sensitivity/demo/DemoSensitivityAnalyzer.java
r1541 r1548 79 79 new StrategyFactory<Strategy, Vector>() { 80 80 @Override 81 public Strategy new Strategy(Vector lags) {81 public Strategy newInstance(Vector lags) { 82 82 ProductParams param = new ProductParams(PRODUCT, 1); 83 83 return new SMA2Crossover(param, (int) lags.get(1), (int) lags.get(2)); … … 90 90 DataSources.YAHOO 91 91 .forProduct(PRODUCT, "./log/Yahoo") 92 . getCache(BEGIN, END));92 .newInstance(BEGIN, END)); 93 93 ExchangeRateTable rates = new SimpleExchangeRateTable(PRODUCT.denomination()); 94 94 -
demo/src/main/java/com/numericalmethod/algoquant/execution/strategy/demo/DemoTimer.java
r1541 r1548 73 73 74 74 public static void main(String[] args) { 75 SequentialCache<Depth> dailyData = DataSources.YAHOO.forProduct(PRODUCT). getCache(BEGIN, END);75 SequentialCache<Depth> dailyData = DataSources.YAHOO.forProduct(PRODUCT).newInstance(BEGIN, END); 76 76 DepthCaches depthCaches = DepthCaches.newInstanceWithSingleCache(PRODUCT, dailyData); 77 77 -
demo/src/main/java/com/numericalmethod/algoquant/execution/strategy/demo/DemoTutorialStrategy.java
r1541 r1548 70 70 DateTime end = JodaTimeUtils.getDate(2012, 1, 1, stock.getExchange().timeZone); 71 71 72 SequentialCache<Depth> dailyData = DataSources.YAHOO.forProduct(product). getCache(begin, end);72 SequentialCache<Depth> dailyData = DataSources.YAHOO.forProduct(product).newInstance(begin, end); 73 73 EquiTimeSampler<Depth> monthlySampler = new EquiTimeSampler<Depth>(Period.months(1)); 74 74 SequentialCache<Depth> monthlyData = monthlySampler.doProcess(dailyData); -
demo/src/main/java/com/numericalmethod/algoquant/model/elliott2005/demo/Demo110.java
r1541 r1548 77 77 // create source of market depth 78 78 DepthCaches depthCaches = new DepthCaches(); 79 depthCaches.addCache(laggedProduct, yahoo1. getCache(begin, end));80 depthCaches.addCache(leadProduct, yahoo2. getCache(begin, end));79 depthCaches.addCache(laggedProduct, yahoo1.newInstance(begin, end)); 80 depthCaches.addCache(leadProduct, yahoo2.newInstance(begin, end)); 81 81 82 82 // set the denomination currency -
demo/src/main/java/com/numericalmethod/algoquant/model/elliott2005/demo/DemoElliott2005_010.java
r1541 r1548 71 71 // create source of market depth 72 72 DepthCaches depthCaches = new DepthCaches(); 73 depthCaches.addCache(product1, DataSources.YAHOO.forProduct(product1, dataFolder). getCache(begin, end));74 depthCaches.addCache(product2, DataSources.YAHOO.forProduct(product2, dataFolder). getCache(begin, end));73 depthCaches.addCache(product1, DataSources.YAHOO.forProduct(product1, dataFolder).newInstance(begin, end)); 74 depthCaches.addCache(product2, DataSources.YAHOO.forProduct(product2, dataFolder).newInstance(begin, end)); 75 75 76 76 // set the denomination currency -
demo/src/main/java/com/numericalmethod/algoquant/model/factormodel/regression/crosssectional/demo/CrossSectionalRegressionDemoParams.java
r1545 r1548 145 145 List<CompanyHistory> histories = COMPANY_HISTORY_DB.getCompanyHistories(stockIds); 146 146 SequentialCache<Double> marketSeries = 147 new HSIReader(HSI_FILE_PATH). getCache(startTime, endTime);147 new HSIReader(HSI_FILE_PATH).newInstance(startTime, endTime); 148 148 SequentialCache<Double> rates = 149 149 new HKIBOR(HKMA_RATES_FILE_PATH) -
demo/src/main/java/com/numericalmethod/algoquant/model/factormodel/regression/crosssectional/demo/DemoCrossSectionalRegressionSensitivityAnalysis.java
r1543 r1548 103 103 return new StrategyFactory<Strategy, Vector>() { 104 104 @Override 105 public Strategy new Strategy(Vector factorOffset) {105 public Strategy newInstance(Vector factorOffset) { 106 106 FactorModelWeightSignal weightSignal = 107 107 new SensitivityAnalysisWeightSignal(DEFAULT_WEIGHT_SIGNAL, -
demo/src/main/java/com/numericalmethod/algoquant/model/infantino2010/demo/Demo010.java
r1507 r1548 142 142 for (Product product : products) { 143 143 cacheMap.addCache(product, 144 DataSources.YAHOO.forProduct(product, "./log"). getCache(begin, end));144 DataSources.YAHOO.forProduct(product, "./log").newInstance(begin, end)); 145 145 } 146 146 return cacheMap; -
demo/src/main/java/com/numericalmethod/algoquant/model/kst1995/demo/Demo020.java
r1541 r1548 65 65 66 66 List<Double> px = new ArrayList<Double>(); 67 SequentialCache<StockEOD> cache = yahoo. getCache(begin, end);67 SequentialCache<StockEOD> cache = yahoo.newInstance(begin, end); 68 68 for (TimedEntry<StockEOD> entry : cache) { 69 69 px.add(entry.getData().getAdjClose()); -
demo/src/main/java/com/numericalmethod/algoquant/model/signal/crossover/demo/DemoBatchParamSimulation.java
r1541 r1548 128 128 129 129 DepthCaches depthCaches = DepthCaches.newInstanceWithSingleCache( 130 product, DataSources.YAHOO.forProduct(product, "./log/Yahoo"). getCache(begin, end));130 product, DataSources.YAHOO.forProduct(product, "./log/Yahoo").newInstance(begin, end)); 131 131 132 132 return depthCaches; -
demo/src/main/java/com/numericalmethod/algoquant/model/signal/crossover/demo/DemoSMA2CrossoverDynamic_010.java
r1541 r1548 98 98 */ 99 99 DepthCaches depthCaches = DepthCaches.newInstanceWithSingleCache( 100 product, DataSources.YAHOO.forProduct(product, "./log/Yahoo"). getCache(begin, end));100 product, DataSources.YAHOO.forProduct(product, "./log/Yahoo").newInstance(begin, end)); 101 101 102 102 // run simulation -
demo/src/main/java/com/numericalmethod/algoquant/model/signal/crossover/demo/DemoSMA2_010.java
r1541 r1548 70 70 DateTime end = JodaTimeUtils.getDate(2009, 2, 2, tz); 71 71 SequentialCache<Depth> cache = 72 DataSources.YAHOO.forProduct(product, "./log/Yahoo"). getCache(begin, end);72 DataSources.YAHOO.forProduct(product, "./log/Yahoo").newInstance(begin, end); 73 73 74 74 // create the strategy -
demo/src/main/java/com/numericalmethod/algoquant/model/signal/crossover/demo/DemoSMA2_011.java
r1541 r1548 75 75 DateTime end = JodaTimeUtils.getDate(2012, 8, 31, tz); 76 76 SequentialCache<Depth> cache = 77 DataSources.YAHOO.forProduct(product, "./log/Yahoo"). getCache(begin, end);77 DataSources.YAHOO.forProduct(product, "./log/Yahoo").newInstance(begin, end); 78 78 79 79 // create the strategy -
demo/src/main/java/com/numericalmethod/algoquant/model/signal/demo/DemoPairsTrading.java
r1507 r1548 135 135 YahooEOD yahoo2 = new YahooEOD(stockProperty2); 136 136 DepthCaches depthCaches = new DepthCaches(); 137 depthCaches.addCache(product1, DepthCacheUtils.fromStockEODCache(product1, yahoo1. getCache(begin, end)));138 depthCaches.addCache(product2, DepthCacheUtils.fromStockEODCache(product2, yahoo2. getCache(begin, end)));137 depthCaches.addCache(product1, DepthCacheUtils.fromStockEODCache(product1, yahoo1.newInstance(begin, end))); 138 depthCaches.addCache(product2, DepthCacheUtils.fromStockEODCache(product2, yahoo2.newInstance(begin, end))); 139 139 140 140 // create strategy -
demo/src/main/java/com/numericalmethod/algoquant/model/signal/volume/demo/DemoADL.java
r1541 r1548 146 146 LOGGER.info(strategy.toString()); 147 147 148 SequentialCache<StockEOD> stockEODCache = yahoo. getCache(begin, end);148 SequentialCache<StockEOD> stockEODCache = yahoo.newInstance(begin, end); 149 149 150 150 // create source of market depth -
demo/src/main/java/com/numericalmethod/algoquant/model/signal/volume/demo/DemoCMF.java
r1541 r1548 144 144 LOGGER.info(strategy.toString()); 145 145 146 SequentialCache<StockEOD> stockEODCache = yahoo. getCache(begin, end);146 SequentialCache<StockEOD> stockEODCache = yahoo.newInstance(begin, end); 147 147 148 148 // create source of market depth -
demo/src/main/java/com/numericalmethod/algoquant/model/volarb/demo/DemoFixedGrid001.java
r1541 r1548 91 91 DepthCaches depthCaches = DepthCaches.newInstanceWithSingleCache( 92 92 fxProduct, 93 DataSources.GAIN_CAPITAL.forProduct(fxProduct, dataFolder). getCache(begin, end));93 DataSources.GAIN_CAPITAL.forProduct(fxProduct, dataFolder).newInstance(begin, end)); 94 94 95 95 // run simulation -
demo/src/main/java/com/numericalmethod/algoquant/model/volarb/demo/DemoFixedGridOnSGXData001.java
r1438 r1548 94 94 // create source of market depth 95 95 DepthCaches depthCaches = new DepthCaches(); 96 depthCaches.addCache(SiMSCI, SiMSCICache. getCache(begin, end));97 depthCaches.addCache(NIKKEI, NIKKEICache. getCache(begin, end));96 depthCaches.addCache(SiMSCI, SiMSCICache.newInstance(begin, end)); 97 depthCaches.addCache(NIKKEI, NIKKEICache.newInstance(begin, end)); 98 98 99 99 // run simulation -
demo/src/main/java/com/numericalmethod/algoquant/model/volarb/demo/DemoFixedGridPortfolio001.java
r1542 r1548 104 104 // create source of market depth 105 105 SequentialCache<? extends Depth> depthCache = 106 DataSources.GAIN_CAPITAL.forProduct(PRODUCT, dataFolder). getCache(BEGIN, END);106 DataSources.GAIN_CAPITAL.forProduct(PRODUCT, dataFolder).newInstance(BEGIN, END); 107 107 DepthCaches depthCaches = DepthCaches.newInstanceWithSingleCache(PRODUCT, depthCache); 108 108 -
demo/src/main/java/com/numericalmethod/algoquant/model/volarb/demo/DemoPeriodic001.java
r1438 r1548 97 97 DepthCaches depthCaches = DepthCaches.newInstanceWithSingleCache( 98 98 fxProduct, 99 DataSources.GAIN_CAPITAL.forProduct(fxProduct, dataFolder). getCache(begin, end));99 DataSources.GAIN_CAPITAL.forProduct(fxProduct, dataFolder).newInstance(begin, end)); 100 100 101 101 // run simulation -
demo/src/main/java/com/numericalmethod/algoquant/model/volarb/demo/DemoRanged001.java
r1541 r1548 91 91 // create source of market depth 92 92 DepthCaches depthCaches = DepthCaches.newInstanceWithSingleCache( 93 fxProduct, gc. getCache(begin, end));93 fxProduct, gc.newInstance(begin, end)); 94 94 95 95 // run simulation -
demo/src/main/java/com/numericalmethod/algoquant/model/volarb/demo/DemoRanged002.java
r1438 r1548 82 82 // construct price source mapping 83 83 DepthCaches depthCaches = new DepthCaches(); 84 depthCaches.addCache(fxProduct1, gc1. getCache(begin, end));85 depthCaches.addCache(fxProduct2, gc2. getCache(begin, end));84 depthCaches.addCache(fxProduct1, gc1.newInstance(begin, end)); 85 depthCaches.addCache(fxProduct2, gc2.newInstance(begin, end)); 86 86 87 87 // create a basket to trade
Note: See TracChangeset
for help on using the changeset viewer.
