Skip to content

Align QuiverQuantCongressUniverse Python stub with sibling Quiver universes#5

Merged
DerekMelchin merged 1 commit into
QuantConnect:masterfrom
AlexCatarino:bug-congress-universe-stub
May 8, 2026
Merged

Align QuiverQuantCongressUniverse Python stub with sibling Quiver universes#5
DerekMelchin merged 1 commit into
QuantConnect:masterfrom
AlexCatarino:bug-congress-universe-stub

Conversation

@AlexCatarino
Copy link
Copy Markdown
Member

@AlexCatarino AlexCatarino commented May 8, 2026

Summary

  • QuiverQuantCongressUniverse was the only Quiver*Universe whose Python stub did not expose its per-row data-point fields (amount, transaction, representative, ...) on the universe class itself, because in C# it inherited from QuiverCongress and emitted QuiverCongressDataPoint instances from Reader rather than instances of itself.
  • This change aligns the class with QuiverInsiderTradingUniverse, QuiverLobbyingUniverse, QuiverCNBCsUniverse, and QuiverGovernmentContractUniverse: the universe now inherits BaseDataCollection directly, the per-row fields are declared on it, and Reader/Clone emit QuiverQuantCongressUniverse instances. QuiverCongressDataPoint and QuiverCongress are unchanged — they still serve the non-universe data path and the data downloader.
  • The C# universe-selection sample drops the OfType<QuiverCongressDataPoint>() cast it previously needed; the Python sample was already cast-free and remains so.
  • The unit test that covered the universe Reader output now asserts on QuiverQuantCongressUniverse instead of QuiverCongressDataPoint.

Closes #4.

Generated Python stub diff

The following diff is from quantconnect-stubs-generator and shows that the universe class now exposes the per-row fields directly, matching its siblings:

--- /c/Users/Alex/quantconnect-stubs-generator/generated_quiver/quiver_installed_sorted.txt	2026-05-08 21:44:05.867309800 +0100
+++ /c/Users/Alex/quantconnect-stubs-generator/generated_quiver/quiver_generated_sorted.txt	2026-05-08 21:44:05.868312500 +0100
@@ -1197,9 +1197,118 @@
         ...


-class QuiverQuantCongressUniverse(QuantConnect.DataSource.QuiverCongress):
+class QuiverQuantCongressUniverse(QuantConnect.Data.UniverseSelection.BaseDataCollection):
     """Universe Selection helper class for QuiverQuant Congress dataset"""

+    @property
+    def record_date(self) -> datetime.datetime:
+        """The date the transaction was recorded by QuiverQuant. Value will always exist."""
+        ...
+
+    @record_date.setter
+    def record_date(self, value: datetime.datetime) -> None:
+        ...
+
+    @property
+    def updated_at(self) -> datetime.datetime:
+        """The date the recorded transaction was updated by QuiverQuant. Alias for EndTime."""
+        ...
+
+    @property
+    def report_date(self) -> typing.Optional[datetime.datetime]:
+        """The date the transaction was reported. Value will always exist."""
+        ...
+
+    @report_date.setter
+    def report_date(self, value: typing.Optional[datetime.datetime]) -> None:
+        ...
+
+    @property
+    def transaction_date(self) -> datetime.datetime:
+        """The date the transaction took place"""
+        ...
+
+    @transaction_date.setter
+    def transaction_date(self, value: datetime.datetime) -> None:
+        ...
+
+    @property
+    def representative(self) -> str:
+        """The Representative making the transaction"""
+        ...
+
+    @representative.setter
+    def representative(self, value: str) -> None:
+        ...
+
+    @property
+    def transaction(self) -> QuantConnect.Orders.OrderDirection:
+        """The type of transaction"""
+        ...
+
+    @transaction.setter
+    def transaction(self, value: QuantConnect.Orders.OrderDirection) -> None:
+        ...
+
+    @property
+    def amount(self) -> typing.Optional[float]:
+        """The amount of the transaction (in USD). The Representative can report a range (see maximum_amount)."""
+        ...
+
+    @amount.setter
+    def amount(self, value: typing.Optional[float]) -> None:
+        ...
+
+    @property
+    def maximum_amount(self) -> typing.Optional[float]:
+        """The maximum amount of the transaction (in USD). The Representative can report a range (see amount)."""
+        ...
+
+    @maximum_amount.setter
+    def maximum_amount(self, value: typing.Optional[float]) -> None:
+        ...
+
+    @property
+    def house(self) -> QuantConnect.DataSource.Congress:
+        """The Chamber of Congress that the trader belongs to"""
+        ...
+
+    @house.setter
+    def house(self, value: QuantConnect.DataSource.Congress) -> None:
+        ...
+
+    @property
+    def party(self) -> QuantConnect.DataSource.Party:
+        """The political party that the trader belongs to"""
+        ...
+
+    @party.setter
+    def party(self, value: QuantConnect.DataSource.Party) -> None:
+        ...
+
+    @property
+    def district(self) -> str:
+        """The district that the trader belongs to (null or empty for Senators)"""
+        ...
+
+    @district.setter
+    def district(self, value: str) -> None:
+        ...
+
+    @property
+    def state(self) -> str:
+        """The state that the trader belongs to"""
+        ...
+
+    @state.setter
+    def state(self, value: str) -> None:
+        ...
+
+    @property
+    def end_time(self) -> datetime.datetime:
+        """Time the data became available"""
+        ...
+
     def clone(self) -> QuantConnect.Data.BaseData:
         """
         Clones the data
@@ -1208,6 +1317,18 @@
         """
         ...

+    def data_time_zone(self) -> typing.Any:
+        """
+        Specifies the data time zone for this data type. This is useful for custom data types
+
+        :returns: The NodaTime.DateTimeZone of this data type.
+        """
+        ...
+
+    def default_resolution(self) -> QuantConnect.Resolution:
+        """Gets the default resolution for this data and security type"""
+        ...
+
     def get_source(self, config: QuantConnect.Data.SubscriptionDataConfig, date: datetime.datetime, is_live_mode: bool) -> QuantConnect.Data.SubscriptionDataSource:
         """
         Return the URL string source of the file. This will be converted to a stream
@@ -1219,6 +1340,15 @@
         """
         ...

+    def is_sparse_data(self) -> bool:
+        """
+        Indicates whether the data is sparse.
+        If true, we disable logging for missing files
+
+        :returns: true.
+        """
+        ...
+
     def reader(self, config: QuantConnect.Data.SubscriptionDataConfig, line: str, date: datetime.datetime, is_live_mode: bool) -> QuantConnect.Data.BaseData:
         """
         Parses the data from the line provided and loads it into LEAN
@@ -1231,12 +1361,8 @@
         """
         ...

-    def requires_mapping(self) -> bool:
-        """
-        Indicates if there is support for mapping
-
-        :returns: True indicates mapping should be used.
-        """
+    def supported_resolutions(self) -> typing.List[QuantConnect.Resolution]:
+        """Gets the supported resolution for this data and security type"""
         ...

     def to_string(self) -> str:

Test plan

  • dotnet test tests/Tests.csproj — 28/28 pass, including QuiverCongressTests.UniverseReaderTest which now asserts on QuiverQuantCongressUniverse instances.
  • Sample selection algorithms compile in C# and Python.
  • Re-run the natural Python pattern from the docs template against mypy --strict to confirm the attr-defined errors quoted in the issue are gone.

…verses

Hoist QuiverCongressDataPoint per-row fields onto QuiverQuantCongressUniverse
and emit instances of the universe class itself from Reader, matching the
pattern used by QuiverInsiderTradingUniverse, QuiverLobbyingUniverse,
QuiverCNBCsUniverse, and QuiverGovernmentContractUniverse. Closes QuantConnect#4.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@AlexCatarino AlexCatarino requested a review from DerekMelchin May 8, 2026 20:52
@DerekMelchin DerekMelchin merged commit 54303b9 into QuantConnect:master May 8, 2026
1 check passed
@AlexCatarino AlexCatarino deleted the bug-congress-universe-stub branch May 12, 2026 10:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

QuiverQuantCongressUniverse stub diverges from other Quiver universe classes — Python

2 participants