public static void main(String[] args) {
		int numSymbol = args.length;
		ArrayList<String> symbols = new ArrayList<String>();
		
		if(numSymbol==0){
			System.out.println("No Symbol given in argument. Exiting!");
			return;
		}
		
		for(int i=0; i<numSymbol; i++){
			symbols.add(args[i]);
		}
		
		Havelock hl = new Havelock("test");
		
		String pwd = System.getProperty("user.dir");
		
		Date date= null;
		String dateStr = null;
		SimpleDateFormat formatter = new SimpleDateFormat("yyyy/MM/dd HH:mm:ss");
		
		//Infinite loop
		while(true){
			date = new Date();
			dateStr = formatter.format(date.getTime());
			System.out.println(dateStr);
			try{
				for(int symIndex = 0; symIndex < symbols.size(); symIndex++){
						String symbol = symbols.get(symIndex);
						String fileName = symbol+".csv";
						String fullPathToFile = pwd + "\\" + DATA_FOLDER + "\\" + fileName;
						System.out.println(fullPathToFile);
						
						//get file, create if does not exist
						File dataFile = new File(fullPathToFile);
						boolean newFile = false;
						if(!dataFile.exists()) {
						    dataFile.createNewFile();
						    newFile=true;
						} 
						
						CSVWriter writer = new CSVWriter(new FileWriter(fullPathToFile,true));
						//write header if file is newly created
						if(newFile){
							writer.writeNext(CSV_HEADERS.split(","));
						}
						
						/*
						 * Get information from Havelock
						 */
						//get symbol and orderbook information
						SymbolInfo symbolInfo = hl.getSymbolInfo(symbol);
						OrderBook orderbook = hl.getOrderBook(symbol);
						
						//get sorted orderbook info
						TreeSet<Order> sortedAsks = orderbook.getBestAsk();
						TreeSet<Order> sortedBids = orderbook.getBestBid();

						//calculate the spread
						//set the threshold to be the average vol per 5 min the past 24 hours
						double threshold = 5*symbolInfo.OneDayStats.vol/MIN_IN_DAY;
						
						Order spreadAsk = getSpreadOrder(sortedAsks, threshold);
						Order spreadBid = getSpreadOrder(sortedBids, threshold);
						double midPrice = MarketMaker.calculateMidPrice(spreadBid, spreadAsk);
						double pctSpread = MarketMaker.calculatePercentSpread(spreadBid,spreadAsk);
						
						String entry = dateStr + ","
									+ symbolInfo.lastPrice + ","
									+ midPrice + ","
									+ pctSpread;
						
						entry += recordPeriodStat(symbolInfo.OneDayStats);
						entry += recordPeriodStat(symbolInfo.SevenDayStats);
						entry += recordPeriodStat(symbolInfo.ThirtyDayStats);
						
						writer.writeNext(entry.split(","));
						
						String keyVars =  "Symbol: %s"
								+" Threshold: %f"
								+" PctSpread: %.2f%n";
						System.out.format(keyVars,symbol,threshold,pctSpread*100);
						
						writer.close();
						
				}
				//catch any exception that might arise record it and try again...
			}catch(Exception e){
				e.printStackTrace();
			}		
			
			try {
				Thread.sleep(60*1000);
			} catch (InterruptedException e) {
				e.printStackTrace();
			}
		}
	}