laplace-python-sdk 1.2.1__tar.gz → 1.2.2__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.2.1/src/laplace_python_sdk.egg-info → laplace_python_sdk-1.2.2}/PKG-INFO +1 -1
- {laplace_python_sdk-1.2.1 → laplace_python_sdk-1.2.2}/pyproject.toml +3 -3
- {laplace_python_sdk-1.2.1 → laplace_python_sdk-1.2.2}/src/laplace/client.py +2 -0
- {laplace_python_sdk-1.2.1 → laplace_python_sdk-1.2.2}/src/laplace/models.py +63 -0
- laplace_python_sdk-1.2.2/src/laplace/screener.py +65 -0
- {laplace_python_sdk-1.2.1 → laplace_python_sdk-1.2.2/src/laplace_python_sdk.egg-info}/PKG-INFO +1 -1
- {laplace_python_sdk-1.2.1 → laplace_python_sdk-1.2.2}/src/laplace_python_sdk.egg-info/SOURCES.txt +1 -0
- {laplace_python_sdk-1.2.1 → laplace_python_sdk-1.2.2}/LICENSE +0 -0
- {laplace_python_sdk-1.2.1 → laplace_python_sdk-1.2.2}/MANIFEST.in +0 -0
- {laplace_python_sdk-1.2.1 → laplace_python_sdk-1.2.2}/README.md +0 -0
- {laplace_python_sdk-1.2.1 → laplace_python_sdk-1.2.2}/setup.cfg +0 -0
- {laplace_python_sdk-1.2.1 → laplace_python_sdk-1.2.2}/src/laplace/__init__.py +0 -0
- {laplace_python_sdk-1.2.1 → laplace_python_sdk-1.2.2}/src/laplace/base.py +0 -0
- {laplace_python_sdk-1.2.1 → laplace_python_sdk-1.2.2}/src/laplace/brokers.py +0 -0
- {laplace_python_sdk-1.2.1 → laplace_python_sdk-1.2.2}/src/laplace/capital_increase.py +0 -0
- {laplace_python_sdk-1.2.1 → laplace_python_sdk-1.2.2}/src/laplace/collections.py +0 -0
- {laplace_python_sdk-1.2.1 → laplace_python_sdk-1.2.2}/src/laplace/earnings.py +0 -0
- {laplace_python_sdk-1.2.1 → laplace_python_sdk-1.2.2}/src/laplace/financials.py +0 -0
- {laplace_python_sdk-1.2.1 → laplace_python_sdk-1.2.2}/src/laplace/funds.py +0 -0
- {laplace_python_sdk-1.2.1 → laplace_python_sdk-1.2.2}/src/laplace/live_price.py +0 -0
- {laplace_python_sdk-1.2.1 → laplace_python_sdk-1.2.2}/src/laplace/news.py +0 -0
- {laplace_python_sdk-1.2.1 → laplace_python_sdk-1.2.2}/src/laplace/politician.py +0 -0
- {laplace_python_sdk-1.2.1 → laplace_python_sdk-1.2.2}/src/laplace/search.py +0 -0
- {laplace_python_sdk-1.2.1 → laplace_python_sdk-1.2.2}/src/laplace/state.py +0 -0
- {laplace_python_sdk-1.2.1 → laplace_python_sdk-1.2.2}/src/laplace/stocks.py +0 -0
- {laplace_python_sdk-1.2.1 → laplace_python_sdk-1.2.2}/src/laplace/websocket.py +0 -0
- {laplace_python_sdk-1.2.1 → laplace_python_sdk-1.2.2}/src/laplace_python_sdk.egg-info/dependency_links.txt +0 -0
- {laplace_python_sdk-1.2.1 → laplace_python_sdk-1.2.2}/src/laplace_python_sdk.egg-info/requires.txt +0 -0
- {laplace_python_sdk-1.2.1 → laplace_python_sdk-1.2.2}/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.2.
|
|
7
|
+
version = "1.2.2"
|
|
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.2.
|
|
67
|
+
python_version = "1.2.2"
|
|
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.2.
|
|
74
|
+
target-version = "1.2.2"
|
|
75
75
|
|
|
76
76
|
[tool.ruff.lint]
|
|
77
77
|
select = ["E", "W", "F", "I", "N", "B", "UP"]
|
|
@@ -10,6 +10,7 @@ from .financials import FinancialsClient
|
|
|
10
10
|
from .funds import FundsClient
|
|
11
11
|
from .live_price import LivePriceClient
|
|
12
12
|
from .politician import PoliticianClient
|
|
13
|
+
from .screener import ScreenerClient
|
|
13
14
|
from .search import SearchClient
|
|
14
15
|
from .state import StateClient
|
|
15
16
|
from .stocks import StocksClient
|
|
@@ -42,6 +43,7 @@ class LaplaceClient(BaseClient):
|
|
|
42
43
|
self.search = SearchClient(self)
|
|
43
44
|
self.state = StateClient(self)
|
|
44
45
|
self.news = NewsClient(self)
|
|
46
|
+
self.screener = ScreenerClient(self)
|
|
45
47
|
|
|
46
48
|
# WebSocket client will be created on demand
|
|
47
49
|
self._websocket_client: Optional[LivePriceWebSocketClient] = None
|
|
@@ -939,6 +939,69 @@ class NewsHighlight(BaseModel):
|
|
|
939
939
|
|
|
940
940
|
model_config = {"populate_by_name": True}
|
|
941
941
|
|
|
942
|
+
class ScreenerRangeFilter(BaseModel):
|
|
943
|
+
"""Min/max numeric range filter for the screener."""
|
|
944
|
+
|
|
945
|
+
min: Optional[float] = None
|
|
946
|
+
max: Optional[float] = None
|
|
947
|
+
|
|
948
|
+
|
|
949
|
+
class ScreenerFilters(BaseModel):
|
|
950
|
+
"""Filters accepted by the screener endpoint."""
|
|
951
|
+
|
|
952
|
+
price: Optional[ScreenerRangeFilter] = None
|
|
953
|
+
daily_change: Optional[ScreenerRangeFilter] = Field(default=None, alias="dailyChange")
|
|
954
|
+
pe_ratio: Optional[ScreenerRangeFilter] = Field(default=None, alias="peRatio")
|
|
955
|
+
pb_ratio: Optional[ScreenerRangeFilter] = Field(default=None, alias="pbRatio")
|
|
956
|
+
market_cap: Optional[ScreenerRangeFilter] = Field(default=None, alias="marketCap")
|
|
957
|
+
weekly_return: Optional[ScreenerRangeFilter] = Field(default=None, alias="weeklyReturn")
|
|
958
|
+
monthly_return: Optional[ScreenerRangeFilter] = Field(default=None, alias="monthlyReturn")
|
|
959
|
+
three_month_return: Optional[ScreenerRangeFilter] = Field(default=None, alias="threeMonthReturn")
|
|
960
|
+
yearly_return: Optional[ScreenerRangeFilter] = Field(default=None, alias="yearlyReturn")
|
|
961
|
+
three_year_return: Optional[ScreenerRangeFilter] = Field(default=None, alias="threeYearReturn")
|
|
962
|
+
five_year_return: Optional[ScreenerRangeFilter] = Field(default=None, alias="fiveYearReturn")
|
|
963
|
+
ytd_return: Optional[ScreenerRangeFilter] = Field(default=None, alias="ytdReturn")
|
|
964
|
+
|
|
965
|
+
model_config = {"populate_by_name": True}
|
|
966
|
+
|
|
967
|
+
|
|
968
|
+
class ScreenerSortBy(str, Enum):
|
|
969
|
+
"""Sort fields supported by the screener endpoint."""
|
|
970
|
+
|
|
971
|
+
PRICE = "price"
|
|
972
|
+
DAILY_CHANGE = "dailyChange"
|
|
973
|
+
MARKET_CAP = "marketCap"
|
|
974
|
+
PE_RATIO = "peRatio"
|
|
975
|
+
PB_RATIO = "pbRatio"
|
|
976
|
+
WEEKLY_RETURN = "weeklyReturn"
|
|
977
|
+
MONTHLY_RETURN = "monthlyReturn"
|
|
978
|
+
THREE_MONTH_RETURN = "threeMonthReturn"
|
|
979
|
+
YEARLY_RETURN = "yearlyReturn"
|
|
980
|
+
THREE_YEAR_RETURN = "threeYearReturn"
|
|
981
|
+
FIVE_YEAR_RETURN = "fiveYearReturn"
|
|
982
|
+
YTD_RETURN = "ytdReturn"
|
|
983
|
+
|
|
984
|
+
|
|
985
|
+
class ScreenerStock(BaseModel):
|
|
986
|
+
"""A single stock entry returned by the screener endpoint."""
|
|
987
|
+
|
|
988
|
+
symbol: str
|
|
989
|
+
price: Optional[float] = None
|
|
990
|
+
daily_change: Optional[float] = Field(default=None, alias="dailyChange")
|
|
991
|
+
market_cap: Optional[float] = Field(default=None, alias="marketCap")
|
|
992
|
+
pe_ratio: Optional[float] = Field(default=None, alias="peRatio")
|
|
993
|
+
pb_ratio: Optional[float] = Field(default=None, alias="pbRatio")
|
|
994
|
+
weekly_return: Optional[float] = Field(default=None, alias="weeklyReturn")
|
|
995
|
+
monthly_return: Optional[float] = Field(default=None, alias="monthlyReturn")
|
|
996
|
+
three_month_return: Optional[float] = Field(default=None, alias="threeMonthReturn")
|
|
997
|
+
yearly_return: Optional[float] = Field(default=None, alias="yearlyReturn")
|
|
998
|
+
three_year_return: Optional[float] = Field(default=None, alias="threeYearReturn")
|
|
999
|
+
five_year_return: Optional[float] = Field(default=None, alias="fiveYearReturn")
|
|
1000
|
+
ytd_return: Optional[float] = Field(default=None, alias="ytdReturn")
|
|
1001
|
+
|
|
1002
|
+
model_config = {"populate_by_name": True}
|
|
1003
|
+
|
|
1004
|
+
|
|
942
1005
|
class WebsocketMonthlyUsageDataResponse(BaseModel):
|
|
943
1006
|
external_user_id: str = Field(alias="externalUserID")
|
|
944
1007
|
first_connection_time: datetime = Field(alias="firstConnectionTime")
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
"""Screener client for Laplace API."""
|
|
2
|
+
|
|
3
|
+
from typing import Optional
|
|
4
|
+
|
|
5
|
+
from laplace.base import BaseClient
|
|
6
|
+
|
|
7
|
+
from .models import (
|
|
8
|
+
PaginatedResponse,
|
|
9
|
+
Region,
|
|
10
|
+
ScreenerFilters,
|
|
11
|
+
ScreenerSortBy,
|
|
12
|
+
ScreenerStock,
|
|
13
|
+
SortDirection,
|
|
14
|
+
)
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
class ScreenerClient:
|
|
18
|
+
"""Client for the stock screener endpoint."""
|
|
19
|
+
|
|
20
|
+
def __init__(self, base_client: BaseClient):
|
|
21
|
+
self._client = base_client
|
|
22
|
+
|
|
23
|
+
def screen(
|
|
24
|
+
self,
|
|
25
|
+
region: Region = Region.TR,
|
|
26
|
+
filters: Optional[ScreenerFilters] = None,
|
|
27
|
+
sort_by: Optional[ScreenerSortBy] = None,
|
|
28
|
+
sort_order: Optional[SortDirection] = None,
|
|
29
|
+
page: int = 1,
|
|
30
|
+
page_size: int = 20,
|
|
31
|
+
) -> PaginatedResponse[ScreenerStock]:
|
|
32
|
+
"""Run the screener with optional filters, sorting, and pagination.
|
|
33
|
+
|
|
34
|
+
Args:
|
|
35
|
+
region: Region (only 'tr' is currently supported).
|
|
36
|
+
filters: Optional filter ranges (price, P/E, returns, etc.).
|
|
37
|
+
sort_by: Optional sort field.
|
|
38
|
+
sort_order: Optional sort direction.
|
|
39
|
+
page: Page number, 1-based (1-10000, default 1).
|
|
40
|
+
page_size: Results per page (1-100, default 20).
|
|
41
|
+
|
|
42
|
+
Returns:
|
|
43
|
+
PaginatedResponse[ScreenerStock]
|
|
44
|
+
"""
|
|
45
|
+
if region != Region.TR:
|
|
46
|
+
raise ValueError("Screener endpoint only supports the 'tr' region")
|
|
47
|
+
|
|
48
|
+
body: dict = {"page": page, "pageSize": page_size}
|
|
49
|
+
|
|
50
|
+
if filters is not None:
|
|
51
|
+
filters_body = filters.model_dump(by_alias=True, exclude_none=True)
|
|
52
|
+
if filters_body:
|
|
53
|
+
body["filters"] = filters_body
|
|
54
|
+
if sort_by is not None:
|
|
55
|
+
body["sortBy"] = sort_by.value
|
|
56
|
+
if sort_order is not None:
|
|
57
|
+
body["sortOrder"] = sort_order.value
|
|
58
|
+
|
|
59
|
+
response = self._client._request(
|
|
60
|
+
"POST",
|
|
61
|
+
"v1/screener",
|
|
62
|
+
params={"region": region.value},
|
|
63
|
+
json=body,
|
|
64
|
+
)
|
|
65
|
+
return PaginatedResponse[ScreenerStock](**response)
|
|
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.2.1 → laplace_python_sdk-1.2.2}/src/laplace_python_sdk.egg-info/requires.txt
RENAMED
|
File without changes
|
{laplace_python_sdk-1.2.1 → laplace_python_sdk-1.2.2}/src/laplace_python_sdk.egg-info/top_level.txt
RENAMED
|
File without changes
|