laplace-python-sdk 1.3.0__tar.gz → 1.5.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {laplace_python_sdk-1.3.0/src/laplace_python_sdk.egg-info → laplace_python_sdk-1.5.0}/PKG-INFO +1 -1
- {laplace_python_sdk-1.3.0 → laplace_python_sdk-1.5.0}/pyproject.toml +3 -3
- {laplace_python_sdk-1.3.0 → laplace_python_sdk-1.5.0}/src/laplace/models.py +47 -2
- {laplace_python_sdk-1.3.0 → laplace_python_sdk-1.5.0}/src/laplace/news.py +208 -56
- {laplace_python_sdk-1.3.0 → laplace_python_sdk-1.5.0/src/laplace_python_sdk.egg-info}/PKG-INFO +1 -1
- {laplace_python_sdk-1.3.0 → laplace_python_sdk-1.5.0}/LICENSE +0 -0
- {laplace_python_sdk-1.3.0 → laplace_python_sdk-1.5.0}/MANIFEST.in +0 -0
- {laplace_python_sdk-1.3.0 → laplace_python_sdk-1.5.0}/README.md +0 -0
- {laplace_python_sdk-1.3.0 → laplace_python_sdk-1.5.0}/setup.cfg +0 -0
- {laplace_python_sdk-1.3.0 → laplace_python_sdk-1.5.0}/src/laplace/__init__.py +0 -0
- {laplace_python_sdk-1.3.0 → laplace_python_sdk-1.5.0}/src/laplace/base.py +0 -0
- {laplace_python_sdk-1.3.0 → laplace_python_sdk-1.5.0}/src/laplace/brokers.py +0 -0
- {laplace_python_sdk-1.3.0 → laplace_python_sdk-1.5.0}/src/laplace/capital_increase.py +0 -0
- {laplace_python_sdk-1.3.0 → laplace_python_sdk-1.5.0}/src/laplace/client.py +0 -0
- {laplace_python_sdk-1.3.0 → laplace_python_sdk-1.5.0}/src/laplace/collections.py +0 -0
- {laplace_python_sdk-1.3.0 → laplace_python_sdk-1.5.0}/src/laplace/earnings.py +0 -0
- {laplace_python_sdk-1.3.0 → laplace_python_sdk-1.5.0}/src/laplace/financials.py +0 -0
- {laplace_python_sdk-1.3.0 → laplace_python_sdk-1.5.0}/src/laplace/funds.py +0 -0
- {laplace_python_sdk-1.3.0 → laplace_python_sdk-1.5.0}/src/laplace/live_price.py +0 -0
- {laplace_python_sdk-1.3.0 → laplace_python_sdk-1.5.0}/src/laplace/politician.py +0 -0
- {laplace_python_sdk-1.3.0 → laplace_python_sdk-1.5.0}/src/laplace/screener.py +0 -0
- {laplace_python_sdk-1.3.0 → laplace_python_sdk-1.5.0}/src/laplace/search.py +0 -0
- {laplace_python_sdk-1.3.0 → laplace_python_sdk-1.5.0}/src/laplace/state.py +0 -0
- {laplace_python_sdk-1.3.0 → laplace_python_sdk-1.5.0}/src/laplace/stocks.py +0 -0
- {laplace_python_sdk-1.3.0 → laplace_python_sdk-1.5.0}/src/laplace/websocket.py +0 -0
- {laplace_python_sdk-1.3.0 → laplace_python_sdk-1.5.0}/src/laplace_python_sdk.egg-info/SOURCES.txt +0 -0
- {laplace_python_sdk-1.3.0 → laplace_python_sdk-1.5.0}/src/laplace_python_sdk.egg-info/dependency_links.txt +0 -0
- {laplace_python_sdk-1.3.0 → laplace_python_sdk-1.5.0}/src/laplace_python_sdk.egg-info/requires.txt +0 -0
- {laplace_python_sdk-1.3.0 → laplace_python_sdk-1.5.0}/src/laplace_python_sdk.egg-info/top_level.txt +0 -0
|
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
|
|
|
4
4
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "laplace-python-sdk"
|
|
7
|
-
version = "1.
|
|
7
|
+
version = "1.5.0"
|
|
8
8
|
description = "Python SDK for Laplace stock data platform"
|
|
9
9
|
readme = "README.md"
|
|
10
10
|
requires-python = ">=3.8"
|
|
@@ -64,14 +64,14 @@ profile = "black"
|
|
|
64
64
|
line_length = 100
|
|
65
65
|
|
|
66
66
|
[tool.mypy]
|
|
67
|
-
python_version = "1.
|
|
67
|
+
python_version = "1.5.0"
|
|
68
68
|
strict = true
|
|
69
69
|
warn_return_any = true
|
|
70
70
|
warn_unused_configs = true
|
|
71
71
|
|
|
72
72
|
[tool.ruff]
|
|
73
73
|
line-length = 100
|
|
74
|
-
target-version = "1.
|
|
74
|
+
target-version = "1.5.0"
|
|
75
75
|
|
|
76
76
|
[tool.ruff.lint]
|
|
77
77
|
select = ["E", "W", "F", "I", "N", "B", "UP"]
|
|
@@ -847,6 +847,19 @@ class NewsOrderBy(str, Enum):
|
|
|
847
847
|
QUALITY_SCORE = "quality_score"
|
|
848
848
|
|
|
849
849
|
|
|
850
|
+
class NewsLane(str, Enum):
|
|
851
|
+
"""News lane options for the filter-news and stream-news endpoints.
|
|
852
|
+
|
|
853
|
+
Lanes are surface-scoped: ``GLOBAL_MACRO`` and ``FAST_MOVERS`` belong to the
|
|
854
|
+
``us`` region, while ``TR_EKONOMI`` and ``BIST`` belong to the ``tr`` region.
|
|
855
|
+
"""
|
|
856
|
+
|
|
857
|
+
GLOBAL_MACRO = "global_macro"
|
|
858
|
+
TR_EKONOMI = "tr_ekonomi"
|
|
859
|
+
BIST = "bist"
|
|
860
|
+
FAST_MOVERS = "fast_movers"
|
|
861
|
+
|
|
862
|
+
|
|
850
863
|
class NewsTicker(BaseModel):
|
|
851
864
|
id: str
|
|
852
865
|
name: str
|
|
@@ -885,8 +898,36 @@ class NewsCategory(BaseModel):
|
|
|
885
898
|
class NewsCategoryListItem(BaseModel):
|
|
886
899
|
"""A canonical news category as returned by /api/v1/news/categories.
|
|
887
900
|
|
|
888
|
-
The ``
|
|
889
|
-
|
|
901
|
+
The numeric ``id`` is the exact value accepted by the ``categoryIds``
|
|
902
|
+
filter of the filter-news and stream-news endpoints; ``name`` is the
|
|
903
|
+
display name for dropdowns.
|
|
904
|
+
"""
|
|
905
|
+
|
|
906
|
+
id: str
|
|
907
|
+
name: str
|
|
908
|
+
|
|
909
|
+
model_config = {"populate_by_name": True}
|
|
910
|
+
|
|
911
|
+
|
|
912
|
+
class NewsLaneListItem(BaseModel):
|
|
913
|
+
"""A news lane as returned by /api/v1/news/lanes.
|
|
914
|
+
|
|
915
|
+
The ``id`` is the exact value accepted by the ``lane`` filter of the
|
|
916
|
+
filter-news and stream-news endpoints (see :class:`NewsLane`).
|
|
917
|
+
"""
|
|
918
|
+
|
|
919
|
+
id: str
|
|
920
|
+
label: str
|
|
921
|
+
|
|
922
|
+
model_config = {"populate_by_name": True}
|
|
923
|
+
|
|
924
|
+
|
|
925
|
+
class NewsApiSourceListItem(BaseModel):
|
|
926
|
+
"""A configured news source as returned by /api/v1/news/api-source-names.
|
|
927
|
+
|
|
928
|
+
The ``id`` is the exact value accepted by the ``apiSource`` filter of the
|
|
929
|
+
filter-news and stream-news endpoints (comma-separated for multiple);
|
|
930
|
+
``name`` is the display name (e.g. "BBC Business").
|
|
890
931
|
"""
|
|
891
932
|
|
|
892
933
|
id: str
|
|
@@ -942,6 +983,10 @@ class NewsV2(BaseModel):
|
|
|
942
983
|
|
|
943
984
|
model_config = {"populate_by_name": True}
|
|
944
985
|
class NewsHighlight(BaseModel):
|
|
986
|
+
"""A daily categorized news highlight as returned by /api/v1/news/highlights."""
|
|
987
|
+
|
|
988
|
+
id: str
|
|
989
|
+
created_at: datetime = Field(alias="createdAt")
|
|
945
990
|
consumer: List[str]
|
|
946
991
|
energy_and_utilities: List[str] = Field(alias="energyAndUtilities")
|
|
947
992
|
finance: List[str]
|
|
@@ -11,8 +11,11 @@ from .models import (
|
|
|
11
11
|
Locale,
|
|
12
12
|
News,
|
|
13
13
|
NewsV2,
|
|
14
|
+
NewsApiSourceListItem,
|
|
14
15
|
NewsCategoryListItem,
|
|
15
16
|
NewsHighlight,
|
|
17
|
+
NewsLane,
|
|
18
|
+
NewsLaneListItem,
|
|
16
19
|
NewsOrderBy,
|
|
17
20
|
NewsType,
|
|
18
21
|
PaginatedResponse,
|
|
@@ -43,18 +46,22 @@ class NewsStream:
|
|
|
43
46
|
base_client: BaseClient,
|
|
44
47
|
locale: Locale,
|
|
45
48
|
region: Region,
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
49
|
+
lane: Optional[NewsLane] = None,
|
|
50
|
+
symbols: Optional[List[str]] = None,
|
|
51
|
+
category_ids: Optional[List[str]] = None,
|
|
52
|
+
sector_ids: Optional[List[str]] = None,
|
|
53
|
+
industry_ids: Optional[List[str]] = None,
|
|
54
|
+
api_sources: Optional[List[str]] = None,
|
|
50
55
|
):
|
|
51
56
|
self.base_client = base_client
|
|
52
57
|
self.locale = locale
|
|
53
58
|
self.region = region
|
|
54
|
-
self.
|
|
55
|
-
self.
|
|
56
|
-
self.
|
|
57
|
-
self.
|
|
59
|
+
self.lane = lane
|
|
60
|
+
self.symbols = symbols
|
|
61
|
+
self.category_ids = category_ids
|
|
62
|
+
self.sector_ids = sector_ids
|
|
63
|
+
self.industry_ids = industry_ids
|
|
64
|
+
self.api_sources = api_sources
|
|
58
65
|
self._task: Optional[asyncio.Task] = None
|
|
59
66
|
self._queue: Optional[asyncio.Queue[NewsStreamResult[List[NewsV2]]]] = None
|
|
60
67
|
self._is_closed = False
|
|
@@ -106,14 +113,18 @@ class NewsStream:
|
|
|
106
113
|
"""Build the streaming URL for the news endpoint."""
|
|
107
114
|
url = f"{self.base_client.base_url}/v1/news/stream"
|
|
108
115
|
params = {"locale": self.locale, "region": self.region.value}
|
|
109
|
-
if self.
|
|
110
|
-
params["
|
|
111
|
-
if self.
|
|
112
|
-
params["
|
|
113
|
-
if self.
|
|
114
|
-
params["
|
|
115
|
-
if self.
|
|
116
|
-
params["
|
|
116
|
+
if self.lane is not None:
|
|
117
|
+
params["lane"] = self.lane.value
|
|
118
|
+
if self.symbols:
|
|
119
|
+
params["symbols"] = ",".join(self.symbols)
|
|
120
|
+
if self.category_ids:
|
|
121
|
+
params["categoryIds"] = ",".join(self.category_ids)
|
|
122
|
+
if self.sector_ids:
|
|
123
|
+
params["sectorIds"] = ",".join(self.sector_ids)
|
|
124
|
+
if self.industry_ids:
|
|
125
|
+
params["industryIds"] = ",".join(self.industry_ids)
|
|
126
|
+
if self.api_sources:
|
|
127
|
+
params["apiSource"] = ",".join(self.api_sources)
|
|
117
128
|
|
|
118
129
|
query_string = urllib.parse.urlencode(params)
|
|
119
130
|
return f"{url}?{query_string}"
|
|
@@ -198,18 +209,46 @@ class NewsClient:
|
|
|
198
209
|
news_type: Optional[NewsType] = None,
|
|
199
210
|
news_order_by: Optional[NewsOrderBy] = None,
|
|
200
211
|
direction: Optional[SortDirection] = None,
|
|
212
|
+
lane: Optional[NewsLane] = None,
|
|
213
|
+
api_source: Optional[str] = None,
|
|
214
|
+
symbols: Optional[str] = None,
|
|
215
|
+
category_ids: Optional[str] = None,
|
|
216
|
+
sector_ids: Optional[str] = None,
|
|
217
|
+
industry_ids: Optional[str] = None,
|
|
218
|
+
quality_score_min: Optional[int] = None,
|
|
219
|
+
quality_score_max: Optional[int] = None,
|
|
220
|
+
timestamp_from: Optional[str] = None,
|
|
221
|
+
timestamp_to: Optional[str] = None,
|
|
201
222
|
extra_filters: Optional[str] = None,
|
|
202
223
|
page: int = 0,
|
|
203
224
|
page_size: PaginationPageSize = PaginationPageSize.PAGE_SIZE_10,
|
|
204
225
|
) -> PaginatedResponse[News]:
|
|
205
226
|
"""Retrieve paginated news.
|
|
206
227
|
|
|
228
|
+
Within a single filter, comma-separated values are OR-ed; different
|
|
229
|
+
filters are AND-ed together (e.g. ``(AAPL OR MSFT) AND category 1``).
|
|
230
|
+
The taxonomy filters are ID-based: ``category_ids`` takes the numeric
|
|
231
|
+
ids returned by :meth:`get_news_categories`; ``sector_ids`` and
|
|
232
|
+
``industry_ids`` take Laplace sector/industry ids.
|
|
233
|
+
|
|
207
234
|
Args:
|
|
208
235
|
locale: Locale code (e.g. "tr", "en")
|
|
209
236
|
region: Region enum (e.g. Region.TR)
|
|
210
237
|
news_type: Optional news type filter
|
|
211
|
-
news_order_by: Optional sorting field
|
|
238
|
+
news_order_by: Optional sorting field (timestamp, quality_score)
|
|
212
239
|
direction: Optional sort direction
|
|
240
|
+
lane: Optional lane filter. Lanes are region-scoped: US lanes are
|
|
241
|
+
GLOBAL_MACRO and FAST_MOVERS; TR lanes are TR_EKONOMI and BIST.
|
|
242
|
+
api_source: Optional comma-separated source ids from
|
|
243
|
+
:meth:`get_news_api_source_names` (e.g. "BBCBusiness,MarketWatch")
|
|
244
|
+
symbols: Optional comma-separated ticker symbols (e.g. "AAPL,MSFT")
|
|
245
|
+
category_ids: Optional comma-separated numeric category ids (e.g. "1,3")
|
|
246
|
+
sector_ids: Optional comma-separated Laplace sector ids
|
|
247
|
+
industry_ids: Optional comma-separated Laplace industry ids
|
|
248
|
+
quality_score_min: Optional minimum quality score, inclusive (0-10)
|
|
249
|
+
quality_score_max: Optional maximum quality score, inclusive (0-10)
|
|
250
|
+
timestamp_from: Optional start date, inclusive (YYYY-MM-DD)
|
|
251
|
+
timestamp_to: Optional end date, inclusive (YYYY-MM-DD)
|
|
213
252
|
extra_filters: Optional extra filters (API-specific)
|
|
214
253
|
page: Page number (default: 0)
|
|
215
254
|
page_size: Page size enum (default: 10)
|
|
@@ -230,6 +269,26 @@ class NewsClient:
|
|
|
230
269
|
params["orderBy"] = news_order_by.value
|
|
231
270
|
if direction is not None:
|
|
232
271
|
params["orderByDirection"] = direction.value
|
|
272
|
+
if lane is not None:
|
|
273
|
+
params["lane"] = lane.value
|
|
274
|
+
if api_source:
|
|
275
|
+
params["apiSource"] = api_source
|
|
276
|
+
if symbols:
|
|
277
|
+
params["symbols"] = symbols
|
|
278
|
+
if category_ids:
|
|
279
|
+
params["categoryIds"] = category_ids
|
|
280
|
+
if sector_ids:
|
|
281
|
+
params["sectorIds"] = sector_ids
|
|
282
|
+
if industry_ids:
|
|
283
|
+
params["industryIds"] = industry_ids
|
|
284
|
+
if quality_score_min is not None:
|
|
285
|
+
params["qualityScoreMin"] = quality_score_min
|
|
286
|
+
if quality_score_max is not None:
|
|
287
|
+
params["qualityScoreMax"] = quality_score_max
|
|
288
|
+
if timestamp_from:
|
|
289
|
+
params["timestampFrom"] = timestamp_from
|
|
290
|
+
if timestamp_to:
|
|
291
|
+
params["timestampTo"] = timestamp_to
|
|
233
292
|
if extra_filters:
|
|
234
293
|
params["extraFilters"] = extra_filters
|
|
235
294
|
|
|
@@ -243,10 +302,12 @@ class NewsClient:
|
|
|
243
302
|
news_type: Optional[NewsType] = None,
|
|
244
303
|
news_order_by: Optional[NewsOrderBy] = None,
|
|
245
304
|
direction: Optional[SortDirection] = None,
|
|
305
|
+
lane: Optional[NewsLane] = None,
|
|
306
|
+
api_source: Optional[str] = None,
|
|
246
307
|
symbols: Optional[str] = None,
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
308
|
+
category_ids: Optional[str] = None,
|
|
309
|
+
sector_ids: Optional[str] = None,
|
|
310
|
+
industry_ids: Optional[str] = None,
|
|
250
311
|
quality_score_min: Optional[int] = None,
|
|
251
312
|
quality_score_max: Optional[int] = None,
|
|
252
313
|
timestamp_from: Optional[str] = None,
|
|
@@ -257,11 +318,10 @@ class NewsClient:
|
|
|
257
318
|
"""Retrieve paginated news (v2).
|
|
258
319
|
|
|
259
320
|
Within a single filter, comma-separated values are OR-ed; different
|
|
260
|
-
filters are AND-ed together (e.g. ``(AAPL OR MSFT) AND
|
|
261
|
-
The
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
``/api/v1/industry`` ``title``).
|
|
321
|
+
filters are AND-ed together (e.g. ``(AAPL OR MSFT) AND category 1``).
|
|
322
|
+
The taxonomy filters are ID-based: ``category_ids`` takes the numeric
|
|
323
|
+
ids returned by :meth:`get_news_categories`; ``sector_ids`` and
|
|
324
|
+
``industry_ids`` take Laplace sector/industry ids.
|
|
265
325
|
|
|
266
326
|
Args:
|
|
267
327
|
locale: Locale code (e.g. "tr", "en")
|
|
@@ -269,10 +329,14 @@ class NewsClient:
|
|
|
269
329
|
news_type: Optional news type filter
|
|
270
330
|
news_order_by: Optional sorting field (timestamp, quality_score)
|
|
271
331
|
direction: Optional sort direction
|
|
332
|
+
lane: Optional lane filter. Lanes are region-scoped: US lanes are
|
|
333
|
+
GLOBAL_MACRO and FAST_MOVERS; TR lanes are TR_EKONOMI and BIST.
|
|
334
|
+
api_source: Optional comma-separated source ids from
|
|
335
|
+
:meth:`get_news_api_source_names` (e.g. "BBCBusiness,MarketWatch")
|
|
272
336
|
symbols: Optional comma-separated ticker symbols (e.g. "AAPL,MSFT")
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
337
|
+
category_ids: Optional comma-separated numeric category ids (e.g. "1,3")
|
|
338
|
+
sector_ids: Optional comma-separated Laplace sector ids
|
|
339
|
+
industry_ids: Optional comma-separated Laplace industry ids
|
|
276
340
|
quality_score_min: Optional minimum quality score, inclusive (0-10)
|
|
277
341
|
quality_score_max: Optional maximum quality score, inclusive (0-10)
|
|
278
342
|
timestamp_from: Optional start date, inclusive (YYYY-MM-DD)
|
|
@@ -296,14 +360,18 @@ class NewsClient:
|
|
|
296
360
|
params["orderBy"] = news_order_by.value
|
|
297
361
|
if direction is not None:
|
|
298
362
|
params["orderByDirection"] = direction.value
|
|
363
|
+
if lane is not None:
|
|
364
|
+
params["lane"] = lane.value
|
|
365
|
+
if api_source:
|
|
366
|
+
params["apiSource"] = api_source
|
|
299
367
|
if symbols:
|
|
300
368
|
params["symbols"] = symbols
|
|
301
|
-
if
|
|
302
|
-
params["
|
|
303
|
-
if
|
|
304
|
-
params["
|
|
305
|
-
if
|
|
306
|
-
params["
|
|
369
|
+
if category_ids:
|
|
370
|
+
params["categoryIds"] = category_ids
|
|
371
|
+
if sector_ids:
|
|
372
|
+
params["sectorIds"] = sector_ids
|
|
373
|
+
if industry_ids:
|
|
374
|
+
params["industryIds"] = industry_ids
|
|
307
375
|
if quality_score_min is not None:
|
|
308
376
|
params["qualityScoreMin"] = quality_score_min
|
|
309
377
|
if quality_score_max is not None:
|
|
@@ -323,9 +391,10 @@ class NewsClient:
|
|
|
323
391
|
"""Retrieve the full canonical news category list.
|
|
324
392
|
|
|
325
393
|
Always returns every category regardless of whether it currently has
|
|
326
|
-
tagged news, ordered by id ascending. The returned ``
|
|
327
|
-
the exact values accepted by the ``
|
|
328
|
-
:meth:`get_news_v2` and :meth:`get_news_stream
|
|
394
|
+
tagged news, ordered by id ascending. The returned numeric ``id``
|
|
395
|
+
values are the exact values accepted by the ``category_ids`` filter of
|
|
396
|
+
:meth:`get_news`, :meth:`get_news_v2` and :meth:`get_news_stream`;
|
|
397
|
+
``name`` is the display name for dropdowns.
|
|
329
398
|
|
|
330
399
|
Args:
|
|
331
400
|
locale: Optional language code ("tr", "en"). Defaults to "en";
|
|
@@ -341,46 +410,127 @@ class NewsClient:
|
|
|
341
410
|
response = self._client.get("v1/news/categories", params=params)
|
|
342
411
|
return [NewsCategoryListItem(**item) for item in response]
|
|
343
412
|
|
|
413
|
+
def get_news_lanes(
|
|
414
|
+
self,
|
|
415
|
+
region: Optional[Region] = None,
|
|
416
|
+
) -> List[NewsLaneListItem]:
|
|
417
|
+
"""Retrieve the fixed news lane list.
|
|
418
|
+
|
|
419
|
+
Returns every lane (``id`` + ``label``) for building a lane filter. The
|
|
420
|
+
returned ``id`` values are the exact values accepted by the ``lane``
|
|
421
|
+
filter of :meth:`get_news`, :meth:`get_news_v2` and
|
|
422
|
+
:meth:`get_news_stream` (see :class:`~laplace.models.NewsLane`).
|
|
423
|
+
|
|
424
|
+
Args:
|
|
425
|
+
region: Optional region filter; only lanes valid for this region
|
|
426
|
+
|
|
427
|
+
Returns:
|
|
428
|
+
List of NewsLaneListItem
|
|
429
|
+
"""
|
|
430
|
+
params: Dict[str, object] = {}
|
|
431
|
+
if region is not None:
|
|
432
|
+
params["region"] = region.value
|
|
433
|
+
|
|
434
|
+
response = self._client.get("v1/news/lanes", params=params)
|
|
435
|
+
return [NewsLaneListItem(**item) for item in response]
|
|
436
|
+
|
|
437
|
+
def get_news_api_source_names(
|
|
438
|
+
self,
|
|
439
|
+
region: Optional[Region] = None,
|
|
440
|
+
language: Optional[Locale] = None,
|
|
441
|
+
) -> List[NewsApiSourceListItem]:
|
|
442
|
+
"""Retrieve the configured news sources.
|
|
443
|
+
|
|
444
|
+
Returns every source (``id`` + ``name``), registry sources first, then
|
|
445
|
+
any legacy sources still on old rows. The returned ``id`` values are
|
|
446
|
+
the exact values accepted by the ``api_source`` filter of
|
|
447
|
+
:meth:`get_news` and :meth:`get_news_v2` and the ``api_sources``
|
|
448
|
+
filter of :meth:`get_news_stream`; ``name`` is the display name
|
|
449
|
+
(e.g. "BBC Business").
|
|
450
|
+
|
|
451
|
+
Args:
|
|
452
|
+
region: Optional region filter; only sources valid for this region
|
|
453
|
+
language: Optional language filter ("tr", "en"); sources with
|
|
454
|
+
content available in this language
|
|
455
|
+
|
|
456
|
+
Returns:
|
|
457
|
+
List of NewsApiSourceListItem
|
|
458
|
+
"""
|
|
459
|
+
params: Dict[str, object] = {}
|
|
460
|
+
if region is not None:
|
|
461
|
+
params["region"] = region.value
|
|
462
|
+
if language is not None:
|
|
463
|
+
params["language"] = language
|
|
464
|
+
|
|
465
|
+
response = self._client.get("v1/news/api-source-names", params=params)
|
|
466
|
+
return [NewsApiSourceListItem(**item) for item in response]
|
|
467
|
+
|
|
344
468
|
def get_highlights(
|
|
345
469
|
self,
|
|
346
470
|
locale: Locale,
|
|
347
|
-
region: Region
|
|
348
|
-
|
|
349
|
-
|
|
471
|
+
region: Region,
|
|
472
|
+
from_date: Optional[str] = None,
|
|
473
|
+
to_date: Optional[str] = None,
|
|
474
|
+
skip: Optional[int] = None,
|
|
475
|
+
top: Optional[int] = None,
|
|
476
|
+
) -> PaginatedResponse[NewsHighlight]:
|
|
477
|
+
"""Retrieve paginated news highlights, newest first.
|
|
350
478
|
|
|
351
479
|
Args:
|
|
352
480
|
locale: Locale code (e.g. "tr", "en")
|
|
353
|
-
region: Region enum (
|
|
481
|
+
region: Region enum (must be Region.US; "tr" is rejected)
|
|
482
|
+
from_date: Optional lower bound, inclusive (YYYY-MM-DD); lists
|
|
483
|
+
highlights created on/after this date
|
|
484
|
+
to_date: Optional upper bound, inclusive of the day (YYYY-MM-DD)
|
|
485
|
+
skip: Optional pagination offset
|
|
486
|
+
top: Optional page size (1-20)
|
|
354
487
|
|
|
355
488
|
Returns:
|
|
356
|
-
NewsHighlight
|
|
489
|
+
PaginatedResponse[NewsHighlight]
|
|
357
490
|
"""
|
|
358
491
|
params: Dict[str, object] = {
|
|
359
492
|
"locale": locale,
|
|
360
|
-
"region": region.value
|
|
493
|
+
"region": region.value,
|
|
361
494
|
}
|
|
362
495
|
|
|
496
|
+
if from_date:
|
|
497
|
+
params["from"] = from_date
|
|
498
|
+
if to_date:
|
|
499
|
+
params["to"] = to_date
|
|
500
|
+
if skip is not None:
|
|
501
|
+
params["skip"] = skip
|
|
502
|
+
if top is not None:
|
|
503
|
+
params["top"] = top
|
|
504
|
+
|
|
363
505
|
response = self._client.get("v1/news/highlights", params=params)
|
|
364
|
-
return NewsHighlight(**response)
|
|
506
|
+
return PaginatedResponse[NewsHighlight](**response)
|
|
365
507
|
|
|
366
508
|
async def get_news_stream(
|
|
367
509
|
self,
|
|
368
510
|
locale: Locale,
|
|
369
511
|
region: Region,
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
512
|
+
lane: Optional[NewsLane] = None,
|
|
513
|
+
symbols: Optional[List[str]] = None,
|
|
514
|
+
category_ids: Optional[List[str]] = None,
|
|
515
|
+
sector_ids: Optional[List[str]] = None,
|
|
516
|
+
industry_ids: Optional[List[str]] = None,
|
|
517
|
+
api_sources: Optional[List[str]] = None,
|
|
374
518
|
) -> NewsStream:
|
|
375
519
|
"""Start streaming news updates.
|
|
376
520
|
|
|
377
521
|
Args:
|
|
378
522
|
locale: Locale code (e.g., "tr", "en")
|
|
379
523
|
region: Region enum (e.g. Region.TR)
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
524
|
+
lane: Optional lane filter. Lanes are region-scoped: US lanes are
|
|
525
|
+
GLOBAL_MACRO and FAST_MOVERS; TR lanes are TR_EKONOMI and BIST.
|
|
526
|
+
symbols: Optional list of ticker symbols (same param as filter-news)
|
|
527
|
+
category_ids: Optional list of numeric category ids from
|
|
528
|
+
:meth:`get_news_categories`
|
|
529
|
+
sector_ids: Optional list of Laplace sector ids
|
|
530
|
+
industry_ids: Optional list of Laplace industry ids
|
|
531
|
+
api_sources: Optional list of source ids from
|
|
532
|
+
:meth:`get_news_api_source_names`; only these sources are
|
|
533
|
+
streamed
|
|
384
534
|
|
|
385
535
|
Returns:
|
|
386
536
|
NewsStream for consuming news items
|
|
@@ -389,10 +539,12 @@ class NewsClient:
|
|
|
389
539
|
self._client,
|
|
390
540
|
locale,
|
|
391
541
|
region,
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
542
|
+
lane=lane,
|
|
543
|
+
symbols=symbols,
|
|
544
|
+
category_ids=category_ids,
|
|
545
|
+
sector_ids=sector_ids,
|
|
546
|
+
industry_ids=industry_ids,
|
|
547
|
+
api_sources=api_sources,
|
|
396
548
|
)
|
|
397
549
|
await stream.subscribe()
|
|
398
550
|
return stream
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{laplace_python_sdk-1.3.0 → laplace_python_sdk-1.5.0}/src/laplace_python_sdk.egg-info/SOURCES.txt
RENAMED
|
File without changes
|
|
File without changes
|
{laplace_python_sdk-1.3.0 → laplace_python_sdk-1.5.0}/src/laplace_python_sdk.egg-info/requires.txt
RENAMED
|
File without changes
|
{laplace_python_sdk-1.3.0 → laplace_python_sdk-1.5.0}/src/laplace_python_sdk.egg-info/top_level.txt
RENAMED
|
File without changes
|