reportify-sdk 0.3.3__tar.gz → 0.3.5__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.
- {reportify_sdk-0.3.3/reportify_sdk.egg-info → reportify_sdk-0.3.5}/PKG-INFO +5 -6
- {reportify_sdk-0.3.3 → reportify_sdk-0.3.5}/README.md +4 -5
- {reportify_sdk-0.3.3 → reportify_sdk-0.3.5}/pyproject.toml +1 -1
- {reportify_sdk-0.3.3 → reportify_sdk-0.3.5}/reportify_sdk/__init__.py +1 -1
- {reportify_sdk-0.3.3 → reportify_sdk-0.3.5}/reportify_sdk/client.py +1 -1
- {reportify_sdk-0.3.3 → reportify_sdk-0.3.5}/reportify_sdk/quant.py +15 -15
- {reportify_sdk-0.3.3 → reportify_sdk-0.3.5}/reportify_sdk/stock.py +1 -84
- {reportify_sdk-0.3.3 → reportify_sdk-0.3.5/reportify_sdk.egg-info}/PKG-INFO +5 -6
- {reportify_sdk-0.3.3 → reportify_sdk-0.3.5}/LICENSE +0 -0
- {reportify_sdk-0.3.3 → reportify_sdk-0.3.5}/reportify_sdk/agent.py +0 -0
- {reportify_sdk-0.3.3 → reportify_sdk-0.3.5}/reportify_sdk/channels.py +0 -0
- {reportify_sdk-0.3.3 → reportify_sdk-0.3.5}/reportify_sdk/chat.py +0 -0
- {reportify_sdk-0.3.3 → reportify_sdk-0.3.5}/reportify_sdk/concepts.py +0 -0
- {reportify_sdk-0.3.3 → reportify_sdk-0.3.5}/reportify_sdk/docs.py +0 -0
- {reportify_sdk-0.3.3 → reportify_sdk-0.3.5}/reportify_sdk/exceptions.py +0 -0
- {reportify_sdk-0.3.3 → reportify_sdk-0.3.5}/reportify_sdk/kb.py +0 -0
- {reportify_sdk-0.3.3 → reportify_sdk-0.3.5}/reportify_sdk/search.py +0 -0
- {reportify_sdk-0.3.3 → reportify_sdk-0.3.5}/reportify_sdk/timeline.py +0 -0
- {reportify_sdk-0.3.3 → reportify_sdk-0.3.5}/reportify_sdk/user.py +0 -0
- {reportify_sdk-0.3.3 → reportify_sdk-0.3.5}/reportify_sdk.egg-info/SOURCES.txt +0 -0
- {reportify_sdk-0.3.3 → reportify_sdk-0.3.5}/reportify_sdk.egg-info/dependency_links.txt +0 -0
- {reportify_sdk-0.3.3 → reportify_sdk-0.3.5}/reportify_sdk.egg-info/requires.txt +0 -0
- {reportify_sdk-0.3.3 → reportify_sdk-0.3.5}/reportify_sdk.egg-info/top_level.txt +0 -0
- {reportify_sdk-0.3.3 → reportify_sdk-0.3.5}/setup.cfg +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: reportify-sdk
|
|
3
|
-
Version: 0.3.
|
|
3
|
+
Version: 0.3.5
|
|
4
4
|
Summary: Python SDK for Reportify API - Financial data and document search
|
|
5
5
|
Author-email: Reportify <support@reportify.cn>
|
|
6
6
|
License-Expression: MIT
|
|
@@ -84,8 +84,7 @@ quote = client.stock.quote("US:AAPL")
|
|
|
84
84
|
overview = client.stock.overview("US:AAPL")
|
|
85
85
|
shareholders = client.stock.shareholders("US:AAPL")
|
|
86
86
|
|
|
87
|
-
#
|
|
88
|
-
stocks = client.stock.screener(country="US", market_cap_more_than=1e10)
|
|
87
|
+
# Earnings calendar
|
|
89
88
|
earnings = client.stock.earnings_calendar(market="us", start_date="2024-01-01", end_date="2024-01-31")
|
|
90
89
|
```
|
|
91
90
|
|
|
@@ -133,7 +132,7 @@ df = client.quant.compute_indicators(["000001"], "MACD()")
|
|
|
133
132
|
|
|
134
133
|
# Screen stocks by formula
|
|
135
134
|
stocks = client.quant.screen(formula="RSI(14) < 30")
|
|
136
|
-
stocks = client.quant.screen(formula="CROSS(MA(5), MA(20))")
|
|
135
|
+
stocks = client.quant.screen(formula="CROSS(MA(CLOSE, 5), MA(CLOSE, 20))")
|
|
137
136
|
|
|
138
137
|
# Get OHLCV data
|
|
139
138
|
ohlcv = client.quant.ohlcv("000001", start_date="2024-01-01")
|
|
@@ -144,8 +143,8 @@ result = client.quant.backtest(
|
|
|
144
143
|
start_date="2023-01-01",
|
|
145
144
|
end_date="2024-01-01",
|
|
146
145
|
symbol="000001",
|
|
147
|
-
entry_formula="CROSS(MA(5), MA(20))",
|
|
148
|
-
exit_formula="CROSSDOWN(MA(5), MA(20))"
|
|
146
|
+
entry_formula="CROSS(MA(CLOSE, 5), MA(CLOSE, 20))",
|
|
147
|
+
exit_formula="CROSSDOWN(MA(CLOSE, 5), MA(CLOSE, 20))"
|
|
149
148
|
)
|
|
150
149
|
print(f"Total Return: {result['total_return_pct']:.2%}")
|
|
151
150
|
```
|
|
@@ -55,8 +55,7 @@ quote = client.stock.quote("US:AAPL")
|
|
|
55
55
|
overview = client.stock.overview("US:AAPL")
|
|
56
56
|
shareholders = client.stock.shareholders("US:AAPL")
|
|
57
57
|
|
|
58
|
-
#
|
|
59
|
-
stocks = client.stock.screener(country="US", market_cap_more_than=1e10)
|
|
58
|
+
# Earnings calendar
|
|
60
59
|
earnings = client.stock.earnings_calendar(market="us", start_date="2024-01-01", end_date="2024-01-31")
|
|
61
60
|
```
|
|
62
61
|
|
|
@@ -104,7 +103,7 @@ df = client.quant.compute_indicators(["000001"], "MACD()")
|
|
|
104
103
|
|
|
105
104
|
# Screen stocks by formula
|
|
106
105
|
stocks = client.quant.screen(formula="RSI(14) < 30")
|
|
107
|
-
stocks = client.quant.screen(formula="CROSS(MA(5), MA(20))")
|
|
106
|
+
stocks = client.quant.screen(formula="CROSS(MA(CLOSE, 5), MA(CLOSE, 20))")
|
|
108
107
|
|
|
109
108
|
# Get OHLCV data
|
|
110
109
|
ohlcv = client.quant.ohlcv("000001", start_date="2024-01-01")
|
|
@@ -115,8 +114,8 @@ result = client.quant.backtest(
|
|
|
115
114
|
start_date="2023-01-01",
|
|
116
115
|
end_date="2024-01-01",
|
|
117
116
|
symbol="000001",
|
|
118
|
-
entry_formula="CROSS(MA(5), MA(20))",
|
|
119
|
-
exit_formula="CROSSDOWN(MA(5), MA(20))"
|
|
117
|
+
entry_formula="CROSS(MA(CLOSE, 5), MA(CLOSE, 20))",
|
|
118
|
+
exit_formula="CROSSDOWN(MA(CLOSE, 5), MA(CLOSE, 20))"
|
|
120
119
|
)
|
|
121
120
|
print(f"Total Return: {result['total_return_pct']:.2%}")
|
|
122
121
|
```
|
|
@@ -39,7 +39,7 @@ class QuantModule:
|
|
|
39
39
|
"""
|
|
40
40
|
Get list of available technical indicators
|
|
41
41
|
|
|
42
|
-
All indicators are functions and require parentheses when used (e.g., MA(20), RSI(14), MACD()).
|
|
42
|
+
All indicators are functions and require parentheses when used (e.g., MA(CLOSE, 20), RSI(14), MACD()).
|
|
43
43
|
|
|
44
44
|
Returns:
|
|
45
45
|
List of indicator definitions with name, description, and fields
|
|
@@ -66,7 +66,7 @@ class QuantModule:
|
|
|
66
66
|
|
|
67
67
|
Variables vs Functions:
|
|
68
68
|
- Variables (no parentheses): CLOSE, OPEN, HIGH, LOW, VOLUME (aliases: C, O, H, L, V, VOL)
|
|
69
|
-
- Functions (
|
|
69
|
+
- Functions (TongDaXin style: col first, n second): MA(CLOSE, 20), RSI(14), MACD(), etc.
|
|
70
70
|
|
|
71
71
|
Args:
|
|
72
72
|
symbols: List of stock codes (e.g., ["000001", "600519"])
|
|
@@ -117,7 +117,7 @@ class QuantModule:
|
|
|
117
117
|
|
|
118
118
|
Variables vs Functions:
|
|
119
119
|
- Variables (no parentheses): CLOSE, OPEN, HIGH, LOW, VOLUME, PE_TTM, ROE_TTM, etc.
|
|
120
|
-
- Functions (
|
|
120
|
+
- Functions (TongDaXin style: col first, n second): MA(CLOSE, 20), PE(), ROE(), RSI(14), etc.
|
|
121
121
|
|
|
122
122
|
Returns factors organized by level:
|
|
123
123
|
- Level 0 Variables: CLOSE, OPEN, HIGH, LOW, VOLUME (price data, no parentheses)
|
|
@@ -151,7 +151,7 @@ class QuantModule:
|
|
|
151
151
|
|
|
152
152
|
Variables vs Functions:
|
|
153
153
|
- Variables (no parentheses): CLOSE, OPEN, HIGH, LOW, VOLUME
|
|
154
|
-
- Functions (
|
|
154
|
+
- Functions (TongDaXin style: col first, n second): MA(CLOSE, 20), PE(), ROE(), RSI(14), etc.
|
|
155
155
|
|
|
156
156
|
Args:
|
|
157
157
|
symbols: List of stock codes
|
|
@@ -171,10 +171,10 @@ class QuantModule:
|
|
|
171
171
|
>>> df = client.quant.compute_factors(["000001"], "MACD().dif")
|
|
172
172
|
|
|
173
173
|
>>> # Close above 20-day MA (boolean)
|
|
174
|
-
>>> df = client.quant.compute_factors(["000001"], "CLOSE > MA(20)")
|
|
174
|
+
>>> df = client.quant.compute_factors(["000001"], "CLOSE > MA(CLOSE, 20)")
|
|
175
175
|
|
|
176
176
|
>>> # Deviation from MA20 in percent
|
|
177
|
-
>>> df = client.quant.compute_factors(["000001"], "(CLOSE - MA(20)) / MA(20) * 100")
|
|
177
|
+
>>> df = client.quant.compute_factors(["000001"], "(CLOSE - MA(CLOSE, 20)) / MA(CLOSE, 20) * 100")
|
|
178
178
|
|
|
179
179
|
>>> # Fundamental factors (note: functions require parentheses)
|
|
180
180
|
>>> df = client.quant.compute_factors(["000001"], "PE()")
|
|
@@ -226,7 +226,7 @@ class QuantModule:
|
|
|
226
226
|
|
|
227
227
|
Variables vs Functions:
|
|
228
228
|
- Variables (no parentheses): CLOSE, OPEN, HIGH, LOW, VOLUME
|
|
229
|
-
- Functions (
|
|
229
|
+
- Functions (TongDaXin style: col first, n second): MA(CLOSE, 20), PE(), ROE(), RSI(14), etc.
|
|
230
230
|
|
|
231
231
|
Args:
|
|
232
232
|
formula: Screening formula using Mai-language syntax
|
|
@@ -242,10 +242,10 @@ class QuantModule:
|
|
|
242
242
|
>>> stocks = client.quant.screen(formula="RSI(14) < 30")
|
|
243
243
|
|
|
244
244
|
>>> # Golden cross
|
|
245
|
-
>>> stocks = client.quant.screen(formula="CROSS(MA(5), MA(10))")
|
|
245
|
+
>>> stocks = client.quant.screen(formula="CROSS(MA(CLOSE, 5), MA(CLOSE, 10))")
|
|
246
246
|
|
|
247
247
|
>>> # Uptrend
|
|
248
|
-
>>> stocks = client.quant.screen(formula="(CLOSE > MA(20)) & (MA(20) > MA(60))")
|
|
248
|
+
>>> stocks = client.quant.screen(formula="(CLOSE > MA(CLOSE, 20)) & (MA(CLOSE, 20) > MA(CLOSE, 60))")
|
|
249
249
|
|
|
250
250
|
>>> # Above upper Bollinger Band
|
|
251
251
|
>>> stocks = client.quant.screen(formula="CLOSE > BOLL(20, 2).upper")
|
|
@@ -372,7 +372,7 @@ class QuantModule:
|
|
|
372
372
|
|
|
373
373
|
Variables vs Functions:
|
|
374
374
|
- Variables (no parentheses): CLOSE, OPEN, HIGH, LOW, VOLUME
|
|
375
|
-
- Functions (
|
|
375
|
+
- Functions (TongDaXin style: col first, n second): MA(CLOSE, 20), PE(), ROE(), RSI(14), etc.
|
|
376
376
|
|
|
377
377
|
Args:
|
|
378
378
|
start_date: Backtest start date (YYYY-MM-DD)
|
|
@@ -386,7 +386,7 @@ class QuantModule:
|
|
|
386
386
|
stop_loss: Stop loss setting (default: 0.0, no stop loss)
|
|
387
387
|
sizer_percent: Position percentage (default: 99%)
|
|
388
388
|
auto_close: Auto close positions (default: True)
|
|
389
|
-
labels: Label dict for returning extra indicator values, e.g. {"up": "CROSS(MA(20), MA(60))"}
|
|
389
|
+
labels: Label dict for returning extra indicator values, e.g. {"up": "CROSS(MA(CLOSE, 20), MA(CLOSE, 60))"}
|
|
390
390
|
|
|
391
391
|
Returns:
|
|
392
392
|
Backtest results including:
|
|
@@ -407,7 +407,7 @@ class QuantModule:
|
|
|
407
407
|
... start_date="2023-01-01",
|
|
408
408
|
... end_date="2024-01-01",
|
|
409
409
|
... symbol="000001",
|
|
410
|
-
... entry_formula="CROSS(MA(5), MA(20))", # Buy when MA5 crosses above MA20
|
|
410
|
+
... entry_formula="CROSS(MA(CLOSE, 5), MA(CLOSE, 20))", # Buy when MA5 crosses above MA20
|
|
411
411
|
... initial_cash=100000
|
|
412
412
|
... )
|
|
413
413
|
>>> print(f"Total Return: {result['total_return_pct']:.2%}")
|
|
@@ -419,8 +419,8 @@ class QuantModule:
|
|
|
419
419
|
... start_date="2023-01-01",
|
|
420
420
|
... end_date="2024-01-01",
|
|
421
421
|
... symbol="000001",
|
|
422
|
-
... entry_formula="CROSS(MA(5), MA(20))", # Buy signal
|
|
423
|
-
... exit_formula="CROSSDOWN(MA(5), MA(20))" # Sell signal
|
|
422
|
+
... entry_formula="CROSS(MA(CLOSE, 5), MA(CLOSE, 20))", # Buy signal
|
|
423
|
+
... exit_formula="CROSSDOWN(MA(CLOSE, 5), MA(CLOSE, 20))" # Sell signal
|
|
424
424
|
... )
|
|
425
425
|
|
|
426
426
|
>>> # Fundamental screening backtest (note: functions require parentheses)
|
|
@@ -438,7 +438,7 @@ class QuantModule:
|
|
|
438
438
|
... symbol="000001",
|
|
439
439
|
... entry_formula="RSI(14) < 30",
|
|
440
440
|
... exit_formula="RSI(14) > 70",
|
|
441
|
-
... labels={"rsi": "RSI(14)", "ma20": "MA(20)"}
|
|
441
|
+
... labels={"rsi": "RSI(14)", "ma20": "MA(CLOSE, 20)"}
|
|
442
442
|
... )
|
|
443
443
|
"""
|
|
444
444
|
data = {
|
|
@@ -369,92 +369,9 @@ class StockModule:
|
|
|
369
369
|
return self._to_dataframe(response)
|
|
370
370
|
|
|
371
371
|
# -------------------------------------------------------------------------
|
|
372
|
-
#
|
|
372
|
+
# Calendar
|
|
373
373
|
# -------------------------------------------------------------------------
|
|
374
374
|
|
|
375
|
-
def screener(
|
|
376
|
-
self,
|
|
377
|
-
*,
|
|
378
|
-
market_cap_more_than: float | None = None,
|
|
379
|
-
market_cap_lower_than: float | None = None,
|
|
380
|
-
price_more_than: float | None = None,
|
|
381
|
-
price_lower_than: float | None = None,
|
|
382
|
-
change_percentage_more_than: float | None = None,
|
|
383
|
-
change_percentage_lower_than: float | None = None,
|
|
384
|
-
volume_more_than: int | None = None,
|
|
385
|
-
volume_lower_than: int | None = None,
|
|
386
|
-
country: str | None = None,
|
|
387
|
-
exchange: str | None = None,
|
|
388
|
-
dividend_yield_more_than: float | None = None,
|
|
389
|
-
dividend_yield_lower_than: float | None = None,
|
|
390
|
-
pe_ttm_more_than: float | None = None,
|
|
391
|
-
pe_ttm_lower_than: float | None = None,
|
|
392
|
-
limit: int = 100,
|
|
393
|
-
) -> pd.DataFrame:
|
|
394
|
-
"""
|
|
395
|
-
Screen stocks based on various criteria
|
|
396
|
-
|
|
397
|
-
Args:
|
|
398
|
-
market_cap_more_than: Market cap greater than
|
|
399
|
-
market_cap_lower_than: Market cap less than
|
|
400
|
-
price_more_than: Stock price greater than
|
|
401
|
-
price_lower_than: Stock price less than
|
|
402
|
-
change_percentage_more_than: Change percentage greater than (e.g., 0.02 for 2%)
|
|
403
|
-
change_percentage_lower_than: Change percentage less than (e.g., 0.04 for 4%)
|
|
404
|
-
volume_more_than: Trading volume greater than
|
|
405
|
-
volume_lower_than: Trading volume less than
|
|
406
|
-
country: Country code (e.g., "US", "CN", "HK")
|
|
407
|
-
exchange: Exchange code (e.g., "NASDAQ", "NYSE", "HKEX")
|
|
408
|
-
dividend_yield_more_than: Dividend yield greater than
|
|
409
|
-
dividend_yield_lower_than: Dividend yield less than
|
|
410
|
-
pe_ttm_more_than: PE TTM greater than
|
|
411
|
-
pe_ttm_lower_than: PE TTM less than
|
|
412
|
-
limit: Maximum number of results (default: 100)
|
|
413
|
-
|
|
414
|
-
Returns:
|
|
415
|
-
DataFrame with screened stocks
|
|
416
|
-
|
|
417
|
-
Example:
|
|
418
|
-
>>> # Find US stocks with PE < 15 and market cap > 1B
|
|
419
|
-
>>> stocks = client.stock.screener(
|
|
420
|
-
... country="US",
|
|
421
|
-
... pe_ttm_lower_than=15,
|
|
422
|
-
... market_cap_more_than=1000000000
|
|
423
|
-
... )
|
|
424
|
-
"""
|
|
425
|
-
data: dict[str, Any] = {"limit": limit}
|
|
426
|
-
if market_cap_more_than is not None:
|
|
427
|
-
data["market_cap_more_than"] = market_cap_more_than
|
|
428
|
-
if market_cap_lower_than is not None:
|
|
429
|
-
data["market_cap_lower_than"] = market_cap_lower_than
|
|
430
|
-
if price_more_than is not None:
|
|
431
|
-
data["price_more_than"] = price_more_than
|
|
432
|
-
if price_lower_than is not None:
|
|
433
|
-
data["price_lower_than"] = price_lower_than
|
|
434
|
-
if change_percentage_more_than is not None:
|
|
435
|
-
data["change_percentage_more_than"] = change_percentage_more_than
|
|
436
|
-
if change_percentage_lower_than is not None:
|
|
437
|
-
data["change_percentage_lower_than"] = change_percentage_lower_than
|
|
438
|
-
if volume_more_than is not None:
|
|
439
|
-
data["volume_more_than"] = volume_more_than
|
|
440
|
-
if volume_lower_than is not None:
|
|
441
|
-
data["volume_lower_than"] = volume_lower_than
|
|
442
|
-
if country:
|
|
443
|
-
data["country"] = country
|
|
444
|
-
if exchange:
|
|
445
|
-
data["exchange"] = exchange
|
|
446
|
-
if dividend_yield_more_than is not None:
|
|
447
|
-
data["dividend_yield_more_than"] = dividend_yield_more_than
|
|
448
|
-
if dividend_yield_lower_than is not None:
|
|
449
|
-
data["dividend_yield_lower_than"] = dividend_yield_lower_than
|
|
450
|
-
if pe_ttm_more_than is not None:
|
|
451
|
-
data["pe_ttm_more_than"] = pe_ttm_more_than
|
|
452
|
-
if pe_ttm_lower_than is not None:
|
|
453
|
-
data["pe_ttm_lower_than"] = pe_ttm_lower_than
|
|
454
|
-
|
|
455
|
-
response = self._post("/v1/stock/screener", json=data)
|
|
456
|
-
return self._to_dataframe(response)
|
|
457
|
-
|
|
458
375
|
def earnings_calendar(
|
|
459
376
|
self,
|
|
460
377
|
*,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: reportify-sdk
|
|
3
|
-
Version: 0.3.
|
|
3
|
+
Version: 0.3.5
|
|
4
4
|
Summary: Python SDK for Reportify API - Financial data and document search
|
|
5
5
|
Author-email: Reportify <support@reportify.cn>
|
|
6
6
|
License-Expression: MIT
|
|
@@ -84,8 +84,7 @@ quote = client.stock.quote("US:AAPL")
|
|
|
84
84
|
overview = client.stock.overview("US:AAPL")
|
|
85
85
|
shareholders = client.stock.shareholders("US:AAPL")
|
|
86
86
|
|
|
87
|
-
#
|
|
88
|
-
stocks = client.stock.screener(country="US", market_cap_more_than=1e10)
|
|
87
|
+
# Earnings calendar
|
|
89
88
|
earnings = client.stock.earnings_calendar(market="us", start_date="2024-01-01", end_date="2024-01-31")
|
|
90
89
|
```
|
|
91
90
|
|
|
@@ -133,7 +132,7 @@ df = client.quant.compute_indicators(["000001"], "MACD()")
|
|
|
133
132
|
|
|
134
133
|
# Screen stocks by formula
|
|
135
134
|
stocks = client.quant.screen(formula="RSI(14) < 30")
|
|
136
|
-
stocks = client.quant.screen(formula="CROSS(MA(5), MA(20))")
|
|
135
|
+
stocks = client.quant.screen(formula="CROSS(MA(CLOSE, 5), MA(CLOSE, 20))")
|
|
137
136
|
|
|
138
137
|
# Get OHLCV data
|
|
139
138
|
ohlcv = client.quant.ohlcv("000001", start_date="2024-01-01")
|
|
@@ -144,8 +143,8 @@ result = client.quant.backtest(
|
|
|
144
143
|
start_date="2023-01-01",
|
|
145
144
|
end_date="2024-01-01",
|
|
146
145
|
symbol="000001",
|
|
147
|
-
entry_formula="CROSS(MA(5), MA(20))",
|
|
148
|
-
exit_formula="CROSSDOWN(MA(5), MA(20))"
|
|
146
|
+
entry_formula="CROSS(MA(CLOSE, 5), MA(CLOSE, 20))",
|
|
147
|
+
exit_formula="CROSSDOWN(MA(CLOSE, 5), MA(CLOSE, 20))"
|
|
149
148
|
)
|
|
150
149
|
print(f"Total Return: {result['total_return_pct']:.2%}")
|
|
151
150
|
```
|
|
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
|