1313from rtbnext .endpoint .profile import ProfileEntity
1414from rtbnext .resource .base import Resource
1515from rtbnext .resource .collectable import CollectableResource
16+ from rtbnext .resource .series import TimeSeriesResource
1617from rtbnext .schema .stats import (
17- DBStats , GlobalStats , ProfileStats , Scatter , ScatterItem , Top10 , WealthStats , HistoryItem , History
18+ DBStats , GlobalStats , History , HistoryItem , ProfileStats , Scatter , ScatterItem , Top10 ,
19+ WealthStats
1820)
1921
2022HistoryPoint = TypedDict ( "HistoryPoint" , {
@@ -38,7 +40,7 @@ class StatsEndpoint( EndpointBase ):
3840
3941 def _point ( self , point : HistoryItem ) -> HistoryPoint :
4042 """Converts a raw history row into a typed history point."""
41-
43+
4244 date , count , total , woman , quote , change , percent = point
4345
4446 return {
@@ -78,6 +80,12 @@ def wealth( self ) -> Resource[ WealthStats ]:
7880
7981 return self ._resource ( "v2/stats/wealth.json" )
8082
83+ @property
84+ def history ( self ) -> TimeSeriesResource [ History , HistoryPoint ]:
85+ """Returns the historical stats time series resource."""
86+
87+ return self ._series ( "v2/stats/history.csv" , point = self ._point )
88+
8189 @property
8290 def top10 ( self ) -> Resource [ Top10 ]:
8391 """Returns the top 10 billionaires list resource."""
0 commit comments