com.tecacet.finance.io.CSVPriceWriter Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of jfapi Show documentation
Show all versions of jfapi Show documentation
JFApi connects to various Web Services that provide financial data such as stock prices,
splits, dividends, and FX rates.
package com.tecacet.finance.io;
import com.tecacet.finance.model.Quote;
import com.tecacet.jflat.CSVWriter;
import java.io.FileWriter;
import java.io.IOException;
import java.util.Collection;
public class CSVPriceWriter {
private static final String[] HEADER = new String[] {"Date", "Open", "High", "Low", "Close", "Volume", "Adj Close"};
private static final String[] PROPERTIES = new String[] {"date", "open", "high", "low", "close", "volume", "adjustedClose"};
public void write(String filename, Collection prices) throws IOException {
FileWriter fw = new FileWriter(filename);
CSVWriter writer = CSVWriter.writerForProperties(PROPERTIES);
writer.withHeader(HEADER);
writer.write(fw, prices);
fw.close();
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy