diff --git a/src/finam/interfaces.py b/src/finam/interfaces.py index 966f42ffbc4b2447f9522c820585e89b44b2a034..30efe0ba89209cdcfec29f8b4489e3007098cb82 100644 --- a/src/finam/interfaces.py +++ b/src/finam/interfaces.py @@ -75,6 +75,12 @@ class IComponent(ABC): After each method call, the component should have :attr:`.status` :attr:`.ComponentStatus.CONNECTED` if connecting was completed, :attr:`.ComponentStatus.CONNECTING` if some but not all required initial input(s) could be pulled, and :attr:`.ComponentStatus.CONNECTING_IDLE` if nothing could be pulled. + + Parameters + ---------- + start_time : :class:`datetime <datetime.datetime>` + The composition's starting time. + Can be before the component's actual time. """ @abstractmethod diff --git a/src/finam/schedule.py b/src/finam/schedule.py index 58301659fb1104b261227447c90611c4751beca3..17b5505b97e0d847150fc128e5789caa240ec5cd 100644 --- a/src/finam/schedule.py +++ b/src/finam/schedule.py @@ -144,6 +144,13 @@ class Composition(Loggable): """Performs the connect and validate phases of the composition If this was not called by the user, it is called at the start of :meth:`.run`. + + Parameters + ---------- + time : :class:`datetime <datetime.datetime>`, optional + Starting time of the composition. + If provided, it should be the starting time of the earliest component. + If not provided, the composition tries to determine the starting time automatically. """ if self.is_connected: raise FinamStatusError("Composition was already connected.") @@ -194,7 +201,12 @@ class Composition(Loggable): Parameters ---------- - t_max : :class:`datetime <datetime.datetime>` or None, optional + t : :class:`datetime <datetime.datetime>`, optional + Starting time of the composition. + If provided, it should be the starting time of the earliest component. + If not provided, the composition tries to determine the starting time automatically. + Ignored if :meth:`.connect` was already called. + t_max : :class:`datetime <datetime.datetime>`, optional Simulation time up to which to simulate. Should be ``None`` if no components with time are present. """ diff --git a/src/finam/sdk/component.py b/src/finam/sdk/component.py index 406a870737f54dff071644cafd479a091957e7ed..7cbcd05007b66cb4c0518fb57669662ada1c589a 100644 --- a/src/finam/sdk/component.py +++ b/src/finam/sdk/component.py @@ -83,6 +83,12 @@ class Component(IComponent, Loggable, ABC): After each method call, the component should have :attr:`.status` :attr:`.ComponentStatus.CONNECTED` if connecting was completed, :attr:`.ComponentStatus.CONNECTING` if some but not all required initial input(s) could be pulled, and :attr:`.ComponentStatus.CONNECTING_IDLE` if nothing could be pulled. + + Parameters + ---------- + start_time : :class:`datetime <datetime.datetime>` + The composition's starting time. + Can be before the component's actual time. """ if start_time is not None and not isinstance(start_time, datetime): raise FinamTimeError("Time in connect must be either None or a datetime") @@ -100,6 +106,14 @@ class Component(IComponent, Loggable, ABC): """Connect exchange data and metadata with linked components. Components must overwrite this method. + + Parameters + ---------- + start_time : :class:`datetime <datetime.datetime>` + The composition's starting time. + Can be before the component's actual time. + + Should be passed to :meth:`.try_connect` calls. """ raise NotImplementedError( f"Method `_connect` must be implemented by all components, but implementation is missing in {self.name}." @@ -347,7 +361,7 @@ class Component(IComponent, Loggable, ABC): Parameters ---------- time : :class:`datetime <datetime.datetime>` - time for data pulls + the composition's starting time as passed to :meth:`.Component.try_connect` exchange_infos : dict of [str, Info] currently or newly available input data infos by input name push_infos : dict of [str, Info] diff --git a/src/finam/tools/connect_helper.py b/src/finam/tools/connect_helper.py index df305a7a6a349d0cf6ed98db43e7589b3445325e..2c73d7f18b5579b39457c8c3557557c36a04cf12 100644 --- a/src/finam/tools/connect_helper.py +++ b/src/finam/tools/connect_helper.py @@ -340,7 +340,7 @@ class ConnectHelper(Loggable): Parameters ---------- time : :class:`datetime <datetime.datetime>` - time for data pulls + the composition's starting time as passed to :meth:`.Component.try_connect` exchange_infos : dict currently or newly available input data infos by input name push_infos : dict