diff --git a/CHANGELOG.md b/CHANGELOG.md index 4c37997..874f493 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -15,3 +15,5 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Made label and expression parameters optional in attribute api response ## [0.0.9] - 2025-12-09 - Perfomance optimizations +## [0.1.0] - 2025-12-10 +Time serires data made optional \ No newline at end of file diff --git a/dataquery/__init__.py b/dataquery/__init__.py index cd87f56..244b623 100644 --- a/dataquery/__init__.py +++ b/dataquery/__init__.py @@ -14,7 +14,7 @@ For more information, visit: https://github.com/dataquery/dataquery-sdk """ -__version__ = "0.0.9" +__version__ = "0.1.0" __author__ = "DATAQUERY SDK Team" __email__ = "dataquery@jpmorgan.com" __license__ = "MIT" diff --git a/dataquery/models.py b/dataquery/models.py index 696fcdf..f4bdb75 100644 --- a/dataquery/models.py +++ b/dataquery/models.py @@ -992,7 +992,7 @@ class Attribute(BaseModel): None, alias="last-published", description="Date/Time data was last published" ) message: Optional[str] = Field(None, description="Attribute level user message") - time_series: Optional[List[List[Union[str, float]]]] = Field( + time_series: Optional[List[List[Union[str, float, None]]]] = Field( None, alias="time-series", description="Time series data" ) diff --git a/examples/expressions/get_expressions_time_series.py b/examples/expressions/get_expressions_time_series.py index 1ca2b8a..8f891ca 100644 --- a/examples/expressions/get_expressions_time_series.py +++ b/examples/expressions/get_expressions_time_series.py @@ -88,12 +88,21 @@ async def main() -> None: page=None, ) - series = getattr(resp, "series", []) or [] - print(f"Series: {len(series)}") - for i, s in enumerate(series[: args.show], 1): - expr = s.get("expression", "") - points = s.get("data", []) - print(f"{i}. {expr} (points: {len(points)})") + # Extract time series from instruments -> attributes -> time_series + print(f"Total Instruments: {len(resp.instruments)}") + series_count = 0 + for instrument in resp.instruments[: args.show]: + if instrument.attributes: + for attr in instrument.attributes: + series_count += 1 + expr = attr.expression or attr.attribute_name or "N/A" + time_series = attr.time_series or [] + print( + f"{series_count}. {expr} (data points: {len(time_series)})" + ) + # Show first few data points as sample + if time_series: + print(f" Sample data (first 5): {time_series[:5]}") except DataQueryError as e: print(f"Error: {e}") diff --git a/examples/files/list_available_files.py b/examples/files/list_available_files.py index 4e10b0d..d6c2100 100644 --- a/examples/files/list_available_files.py +++ b/examples/files/list_available_files.py @@ -69,10 +69,6 @@ async def main(): print(f"{'File Name':<40} {'Date':<10} {'Size':<15}") print("-" * 60) - for f in files[:20]: - size_str = f"{f.get('file_size', 0):,} bytes" - print(f"{f.file_name:<40} {f.file_date:<10} {size_str:<15}") - if len(files) > 20: print(f"... and {len(files) - 20} more")