System.out.print("Generating data for 20 min...");
// initializing starting prices
for( Company company : companies ) {
company.setCurrentPrice( nextStartingPrice( startingPrices ) );
StockTick tick = new StockTick( company.getSymbol(),
company.getCurrentPrice(),
0 );
persister.save( tick );
}
for( long offset = 0; offset < timespam; offset += nextStep( interval ) ) {
int company = symbols.nextInt( companies.length );
double price = companies[company].getCurrentPrice() * (1 + nextPriceChange( priceChanges ));
StockTick tick = new StockTick(companies[company].getSymbol(),
price,
offset );
persister.save( tick );
companies[company].setCurrentPrice( price );
}