All Downloads are FREE. Search and download functionalities are using the official Maven repository.

yahoofinance.quotes.csv.FxQuotesRequest Maven / Gradle / Ivy

Go to download

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.

There is a newer version: 3.17.0
Show newest version

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;
    }
    
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy