You are viewing an archived page from the original site. Go to the new numericalmethod.com →

Changeset 1548 in algoquant


Ignore:
Timestamp:
1/31/2014 12:58:41 AM (10 months ago)
Author:
haksunli
Message:

CHG: standardize the naming convention: all Factory classes now use 'newInstance'

Files:
108 edited

Legend:

Unmodified
Added
Removed
  • core/src/main/java/com/numericalmethod/algoquant/data/cache/CacheFactory.java

    r1366 r1548  
    4949     * @return the cache 
    5050     */ 
    51     SequentialCache<T> getCache(DateTime begin, DateTime end); 
     51    SequentialCache<T> newInstance(DateTime begin, DateTime end); 
    5252} 
  • core/src/main/java/com/numericalmethod/algoquant/data/cache/processor/ProcessedCacheFactory.java

    r1366 r1548  
    4545 
    4646    @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)); 
    4949    } 
    5050} 
  • core/src/main/java/com/numericalmethod/algoquant/data/calendar/holiday/WebHolidayUpdater.java

    r1507 r1548  
    8484                                                    Stock yahooInstrument) { 
    8585        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()); 
    8787        return cache; 
    8888    } 
  • core/src/main/java/com/numericalmethod/algoquant/data/historicaldata/DepthCacheUtils.java

    r1495 r1548  
    122122        return new CacheFactory<Depth>() { 
    123123            @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); 
    126126            } 
    127127        }; 
  • core/src/main/java/com/numericalmethod/algoquant/data/historicaldata/bloomberg/BloombergTickData.java

    r1366 r1548  
    5454 
    5555    @Override 
    56     public SequentialCache<Depth> getCache(final DateTime begin, final DateTime end) { 
     56    public SequentialCache<Depth> newInstance(final DateTime begin, final DateTime end) { 
    5757        return new SequentialCache<Depth>() { 
    5858            @Override 
  • core/src/main/java/com/numericalmethod/algoquant/data/historicaldata/bloomberg/IntradayTickDataDownloader.java

    r1366 r1548  
    7575        DateTime end) 
    7676        throws IOException { 
    77         Session session = sessionFactory.newSession(); 
     77        Session session = sessionFactory.newInstance(); 
    7878 
    7979        if (!session.start()) { 
  • core/src/main/java/com/numericalmethod/algoquant/data/historicaldata/bloomberg/LocalhostSessionFactory.java

    r1366 r1548  
    3737 
    3838    @Override 
    39     public Session newSession() { 
     39    public Session newInstance() { 
    4040        SessionOptions sessionOptions = new SessionOptions(); 
    4141        sessionOptions.setServerHost(HOST_NAME); 
  • core/src/main/java/com/numericalmethod/algoquant/data/historicaldata/bloomberg/SessionFactory.java

    r1366 r1548  
    3232public interface SessionFactory { 
    3333 
    34     public Session newSession(); 
     34    public Session newInstance(); 
    3535} 
  • core/src/main/java/com/numericalmethod/algoquant/data/historicaldata/gaincapital/GainCapitalFx.java

    r1366 r1548  
    100100 
    101101    @Override 
    102     public SequentialCache<Depth> getCache(final DateTime begin, final DateTime end) { 
     102    public SequentialCache<Depth> newInstance(final DateTime begin, final DateTime end) { 
    103103        return new SequentialCache<Depth>() { 
    104104            @Override 
  • core/src/main/java/com/numericalmethod/algoquant/data/historicaldata/gaincapital/preprocess/GainCapitalFxRawCsvFile.java

    r1366 r1548  
    2323package com.numericalmethod.algoquant.data.historicaldata.gaincapital.preprocess; 
    2424 
    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; 
     25import static com.numericalmethod.nmutils.NMUtils.getClassLogger; 
     26import java.io.*; 
    3127import java.util.Arrays; 
    3228import org.slf4j.Logger; 
    … …  
    10096    static interface CellProcessorsFactory { 
    10197 
    102         CellProcessor[] newCellProcessor(); 
    103     } 
     98        CellProcessor[] newInstance(); 
     99    } 
     100 
    104101    static CellProcessorsFactory processors1 = new CellProcessorsFactory() { 
    105102        @Override 
    106         public CellProcessor[] newCellProcessor() { 
     103        public CellProcessor[] newInstance() { 
    107104            return new CellProcessor[]{ 
    108                     new Unique(new ParseLong()),//lTid 
    109                     null,//cDealable 
    110                     null,//CurrencyPair 
    111                     new StrMinMax(1, 60),//RateDateTime 
    112                     new ParseDouble(),//RateBid 
    113                     new ParseDouble()//RateAsk 
    114                 }; 
     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            }; 
    115112        } 
    116113    }; 
    117114    static CellProcessorsFactory processors2 = new CellProcessorsFactory() { 
    118115        @Override 
    119         public CellProcessor[] newCellProcessor() { 
     116        public CellProcessor[] newInstance() { 
    120117            return new CellProcessor[]{ 
    121                     new Unique(new ParseLong()),//lTid 
    122                     null,//CurrencyPair 
    123                     new StrMinMax(1, 60),//RateDateTime 
    124                     new ParseDouble(),//RateBid 
    125                     new ParseDouble(),//RateAsk 
    126                     null//cDealable 
    127                 }; 
     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            }; 
    128125        } 
    129126    }; 
    … …  
    160157 
    161158                MyBeanReader found = new MyBeanReader(new InputStreamReader(new FileInputStream(file), charsetName), 
    162                                                       headers, cellProcessors.newCellProcessor()); 
     159                                                      headers, cellProcessors.newInstance()); 
    163160                found.getHeader(true);//skip the header 
    164161 
    … …  
    189186 
    190187                trial.getHeader(false); 
    191                 Row row = trial.read(Row.class, headers, processors2.newCellProcessor()); 
     188                Row row = trial.read(Row.class, headers, processors2.newInstance()); 
    192189                long lTid = row.lTid;//check if we can read the first line 
    193190 
    194191                MyBeanReader found = new MyBeanReader(new InputStreamReader(new FileInputStream(file), charsetName), 
    195                                                       headers, processors2.newCellProcessor()); 
     192                                                      headers, processors2.newInstance()); 
    196193                return found; 
    197194            } catch (Exception ex) { 
    … …  
    201198    } 
    202199    /* 
    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. 
    204202     * We need to guess what format a particular file has before reading it. 
    205203     * Life is complicated...... 
    206204     */ 
     205 
    207206    private static Format[] formats = new Format[]{ 
    208207        new Processor2Header(), 
    … …  
    238237        } 
    239238    } 
     239 
    240240    private static final Logger logger = getClassLogger(); 
    241241    private final MyBeanReader reader; 
  • core/src/main/java/com/numericalmethod/algoquant/data/historicaldata/hkex/HSIReader.java

    r1507 r1548  
    108108 
    109109    @Override 
    110     public SequentialCache<Double> getCache(final DateTime begin, final DateTime end) { 
     110    public SequentialCache<Double> newInstance(final DateTime begin, final DateTime end) { 
    111111        return new SequentialCache<Double>() { 
    112112            @Override 
  • core/src/main/java/com/numericalmethod/algoquant/data/historicaldata/sgx/SGXTickData.java

    r1507 r1548  
    125125 
    126126    @Override 
    127     public SequentialCache<Depth> getCache(final DateTime begin, final DateTime end) { 
     127    public SequentialCache<Depth> newInstance(final DateTime begin, final DateTime end) { 
    128128        return new SequentialCache<Depth>() { 
    129129            @Override 
  • core/src/main/java/com/numericalmethod/algoquant/data/historicaldata/taq/TAQData.java

    r1366 r1548  
    6565 
    6666    @Override 
    67     public SequentialCache<TAQTick> getCache(final DateTime begin, final DateTime end) { 
     67    public SequentialCache<TAQTick> newInstance(final DateTime begin, final DateTime end) { 
    6868        return new SequentialCache<TAQTick>() { 
    6969            @Override 
  • core/src/main/java/com/numericalmethod/algoquant/data/historicaldata/yahoo/MultipleYahooEOD.java

    r1507 r1548  
    6262                dirOut); 
    6363 
    64             SequentialCache<StockEOD> seq = source.getCache(begin, end); 
     64            SequentialCache<StockEOD> seq = source.newInstance(begin, end); 
    6565 
    6666            SequentialCache<Double> doubleCache = transformer.doProcess(seq); 
  • core/src/main/java/com/numericalmethod/algoquant/data/historicaldata/yahoo/YahooEOD.java

    r1507 r1548  
    8080 
    8181    @Override 
    82     public SequentialCache<StockEOD> getCache(DateTime begin, DateTime end) { 
     82    public SequentialCache<StockEOD> newInstance(DateTime begin, DateTime end) { 
    8383        final DateTime cacheBegin = roundTime(begin, stock.getExchange()); 
    8484        final DateTime cacheEnd = roundTime(end, stock.getExchange()); 
    … …  
    206206                                   begin.toString(), end.toString())); 
    207207        YahooEODWebDownloader webReader = new YahooEODWebDownloader(stock); 
    208         SequentialCache<StockEOD> webCache = webReader.getCache(begin, end); 
     208        SequentialCache<StockEOD> webCache = webReader.newInstance(begin, end); 
    209209        for (TimedEntry<StockEOD> entry : webCache) { 
    210210            buffer.put(entry.getTime(), entry.getData()); 
  • core/src/main/java/com/numericalmethod/algoquant/data/historicaldata/yahoo/YahooEODCsvZipFileWriter.java

    r1507 r1548  
    102102     */ 
    103103    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)); 
    105105    } 
    106106 
  • core/src/main/java/com/numericalmethod/algoquant/data/historicaldata/yahoo/YahooEODWebDownloader.java

    r1507 r1548  
    6161 
    6262    @Override 
    63     public SequentialCache<StockEOD> getCache(final DateTime begin, final DateTime end) { 
     63    public SequentialCache<StockEOD> newInstance(final DateTime begin, final DateTime end) { 
    6464        // URL 
    6565        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  
    9595            histories = COMPANY_HISTORY_DB.getCompanyHistories(stockIds); 
    9696            SequentialCache<Double> marketSeries = 
    97                     new HSIReader(HSI_FILE_PATH).getCache(startTime, endTime); 
     97                    new HSIReader(HSI_FILE_PATH).newInstance(startTime, endTime); 
    9898            SequentialCache<Double> rates = 
    9999                    new HKIBOR(HKMA_RATES_FILE_PATH) 
  • core/src/main/java/com/numericalmethod/algoquant/execution/depth/SingleProductDepthCacheFactory.java

    r1526 r1548  
    3131 
    3232/** 
    33  *  
     33 * 
    3434 * @author Haksun Li 
    3535 */ 
    … …  
    3838    /** 
    3939     * 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 created 
    42      * @param times the times for which updates are computed 
     40     * 
     41     * @param product      the product for which a depth cache is created 
     42     * @param times        the times for which updates are computed 
    4343     * @param initialPrice the initial price of the product 
    44      * @param params the model parameters 
     44     * @param params       the model parameters 
    4545     * @return a fresh depth cache 
    4646     */ 
    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); 
    5251} 
  • core/src/main/java/com/numericalmethod/algoquant/execution/depth/returns/AR1GARCH11Returns.java

    r1541 r1548  
    8989 
    9090    @Override 
    91     public SequentialCache<? extends Depth> newDepths( 
     91    public SequentialCache<? extends Depth> newInstance( 
    9292        Product product, 
    9393        List<DateTime> times, 
  • core/src/main/java/com/numericalmethod/algoquant/execution/depth/returns/AR1Returns.java

    r1541 r1548  
    7676 
    7777    @Override 
    78     public SequentialCache<? extends Depth> newDepths( 
     78    public SequentialCache<? extends Depth> newInstance( 
    7979        Product product, 
    8080        List<DateTime> times, 
  • core/src/main/java/com/numericalmethod/algoquant/execution/depth/returns/ARCH1Returns.java

    r1541 r1548  
    8181 
    8282    @Override 
    83     public SequentialCache<? extends Depth> newDepths( 
     83    public SequentialCache<? extends Depth> newInstance( 
    8484            Product product, 
    8585            List<DateTime> times, 
  • core/src/main/java/com/numericalmethod/algoquant/execution/depth/returns/ARIMA0d0Returns.java

    r1541 r1548  
    7777 
    7878    @Override 
    79     public SequentialCache<? extends Depth> newDepths( 
     79    public SequentialCache<? extends Depth> newInstance( 
    8080            Product product, 
    8181            List<DateTime> times, 
  • core/src/main/java/com/numericalmethod/algoquant/execution/depth/returns/ARMA11Returns.java

    r1541 r1548  
    7575 
    7676    @Override 
    77     public SequentialCache<? extends Depth> newDepths( 
     77    public SequentialCache<? extends Depth> newInstance( 
    7878            Product product, 
    7979            List<DateTime> times, 
  • core/src/main/java/com/numericalmethod/algoquant/execution/depth/returns/RandomWalkReturns.java

    r1541 r1548  
    6969 
    7070    @Override 
    71     public SequentialCache<? extends Depth> newDepths( 
     71    public SequentialCache<? extends Depth> newInstance( 
    7272            Product product, 
    7373            List<DateTime> times, 
  • core/src/main/java/com/numericalmethod/algoquant/execution/product/fx/simulator/CrossRateCacheFactory.java

    r1366 r1548  
    7676 
    7777    @Override 
    78     public SequentialCache<Depth> getCache(DateTime begin, DateTime end) { 
     78    public SequentialCache<Depth> newInstance(DateTime begin, DateTime end) { 
    7979        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)); 
    8282 
    8383        VectorCache<Depth> vectorCache = new VectorCache<Depth>(cacheList); 
  • core/src/main/java/com/numericalmethod/algoquant/execution/product/fx/simulator/InvertedRateCacheFactory.java

    r1366 r1548  
    5757 
    5858    @Override 
    59     public SequentialCache<Depth> getCache(DateTime begin, DateTime end) { 
     59    public SequentialCache<Depth> newInstance(DateTime begin, DateTime end) { 
    6060 
    61         final SequentialCache<Depth> cache = cacheFactory.getCache(begin, end); 
     61        final SequentialCache<Depth> cache = cacheFactory.newInstance(begin, end); 
    6262 
    6363        return new SequentialCache<Depth>() { 
  • core/src/main/java/com/numericalmethod/algoquant/execution/product/stock/usa/nasdaq/NASDAQ100.java

    r1513 r1548  
    109109            Product product = it.next(); 
    110110            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); 
    112112            map.put(product, cache); 
    113113        } 
  • core/src/main/java/com/numericalmethod/algoquant/execution/simulation/DepthCachesLoader.java

    r1430 r1548  
    5353        for (Product product : products) { 
    5454            cacheMap.addCache(product, 
    55                               dataSource.forProduct(product, dataFolder).getCache(begin, end)); 
     55                              dataSource.forProduct(product, dataFolder).newInstance(begin, end)); 
    5656        } 
    5757        return cacheMap; 
  • core/src/main/java/com/numericalmethod/algoquant/execution/simulation/batch/BatchParameterizedSimulation.java

    r1537 r1548  
    3131import com.numericalmethod.algoquant.execution.strategy.Strategy; 
    3232import 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; 
     33import static com.numericalmethod.nmutils.collection.CollectionUtils.newHashMap; 
     34import java.util.*; 
    3735import java.util.Map.Entry; 
    3836 
    … …  
    7068     * @throws SimulationException when any error occurs during simulation runs 
    7169     */ 
    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) 
    7673        throws SimulationException { 
    7774        Collection<P> paramsCopy = new ArrayList<P>(params); 
    … …  
    8683                depthCaches, 
    8784                rates, 
    88                 factory.newStrategy(param)); 
     85                factory.newInstance(param)); 
    8986            tasks.add(task); 
    9087            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  
    3737import com.numericalmethod.algoquant.execution.simulator.Simulator; 
    3838import 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; 
     39import static com.numericalmethod.nmutils.collection.CollectionUtils.newHashMap; 
     40import com.numericalmethod.suanshu.misc.parallel.*; 
    4241import 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; 
     42import java.util.*; 
    4943import java.util.Map.Entry; 
    5044import org.joda.time.DateTime; 
    … …  
    5246/** 
    5347 * Runs a Monte Carlo simulation for a strategy using simulated order books. 
    54  *  
     48 * 
    5549 * For most common use cases, you should consider {@link MCSimulationTaskRunner} 
    56  *  
     50 * 
    5751 * @param <D> the type of the parameters used to generate depth caches 
    5852 * @author Johannes Lehmann 
    … …  
    6357    /** 
    6458     * The strategy factory that creates new strategy instances to be used by the simulation. 
    65      *  
     59     * 
    6660     * Note that since multiple simulations will be run in parallel, it is important that each 
    6761     * strategies generated are independent of each other. 
    … …  
    7165        /** 
    7266         * Creates a new strategy instance. 
    73          *  
     67         * 
    7468         * @return a new instance of the strategy 
    7569         */ 
    76         Strategy newStrategy(); 
     70        Strategy newInstance(); 
    7771    } 
    7872 
    … …  
    8478        /** 
    8579         * Creates a new simulator instance with the given order books of products. 
    86          *  
     80         * 
    8781         * @param depthCaches the depth caches for all products 
    88          * @param rates the exchange rate table 
     82         * @param rates       the exchange rate table 
    8983         * @return a new simulator instance 
    9084         */ 
    91         Simulator newSimulator(DepthCaches depthCaches, ExchangeRateTable rates); 
     85        Simulator newInstance(DepthCaches depthCaches, ExchangeRateTable rates); 
    9286    } 
    9387 
    … …  
    10498    /** 
    10599     * Constructs a Monte Carlo simulator from a {@link SimTemplate}. 
    106      *  
    107      * @param template the template for the simulation we want to create 
     100     * 
     101     * @param template          the template for the simulation we want to create 
    108102     * @param depthCacheFactory the factory to generate simulated depths 
    109      * @param times the times for which to generate depths 
    110      * @param initialPrices the initial price of each product 
    111      * @param simulatorFactory the factory to generate simulators 
     103     * @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 
    112106     */ 
    113107    public MCSimulation(final SimTemplate template, 
    … …  
    117111                        SimulatorFactory simulatorFactory) { 
    118112        this(new StrategyFactory() { 
    119  
    120113            @Override 
    121             public Strategy newStrategy() { 
     114            public Strategy newInstance() { 
    122115                return template.getStrategy(); 
    123116            } 
    … …  
    129122     * Constructs a Monte Carlo simulator. Note that it is necessary that all of the input factory 
    130123     * objects are thread-safe. 
    131      *  
    132      * @param strategyFactory the factory to generate the strategy 
    133      * @param depthCacheFactory the factory to generate simulated depths 
    134      * @param products the products that are to be included in the simulation 
    135      * @param times the times for which to generate depths 
    136      * @param initialPrices the initial price of each product 
    137      * @param rates the exchange rate table 
    138      * @param simulatorFactory the factory to generate simulators 
     124     * 
     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 
    139132     * @param performanceAnalyzer the performance analyzer to generate performance reports 
    140133     */ 
    … …  
    159152    /** 
    160153     * Runs an MC simulation for the given parameter. 
    161      *  
     154     * 
    162155     * @param param the parameter 
    163156     * @param nSims the number of simulations to run 
    … …  
    168161        throws SimulationException { 
    169162        final Collection<SimulationTask> tasks = 
    170                 Collections.synchronizedList(new ArrayList<SimulationTask>(nSims)); 
     163            Collections.synchronizedList(new ArrayList<SimulationTask>(nSims)); 
    171164 
    172165        try { 
    … …  
    175168                public void run(int i) throws Exception { 
    176169                    DepthCaches depthCaches = 
    177                             depthCacheFactory.newDepths(products, times, initialPrices, param); 
    178                     Simulator simulator = simulatorFactory.newSimulator(depthCaches, rates); 
    179                     Strategy strategy = strategyFactory.newStrategy(); 
     170                        depthCacheFactory.newDepths(products, times, initialPrices, param); 
     171                    Simulator simulator = simulatorFactory.newInstance(depthCaches, rates); 
     172                    Strategy strategy = strategyFactory.newInstance(); 
    180173                    tasks.add(new SimulationTask(Long.toString(i), 
    181174                                                 simulator, 
    … …  
    197190    /** 
    198191     * Runs an MC simulation with a null parameter. 
    199      *  
     192     * 
    200193     * @param nSims the number of simulations to run 
    201194     * @return an empirical distribution of each performance measure 
    … …  
    209202    /** 
    210203     * Runs an MC simulation for each parameter in the given collection. 
    211      *  
     204     * 
    212205     * @param params the parameters to run the simulation on 
    213      * @param nSims the number of simulations per parameter 
     206     * @param nSims  the number of simulations per parameter 
    214207     * @return for each performance measure an empirical distribution for each parameter 
    215208     * @throws SimulationException thrown if a simulation throws an exception 
  • core/src/main/java/com/numericalmethod/algoquant/execution/simulation/batch/montecarlo/MCSimulationTaskRunner.java

    r1539 r1548  
    144144        MCSimulation<T> mcSimulation = 
    145145                new MCSimulation<T>(simTemplate, 
    146                                     task.depthCacheFactory(rng), 
     146                                    task.getDepthCacheFactory(rng), 
    147147                                    times, 
    148148                                    initialPrices, 
    149149                                    simulatorFactory); 
    150150        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); 
    153153        return chart; 
    154154    } 
  • core/src/main/java/com/numericalmethod/algoquant/execution/simulation/batch/montecarlo/MarketSnapshotSimulatorFactory.java

    r1532 r1548  
    7272 
    7373    @Override 
    74     public final Simulator newSimulator(DepthCaches fakePrices, ExchangeRateTable rates) { 
     74    public final Simulator newInstance(DepthCaches fakePrices, ExchangeRateTable rates) { 
    7575 
    7676        RandomAccessCache<MarketSnapshot> marketSnapshotsWithFakePrices = 
  • core/src/main/java/com/numericalmethod/algoquant/execution/simulation/batch/montecarlo/depths/SingleDepthCacheFactoryAdaptor.java

    r1539 r1548  
    5858        for (Product product : products) { 
    5959            depthCaches.addCache(product, singleProductDepthCacheFactory 
    60                 .newDepths(product, times, initialPrices.get(product), params)); 
     60                .newInstance(product, times, initialPrices.get(product), params)); 
    6161        } 
    6262        return depthCaches; 
  • core/src/main/java/com/numericalmethod/algoquant/execution/simulation/batch/montecarlo/tasks/AR1GARCH11Task.java

    r1539 r1548  
    6363 
    6464    @Override 
    65     public DepthCacheFactory<Vector> depthCacheFactory(RandomStandardNormalNumberGenerator rng) { 
     65    public DepthCacheFactory<Vector> getDepthCacheFactory(RandomStandardNormalNumberGenerator rng) { 
    6666        return new SingleDepthCacheFactoryAdaptor(new AR1GARCH11Returns(rng)); 
    6767    } 
    6868 
    6969    @Override 
    70     public List<Vector> params() { 
     70    public List<Vector> getParams() { 
    7171        List<Vector> params = new ArrayList<Vector>(); 
    7272        for (double phi : phiValues) { 
    … …  
    7777 
    7878    @Override 
    79     public MCPlotter<Vector> mcPlotter() { 
     79    public MCPlotter<Vector> getPlotter() { 
    8080        return new MCVectorMeanPlotter(title(), "phi", 1); 
    8181    } 
  • core/src/main/java/com/numericalmethod/algoquant/execution/simulation/batch/montecarlo/tasks/AR1Task.java

    r1539 r1548  
    5656 
    5757    @Override 
    58     public DepthCacheFactory<Vector> depthCacheFactory(RandomStandardNormalNumberGenerator rng) { 
     58    public DepthCacheFactory<Vector> getDepthCacheFactory(RandomStandardNormalNumberGenerator rng) { 
    5959        return new SingleDepthCacheFactoryAdaptor(new AR1Returns(rng)); 
    6060    } 
    6161 
    6262    @Override 
    63     public List<Vector> params() { 
     63    public List<Vector> getParams() { 
    6464        List<Vector> params = new ArrayList<Vector>(phi.size()); 
    6565        for (int i = 0; i < phi.size(); i++) { 
    … …  
    7070 
    7171    @Override 
    72     public MCPlotter<Vector> mcPlotter() { 
     72    public MCPlotter<Vector> getPlotter() { 
    7373        return new MCVectorMeanPlotter("AR(1)", "phi", 1); 
    7474    } 
  • core/src/main/java/com/numericalmethod/algoquant/execution/simulation/batch/montecarlo/tasks/ARCH1Task.java

    r1539 r1548  
    5656 
    5757    @Override 
    58     public DepthCacheFactory<Vector> depthCacheFactory(RandomStandardNormalNumberGenerator rng) { 
     58    public DepthCacheFactory<Vector> getDepthCacheFactory(RandomStandardNormalNumberGenerator rng) { 
    5959        return new SingleDepthCacheFactoryAdaptor(new ARCH1Returns(rng)); 
    6060    } 
    6161 
    6262    @Override 
    63     public List<Vector> params() { 
     63    public List<Vector> getParams() { 
    6464        List<Vector> params = new ArrayList<Vector>(); 
    6565        for (double a1 : a1Values) { 
    … …  
    7070 
    7171    @Override 
    72     public MCPlotter<Vector> mcPlotter() { 
     72    public MCPlotter<Vector> getPlotter() { 
    7373        return new MCVectorMeanPlotter(title(), "a1", 2); 
    7474    } 
  • core/src/main/java/com/numericalmethod/algoquant/execution/simulation/batch/montecarlo/tasks/ARMA11Task.java

    r1539 r1548  
    6262 
    6363    @Override 
    64     public DepthCacheFactory<Vector> depthCacheFactory(RandomStandardNormalNumberGenerator rng) { 
     64    public DepthCacheFactory<Vector> getDepthCacheFactory(RandomStandardNormalNumberGenerator rng) { 
    6565        return new SingleDepthCacheFactoryAdaptor(new ARMA11Returns(rng)); 
    6666    } 
    6767 
    6868    @Override 
    69     public List<Vector> params() { 
     69    public List<Vector> getParams() { 
    7070        List<Vector> params = new ArrayList<Vector>(); 
    7171        for (double mu : muValues) { 
    … …  
    7676 
    7777    @Override 
    78     public MCPlotter<Vector> mcPlotter() { 
     78    public MCPlotter<Vector> getPlotter() { 
    7979        return new MCVectorMeanPlotter(title(), "mu", 1); 
    8080    } 
  • core/src/main/java/com/numericalmethod/algoquant/execution/simulation/batch/montecarlo/tasks/MCSimulationTask.java

    r1539 r1548  
    3131/** 
    3232 * Represents a task that is executed by {@link MCSimulationTaskRunner}. 
    33  *  
     33 * 
    3434 * @author Johannes Lehmann 
    3535 * @param <T> the type of the parameter that is accepted by the {@link DepthCacheFactory}. 
    … …  
    4242     * @return the factory that creates the simulated depths for a given parameter 
    4343     */ 
    44     DepthCacheFactory<T> depthCacheFactory(RandomStandardNormalNumberGenerator rng); 
     44    DepthCacheFactory<T> getDepthCacheFactory(RandomStandardNormalNumberGenerator rng); 
    4545 
    4646    /** 
    4747     * @return the parameters for which to run a Monte Carlo simulation 
    4848     */ 
    49     List<T> params(); 
     49    List<T> getParams(); 
    5050 
    5151    /** 
    5252     * @return the plotter that will be used to plot the result 
    5353     */ 
    54     MCPlotter<T> mcPlotter(); 
    55  
     54    MCPlotter<T> getPlotter(); 
    5655} 
  • core/src/main/java/com/numericalmethod/algoquant/execution/simulation/batch/montecarlo/tasks/RandomWalkTask.java

    r1539 r1548  
    5656 
    5757    @Override 
    58     public DepthCacheFactory<Vector> depthCacheFactory(RandomStandardNormalNumberGenerator rng) { 
     58    public DepthCacheFactory<Vector> getDepthCacheFactory(RandomStandardNormalNumberGenerator rng) { 
    5959        return new SingleDepthCacheFactoryAdaptor(new RandomWalkReturns(rng)); 
    6060    } 
    6161 
    6262    @Override 
    63     public List<Vector> params() { 
     63    public List<Vector> getParams() { 
    6464        List<Vector> params = new ArrayList<Vector>(mu.size()); 
    6565        for (int i = 0; i < mu.size(); i++) { 
    … …  
    7070 
    7171    @Override 
    72     public MCPlotter<Vector> mcPlotter() { 
     72    public MCPlotter<Vector> getPlotter() { 
    7373        return new MCVectorMeanPlotter("Random Walk", "mu", 1); 
    7474    } 
  • core/src/main/java/com/numericalmethod/algoquant/execution/simulation/template/SimTemplateYahooEOD.java

    r1535 r1548  
    5858        for (Product product : getProducts()) { 
    5959            depthCaches.addCache(product, 
    60                                  DataSources.YAHOO.forProduct(product, dataFolder).getCache(begin, end)); 
     60                                 DataSources.YAHOO.forProduct(product, dataFolder).newInstance(begin, end)); 
    6161        } 
    6262    } 
  • core/src/main/java/com/numericalmethod/algoquant/execution/simulator/SimMarketFactory.java

    r1366 r1548  
    3939     * @return a {@code SimMarket} instance for the given product 
    4040     */ 
    41     public SimMarket newSimMarket(Product product); 
     41    public SimMarket newInstance(Product product); 
    4242} 
  • core/src/main/java/com/numericalmethod/algoquant/execution/simulator/SimpleSimulator.java

    r1532 r1548  
    128128        private SimMarketFactory simMarketFactory = new SimMarketFactory() { // default SimMarket 
    129129            @Override 
    130             public SimMarket newSimMarket(Product product) { 
     130            public SimMarket newInstance(Product product) { 
    131131                return new SimpleSimMarket(product); 
    132132            } 
    … …  
    198198            this.simMarketFactory = new SimMarketFactory() { 
    199199                @Override 
    200                 public SimMarket newSimMarket(Product product) { 
     200                public SimMarket newInstance(Product product) { 
    201201                    return new SimpleSimMarket(product, model); 
    202202                } 
    … …  
    279279        for (Product product : products) { 
    280280            components.add(new MarketComponent( 
    281                 simMarketFactory.newSimMarket(product), 
     281                simMarketFactory.newInstance(product), 
    282282                channelSimPrice.newChannelInput(), 
    283283                channelBroker.newChannelInput(), 
  • core/src/main/java/com/numericalmethod/algoquant/execution/simulator/StrategyComponent.java

    r1366 r1548  
    7878                buildHandlerMap(EnumSet.allOf(ChannelMessageHandlerFactories.class), strategy); 
    7979            for (ChannelMessageHandlerFactory factory : customMessageHandlerFactories) { 
    80                 strategyMessageHandlers.put(factory.getSubscriberClass(), factory.newHandler(strategy)); 
     80                strategyMessageHandlers.put(factory.getSubscriberClass(), factory.newInstance(strategy)); 
    8181            } 
    8282            this.strategyMessageDispatcher = new SimpleMessageDispatcher(strategyMessageHandlers); 
    … …  
    105105 
    106106            for (ChannelMessageHandlerFactories entry : handlersEnum) { 
    107                 handlerMap.put(entry.getSubscriberClass(), entry.newHandler(handler)); 
     107                handlerMap.put(entry.getSubscriberClass(), entry.newInstance(handler)); 
    108108            } 
    109109 
  • core/src/main/java/com/numericalmethod/algoquant/execution/simulator/handler/ChannelMessageHandlerFactories.java

    r1518 r1548  
    4343    DEPTH(Depth.class) { 
    4444        @Override 
    45         public ChannelMessageHandler newHandler(UpdateHandler handler) { 
     45        public ChannelMessageHandler newInstance(UpdateHandler handler) { 
    4646 
    4747            if (handler instanceof DepthHandler) { 
    … …  
    5757    EXECUTION(Execution.class) { 
    5858        @Override 
    59         public ChannelMessageHandler newHandler(UpdateHandler handler) { 
     59        public ChannelMessageHandler newInstance(UpdateHandler handler) { 
    6060 
    6161            if (handler instanceof ExecutionHandler) { 
    … …  
    7171    STOCK_EOD(StockEOD.class) { 
    7272        @Override 
    73         public ChannelMessageHandler newHandler(UpdateHandler handler) { 
     73        public ChannelMessageHandler newInstance(UpdateHandler handler) { 
    7474 
    7575            if (handler instanceof StockEODHandler) { 
    … …  
    8585    TIMER(TimerEvent.class) { 
    8686        @Override 
    87         public ChannelMessageHandler newHandler(UpdateHandler handler) { 
     87        public ChannelMessageHandler newInstance(UpdateHandler handler) { 
    8888 
    8989            if (handler instanceof TimerHandler) { 
    … …  
    9696    MARKET_SNAPSHOT(MarketSnapshot.class) { 
    9797        @Override 
    98         public ChannelMessageHandler newHandler(UpdateHandler handler) { 
     98        public ChannelMessageHandler newInstance(UpdateHandler handler) { 
    9999 
    100100            if (handler instanceof MarketSnapshotHandler) { 
    … …  
    117117 
    118118    @Override 
    119     public abstract ChannelMessageHandler newHandler(UpdateHandler handler); 
     119    public abstract ChannelMessageHandler newInstance(UpdateHandler handler); 
    120120} 
  • core/src/main/java/com/numericalmethod/algoquant/execution/simulator/handler/ChannelMessageHandlerFactory.java

    r1366 r1548  
    4646     * @return the new instance 
    4747     */ 
    48     ChannelMessageHandler newHandler(UpdateHandler handler); 
     48    ChannelMessageHandler newInstance(UpdateHandler handler); 
    4949} 
  • core/src/main/java/com/numericalmethod/algoquant/execution/strategy/StrategyFactory.java

    r1366 r1548  
    3939     * @return the new strategy instance 
    4040     */ 
    41     S newStrategy(P param); 
     41    S newInstance(P param); 
    4242} 
  • core/src/main/java/com/numericalmethod/algoquant/execution/strategy/optimizer/StrategyOptimizer.java

    r1401 r1548  
    129129 
    130130                try { 
    131                     Strategy strategy = strategyFactory.newStrategy(x.toArray()); 
     131                    Strategy strategy = strategyFactory.newInstance(x.toArray()); 
    132132                    if (strategy == null) { 
    133133                        LOGGER.debug("null stategy @ " + x); 
  • core/src/main/java/com/numericalmethod/algoquant/framework/template/factormodel/CrossSectionalRegressionStrategyTemplate.java

    r1547 r1548  
    137137        return new StrategyFactory<Strategy, Double>() { 
    138138            @Override 
    139             public Strategy newStrategy(Double factorOffset) { 
     139            public Strategy newInstance(Double factorOffset) { 
    140140                FactorModelWeightSignal weightSignal = 
    141141                        new SensitivityAnalysisWeightSignal(CrossSectionalRegressionSimTemplate 
  • core/src/main/java/com/numericalmethod/algoquant/model/analysis/cointegration/CointegratedPairsSearch.java

    r1366 r1548  
    265265        SequentialCache<VectorCache.Vector<Double>> noNullDataCache = 
    266266                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))); 
    269269 
    270270        return noNullDataCache; 
  • core/src/main/java/com/numericalmethod/algoquant/model/factormodel/regression/crosssectional/FixedEffectsCrossSectionalRegression.java

    r1541 r1548  
    4949              new Factory() { 
    5050            @Override 
    51             public com.numericalmethod.suanshu.stats.regression.linear.panel.PanelRegression getPanelRegression( 
     51            public com.numericalmethod.suanshu.stats.regression.linear.panel.PanelRegression newInstance( 
    5252                ReturnPanelData returns) { 
    5353 
  • core/src/main/java/com/numericalmethod/algoquant/model/factormodel/regression/crosssectional/PanelCrossSectionalRegression.java

    r1541 r1548  
    3333import com.numericalmethod.algoquant.model.util.returns.ReturnCalculator; 
    3434import com.numericalmethod.suanshu.stats.regression.linear.LinearModel; 
     35import com.numericalmethod.suanshu.stats.regression.linear.panel.PanelRegression; 
    3536import java.util.Arrays; 
    3637import java.util.Iterator; 
    … …  
    4647    public static interface Factory { 
    4748 
    48         public com.numericalmethod.suanshu.stats.regression.linear.panel.PanelRegression getPanelRegression( 
     49        public PanelRegression newInstance( 
    4950            ReturnPanelData returns); 
    5051    } 
    … …  
    100101        // run the regression to compute the premiums 
    101102        com.numericalmethod.suanshu.stats.regression.linear.panel.PanelRegression regression = 
    102             factory.getPanelRegression(panel); 
     103            factory.newInstance(panel); 
    103104        LinearModel lm = regression.getLinearModel(panel.getRows().get(0).subject()); // any stock will have the same beta 
    104105        Premiums premiums = 
  • core/src/main/java/com/numericalmethod/algoquant/model/infantino2010/strategy/Infantino2010StrategyFactory.java

    r1366 r1548  
    102102 
    103103    @Override 
    104     public Infantino2010Strategy newStrategy(Param param) { 
     104    public Infantino2010Strategy newInstance(Param param) { 
    105105        return new Infantino2010Strategy( 
    106106            param.getInfoSet(), 
  • core/src/main/java/com/numericalmethod/algoquant/model/portfoliooptimization/performance/PerformanceOptimizedPortfolio.java

    r1542 r1548  
    9090 
    9191            @Override 
    92             public Strategy newStrategy(double[] params) { 
     92            public Strategy newInstance(double[] params) { 
    9393                Map<Product, Double> weights = newHashMap(); 
    9494 
    … …  
    159159 
    160160    public Strategy getStrategy(double[] params) { 
    161         return strategyFactory.newStrategy(params); 
     161        return strategyFactory.newInstance(params); 
    162162    } 
    163163} 
  • core/src/main/java/com/numericalmethod/algoquant/model/portfoliooptimization/performance/PerformanceOptimizedYahooEODPortfolio.java

    r1507 r1548  
    8686                            product, 
    8787                            DepthCacheUtils.fromStockEODCache(product, 
    88                                                               cacheFactories.get(product).getCache(begin, end))); 
     88                                                              cacheFactories.get(product).newInstance(begin, end))); 
    8989                    } 
    9090 
  • core/src/main/java/com/numericalmethod/algoquant/model/signal/technical/crossover/strategy/SMA2CrossoverDynamic.java

    r1541 r1548  
    8888 
    8989            @Override 
    90             public Strategy newStrategy(double[] params) { 
     90            public Strategy newInstance(double[] params) { 
    9191                int fastLag = Math.round((float) params[0]); 
    9292                int slowLag = Math.round((float) params[1]); 
    … …  
    186186            performanceMeasureFactory); 
    187187 
    188         DepthCaches depthCaches = DepthCaches.newInstanceWithSingleCache(productParams.product, cacheFactory.getCache(begin, end)); 
     188        DepthCaches depthCaches = DepthCaches.newInstanceWithSingleCache(productParams.product, cacheFactory.newInstance(begin, end)); 
    189189        StrategyOptimizer.Minimizer.Result optimalParams = optimizer.findOptimalParams( 
    190190            depthCaches, 
    … …  
    197197        } 
    198198        SMA2Crossover sma = getSMA2CrossoverInstance(optimalParams.optimizer.toArray()); 
    199         sma.initialize(cacheFactory.getCache(begin, end));// calibrate using only the last "period" data 
     199        sma.initialize(cacheFactory.newInstance(begin, end));// calibrate using only the last "period" data 
    200200 
    201201        return sma; 
  • core/src/main/java/com/numericalmethod/algoquant/model/signal/technical/crossover/strategy/SMA2CrossoverFactory.java

    r1541 r1548  
    3232 
    3333    @Override 
    34     public SMA2Crossover newStrategy(SMA2CrossoverParam param) { 
     34    public SMA2Crossover newInstance(SMA2CrossoverParam param) { 
    3535        return new SMA2Crossover( 
    3636            param.getProductParams(), 
  • core/src/main/java/com/numericalmethod/algoquant/model/volarb/MeanReversionStrategyFactory.java

    r1431 r1548  
    3232 
    3333    @Override 
    34     public MeanReversionStrategy newStrategy(MeanReversionStrategyParam param) { 
     34    public MeanReversionStrategy newInstance(MeanReversionStrategyParam param) { 
    3535        return new MeanReversionStrategy( 
    3636            param.getBasket(), 
  • core/src/test/java/com/numericalmethod/algoquant/data/cache/TestDepthCacheFactory.java

    r1366 r1548  
    4242 
    4343    @Override 
    44     public SequentialCache<Depth> getCache(DateTime begin, DateTime end) { // Note: this method will always return all the input depths without checking begin/end time 
     44    public SequentialCache<Depth> newInstance(DateTime begin, DateTime end) { // Note: this method will always return all the input depths without checking begin/end time 
    4545        return new SequentialCache<Depth>() { 
    4646            @Override 
  • core/src/test/java/com/numericalmethod/algoquant/data/cache/conversion/Cache2MatrixTest.java

    r1507 r1548  
    5555 
    5656        @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))); 
    5858 
    5959//        System.out.println(instance); 
    … …  
    8989        @SuppressWarnings("unchecked") 
    9090        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))); 
    9393 
    9494//        System.out.println(instance); 
  • core/src/test/java/com/numericalmethod/algoquant/data/cache/conversion/Cache2ReturnsMatrixTest.java

    r1507 r1548  
    6060        @SuppressWarnings("unchecked") 
    6161        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))); 
    6363 
    6464//        System.out.println(instance); 
    … …  
    9191        @SuppressWarnings("unchecked") 
    9292        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))); 
    9494 
    9595        SampleCovariance instance = new SampleCovariance(returns); 
  • core/src/test/java/com/numericalmethod/algoquant/data/cache/processor/filter/WeekdayFilterTest.java

    r1366 r1548  
    5050        Product fxProduct = FxProductFactory.getInstance("NZD", "CHF", 0.0001); 
    5151        GainCapitalFx source = new GainCapitalFx(fxProduct, "./test-data/gaincapital"); 
    52         SequentialCache<Depth> cache = source.getCache(begin, end); 
     52        SequentialCache<Depth> cache = source.newInstance(begin, end); 
    5353 
    5454        DailyDataSampler<Depth> dailySampler = new DailyDataSampler<Depth>(hour); 
  • core/src/test/java/com/numericalmethod/algoquant/data/cache/processor/sampler/DailyDataSamplerTest.java

    r1366 r1548  
    5252            hour); 
    5353 
    54         Iterator<TimedEntry<Depth>> it = sampler.doProcess(source.getCache(begin, end)).iterator(); 
     54        Iterator<TimedEntry<Depth>> it = sampler.doProcess(source.newInstance(begin, end)).iterator(); 
    5555        TimedEntry<Depth> entry = it.next(); 
    5656        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  
    4949 
    5050        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( 
    5252            JodaTimeUtils.getDate(2000, 5, 30, GainCapitalFx.TIME_ZONE), 
    5353            JodaTimeUtils.getDate(2000, 6, 2, GainCapitalFx.TIME_ZONE)); 
    … …  
    8181        Product fxProduct = FxProductFactory.getInstance("EUR", "USD", 0.0001); 
    8282        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( 
    8484            JodaTimeUtils.getDate(2000, 5, 30, GainCapitalFx.TIME_ZONE), 
    8585            JodaTimeUtils.getDate(2010, 10, 1, GainCapitalFx.TIME_ZONE)); 
  • core/src/test/java/com/numericalmethod/algoquant/data/export/xml/BatchSimulationXmlWriterUtilsTest.java

    r1537 r1548  
    7373        for (Product product : products) { 
    7474            caches.addCache(product, 
    75                             DataSources.YAHOO.forProduct(product, "./log").getCache(begin, end)); 
     75                            DataSources.YAHOO.forProduct(product, "./log").newInstance(begin, end)); 
    7676        } 
    7777 
  • core/src/test/java/com/numericalmethod/algoquant/data/historicaldata/bloomberg/BloombergTickDataTest.java

    r1366 r1548  
    9090 
    9191        BloombergTickData data = new BloombergTickData(product1, outDir); 
    92         SequentialCache<Depth> loadedCache = data.getCache(begin, end); 
     92        SequentialCache<Depth> loadedCache = data.newInstance(begin, end); 
    9393 
    9494        time = begin; 
  • core/src/test/java/com/numericalmethod/algoquant/data/historicaldata/compustat/MockMarketData.java

    r1517 r1548  
    4343            List<CompanyHistory> companyHistories = new CommonHistoriesFilter(MEASURES, START_TIME, END_TIME).filter(COMPANY_HISTORY_DB.getAllCompanyHistories()); 
    4444            // 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); 
    4646            SequentialCache<Double> rates = new HKIBOR("./test-data/HKMA/T060301.xls").getRatesForMaturity(HKIBOR.Maturity.TWELVE_MONTH); 
    4747 
  • core/src/test/java/com/numericalmethod/algoquant/data/historicaldata/gaincapital/GainCapitalFxTest.java

    r1366 r1548  
    4242    public void test_0010() { 
    4343        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( 
    4545            JodaTimeUtils.getDate(2010, 8, 1, GainCapitalFx.TIME_ZONE), 
    4646            new DateTime(2010, 8, 2, 23, 59, 59, 999, GainCapitalFx.TIME_ZONE)); 
    … …  
    5858    public void test_0020() { 
    5959        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( 
    6161            JodaTimeUtils.getDate(2010, 8, 1, GainCapitalFx.TIME_ZONE), 
    6262            new DateTime(2010, 8, 3, 12, 0, 0, 0, GainCapitalFx.TIME_ZONE)); 
    … …  
    7777    public void test_0030() { 
    7878        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( 
    8080            JodaTimeUtils.getDate(2008, 5, 31, GainCapitalFx.TIME_ZONE), 
    8181            JodaTimeUtils.getDate(2008, 6, 14, GainCapitalFx.TIME_ZONE)); 
    … …  
    9696    public void test_0040() { 
    9797        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( 
    9999            JodaTimeUtils.getDate(2008, 5, 31, GainCapitalFx.TIME_ZONE), 
    100100            new DateTime(2010, 8, 3, 12, 0, 0, 0, GainCapitalFx.TIME_ZONE)); 
    … …  
    112112    public void test_getCache_0010() { 
    113113        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( 
    115115            JodaTimeUtils.getDate(2010, 8, 1, GainCapitalFx.TIME_ZONE), 
    116116            new DateTime(2010, 8, 2, 23, 59, 59, 999, GainCapitalFx.TIME_ZONE)); 
    117117 
    118         SequentialCache<Depth> instance2 = new GainCapitalFx(fxProduct, "./test-data/gaincapital").getCache( 
     118        SequentialCache<Depth> instance2 = new GainCapitalFx(fxProduct, "./test-data/gaincapital").newInstance( 
    119119            JodaTimeUtils.getDate(2010, 8, 1, GainCapitalFx.TIME_ZONE), 
    120120            new DateTime(2010, 8, 2, 0, 0, 0, 0, GainCapitalFx.TIME_ZONE)); 
    … …  
    137137        DateTime begin = new DateTime(2010, 8, 1, 18, 0, GainCapitalFx.TIME_ZONE); 
    138138        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( 
    140140            begin, end); 
    141141 
    … …  
    154154        DateTime begin = new DateTime(2010, 8, 1, 23, 59, 55, GainCapitalFx.TIME_ZONE); 
    155155        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( 
    157157            begin, end); 
    158158 
    … …  
    171171        DateTime begin = new DateTime(2010, 8, 1, 23, 59, 55, GainCapitalFx.TIME_ZONE); 
    172172        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( 
    174174            begin, end); 
    175175 
  • core/src/test/java/com/numericalmethod/algoquant/data/historicaldata/gaincapital/preprocess/GainCapitalFxRawCsvFileTest.java

    r1366 r1548  
    5151            } 
    5252        } 
    53         CellProcessor[] processors = GainCapitalFxRawCsvFile.processors1.newCellProcessor(); 
     53        CellProcessor[] processors = GainCapitalFxRawCsvFile.processors1.newInstance(); 
    5454        Row row = trial.read(Row.class, headers, processors); 
    5555        assertEquals(1283399047, row.getLTid().longValue()); 
    … …  
    6969            } 
    7070        } 
    71         CellProcessor[] processors = GainCapitalFxRawCsvFile.processors2.newCellProcessor(); 
     71        CellProcessor[] processors = GainCapitalFxRawCsvFile.processors2.newInstance(); 
    7272        Row row = trial.read(Row.class, headers, processors); 
    7373        assertEquals(905536420, row.getLTid().longValue()); 
  • core/src/test/java/com/numericalmethod/algoquant/data/historicaldata/sgx/SGXTickDataTest.java

    r1507 r1548  
    5050        SGXTickData instance = new SGXTickData("./test-data/sgx/SiMSCI", sgxOptions); 
    5151 
    52         SequentialCache<Depth> cache = instance.getCache( 
     52        SequentialCache<Depth> cache = instance.newInstance( 
    5353            JodaTimeUtils.getDate(2011, 1, 1, TimeZoneUtils.SINGAPORE), 
    5454            JodaTimeUtils.getDate(2011, 2, 28, TimeZoneUtils.SINGAPORE)); 
    … …  
    7070        SGXTickData instance = new SGXTickData("./test-data/sgx/SiMSCI", sgxOptions); 
    7171 
    72         SequentialCache<Depth> cache = instance.getCache( 
     72        SequentialCache<Depth> cache = instance.newInstance( 
    7373            JodaTimeUtils.getDate(2011, 1, 1, TimeZoneUtils.SINGAPORE), 
    7474            JodaTimeUtils.getDate(2011, 2, 28, TimeZoneUtils.SINGAPORE)); 
    … …  
    9090        SGXTickData instance = new SGXTickData("./test-data/sgx/SiMSCI", sgxOptions); 
    9191 
    92         SequentialCache<Depth> cache = instance.getCache( 
     92        SequentialCache<Depth> cache = instance.newInstance( 
    9393            JodaTimeUtils.getDate(2009, 7, 1, TimeZoneUtils.SINGAPORE), 
    9494            JodaTimeUtils.getDate(2009, 7, 2, TimeZoneUtils.SINGAPORE)); 
    … …  
    105105        SGXTickData instance = new SGXTickData("./test-data/sgx/SiMSCI", sgxOptions); 
    106106 
    107         SequentialCache<Depth> cache = instance.getCache( 
     107        SequentialCache<Depth> cache = instance.newInstance( 
    108108            JodaTimeUtils.getDate(2011, 1, 1, TimeZoneUtils.SINGAPORE), 
    109109            new DateTime(2011, 2, 28, Exchange.SGX.closeHour, Exchange.SGX.closeMinute, 0, 0, TimeZoneUtils.SINGAPORE)); 
    … …  
    135135        DateTime end = begin.plus(Period.months(6)); 
    136136 
    137         SequentialCache<Depth> cache = sgx.getCache(begin, end); 
     137        SequentialCache<Depth> cache = sgx.newInstance(begin, end); 
    138138 
    139139        TimedEntry<Depth> te = cache.iterator().next(); 
    … …  
    146146        SGXTickData instance = new SGXTickData("./test-data/sgx/SiMSCI", sgxOptions); 
    147147 
    148         SequentialCache<Depth> cache = instance.getCache( 
     148        SequentialCache<Depth> cache = instance.newInstance( 
    149149            JodaTimeUtils.getDate(2011, 1, 1, TimeZoneUtils.SINGAPORE), 
    150150            new DateTime(2011, 2, 28, Exchange.SGX.closeHour, Exchange.SGX.closeMinute, 0, 0, TimeZoneUtils.SINGAPORE)); 
    … …  
    196196        SGXTickData instance = new SGXTickData("./test-data/sgx/SiMSCI", sgxOptions); 
    197197 
    198         SequentialCache<Depth> cache = instance.getCache( 
     198        SequentialCache<Depth> cache = instance.newInstance( 
    199199            JodaTimeUtils.getDate(2011, 1, 1, TimeZoneUtils.SINGAPORE), 
    200200            JodaTimeUtils.getDate(2011, 2, 28, TimeZoneUtils.SINGAPORE)); 
  • core/src/test/java/com/numericalmethod/algoquant/data/historicaldata/taq/TAQDataTest.java

    r1366 r1548  
    4444        DateTime beginDate = new DateTime(2010, 1, 4, 4, 0, TAQData.TIME_ZONE); 
    4545        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); 
    4747 
    4848        List<TimedEntry<TAQTick>> itemList = new ArrayList<TimedEntry<TAQTick>>(); 
    … …  
    7676        DateTime beginDate = new DateTime(2010, 3, 11, 8, 45, 0, TAQData.TIME_ZONE); 
    7777        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); 
    7979 
    8080        List<TimedEntry<TAQTick>> itemList = new ArrayList<TimedEntry<TAQTick>>(); 
    … …  
    102102        DateTime beginDate = new DateTime(2012, 3, 11, 8, 45, 0, TAQData.TIME_ZONE); 
    103103        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); 
    105105 
    106106        List<TimedEntry<TAQTick>> itemList = new ArrayList<TimedEntry<TAQTick>>(); 
  • core/src/test/java/com/numericalmethod/algoquant/data/historicaldata/yahoo/YahooEODTest.java

    r1507 r1548  
    5959        DateTime end = JodaTimeUtils.getDate(2003, 1, 10, HK0005.getExchange().timeZone); 
    6060        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); 
    6262 
    6363        int count = 0; 
    … …  
    7878        DateTime end = JodaTimeUtils.getDate(1984, 9, 10, AAPL.getExchange().timeZone); 
    7979        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); 
    8181 
    8282        int count = 0; 
    … …  
    9999        DateTime end = JodaTimeUtils.getDate(1984, 10, 1, AAPL.getExchange().timeZone); 
    100100        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); 
    102102 
    103103        int count = 0; 
    … …  
    116116        DateTime begin = JodaTimeUtils.getDate(1984, 9, 7, AAPL.getExchange().timeZone); 
    117117        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); 
    119119 
    120120        int count = 0; 
    … …  
    132132        YahooEOD source = new YahooEOD(HK0005, "./test-data/Yahoo", getTestFolderName()); 
    133133 
    134         SequentialCache<StockEOD> instance1 = source.getCache( 
     134        SequentialCache<StockEOD> instance1 = source.newInstance( 
    135135            JodaTimeUtils.getDate(2005, 1, 1, HK0005.getExchange().timeZone), 
    136136            JodaTimeUtils.getDate(2005, 1, 10, HK0005.getExchange().timeZone)); 
    137137 
    138         SequentialCache<StockEOD> instance2 = source.getCache( 
     138        SequentialCache<StockEOD> instance2 = source.newInstance( 
    139139            JodaTimeUtils.getDate(2004, 12, 20, HK0005.getExchange().timeZone), 
    140140            JodaTimeUtils.getDate(2005, 1, 10, HK0005.getExchange().timeZone)); 
  • core/src/test/java/com/numericalmethod/algoquant/data/historicaldata/yahoo/YahooEODWebDownloaderTest.java

    r1507 r1548  
    4545        final DateTime endDate = JodaTimeUtils.getDate(2010, 11, 12, Exchange.HKEX.timeZone); 
    4646 
    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); 
    4848 
    4949        int count = 0; 
    … …  
    6060        final DateTime endDate = JodaTimeUtils.getDate(2010, 11, 12, Exchange.NASDAQ.timeZone); 
    6161 
    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); 
    6363 
    6464        int count = 0; 
    … …  
    7474        YahooEODWebDownloader source = new YahooEODWebDownloader(HK0005.getInstance().as(Stock.class)); 
    7575 
    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), 
    7777                                                               JodaTimeUtils.getDate(2010, 11, 12, Exchange.HKEX.timeZone)); 
    7878 
    79         SequentialCache<StockEOD> instance2 = source.getCache( 
     79        SequentialCache<StockEOD> instance2 = source.newInstance( 
    8080            JodaTimeUtils.getDate(2010, 11, 5, Exchange.HKEX.timeZone), 
    8181            JodaTimeUtils.getDate(2010, 11, 15, Exchange.HKEX.timeZone)); 
  • core/src/test/java/com/numericalmethod/algoquant/execution/depth/SimulatedDepthCacheTest.java

    r1541 r1548  
    122122        DateTime end = begin.plusDays(4); 
    123123        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));; 
    125125 
    126126        SequentialCache<Depth> simulatedCache = new SimulatedDepthCache( 
  • core/src/test/java/com/numericalmethod/algoquant/execution/performance/measure/decomposition/PartialPerformanceMeasureTest.java

    r1542 r1548  
    5757    private final ProductParams params = new ProductParams(product, 1.0); 
    5858    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)); 
    6060    private final Simulator simulator = new SimpleSimulator.Builder(depthCaches).build(); 
    6161 
  • core/src/test/java/com/numericalmethod/algoquant/execution/product/fx/simulator/CrossRateCacheFactoryTest.java

    r1366 r1548  
    7373            factory1, factory2); 
    7474 
    75         Iterator<TimedEntry<Depth>> itr = crossRateFactory.getCache(null, null).iterator(); 
     75        Iterator<TimedEntry<Depth>> itr = crossRateFactory.newInstance(null, null).iterator(); 
    7676 
    7777        TimedEntry<Depth> testedTimeEntry = itr.next(); 
    … …  
    124124        DateTime begin = new DateTime(2009, 1, 1, 0, 0, GainCapitalFx.TIME_ZONE); 
    125125        DateTime end = begin.plus(Period.days(10)); 
    126         SequentialCache<Depth> cache = chfdkk.getCache(begin, end); 
     126        SequentialCache<Depth> cache = chfdkk.newInstance(begin, end); 
    127127 
    128128        int count = 0; 
  • core/src/test/java/com/numericalmethod/algoquant/execution/product/fx/simulator/InvertedRateCacheFactoryTest.java

    r1366 r1548  
    6565            product, factory); 
    6666 
    67         Iterator<TimedEntry<Depth>> itr = invertedRateFactory.getCache(null, null).iterator(); 
     67        Iterator<TimedEntry<Depth>> itr = invertedRateFactory.newInstance(null, null).iterator(); 
    6868 
    6969        TimedEntry<Depth> testedTimeEntry = itr.next(); 
    … …  
    106106        DateTime end = begin.plus(Period.days(10)); 
    107107 
    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); 
    110110 
    111111        int countchfeur = 0; 
  • core/src/test/java/com/numericalmethod/algoquant/execution/simulation/batch/montecarlo/MCSimulationTest.java

    r1539 r1548  
    7575        StrategyFactory strategyFactory = new StrategyFactory() { 
    7676            @Override 
    77             public Strategy newStrategy() { 
     77            public Strategy newInstance() { 
    7878                return new MockStrategyBuySellFixedQty(PRODUCT, 1.0); 
    7979            } 
    … …  
    115115        SimulatorFactory simFactory = new SimulatorFactory() { 
    116116            @Override 
    117             public Simulator newSimulator(DepthCaches depthCaches, ExchangeRateTable rates) { 
     117            public Simulator newInstance(DepthCaches depthCaches, ExchangeRateTable rates) { 
    118118                return new SimpleSimulator.Builder(depthCaches).useExchangeRates(rates).build(); 
    119119            } 
    … …  
    154154        MCSimulation.StrategyFactory strategyFactory = new MCSimulation.StrategyFactory() { 
    155155            @Override 
    156             public Strategy newStrategy() { 
     156            public Strategy newInstance() { 
    157157                return new MockStrategyBuySellFixedQty(product, 1.0); 
    158158            } 
    … …  
    161161        MCSimulation.SimulatorFactory simFactory = new MCSimulation.SimulatorFactory() { 
    162162            @Override 
    163             public Simulator newSimulator(DepthCaches depthCaches, ExchangeRateTable rates) { 
     163            public Simulator newInstance(DepthCaches depthCaches, ExchangeRateTable rates) { 
    164164                return new SimpleSimulator.Builder(depthCaches).useExchangeRates(rates).build(); 
    165165            } 
  • core/src/test/java/com/numericalmethod/algoquant/execution/simulation/batch/sensitivity/SensitivityAnalyzerTest.java

    r1537 r1548  
    5353                new StrategyFactory<Strategy, Vector>() { 
    5454                    @Override 
    55                     public synchronized Strategy newStrategy(Vector param) { 
     55                    public synchronized Strategy newInstance(Vector param) { 
    5656                        final double n = param.get(1); 
    5757                        return new Strategy() { 
  • core/src/test/java/com/numericalmethod/algoquant/execution/simulator/SimpleSimulatorTest.java

    r1507 r1548  
    6666        YahooEOD yahoo = new YahooEOD(stock, "./test-data/Yahoo", "./log/Yahoo"); 
    6767        DEPTH_CACHES = DepthCaches.newInstanceWithSingleCache( 
    68             PRODUCT, DepthCacheUtils.fromStockEODCache(PRODUCT, yahoo.getCache(begin, end))); 
     68            PRODUCT, DepthCacheUtils.fromStockEODCache(PRODUCT, yahoo.newInstance(begin, end))); 
    6969    } 
    7070 
    … …  
    181181 
    182182                    @Override 
    183                     public ChannelMessageHandler newHandler(UpdateHandler handler) { 
     183                    public ChannelMessageHandler newInstance(UpdateHandler handler) { 
    184184                        if (handler instanceof MessageTypeA.UpdateHandlerA) { 
    185185                            return new MessageTypeA.MessageHandlerA((MessageTypeA.UpdateHandlerA) handler); 
  • core/src/test/java/com/numericalmethod/algoquant/execution/strategy/composite/CompositeStrategyTest.java

    r1542 r1548  
    5151    private final ProductParams params = new ProductParams(product, 1.0); 
    5252    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)); 
    5454    private Simulator simulator = new SimpleSimulator.Builder(depthCaches).build(); 
    5555 
  • core/src/test/java/com/numericalmethod/algoquant/model/factormodel/regression/crosssectional/AbstractCrossSectionalRegressionTest.java

    r1541 r1548  
    9494        throws ZipException, IOException, ParseException { 
    9595        SequentialCache<Double> marketSeries = 
    96             new HSIReader(HSI_FILE_PATH).getCache(startTime, endTime); 
     96            new HSIReader(HSI_FILE_PATH).newInstance(startTime, endTime); 
    9797        SequentialCache<Double> rates = 
    9898            new HKIBOR(HKMA_RATES_FILE_PATH) 
  • core/src/test/java/com/numericalmethod/algoquant/model/volarb/MeanReversionStrategyTest.java

    r1507 r1548  
    7575        DepthCaches depthCaches = new DepthCaches(); 
    7676        depthCaches.addCache(productXOM, 
    77                              DepthCacheUtils.fromStockEODCache(productXOM, yahooEODXOM.getCache(begin, end))); 
     77                             DepthCacheUtils.fromStockEODCache(productXOM, yahooEODXOM.newInstance(begin, end))); 
    7878        depthCaches.addCache(productGOOG, 
    79                              DepthCacheUtils.fromStockEODCache(productGOOG, yahooEODGOOG.getCache(begin, end))); 
     79                             DepthCacheUtils.fromStockEODCache(productGOOG, yahooEODGOOG.newInstance(begin, end))); 
    8080 
    8181        // create the strategy 
  • demo/src/main/java/com/numericalmethod/algoquant/data/historicaldata/sgx/demo/DemoSiMSCITickData.java

    r1507 r1548  
    4949        SGXTickData source = new SGXTickData(DATA_FOLDER, SGXOptions.SiMSCI); 
    5050 
    51         SequentialCache<Depth> cache = source.getCache( 
     51        SequentialCache<Depth> cache = source.newInstance( 
    5252            JodaTimeUtils.getDate(2011, 1, 1, TimeZoneUtils.SINGAPORE), 
    5353            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  
    9999    private static final StrategyFactory STRATEGY_FACTORY = new StrategyFactory() { 
    100100        @Override 
    101         public Strategy newStrategy() { 
     101        public Strategy newInstance() { 
    102102            return new SMA2Crossover(new ProductParams(PRODUCT, 1.0), 1, 2); 
    103103        } 
    … …  
    129129    private static final SimulatorFactory SIMULATOR_FACTORY = new SimulatorFactory() { 
    130130        @Override 
    131         public Simulator newSimulator(DepthCaches depthCaches, ExchangeRateTable rates) { 
     131        public Simulator newInstance(DepthCaches depthCaches, ExchangeRateTable rates) { 
    132132            SimpleSimulator.Builder builder = new SimpleSimulator.Builder(depthCaches); 
    133133            SimpleSimulator simulator = 
  • demo/src/main/java/com/numericalmethod/algoquant/execution/simulation/batch/montecarlo/demo/DemoMCSimulationTaskRunner.java

    r1541 r1548  
    8484    private static final SimulatorFactory SIMULATOR_FACTORY = new SimulatorFactory() { 
    8585        @Override 
    86         public Simulator newSimulator(DepthCaches depthCaches, ExchangeRateTable rates) { 
     86        public Simulator newInstance(DepthCaches depthCaches, ExchangeRateTable rates) { 
    8787            return new SimpleSimulator.Builder(depthCaches).useExchangeRates(rates).build(); 
    8888        } 
  • demo/src/main/java/com/numericalmethod/algoquant/execution/simulation/batch/sensitivity/demo/DemoSensitivityAnalyzer.java

    r1541 r1548  
    7979            new StrategyFactory<Strategy, Vector>() { 
    8080                @Override 
    81                 public Strategy newStrategy(Vector lags) { 
     81                public Strategy newInstance(Vector lags) { 
    8282                    ProductParams param = new ProductParams(PRODUCT, 1); 
    8383                    return new SMA2Crossover(param, (int) lags.get(1), (int) lags.get(2)); 
    … …  
    9090                                                       DataSources.YAHOO 
    9191                                                           .forProduct(PRODUCT, "./log/Yahoo") 
    92                                                            .getCache(BEGIN, END)); 
     92                                                           .newInstance(BEGIN, END)); 
    9393        ExchangeRateTable rates = new SimpleExchangeRateTable(PRODUCT.denomination()); 
    9494 
  • demo/src/main/java/com/numericalmethod/algoquant/execution/strategy/demo/DemoTimer.java

    r1541 r1548  
    7373 
    7474    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); 
    7676        DepthCaches depthCaches = DepthCaches.newInstanceWithSingleCache(PRODUCT, dailyData); 
    7777 
  • demo/src/main/java/com/numericalmethod/algoquant/execution/strategy/demo/DemoTutorialStrategy.java

    r1541 r1548  
    7070        DateTime end = JodaTimeUtils.getDate(2012, 1, 1, stock.getExchange().timeZone); 
    7171 
    72         SequentialCache<Depth> dailyData = DataSources.YAHOO.forProduct(product).getCache(begin, end); 
     72        SequentialCache<Depth> dailyData = DataSources.YAHOO.forProduct(product).newInstance(begin, end); 
    7373        EquiTimeSampler<Depth> monthlySampler = new EquiTimeSampler<Depth>(Period.months(1)); 
    7474        SequentialCache<Depth> monthlyData = monthlySampler.doProcess(dailyData); 
  • demo/src/main/java/com/numericalmethod/algoquant/model/elliott2005/demo/Demo110.java

    r1541 r1548  
    7777        // create source of market depth 
    7878        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)); 
    8181 
    8282        // set the denomination currency 
  • demo/src/main/java/com/numericalmethod/algoquant/model/elliott2005/demo/DemoElliott2005_010.java

    r1541 r1548  
    7171        // create source of market depth 
    7272        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)); 
    7575 
    7676        // set the denomination currency 
  • demo/src/main/java/com/numericalmethod/algoquant/model/factormodel/regression/crosssectional/demo/CrossSectionalRegressionDemoParams.java

    r1545 r1548  
    145145        List<CompanyHistory> histories = COMPANY_HISTORY_DB.getCompanyHistories(stockIds); 
    146146        SequentialCache<Double> marketSeries = 
    147                 new HSIReader(HSI_FILE_PATH).getCache(startTime, endTime); 
     147                new HSIReader(HSI_FILE_PATH).newInstance(startTime, endTime); 
    148148        SequentialCache<Double> rates = 
    149149                new HKIBOR(HKMA_RATES_FILE_PATH) 
  • demo/src/main/java/com/numericalmethod/algoquant/model/factormodel/regression/crosssectional/demo/DemoCrossSectionalRegressionSensitivityAnalysis.java

    r1543 r1548  
    103103        return new StrategyFactory<Strategy, Vector>() { 
    104104            @Override 
    105             public Strategy newStrategy(Vector factorOffset) { 
     105            public Strategy newInstance(Vector factorOffset) { 
    106106                FactorModelWeightSignal weightSignal = 
    107107                        new SensitivityAnalysisWeightSignal(DEFAULT_WEIGHT_SIGNAL, 
  • demo/src/main/java/com/numericalmethod/algoquant/model/infantino2010/demo/Demo010.java

    r1507 r1548  
    142142        for (Product product : products) { 
    143143            cacheMap.addCache(product, 
    144                               DataSources.YAHOO.forProduct(product, "./log").getCache(begin, end)); 
     144                              DataSources.YAHOO.forProduct(product, "./log").newInstance(begin, end)); 
    145145        } 
    146146        return cacheMap; 
  • demo/src/main/java/com/numericalmethod/algoquant/model/kst1995/demo/Demo020.java

    r1541 r1548  
    6565 
    6666        List<Double> px = new ArrayList<Double>(); 
    67         SequentialCache<StockEOD> cache = yahoo.getCache(begin, end); 
     67        SequentialCache<StockEOD> cache = yahoo.newInstance(begin, end); 
    6868        for (TimedEntry<StockEOD> entry : cache) { 
    6969            px.add(entry.getData().getAdjClose()); 
  • demo/src/main/java/com/numericalmethod/algoquant/model/signal/crossover/demo/DemoBatchParamSimulation.java

    r1541 r1548  
    128128 
    129129        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)); 
    131131 
    132132        return depthCaches; 
  • demo/src/main/java/com/numericalmethod/algoquant/model/signal/crossover/demo/DemoSMA2CrossoverDynamic_010.java

    r1541 r1548  
    9898         */ 
    9999        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)); 
    101101 
    102102        // run simulation 
  • demo/src/main/java/com/numericalmethod/algoquant/model/signal/crossover/demo/DemoSMA2_010.java

    r1541 r1548  
    7070        DateTime end = JodaTimeUtils.getDate(2009, 2, 2, tz); 
    7171        SequentialCache<Depth> cache = 
    72             DataSources.YAHOO.forProduct(product, "./log/Yahoo").getCache(begin, end); 
     72            DataSources.YAHOO.forProduct(product, "./log/Yahoo").newInstance(begin, end); 
    7373 
    7474        // create the strategy 
  • demo/src/main/java/com/numericalmethod/algoquant/model/signal/crossover/demo/DemoSMA2_011.java

    r1541 r1548  
    7575        DateTime end = JodaTimeUtils.getDate(2012, 8, 31, tz); 
    7676        SequentialCache<Depth> cache = 
    77             DataSources.YAHOO.forProduct(product, "./log/Yahoo").getCache(begin, end); 
     77            DataSources.YAHOO.forProduct(product, "./log/Yahoo").newInstance(begin, end); 
    7878 
    7979        // create the strategy 
  • demo/src/main/java/com/numericalmethod/algoquant/model/signal/demo/DemoPairsTrading.java

    r1507 r1548  
    135135        YahooEOD yahoo2 = new YahooEOD(stockProperty2); 
    136136        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))); 
    139139 
    140140        // create strategy 
  • demo/src/main/java/com/numericalmethod/algoquant/model/signal/volume/demo/DemoADL.java

    r1541 r1548  
    146146        LOGGER.info(strategy.toString()); 
    147147 
    148         SequentialCache<StockEOD> stockEODCache = yahoo.getCache(begin, end); 
     148        SequentialCache<StockEOD> stockEODCache = yahoo.newInstance(begin, end); 
    149149 
    150150        // create source of market depth 
  • demo/src/main/java/com/numericalmethod/algoquant/model/signal/volume/demo/DemoCMF.java

    r1541 r1548  
    144144        LOGGER.info(strategy.toString()); 
    145145 
    146         SequentialCache<StockEOD> stockEODCache = yahoo.getCache(begin, end); 
     146        SequentialCache<StockEOD> stockEODCache = yahoo.newInstance(begin, end); 
    147147 
    148148        // create source of market depth 
  • demo/src/main/java/com/numericalmethod/algoquant/model/volarb/demo/DemoFixedGrid001.java

    r1541 r1548  
    9191        DepthCaches depthCaches = DepthCaches.newInstanceWithSingleCache( 
    9292            fxProduct, 
    93             DataSources.GAIN_CAPITAL.forProduct(fxProduct, dataFolder).getCache(begin, end)); 
     93            DataSources.GAIN_CAPITAL.forProduct(fxProduct, dataFolder).newInstance(begin, end)); 
    9494 
    9595        // run simulation 
  • demo/src/main/java/com/numericalmethod/algoquant/model/volarb/demo/DemoFixedGridOnSGXData001.java

    r1438 r1548  
    9494        // create source of market depth 
    9595        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)); 
    9898 
    9999        // run simulation 
  • demo/src/main/java/com/numericalmethod/algoquant/model/volarb/demo/DemoFixedGridPortfolio001.java

    r1542 r1548  
    104104        // create source of market depth 
    105105        SequentialCache<? extends Depth> depthCache = 
    106             DataSources.GAIN_CAPITAL.forProduct(PRODUCT, dataFolder).getCache(BEGIN, END); 
     106            DataSources.GAIN_CAPITAL.forProduct(PRODUCT, dataFolder).newInstance(BEGIN, END); 
    107107        DepthCaches depthCaches = DepthCaches.newInstanceWithSingleCache(PRODUCT, depthCache); 
    108108 
  • demo/src/main/java/com/numericalmethod/algoquant/model/volarb/demo/DemoPeriodic001.java

    r1438 r1548  
    9797        DepthCaches depthCaches = DepthCaches.newInstanceWithSingleCache( 
    9898            fxProduct, 
    99             DataSources.GAIN_CAPITAL.forProduct(fxProduct, dataFolder).getCache(begin, end)); 
     99            DataSources.GAIN_CAPITAL.forProduct(fxProduct, dataFolder).newInstance(begin, end)); 
    100100 
    101101        // run simulation 
  • demo/src/main/java/com/numericalmethod/algoquant/model/volarb/demo/DemoRanged001.java

    r1541 r1548  
    9191        // create source of market depth 
    9292        DepthCaches depthCaches = DepthCaches.newInstanceWithSingleCache( 
    93             fxProduct, gc.getCache(begin, end)); 
     93            fxProduct, gc.newInstance(begin, end)); 
    9494 
    9595        // run simulation 
  • demo/src/main/java/com/numericalmethod/algoquant/model/volarb/demo/DemoRanged002.java

    r1438 r1548  
    8282        // construct price source mapping 
    8383        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)); 
    8686 
    8787        // create a basket to trade 
Note: See TracChangeset for help on using the changeset viewer.