reportify-sdk 0.3.3__py3-none-any.whl → 0.3.5__py3-none-any.whl

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/__init__.py CHANGED
@@ -20,7 +20,7 @@ from reportify_sdk.exceptions import (
20
20
  APIError,
21
21
  )
22
22
 
23
- __version__ = "0.3.3"
23
+ __version__ = "0.3.0"
24
24
  __all__ = [
25
25
  "Reportify",
26
26
  "ReportifyError",
reportify_sdk/client.py CHANGED
@@ -74,7 +74,7 @@ class Reportify:
74
74
  return {
75
75
  "Authorization": f"Bearer {self.api_key}",
76
76
  "Content-Type": "application/json",
77
- "User-Agent": "reportify-sdk-python/0.3.3",
77
+ "User-Agent": "reportify-sdk-python/0.3.5",
78
78
  }
79
79
 
80
80
  def _request(
reportify_sdk/quant.py CHANGED
@@ -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 (with parentheses): MA(20), RSI(14), MACD(), etc.
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 (with parentheses): MA(20), PE(), ROE(), RSI(14), etc.
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 (with parentheses): MA(20), PE(), ROE(), RSI(14), etc.
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 (with parentheses): MA(20), PE(), ROE(), RSI(14), etc.
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 (with parentheses): MA(20), PE(), ROE(), RSI(14), etc.
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 = {
reportify_sdk/stock.py CHANGED
@@ -369,92 +369,9 @@ class StockModule:
369
369
  return self._to_dataframe(response)
370
370
 
371
371
  # -------------------------------------------------------------------------
372
- # Screening and Calendar
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
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
- # Screening and calendar
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
  ```
@@ -1,19 +1,19 @@
1
- reportify_sdk/__init__.py,sha256=IyHi12_4qJqkiy4apx5p4103d8ztlnt97aHxBPIN4SY,662
1
+ reportify_sdk/__init__.py,sha256=l7E4ELvxQ8qSEpgDK3-I3JfhBBKmLS8RP4hpbxieVac,662
2
2
  reportify_sdk/agent.py,sha256=y1iP4Jq7-ESMxeCWB_vxkAvwCjUCWT8K-ZSeJswU6nQ,6358
3
3
  reportify_sdk/channels.py,sha256=VbBCispCiP2Mzqn5lmBWVNWog4ElVni46mK2zg7KKzg,3518
4
4
  reportify_sdk/chat.py,sha256=GQVfre4p2H9Kb0imX1-LvGqMrtnsuGhjQskBNUqUI_I,3613
5
- reportify_sdk/client.py,sha256=gf_d6uxfI5zzcLPxkJDinfU05p-s7J1W5I4WJ9rLTmg,8206
5
+ reportify_sdk/client.py,sha256=yXFIrS-fvgRRM6pDHZ3GKFcFHvKfH_YkKMSTHNyHf9c,8206
6
6
  reportify_sdk/concepts.py,sha256=XlHPuuZacFFUccMthyeb5R2OTayFYxXgIODKNfJLa_c,1891
7
7
  reportify_sdk/docs.py,sha256=T5RO_FQe7ARRlav8eZQrgggDNmbCb8Cgiaq8YtEoaFA,16850
8
8
  reportify_sdk/exceptions.py,sha256=r2_C_kTh6tCrQnfA3UozSqMMA-2OBnoP3pGpgYeqcdU,1049
9
9
  reportify_sdk/kb.py,sha256=3e82_56hvnGQ2fI404g3DAem9javPY7OpE5B8goYOB8,2895
10
- reportify_sdk/quant.py,sha256=EWjCHMfkXJMRoLy159BeUKL7axmgWl8n-UcWcnwhsnA,17411
10
+ reportify_sdk/quant.py,sha256=X3ZJsexslUsyz1tiXT481BpzLBLJ1_vipcChKxZll-k,17672
11
11
  reportify_sdk/search.py,sha256=rzleME8_DwdiJ-__0qPjXkQZmaJ6JXH-ycJ_mUlkkNw,11866
12
- reportify_sdk/stock.py,sha256=OcDb8REompgVEtZA6msWEWj6BilryQGZHpzWbyt9sxY,21996
12
+ reportify_sdk/stock.py,sha256=t-2KOqiZ5DpOYKHjSncY33YBjQu92hjRNbtbhrdr3Zs,18259
13
13
  reportify_sdk/timeline.py,sha256=7ZbF5-0eGoF_N5h9swEyYgZSaMb54PMwLDXlaqFS4ns,5396
14
14
  reportify_sdk/user.py,sha256=lsdhvaovllEwYiz4fhhSwl8PMX8tKswzABAvZbB0iJw,1261
15
- reportify_sdk-0.3.3.dist-info/licenses/LICENSE,sha256=zBUq4DL4lE-fZU_PMkr0gnxkYS1LhdRHFw8_LmCb-ek,1066
16
- reportify_sdk-0.3.3.dist-info/METADATA,sha256=w652XBK5mNEgaNEthMoq19zw-6t6Td0oMXhaMiSQsNQ,6451
17
- reportify_sdk-0.3.3.dist-info/WHEEL,sha256=wUyA8OaulRlbfwMtmQsvNngGrxQHAvkKcvRmdizlJi0,92
18
- reportify_sdk-0.3.3.dist-info/top_level.txt,sha256=tc_dzCSWIDsNbHSi-FlyEEX8xwinhN9gl-CwyLRE4B0,14
19
- reportify_sdk-0.3.3.dist-info/RECORD,,
15
+ reportify_sdk-0.3.5.dist-info/licenses/LICENSE,sha256=zBUq4DL4lE-fZU_PMkr0gnxkYS1LhdRHFw8_LmCb-ek,1066
16
+ reportify_sdk-0.3.5.dist-info/METADATA,sha256=od5BzK93KU7BeNNxKVmKentnvpbj5eneJ3OI0trUwDY,6416
17
+ reportify_sdk-0.3.5.dist-info/WHEEL,sha256=wUyA8OaulRlbfwMtmQsvNngGrxQHAvkKcvRmdizlJi0,92
18
+ reportify_sdk-0.3.5.dist-info/top_level.txt,sha256=tc_dzCSWIDsNbHSi-FlyEEX8xwinhN9gl-CwyLRE4B0,14
19
+ reportify_sdk-0.3.5.dist-info/RECORD,,