com.tecacet.finance.service.stock.yahoo.YahooPriceParser 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.service.stock.yahoo;
import com.tecacet.finance.model.Quote;
import com.tecacet.jflat.CSVReader;
import org.apache.commons.io.input.BOMInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.util.List;
public class YahooPriceParser {
private final static String[] PRICE_PROPERTIES = new String[] {"date", "open", "close", "volume", "high", "low", "adjustedClose"};
private final static String[] PRICE_COLUMNS = new String[] {"Date", "Open", "Close", "Volume", "High", "Low", "Adj Close"};
private final CSVReader reader;
public YahooPriceParser() {
this(PRICE_PROPERTIES, PRICE_COLUMNS);
}
public YahooPriceParser(String[] properties, String[] columns) {
super();
reader = CSVReader.readerWithHeaderMapping(Quote.class, columns, properties);
}
public List parse(InputStream is) throws IOException {
return reader.readAll(new BOMInputStream(is));
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy