/* * ------------------------------------------------------------------------- * $Id: ReadYahooCSV.java,v 1.9 2004/05/26 19:03:12 estewart Exp $ * ------------------------------------------------------------------------- * Copyright (c) 1999 Visual Numerics Inc. All Rights Reserved. * * This software is confidential information which is proprietary to * and a trade secret of Visual Numerics, Inc. Use, duplication or * disclosure is subject to the terms of an appropriate license * agreement. * * VISUAL NUMERICS MAKES NO REPRESENTATIONS OR WARRANTIES ABOUT THE * SUITABILITY OF THE SOFTWARE, EITHER EXPRESS OR IMPLIED, INCLUDING * BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE, OR NON-INFRINGEMENT. VISUAL * NUMERICS SHALL NOT BE LIABLE FOR ANY DAMAGES SUFFERED BY LICENSEE * AS A RESULT OF USING, MODIFYING OR DISTRIBUTING THIS SOFTWARE OR * ITS DERIVATIVES. *-------------------------------------------------------------------------- */ package com.imsl.demo.risk; import java.io.*; import java.util.*; /** * Read data from chart.yahoo.com * Format: * 30-Jan-02,60.44,61.32,60.17,60.42 * * See http://finance.yahoo.com/m1?u for symbol names * * @author brophy * @created January 31, 2002 */ public class ReadYahooCSV extends com.imsl.io.FlatFile { /** Creates new ReadStockData */ public ReadYahooCSV(String filename) throws java.io.IOException { super(filename); init(); } /** Creates new ReadYahooCSV */ public ReadYahooCSV(InputStream is) throws IOException { super(new BufferedReader(new InputStreamReader(is))); init(); } private void init() throws java.io.IOException { readLine(); setColumnName(1, "Date"); setColumnName(2, "Open"); setColumnName(3, "High"); setColumnName(4, "Low"); setColumnName(5, "Close"); setColumnClass(1, java.sql.Date.class); for (int k = 2; k <= 5; k++) setColumnClass(k, Double.class); setDateColumnParser(1, "dd-MMM-yy", Locale.US); } /** * @param args the command line arguments */ public static void main (String args[]) throws Exception { Database db = new Database(); //db.save("risk.db"); } }