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.

  • 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

    • getAmount

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

      public String getBase()
      Retrieves the base currency for the current time series.
      Returns:
      A string representing the base currency
    • getEndDate

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

      public SeriesRates getPeriodicRates() throws IOException, URISyntaxException, JsonSyntaxException
      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
    • getStartDate

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

      public Collection<String> getSymbols()
      Retrieves the collection of currency symbols associated with the time series.
      Returns:
      A collection containing the currency symbols