yfin-cli 0.1.1__tar.gz → 0.2.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 (42) hide show
  1. {yfin_cli-0.1.1 → yfin_cli-0.2.0}/COMMANDS.md +21 -0
  2. {yfin_cli-0.1.1 → yfin_cli-0.2.0}/PKG-INFO +2 -2
  3. {yfin_cli-0.1.1 → yfin_cli-0.2.0}/README.md +1 -1
  4. {yfin_cli-0.1.1 → yfin_cli-0.2.0}/pyproject.toml +1 -1
  5. {yfin_cli-0.1.1 → yfin_cli-0.2.0}/src/cli.py +2 -0
  6. {yfin_cli-0.1.1 → yfin_cli-0.2.0}/src/commands/stock.py +16 -0
  7. {yfin_cli-0.1.1 → yfin_cli-0.2.0}/src/writer.py +3 -1
  8. {yfin_cli-0.1.1 → yfin_cli-0.2.0}/tests/test_writer.py +44 -0
  9. {yfin_cli-0.1.1 → yfin_cli-0.2.0}/uv.lock +1 -1
  10. {yfin_cli-0.1.1 → yfin_cli-0.2.0}/.gitignore +0 -0
  11. {yfin_cli-0.1.1 → yfin_cli-0.2.0}/.python-version +0 -0
  12. {yfin_cli-0.1.1 → yfin_cli-0.2.0}/LICENSE +0 -0
  13. {yfin_cli-0.1.1 → yfin_cli-0.2.0}/src/__init__.py +0 -0
  14. {yfin_cli-0.1.1 → yfin_cli-0.2.0}/src/commands/__init__.py +0 -0
  15. {yfin_cli-0.1.1 → yfin_cli-0.2.0}/src/commands/analysis.py +0 -0
  16. {yfin_cli-0.1.1 → yfin_cli-0.2.0}/src/commands/calendar.py +0 -0
  17. {yfin_cli-0.1.1 → yfin_cli-0.2.0}/src/commands/financials.py +0 -0
  18. {yfin_cli-0.1.1 → yfin_cli-0.2.0}/src/commands/industry.py +0 -0
  19. {yfin_cli-0.1.1 → yfin_cli-0.2.0}/src/commands/market.py +0 -0
  20. {yfin_cli-0.1.1 → yfin_cli-0.2.0}/src/commands/screen.py +0 -0
  21. {yfin_cli-0.1.1 → yfin_cli-0.2.0}/src/commands/sector.py +0 -0
  22. {yfin_cli-0.1.1 → yfin_cli-0.2.0}/src/decorators.py +0 -0
  23. {yfin_cli-0.1.1 → yfin_cli-0.2.0}/src/typer.py +0 -0
  24. {yfin_cli-0.1.1 → yfin_cli-0.2.0}/src/utils.py +0 -0
  25. {yfin_cli-0.1.1 → yfin_cli-0.2.0}/tests/conftest.py +0 -0
  26. {yfin_cli-0.1.1 → yfin_cli-0.2.0}/tests/test_analysis.py +0 -0
  27. {yfin_cli-0.1.1 → yfin_cli-0.2.0}/tests/test_balance_sheet.py +0 -0
  28. {yfin_cli-0.1.1 → yfin_cli-0.2.0}/tests/test_calendar_earnings.py +0 -0
  29. {yfin_cli-0.1.1 → yfin_cli-0.2.0}/tests/test_calendar_economic_events.py +0 -0
  30. {yfin_cli-0.1.1 → yfin_cli-0.2.0}/tests/test_calendar_ipo.py +0 -0
  31. {yfin_cli-0.1.1 → yfin_cli-0.2.0}/tests/test_cashflow.py +0 -0
  32. {yfin_cli-0.1.1 → yfin_cli-0.2.0}/tests/test_dividends.py +0 -0
  33. {yfin_cli-0.1.1 → yfin_cli-0.2.0}/tests/test_earnings_dates.py +0 -0
  34. {yfin_cli-0.1.1 → yfin_cli-0.2.0}/tests/test_fast_info.py +0 -0
  35. {yfin_cli-0.1.1 → yfin_cli-0.2.0}/tests/test_history.py +0 -0
  36. {yfin_cli-0.1.1 → yfin_cli-0.2.0}/tests/test_income_statement.py +0 -0
  37. {yfin_cli-0.1.1 → yfin_cli-0.2.0}/tests/test_industry.py +0 -0
  38. {yfin_cli-0.1.1 → yfin_cli-0.2.0}/tests/test_market_status.py +0 -0
  39. {yfin_cli-0.1.1 → yfin_cli-0.2.0}/tests/test_news.py +0 -0
  40. {yfin_cli-0.1.1 → yfin_cli-0.2.0}/tests/test_screen.py +0 -0
  41. {yfin_cli-0.1.1 → yfin_cli-0.2.0}/tests/test_sec_filings.py +0 -0
  42. {yfin_cli-0.1.1 → yfin_cli-0.2.0}/tests/test_sector.py +0 -0
@@ -13,6 +13,7 @@ A comprehensive reference for every command in the `yfin` CLI.
13
13
  - [`history`](#history)
14
14
  - [`dividends`](#dividends)
15
15
  - [`fast-info`](#fast-info)
16
+ - [`info`](#info)
16
17
  - [`news`](#news)
17
18
  - [Market](#market)
18
19
  - [`market-status`](#market-status)
@@ -139,6 +140,26 @@ yfin fast-info MSFT
139
140
 
140
141
  ---
141
142
 
143
+ ### `info`
144
+
145
+ Get detailed info for a stock ticker. Returns comprehensive information including company profile, financial metrics, and market data.
146
+
147
+ | Parameter | Type | Required | Default | Description |
148
+ | --------- | -------- | -------- | ------- | ------------------- |
149
+ | `TICKER` | argument | ✅ | — | Stock ticker symbol |
150
+
151
+ **Examples:**
152
+
153
+ ```bash
154
+ # Get detailed info for Tesla
155
+ yfin info TSLA
156
+
157
+ # Get detailed info for Apple
158
+ yfin info AAPL
159
+ ```
160
+
161
+ ---
162
+
142
163
  ### `news`
143
164
 
144
165
  Get news articles for a stock ticker.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: yfin-cli
3
- Version: 0.1.1
3
+ Version: 0.2.0
4
4
  Summary: A command-line interface for Yahoo Finance data
5
5
  License-Expression: MIT
6
6
  License-File: LICENSE
@@ -88,7 +88,7 @@ yfin --output table history AAPL --period 1y
88
88
 
89
89
  | Category | Commands |
90
90
  | -------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
91
- | **Stock** | `history`, `dividends`, `fast-info`, `news` |
91
+ | **Stock** | `history`, `dividends`, `fast-info`, `info`, `news` |
92
92
  | **Market** | `market-status` |
93
93
  | **Calendar** | `calendar-earnings`, `calendar-economic-events`, `calendar-ipo` |
94
94
  | **Financials** | `income-stmt`, `balance-sheet`, `cashflow`, `earnings-dates`, `sec-filings` |
@@ -75,7 +75,7 @@ yfin --output table history AAPL --period 1y
75
75
 
76
76
  | Category | Commands |
77
77
  | -------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
78
- | **Stock** | `history`, `dividends`, `fast-info`, `news` |
78
+ | **Stock** | `history`, `dividends`, `fast-info`, `info`, `news` |
79
79
  | **Market** | `market-status` |
80
80
  | **Calendar** | `calendar-earnings`, `calendar-economic-events`, `calendar-ipo` |
81
81
  | **Financials** | `income-stmt`, `balance-sheet`, `cashflow`, `earnings-dates`, `sec-filings` |
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "yfin-cli"
3
- version = "0.1.1"
3
+ version = "0.2.0"
4
4
  license = "MIT"
5
5
  description = "A command-line interface for Yahoo Finance data"
6
6
  readme = { file = "README.md", content-type = "text/markdown" }
@@ -9,6 +9,7 @@ from .commands.stock import (
9
9
  history,
10
10
  dividends,
11
11
  fast_info,
12
+ info,
12
13
  news,
13
14
  )
14
15
  from .commands.market import market_status
@@ -80,6 +81,7 @@ def main(ctx: typer.Context, output: OutputType = default_output):
80
81
  app.command(rich_help_panel="Stock")(history)
81
82
  app.command(rich_help_panel="Stock")(dividends)
82
83
  app.command(rich_help_panel="Stock")(fast_info)
84
+ app.command(rich_help_panel="Stock")(info)
83
85
  app.command(rich_help_panel="Stock")(news)
84
86
 
85
87
  app.command(rich_help_panel="Market")(market_status)
@@ -82,6 +82,22 @@ def fast_info(
82
82
  return fast_info_dict
83
83
 
84
84
 
85
+ @command
86
+ def info(
87
+ ticker: TickerType,
88
+ ):
89
+ """
90
+ Get detailed info for a stock ticker.
91
+
92
+ Returns comprehensive information including company profile, financial metrics, and market data.
93
+ """
94
+ stock = yf.Ticker(ticker)
95
+ info = stock.get_info()
96
+ if info is None:
97
+ return None
98
+ return info
99
+
100
+
85
101
  @command
86
102
  def news(
87
103
  ticker: TickerType,
@@ -20,7 +20,9 @@ class WriterFactory:
20
20
 
21
21
  class JsonWriter(OutputWriter):
22
22
  def write(self, data: dict | list) -> None:
23
- console_print(json.dumps(data, indent=2, default=str))
23
+ # Use print() instead of console_print() because Rich interprets
24
+ # escape sequences and markup, corrupting JSON with special characters.
25
+ print(json.dumps(data, indent=2, default=str))
24
26
 
25
27
 
26
28
  class TableWriter(OutputWriter):
@@ -96,6 +96,50 @@ def test_json_writer_list(capsys):
96
96
  assert data == [{"a": 1}, {"a": 2}]
97
97
 
98
98
 
99
+ # ── JsonWriter: special characters (regression) ──────────────────────
100
+
101
+
102
+ def test_json_writer_newlines(capsys):
103
+ """Newlines in values must be escaped, not rendered literally."""
104
+ writer = JsonWriter()
105
+ writer.write({"desc": "line1\nline2\nline3"})
106
+ output = capsys.readouterr().out
107
+ data = json.loads(output)
108
+
109
+ assert data == {"desc": "line1\nline2\nline3"}
110
+
111
+
112
+ def test_json_writer_tabs_and_backslashes(capsys):
113
+ """Tabs and backslashes must survive round-trip through JSON."""
114
+ writer = JsonWriter()
115
+ writer.write({"path": "C:\\Users\\file", "col": "a\tb"})
116
+ output = capsys.readouterr().out
117
+ data = json.loads(output)
118
+
119
+ assert data == {"path": "C:\\Users\\file", "col": "a\tb"}
120
+
121
+
122
+ def test_json_writer_quotes(capsys):
123
+ """Double quotes inside values must be escaped."""
124
+ writer = JsonWriter()
125
+ writer.write({"msg": 'He said "hello"'})
126
+ output = capsys.readouterr().out
127
+ data = json.loads(output)
128
+
129
+ assert data == {"msg": 'He said "hello"'}
130
+
131
+
132
+ def test_json_writer_rich_markup(capsys):
133
+ """Rich markup-like strings (e.g. [bold]) must not be interpreted."""
134
+ writer = JsonWriter()
135
+ writer.write({"note": "[bold]important[/bold]", "tag": "[red]alert[/red]"})
136
+ output = capsys.readouterr().out
137
+ data = json.loads(output)
138
+
139
+ assert data["note"] == "[bold]important[/bold]"
140
+ assert data["tag"] == "[red]alert[/red]"
141
+
142
+
99
143
  # ── --output table CLI integration ────────────────────────────────────
100
144
 
101
145
 
@@ -1094,7 +1094,7 @@ wheels = [
1094
1094
 
1095
1095
  [[package]]
1096
1096
  name = "yfin-cli"
1097
- version = "0.1.1"
1097
+ version = "0.2.0"
1098
1098
  source = { editable = "." }
1099
1099
  dependencies = [
1100
1100
  { name = "lxml" },
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