Class TimeSeries

java.lang.Object
net.thauvin.erik.frankfurter.TimeSeries

public class TimeSeries extends Object
Represents a time series of currency exchange rate data for a specified base currency over a defined date range.

This class provides functionality to retrieve historical exchange rates using a builder pattern for flexible configuration of parameters.

Since:
0.9.0
Author:
Erik C. Thauvin
  • Constructor Details

    • TimeSeries

      public TimeSeries(TimeSeries.Builder builder)
      Constructs a new instance of the TimeSeries class using the specified builder object.
      Parameters:
      builder - the Builder instance containing the configuration for the TimeSeries object
  • Method Details

    • amount

      public Double amount()
      Retrieves the amount associated with the current time series.
      Returns:
      a Double representing the value of the amount field
    • base

      public String base()
      Retrieves the base currency for the current time series.
      Returns:
      a string representing the base currency
    • endDate

      public LocalDate endDate()
      Retrieves the end date associated with the time series.
      Returns:
      The end date as a LocalDate object
    • periodicRates

      Retrieves the periodic exchange rates for a time series based on the specified input parameters.

      This method constructs a time series request using defined start and end dates, base currency, symbols, and amount, and fetches the corresponding data.

      Returns:
      a SeriesRates object containing the exchange rate information for the specified time range and conditions.
      Throws:
      IOException - if an I/O error occurs during data retrieval
      URISyntaxException - if the generated URI for the data request is invalid
      IllegalArgumentException - if required parameters such as the start date are not set, or if the end date is before the start date
      JsonSyntaxException - if the JSON response from the API does not match the expected format
      InterruptedException
    • startDate

      public LocalDate startDate()
      Retrieves the start date associated with the time series.
      Returns:
      The start date as a LocalDate object
    • symbols

      public List<String> symbols()
      Retrieves the list of currency symbols associated with the time series.
      Returns:
      a list containing the currency symbols