Package net.thauvin.erik.frankfurter
Class TimeSeries
java.lang.Object
net.thauvin.erik.frankfurter.TimeSeries
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
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classBuilder class to construct instances of theTimeSeriesclass. -
Constructor Summary
ConstructorsConstructorDescriptionTimeSeries(TimeSeries.Builder builder) Constructs a new instance of the TimeSeries class using the specified builder object. -
Method Summary
Modifier and TypeMethodDescriptionamount()Retrieves the amount associated with the current time series.base()Retrieves the base currency for the current time series.endDate()Retrieves the end date associated with the time series.Retrieves the periodic exchange rates for a time series based on the specified input parameters.Retrieves the start date associated with the time series.symbols()Retrieves the list of currency symbols associated with the time series.
-
Constructor Details
-
TimeSeries
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
Retrieves the amount associated with the current time series.- Returns:
- a
Doublerepresenting the value of the amount field
-
base
Retrieves the base currency for the current time series.- Returns:
- a string representing the base currency
-
endDate
Retrieves the end date associated with the time series.- Returns:
- The end date as a
LocalDateobject
-
periodicRates
public SeriesRates periodicRates() throws IOException, URISyntaxException, JsonSyntaxException, InterruptedExceptionRetrieves 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
SeriesRatesobject containing the exchange rate information for the specified time range and conditions. - Throws:
IOException- if an I/O error occurs during data retrievalURISyntaxException- if the generated URI for the data request is invalidIllegalArgumentException- if required parameters such as the start date are not set, or if the end date is before the start dateJsonSyntaxException- if the JSON response from the API does not match the expected formatInterruptedException
-
startDate
Retrieves the start date associated with the time series.- Returns:
- The start date as a
LocalDateobject
-
symbols
Retrieves the list of currency symbols associated with the time series.- Returns:
- a list containing the currency symbols
-