pypsx-toolkit 3.0.4__tar.gz → 3.1.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.
- {pypsx_toolkit-3.0.4 → pypsx_toolkit-3.1.0}/PKG-INFO +27 -21
- {pypsx_toolkit-3.0.4 → pypsx_toolkit-3.1.0}/README.md +22 -18
- {pypsx_toolkit-3.0.4 → pypsx_toolkit-3.1.0}/pyproject.toml +9 -3
- {pypsx_toolkit-3.0.4 → pypsx_toolkit-3.1.0}/pypsx_toolkit/__init__.py +1 -1
- {pypsx_toolkit-3.0.4 → pypsx_toolkit-3.1.0}/pypsx_toolkit/api.pyi +10 -2
- {pypsx_toolkit-3.0.4 → pypsx_toolkit-3.1.0}/setup.py +21 -0
- {pypsx_toolkit-3.0.4 → pypsx_toolkit-3.1.0}/LICENSE +0 -0
- {pypsx_toolkit-3.0.4 → pypsx_toolkit-3.1.0}/MANIFEST.in +0 -0
- {pypsx_toolkit-3.0.4 → pypsx_toolkit-3.1.0}/pypsx_toolkit/__init__.pyi +0 -0
- {pypsx_toolkit-3.0.4 → pypsx_toolkit-3.1.0}/pypsx_toolkit/analysis/__init__.py +0 -0
- {pypsx_toolkit-3.0.4 → pypsx_toolkit-3.1.0}/pypsx_toolkit/analysis/__init__.pyi +0 -0
- {pypsx_toolkit-3.0.4 → pypsx_toolkit-3.1.0}/pypsx_toolkit/core/__init__.py +0 -0
- {pypsx_toolkit-3.0.4 → pypsx_toolkit-3.1.0}/pypsx_toolkit/core/errors.pyi +0 -0
- {pypsx_toolkit-3.0.4 → pypsx_toolkit-3.1.0}/pypsx_toolkit/core/stream.pyi +0 -0
- {pypsx_toolkit-3.0.4 → pypsx_toolkit-3.1.0}/pypsx_toolkit/endpoints/__init__.py +0 -0
- {pypsx_toolkit-3.0.4 → pypsx_toolkit-3.1.0}/pypsx_toolkit/endpoints/constants.py +0 -0
- {pypsx_toolkit-3.0.4 → pypsx_toolkit-3.1.0}/pypsx_toolkit/format/__init__.py +0 -0
- {pypsx_toolkit-3.0.4 → pypsx_toolkit-3.1.0}/pypsx_toolkit/market.pyi +0 -0
- {pypsx_toolkit-3.0.4 → pypsx_toolkit-3.1.0}/pypsx_toolkit/models.py +0 -0
- {pypsx_toolkit-3.0.4 → pypsx_toolkit-3.1.0}/pypsx_toolkit/models.pyi +0 -0
- {pypsx_toolkit-3.0.4 → pypsx_toolkit-3.1.0}/pypsx_toolkit/py.typed +0 -0
- {pypsx_toolkit-3.0.4 → pypsx_toolkit-3.1.0}/pypsx_toolkit/ticker.pyi +0 -0
- {pypsx_toolkit-3.0.4 → pypsx_toolkit-3.1.0}/pypsx_toolkit.egg-info/SOURCES.txt +0 -0
- {pypsx_toolkit-3.0.4 → pypsx_toolkit-3.1.0}/setup.cfg +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: pypsx-toolkit
|
|
3
|
-
Version: 3.0
|
|
3
|
+
Version: 3.1.0
|
|
4
4
|
Summary: Pakistan Stock Exchange (PSX) data library with yfinance-like API
|
|
5
5
|
Author-email: PyPSX Team <pypsxofficial@gmail.com>
|
|
6
6
|
Maintainer-email: PyPSX Team <pypsxofficial@gmail.com>
|
|
@@ -35,6 +35,8 @@ Classifier: Programming Language :: Python :: 3
|
|
|
35
35
|
Classifier: Programming Language :: Python :: 3.10
|
|
36
36
|
Classifier: Programming Language :: Python :: 3.11
|
|
37
37
|
Classifier: Programming Language :: Python :: 3.12
|
|
38
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
39
|
+
Classifier: Programming Language :: Python :: 3.14
|
|
38
40
|
Classifier: Programming Language :: Python :: 3 :: Only
|
|
39
41
|
Classifier: Topic :: Office/Business :: Financial
|
|
40
42
|
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
|
@@ -45,9 +47,9 @@ License-File: LICENSE
|
|
|
45
47
|
Requires-Dist: requests>=2.31.0
|
|
46
48
|
Requires-Dist: beautifulsoup4>=4.12.0
|
|
47
49
|
Requires-Dist: lxml>=4.9.0
|
|
48
|
-
Requires-Dist: pandas<
|
|
50
|
+
Requires-Dist: pandas<3.0.0,>=2.0.0
|
|
49
51
|
Requires-Dist: loguru>=0.7.0
|
|
50
|
-
Requires-Dist: numpy<2.
|
|
52
|
+
Requires-Dist: numpy<2.4.0,>=1.24.0
|
|
51
53
|
Requires-Dist: tqdm>=4.66.0
|
|
52
54
|
Provides-Extra: plot
|
|
53
55
|
Requires-Dist: matplotlib>=3.5.0; extra == "plot"
|
|
@@ -217,7 +219,7 @@ ticker = pypsx_toolkit.PSXTicker("OGDC")
|
|
|
217
219
|
- `ticker.history(period="1y", interval="1d")` - Get historical data
|
|
218
220
|
- `ticker.intraday()` - Get intraday trades (last ~2 days)
|
|
219
221
|
- `ticker.get_historical(start_date, end_date)` - Get full OHLCV data for date range
|
|
220
|
-
- `ticker.dividends()` - Get dividend information
|
|
222
|
+
- `ticker.dividends()` - Get dividend information
|
|
221
223
|
- `ticker.announcements()` - Get company announcements
|
|
222
224
|
- `ticker.orderbook()` - Get trading board data (bid/ask prices)
|
|
223
225
|
|
|
@@ -592,24 +594,25 @@ for insight in analysis["portfolio_insights"]:
|
|
|
592
594
|
|
|
593
595
|
### PSXTicker Class
|
|
594
596
|
|
|
595
|
-
<!-- pypsx-test: skip: API signature reference, not executable code (shows type annotations in call position) -->
|
|
596
597
|
```python
|
|
597
|
-
|
|
598
|
+
import pypsx_toolkit
|
|
599
|
+
|
|
600
|
+
ticker = pypsx_toolkit.PSXTicker("OGDC")
|
|
598
601
|
|
|
599
|
-
# Properties
|
|
602
|
+
# Properties (no parentheses)
|
|
600
603
|
ticker.info # Dict with company info
|
|
601
604
|
ticker.snapshot # Dict with comprehensive snapshot data from all tabs
|
|
602
|
-
ticker.fast_info
|
|
605
|
+
ticker.fast_info # Quick metrics dict
|
|
603
606
|
|
|
604
607
|
# Methods
|
|
605
|
-
ticker.history(period="1y", interval="1d")
|
|
606
|
-
ticker.intraday()
|
|
607
|
-
ticker.get_historical(
|
|
608
|
-
ticker.market_watch()
|
|
609
|
-
ticker.sector()
|
|
610
|
-
ticker.orderbook()
|
|
611
|
-
ticker.dividends()
|
|
612
|
-
ticker.announcements()
|
|
608
|
+
ticker.history(period="1y", interval="1d") # Historical data
|
|
609
|
+
ticker.intraday() # Intraday trades
|
|
610
|
+
ticker.get_historical("2024-01-01", "2024-12-31") # Full OHLCV data
|
|
611
|
+
ticker.market_watch() # Market watch row
|
|
612
|
+
ticker.sector() # Sector information
|
|
613
|
+
ticker.orderbook() # Trading board data
|
|
614
|
+
ticker.dividends() # DataFrame with dividends
|
|
615
|
+
ticker.announcements() # DataFrame with announcements
|
|
613
616
|
```
|
|
614
617
|
|
|
615
618
|
### Market Functions
|
|
@@ -638,11 +641,14 @@ pypsx_toolkit.get_snapshot(symbol) # Get snapshot data from all tab
|
|
|
638
641
|
|
|
639
642
|
### Download Functions
|
|
640
643
|
|
|
641
|
-
<!-- pypsx-test: skip: API signature reference; parameter names are placeholders, not bound values -->
|
|
642
644
|
```python
|
|
643
|
-
pypsx_toolkit
|
|
644
|
-
|
|
645
|
-
|
|
645
|
+
import pypsx_toolkit
|
|
646
|
+
|
|
647
|
+
symbols = ["OGDC", "HBL"]
|
|
648
|
+
|
|
649
|
+
pypsx_toolkit.download(symbols, period="1y", interval="1d") # Batch download
|
|
650
|
+
pypsx_toolkit.get_intraday_multiple(symbols) # Multiple intraday
|
|
651
|
+
pypsx_toolkit.get_historical("OGDC", "2024-01-01", "2024-12-31") # Historical OHLCV
|
|
646
652
|
```
|
|
647
653
|
|
|
648
654
|
## Backward Compatibility
|
|
@@ -653,7 +659,7 @@ The library maintains backward compatibility:
|
|
|
653
659
|
|
|
654
660
|
## Notes
|
|
655
661
|
|
|
656
|
-
- **Dividends**:
|
|
662
|
+
- **Dividends**: dividend records use their own column naming, which differs from the conventions used elsewhere in the toolkit.
|
|
657
663
|
- **Data Availability**: Some data may not be available when the market is closed.
|
|
658
664
|
- **Symbol Names**: Use official PSX symbols (e.g., "OGDC", "PPL", "KEL").
|
|
659
665
|
|
|
@@ -151,7 +151,7 @@ ticker = pypsx_toolkit.PSXTicker("OGDC")
|
|
|
151
151
|
- `ticker.history(period="1y", interval="1d")` - Get historical data
|
|
152
152
|
- `ticker.intraday()` - Get intraday trades (last ~2 days)
|
|
153
153
|
- `ticker.get_historical(start_date, end_date)` - Get full OHLCV data for date range
|
|
154
|
-
- `ticker.dividends()` - Get dividend information
|
|
154
|
+
- `ticker.dividends()` - Get dividend information
|
|
155
155
|
- `ticker.announcements()` - Get company announcements
|
|
156
156
|
- `ticker.orderbook()` - Get trading board data (bid/ask prices)
|
|
157
157
|
|
|
@@ -526,24 +526,25 @@ for insight in analysis["portfolio_insights"]:
|
|
|
526
526
|
|
|
527
527
|
### PSXTicker Class
|
|
528
528
|
|
|
529
|
-
<!-- pypsx-test: skip: API signature reference, not executable code (shows type annotations in call position) -->
|
|
530
529
|
```python
|
|
531
|
-
|
|
530
|
+
import pypsx_toolkit
|
|
531
|
+
|
|
532
|
+
ticker = pypsx_toolkit.PSXTicker("OGDC")
|
|
532
533
|
|
|
533
|
-
# Properties
|
|
534
|
+
# Properties (no parentheses)
|
|
534
535
|
ticker.info # Dict with company info
|
|
535
536
|
ticker.snapshot # Dict with comprehensive snapshot data from all tabs
|
|
536
|
-
ticker.fast_info
|
|
537
|
+
ticker.fast_info # Quick metrics dict
|
|
537
538
|
|
|
538
539
|
# Methods
|
|
539
|
-
ticker.history(period="1y", interval="1d")
|
|
540
|
-
ticker.intraday()
|
|
541
|
-
ticker.get_historical(
|
|
542
|
-
ticker.market_watch()
|
|
543
|
-
ticker.sector()
|
|
544
|
-
ticker.orderbook()
|
|
545
|
-
ticker.dividends()
|
|
546
|
-
ticker.announcements()
|
|
540
|
+
ticker.history(period="1y", interval="1d") # Historical data
|
|
541
|
+
ticker.intraday() # Intraday trades
|
|
542
|
+
ticker.get_historical("2024-01-01", "2024-12-31") # Full OHLCV data
|
|
543
|
+
ticker.market_watch() # Market watch row
|
|
544
|
+
ticker.sector() # Sector information
|
|
545
|
+
ticker.orderbook() # Trading board data
|
|
546
|
+
ticker.dividends() # DataFrame with dividends
|
|
547
|
+
ticker.announcements() # DataFrame with announcements
|
|
547
548
|
```
|
|
548
549
|
|
|
549
550
|
### Market Functions
|
|
@@ -572,11 +573,14 @@ pypsx_toolkit.get_snapshot(symbol) # Get snapshot data from all tab
|
|
|
572
573
|
|
|
573
574
|
### Download Functions
|
|
574
575
|
|
|
575
|
-
<!-- pypsx-test: skip: API signature reference; parameter names are placeholders, not bound values -->
|
|
576
576
|
```python
|
|
577
|
-
pypsx_toolkit
|
|
578
|
-
|
|
579
|
-
|
|
577
|
+
import pypsx_toolkit
|
|
578
|
+
|
|
579
|
+
symbols = ["OGDC", "HBL"]
|
|
580
|
+
|
|
581
|
+
pypsx_toolkit.download(symbols, period="1y", interval="1d") # Batch download
|
|
582
|
+
pypsx_toolkit.get_intraday_multiple(symbols) # Multiple intraday
|
|
583
|
+
pypsx_toolkit.get_historical("OGDC", "2024-01-01", "2024-12-31") # Historical OHLCV
|
|
580
584
|
```
|
|
581
585
|
|
|
582
586
|
## Backward Compatibility
|
|
@@ -587,7 +591,7 @@ The library maintains backward compatibility:
|
|
|
587
591
|
|
|
588
592
|
## Notes
|
|
589
593
|
|
|
590
|
-
- **Dividends**:
|
|
594
|
+
- **Dividends**: dividend records use their own column naming, which differs from the conventions used elsewhere in the toolkit.
|
|
591
595
|
- **Data Availability**: Some data may not be available when the market is closed.
|
|
592
596
|
- **Symbol Names**: Use official PSX symbols (e.g., "OGDC", "PPL", "KEL").
|
|
593
597
|
|
|
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
|
|
|
4
4
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "pypsx-toolkit"
|
|
7
|
-
version = "3.0
|
|
7
|
+
version = "3.1.0"
|
|
8
8
|
description = "Pakistan Stock Exchange (PSX) data library with yfinance-like API"
|
|
9
9
|
readme = "README.md"
|
|
10
10
|
# 3.10 is the real floor: `pandas>=2.0` already excludes 3.8/3.9, and
|
|
@@ -28,6 +28,8 @@ classifiers = [
|
|
|
28
28
|
"Programming Language :: Python :: 3.10",
|
|
29
29
|
"Programming Language :: Python :: 3.11",
|
|
30
30
|
"Programming Language :: Python :: 3.12",
|
|
31
|
+
"Programming Language :: Python :: 3.13",
|
|
32
|
+
"Programming Language :: Python :: 3.14",
|
|
31
33
|
"Programming Language :: Python :: 3 :: Only",
|
|
32
34
|
"Topic :: Office/Business :: Financial",
|
|
33
35
|
"Topic :: Software Development :: Libraries :: Python Modules",
|
|
@@ -38,9 +40,13 @@ dependencies = [
|
|
|
38
40
|
"requests>=2.31.0",
|
|
39
41
|
"beautifulsoup4>=4.12.0",
|
|
40
42
|
"lxml>=4.9.0",
|
|
41
|
-
|
|
43
|
+
# See pypsx_dev/pyproject.toml's identical pins for the reasoning: the
|
|
44
|
+
# ceiling must not exclude the first cp314-wheel release (pandas 2.3.3,
|
|
45
|
+
# numpy 2.3.2), and is deliberately kept below pandas 3.0 (mandatory CoW +
|
|
46
|
+
# other breaking changes) pending its own review.
|
|
47
|
+
"pandas>=2.0.0,<3.0.0",
|
|
42
48
|
"loguru>=0.7.0",
|
|
43
|
-
"numpy>=1.24.0,<2.
|
|
49
|
+
"numpy>=1.24.0,<2.4.0",
|
|
44
50
|
# Imported by api.py, endpoints/historical.py and core/utils.py. Those imports
|
|
45
51
|
# are try/except-guarded with a no-op fallback, but the fallback path is
|
|
46
52
|
# untested and every target environment (including Colab) already ships tqdm.
|
|
@@ -6,9 +6,10 @@ import pandas as pd
|
|
|
6
6
|
|
|
7
7
|
def download(
|
|
8
8
|
symbols: Union[str, List[str]],
|
|
9
|
-
period: str = "
|
|
9
|
+
period: str = "1y",
|
|
10
10
|
interval: str = "1d",
|
|
11
11
|
to_csv: Optional[str] = None,
|
|
12
|
+
show_progress: bool = True,
|
|
12
13
|
) -> pd.DataFrame:
|
|
13
14
|
"""
|
|
14
15
|
Download historical OHLCV data for one or more PSX symbols (yfinance-style).
|
|
@@ -18,6 +19,8 @@ def download(
|
|
|
18
19
|
period: Time period — "1d","5d","1mo","3mo","6mo","1y","2y","5y","10y","ytd","max".
|
|
19
20
|
interval: Bar interval. Only "1d" is currently supported.
|
|
20
21
|
to_csv: Optional path to save the result as CSV.
|
|
22
|
+
show_progress: Display a progress bar while fetching. Set False in
|
|
23
|
+
notebooks, reports or logs where the bar is just noise.
|
|
21
24
|
|
|
22
25
|
Returns:
|
|
23
26
|
For a single symbol: DataFrame with [Open, High, Low, Close, Volume, Change%].
|
|
@@ -73,12 +76,17 @@ def get_intraday(symbol: str) -> pd.DataFrame:
|
|
|
73
76
|
...
|
|
74
77
|
|
|
75
78
|
|
|
76
|
-
def get_intraday_multiple(
|
|
79
|
+
def get_intraday_multiple(
|
|
80
|
+
symbols: List[str],
|
|
81
|
+
show_progress: bool = True,
|
|
82
|
+
) -> pd.DataFrame:
|
|
77
83
|
"""
|
|
78
84
|
Fetch intraday tick data for multiple symbols in parallel.
|
|
79
85
|
|
|
80
86
|
Args:
|
|
81
87
|
symbols: List of PSX ticker symbols.
|
|
88
|
+
show_progress: Display a progress bar while fetching. Set False in
|
|
89
|
+
notebooks, reports or logs where the bar is just noise.
|
|
82
90
|
|
|
83
91
|
Returns:
|
|
84
92
|
Concatenated DataFrame with an additional "Symbol" column.
|
|
@@ -85,6 +85,27 @@ def main():
|
|
|
85
85
|
# embedsignature=True: embeds the Python call signature in the docstring
|
|
86
86
|
# so IDEs can show it even when the .pyi stub is absent.
|
|
87
87
|
"embedsignature": True,
|
|
88
|
+
# annotation_typing defaults to True, which makes Cython treat a
|
|
89
|
+
# PEP 484 parameter annotation like
|
|
90
|
+
# `def correlation_matrix(df_dict: Dict[str, pd.DataFrame])`
|
|
91
|
+
# as a `cdef dict` declaration and enforce it at the C level.
|
|
92
|
+
#
|
|
93
|
+
# Two problems, both COMPILED-ONLY -- they cannot reproduce from
|
|
94
|
+
# source, which is the worst possible failure mode here:
|
|
95
|
+
#
|
|
96
|
+
# 1. Cython's builtin-container coercion is exact-type-only, so
|
|
97
|
+
# passing an OrderedDict/defaultdict/Counter to a
|
|
98
|
+
# Dict[...]-annotated parameter raises TypeError even though
|
|
99
|
+
# it is a perfectly good Mapping.
|
|
100
|
+
# 2. It pre-empts the library's own validation. The argument
|
|
101
|
+
# checks in analysis/stats.py exist to say "correlation_matrix()
|
|
102
|
+
# expects {symbol: DataFrame}, got a single DataFrame" -- but
|
|
103
|
+
# with annotation_typing on, Cython rejects the call first with
|
|
104
|
+
# a terse message naming neither the function nor the fix.
|
|
105
|
+
#
|
|
106
|
+
# pypsx set this to False for the same reason; the toolkit had
|
|
107
|
+
# been left on the default.
|
|
108
|
+
"annotation_typing": False,
|
|
88
109
|
},
|
|
89
110
|
build_dir="build",
|
|
90
111
|
annotate=False,
|
|
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
|