yahoofinance.quotes.csv.FxQuotesRequest Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of YahooFinanceAPI Show documentation
Show all versions of YahooFinanceAPI Show documentation
This library provides some methods that should make it easy
to communicate with the Yahoo Finance API.
It allows you to request detailed information, some statistics
and historical quotes on stocks.
Separate functionality is available to request a simple FX quote.
Please check the javadoc to get a complete overview of the available methods
and to get an idea of which data is available from Yahoo Finance.
package yahoofinance.quotes.csv;
import java.util.ArrayList;
import java.util.List;
import yahoofinance.Utils;
import yahoofinance.YahooFinance;
import yahoofinance.quotes.fx.FxQuote;
/**
*
* @author Stijn Strickx
*/
public class FxQuotesRequest extends QuotesRequest {
public static final List DEFAULT_PROPERTIES = new ArrayList();
static {
DEFAULT_PROPERTIES.add(QuotesProperty.Symbol);
DEFAULT_PROPERTIES.add(QuotesProperty.LastTradePriceOnly);
}
public FxQuotesRequest(String query) {
super(query, FxQuotesRequest.DEFAULT_PROPERTIES);
}
@Override
protected FxQuote parseCSVLine(String line) {
String[] split = Utils.stripOverhead(line).split(YahooFinance.QUOTES_CSV_DELIMITER);
if(split.length >= 2) {
return new FxQuote(split[0], Utils.getBigDecimal(split[1]));
}
return null;
}
}