pypsx 2.6.4__tar.gz → 2.7.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.
Files changed (38) hide show
  1. {pypsx-2.6.4 → pypsx-2.7.0}/PKG-INFO +1 -1
  2. {pypsx-2.6.4 → pypsx-2.7.0}/pyproject.toml +1 -1
  3. {pypsx-2.6.4 → pypsx-2.7.0}/pypsx/__init__.py +39 -1
  4. {pypsx-2.6.4 → pypsx-2.7.0}/pypsx/__init__.pyi +35 -0
  5. {pypsx-2.6.4 → pypsx-2.7.0}/MANIFEST.in +0 -0
  6. {pypsx-2.6.4 → pypsx-2.7.0}/README.md +0 -0
  7. {pypsx-2.6.4 → pypsx-2.7.0}/pypsx/auth.pyi +0 -0
  8. {pypsx-2.6.4 → pypsx-2.7.0}/pypsx/cli/__init__.py +0 -0
  9. {pypsx-2.6.4 → pypsx-2.7.0}/pypsx/client.pyi +0 -0
  10. {pypsx-2.6.4 → pypsx-2.7.0}/pypsx/dashboard/__init__.py +0 -0
  11. {pypsx-2.6.4 → pypsx-2.7.0}/pypsx/dashboard/assets/dashboard.css +0 -0
  12. {pypsx-2.6.4 → pypsx-2.7.0}/pypsx/dashboard/assets/dashboard.js +0 -0
  13. {pypsx-2.6.4 → pypsx-2.7.0}/pypsx/dashboard/assets/index.html +0 -0
  14. {pypsx-2.6.4 → pypsx-2.7.0}/pypsx/data/__init__.py +0 -0
  15. {pypsx-2.6.4 → pypsx-2.7.0}/pypsx/data/cache/__init__.py +0 -0
  16. {pypsx-2.6.4 → pypsx-2.7.0}/pypsx/data/provider.pyi +0 -0
  17. {pypsx-2.6.4 → pypsx-2.7.0}/pypsx/py.typed +0 -0
  18. {pypsx-2.6.4 → pypsx-2.7.0}/pypsx/reference/__init__.py +0 -0
  19. {pypsx-2.6.4 → pypsx-2.7.0}/pypsx/reference/indices_sectors_constituents.json +0 -0
  20. {pypsx-2.6.4 → pypsx-2.7.0}/pypsx/sdk.pyi +0 -0
  21. {pypsx-2.6.4 → pypsx-2.7.0}/pypsx/strategy.pyi +0 -0
  22. {pypsx-2.6.4 → pypsx-2.7.0}/pypsx/trader.pyi +0 -0
  23. {pypsx-2.6.4 → pypsx-2.7.0}/pypsx/trader_core/__init__.py +0 -0
  24. {pypsx-2.6.4 → pypsx-2.7.0}/pypsx/trader_core/backtesting/__init__.py +0 -0
  25. {pypsx-2.6.4 → pypsx-2.7.0}/pypsx/trader_core/data/__init__.py +0 -0
  26. {pypsx-2.6.4 → pypsx-2.7.0}/pypsx/trader_core/execution/__init__.py +0 -0
  27. {pypsx-2.6.4 → pypsx-2.7.0}/pypsx/trader_core/portfolio/__init__.py +0 -0
  28. {pypsx-2.6.4 → pypsx-2.7.0}/pypsx/trader_core/strategies/__init__.py +0 -0
  29. {pypsx-2.6.4 → pypsx-2.7.0}/pypsx/trader_core/utils/__init__.py +0 -0
  30. {pypsx-2.6.4 → pypsx-2.7.0}/pypsx/universe.pyi +0 -0
  31. {pypsx-2.6.4 → pypsx-2.7.0}/pypsx/utils/__init__.py +0 -0
  32. {pypsx-2.6.4 → pypsx-2.7.0}/pypsx/utils/enums.py +0 -0
  33. {pypsx-2.6.4 → pypsx-2.7.0}/pypsx/utils/enums.pyi +0 -0
  34. {pypsx-2.6.4 → pypsx-2.7.0}/pypsx/utils/exceptions.py +0 -0
  35. {pypsx-2.6.4 → pypsx-2.7.0}/pypsx/utils/exceptions.pyi +0 -0
  36. {pypsx-2.6.4 → pypsx-2.7.0}/pypsx.egg-info/SOURCES.txt +0 -0
  37. {pypsx-2.6.4 → pypsx-2.7.0}/setup.cfg +0 -0
  38. {pypsx-2.6.4 → pypsx-2.7.0}/setup.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: pypsx
3
- Version: 2.6.4
3
+ Version: 2.7.0
4
4
  Summary: Pakistan Stock Exchange (PSX) Trading SDK for Paper Trading and Backtesting
5
5
  Author: PyPSX Team
6
6
  License: Proprietary
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "pypsx"
7
- version = "2.6.4"
7
+ version = "2.7.0"
8
8
  description = "Pakistan Stock Exchange (PSX) Trading SDK for Paper Trading and Backtesting"
9
9
  readme = "README.md"
10
10
  requires-python = ">=3.10"
@@ -37,6 +37,15 @@ from .universe import (
37
37
  # from pypsx.utils. PyPSXError is the base class for every pypsx exception.
38
38
  from .utils.exceptions import PyPSXError, UniverseDataError
39
39
 
40
+ # PSX history archive functions, imported on first use (see __getattr__ below).
41
+ _ARCHIVE_NAMES = frozenset({
42
+ "ArchiveError", "RateLimitError", "get_historical", "get_corporate_actions", "get_announcements", "get_companies", "get_calendar",
43
+ "get_indices", "get_index_history", "get_index_members", "get_intraday_archive", "get_intraday_sessions",
44
+ "get_fundamentals", "get_futures_open_interest", "get_futures_position_limits", "get_var_haircuts",
45
+ "get_circuit_limits", "get_post_close", "get_block_trades", "get_margin_trading", "get_market_workbook",
46
+ "get_archive_status",
47
+ })
48
+
40
49
  # Deprecated: Trader class for local execution (kept for backward compatibility)
41
50
  # Lazy imports to avoid loading trader_core (which imports backtesting engine)
42
51
  # when backend only needs data services like PyPSXService
@@ -91,6 +100,12 @@ def __getattr__(name: str):
91
100
  # Simplified public API (pypsx.api) - one-line data fetching and backtesting.
92
101
  # BacktestResult is the documented return type of backtest(); users need it
93
102
  # for isinstance checks and type annotations.
103
+ # PSX history archive (pypsx/archive.py): a thin client for the server's /v1 archive API.
104
+ if name in _ARCHIVE_NAMES:
105
+ from . import archive
106
+ obj = getattr(archive, name)
107
+ setattr(module, name, obj)
108
+ return obj
94
109
  if name in (
95
110
  "download",
96
111
  "get_ohlcv",
@@ -118,7 +133,7 @@ def __getattr__(name: str):
118
133
  # PortfolioService,
119
134
  # )
120
135
 
121
- __version__ = "2.6.4"
136
+ __version__ = "2.7.0"
122
137
 
123
138
  __all__ = [
124
139
  # Primary API - account-aware client
@@ -148,6 +163,29 @@ __all__ = [
148
163
  "get_market_depth",
149
164
  "backtest",
150
165
  "BacktestResult",
166
+ # PSX history archive (1998-today history, corporate actions, indices, intraday archive, market activity)
167
+ "ArchiveError",
168
+ "RateLimitError",
169
+ "get_historical",
170
+ "get_corporate_actions",
171
+ "get_announcements",
172
+ "get_companies",
173
+ "get_calendar",
174
+ "get_indices",
175
+ "get_index_history",
176
+ "get_index_members",
177
+ "get_intraday_archive",
178
+ "get_intraday_sessions",
179
+ "get_fundamentals",
180
+ "get_futures_open_interest",
181
+ "get_futures_position_limits",
182
+ "get_var_haircuts",
183
+ "get_circuit_limits",
184
+ "get_post_close",
185
+ "get_block_trades",
186
+ "get_margin_trading",
187
+ "get_market_workbook",
188
+ "get_archive_status",
151
189
  # Utilities
152
190
  "indicators",
153
191
  "validation",
@@ -27,6 +27,7 @@ def download(
27
27
  end: str | None = ...,
28
28
  period: str | None = ...,
29
29
  interval: str = ...,
30
+ adjust_splits: bool = ...,
30
31
  ) -> _pd.DataFrame: ...
31
32
  def get_ohlcv(
32
33
  symbols,
@@ -34,6 +35,7 @@ def get_ohlcv(
34
35
  end: str | None = ...,
35
36
  period: str | None = ...,
36
37
  interval: str = ...,
38
+ adjust_splits: bool = ...,
37
39
  ) -> _pd.DataFrame: ...
38
40
  def get_intraday(
39
41
  symbols,
@@ -41,7 +43,40 @@ def get_intraday(
41
43
  end: str | None = ...,
42
44
  period: str | None = ...,
43
45
  interval: str = ...,
46
+ session_date: str | None = ...,
44
47
  ) -> _pd.DataFrame: ...
48
+
49
+ # PSX history archive (pypsx/archive.py): thin client of the server's /v1 archive API.
50
+ import datetime as _dt
51
+ from typing import Any as _Any, Union as _Union
52
+ _DateLike = _Union[str, _dt.date, _dt.datetime, None]
53
+ class ArchiveError(Exception):
54
+ detail: str
55
+ status_code: int | None
56
+ class RateLimitError(Exception):
57
+ retry_after: float | None
58
+ limit: _Any
59
+ resource: _Any
60
+ def get_historical(symbol: str, start: _DateLike = ..., end: _DateLike = ..., adjust_splits: bool = ..., total_return: bool = ..., dividends: bool = ..., *, max_rows: int = ...) -> _pd.DataFrame: ...
61
+ def get_corporate_actions(symbol: str | None = ..., start: _DateLike = ..., end: _DateLike = ..., kind: str | None = ..., include_quarantined: bool = ..., *, max_rows: int = ...) -> _pd.DataFrame: ...
62
+ def get_announcements(symbol: str, start: _DateLike = ..., end: _DateLike = ..., contains: str | None = ..., *, max_rows: int = ...) -> _pd.DataFrame: ...
63
+ def get_companies(q: str | None = ..., listed: bool | None = ..., *, max_rows: int = ...) -> _pd.DataFrame: ...
64
+ def get_calendar(start: _DateLike = ..., end: _DateLike = ...) -> _pd.DataFrame: ...
65
+ def get_indices() -> _pd.DataFrame: ...
66
+ def get_index_history(index: str, start: _DateLike = ..., end: _DateLike = ..., *, max_rows: int = ...) -> _pd.DataFrame: ...
67
+ def get_index_members(index: str, date: _DateLike = ...) -> _pd.DataFrame: ...
68
+ def get_intraday_archive(symbol: str, session_date: _DateLike) -> _pd.DataFrame: ...
69
+ def get_intraday_sessions(symbol: str) -> _pd.DataFrame: ...
70
+ def get_fundamentals(symbol: str, statement: str | None = ..., wide: bool = ...) -> _pd.DataFrame: ...
71
+ def get_futures_open_interest(symbol: str, start: _DateLike = ..., end: _DateLike = ..., date: _DateLike = ..., *, detail: bool = ..., max_rows: int = ...) -> _pd.DataFrame: ...
72
+ def get_futures_position_limits(symbol: str, start: _DateLike = ..., end: _DateLike = ..., date: _DateLike = ..., *, max_rows: int = ...) -> _pd.DataFrame: ...
73
+ def get_var_haircuts(symbol: str | None = ..., start: _DateLike = ..., end: _DateLike = ..., date: _DateLike = ..., *, max_rows: int = ...) -> _pd.DataFrame: ...
74
+ def get_circuit_limits(symbol: str | None = ..., start: _DateLike = ..., end: _DateLike = ..., date: _DateLike = ..., market: str | None = ..., *, max_rows: int = ...) -> _pd.DataFrame: ...
75
+ def get_post_close(symbol: str | None = ..., start: _DateLike = ..., end: _DateLike = ..., date: _DateLike = ..., *, max_rows: int = ...) -> _pd.DataFrame: ...
76
+ def get_block_trades(date: _DateLike = ..., symbol: str | None = ..., start: _DateLike = ..., end: _DateLike = ..., *, max_rows: int = ...) -> _pd.DataFrame: ...
77
+ def get_margin_trading(symbol: str | None = ..., start: _DateLike = ..., end: _DateLike = ..., date: _DateLike = ..., kind: str = ..., *, max_rows: int = ...) -> _pd.DataFrame: ...
78
+ def get_market_workbook(year: int | None = ..., sheet: str | None = ...) -> _pd.DataFrame: ...
79
+ def get_archive_status() -> dict[str, _Any]: ...
45
80
  def get_quote(symbol: str) -> dict: ...
46
81
  def get_market_depth(symbol: str) -> dict: ...
47
82
  def backtest(
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
File without changes
File without changes