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

com.tecacet.finance.service.stock.yahoo.YahooDividendService Maven / Gradle / Ivy

Go to download

JFApi connects to various Web Services that provide financial data such as stock prices, splits, dividends, and FX rates.

There is a newer version: 1.1.3
Show newest version
package com.tecacet.finance.service.stock.yahoo;

import com.tecacet.finance.model.StandardPeriodType;
import com.tecacet.finance.service.stock.DividendService;
import com.tecacet.finance.service.stock.StockServiceException;

import java.io.InputStream;
import java.math.BigDecimal;
import java.time.LocalDate;
import java.util.Map;

public class YahooDividendService extends AbstractYahooService implements DividendService {

    private final YahooDividendParser parser = new YahooDividendParser();

    @Override
    public Map getHistoricalDividends(String symbol, LocalDate fromDate, LocalDate toDate) throws StockServiceException {
        try {
            Map params = getRequestParams(fromDate, toDate, StandardPeriodType.DAY);
            params.put("events", "div");
            InputStream is = getUrlStream(symbol, params);
            return parser.parse(is);
        } catch (Exception e) {
            throw new StockServiceException(e);
        }
    }

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy