debtstack-ai 0.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.
@@ -0,0 +1,266 @@
1
+ Metadata-Version: 2.4
2
+ Name: debtstack-ai
3
+ Version: 0.1.0
4
+ Summary: Corporate credit data API for AI agents
5
+ Author-email: "DebtStack.ai" <hello@debtstack.ai>
6
+ License: MIT
7
+ Project-URL: Homepage, https://debtstack.ai
8
+ Project-URL: Documentation, https://docs.debtstack.ai
9
+ Project-URL: Repository, https://github.com/debtstack-ai/debtstack-python
10
+ Project-URL: Issues, https://github.com/debtstack-ai/debtstack-python/issues
11
+ Project-URL: Changelog, https://github.com/debtstack-ai/debtstack-python/blob/main/CHANGELOG.md
12
+ Keywords: credit,debt,bonds,finance,api,ai,agents,langchain
13
+ Classifier: Development Status :: 4 - Beta
14
+ Classifier: Intended Audience :: Developers
15
+ Classifier: Intended Audience :: Financial and Insurance Industry
16
+ Classifier: License :: OSI Approved :: MIT License
17
+ Classifier: Programming Language :: Python :: 3
18
+ Classifier: Programming Language :: Python :: 3.8
19
+ Classifier: Programming Language :: Python :: 3.9
20
+ Classifier: Programming Language :: Python :: 3.10
21
+ Classifier: Programming Language :: Python :: 3.11
22
+ Classifier: Programming Language :: Python :: 3.12
23
+ Classifier: Topic :: Office/Business :: Financial
24
+ Classifier: Topic :: Software Development :: Libraries :: Python Modules
25
+ Requires-Python: >=3.8
26
+ Description-Content-Type: text/markdown
27
+ Requires-Dist: httpx>=0.24.0
28
+ Provides-Extra: dev
29
+ Requires-Dist: pytest>=7.0; extra == "dev"
30
+ Requires-Dist: pytest-asyncio>=0.21; extra == "dev"
31
+ Requires-Dist: pytest-cov>=4.0; extra == "dev"
32
+ Requires-Dist: mypy>=1.0; extra == "dev"
33
+ Requires-Dist: black>=23.0; extra == "dev"
34
+ Requires-Dist: ruff>=0.1.0; extra == "dev"
35
+ Requires-Dist: respx>=0.20; extra == "dev"
36
+ Provides-Extra: langchain
37
+ Requires-Dist: langchain-core>=0.1.0; extra == "langchain"
38
+ Provides-Extra: llamaindex
39
+ Requires-Dist: llama-index>=0.10.0; extra == "llamaindex"
40
+
41
+ # DebtStack.ai Python SDK
42
+
43
+ **Corporate credit data for AI agents.**
44
+
45
+ [![PyPI](https://img.shields.io/pypi/v/debtstack-ai)](https://pypi.org/project/debtstack-ai/)
46
+ [![License](https://img.shields.io/badge/license-MIT-blue.svg)](LICENSE)
47
+
48
+ ## Why DebtStack?
49
+
50
+ Equity data is everywhere. Credit data isn't.
51
+
52
+ There's no "Yahoo Finance for bonds." Corporate debt structures, guarantor chains, and covenant details are buried in SEC filings—scattered across 10-Ks, 8-Ks, credit agreements, and indentures. An AI agent trying to answer "which telecom companies have leverage above 5x?" would need to read dozens of filings, extract the right numbers, and compute ratios manually.
53
+
54
+ **DebtStack fixes this.** We extract, normalize, and serve corporate credit data through an API built for AI agents.
55
+
56
+ ### Three Things You Can't Do Elsewhere
57
+
58
+ **1. Cross-Company Credit Queries**
59
+ ```python
60
+ # Find distressed telecom companies
61
+ GET /v1/companies?sector=Telecommunications&min_leverage=5&sort=-net_leverage_ratio
62
+ ```
63
+ Screen 177 companies by leverage, coverage ratios, or maturity risk in one call. No filing-by-filing analysis.
64
+
65
+ **2. Pre-Built Entity Relationships**
66
+ ```python
67
+ # Who guarantees this bond?
68
+ POST /v1/entities/traverse
69
+ {"start": {"type": "bond", "id": "893830AK8"}, "relationships": ["guarantees"]}
70
+ ```
71
+ Guarantor chains, parent-subsidiary hierarchies, structural subordination—mapped and queryable. This data exists nowhere else in machine-readable form.
72
+
73
+ **3. Agent-Ready Speed**
74
+ ```
75
+ < 100ms response time
76
+ ```
77
+ AI agents chain multiple calls. If each took 30 seconds (reading a filing), a portfolio analysis would take hours. DebtStack returns in milliseconds.
78
+
79
+ ---
80
+
81
+ ## Installation
82
+
83
+ ```bash
84
+ pip install debtstack-ai
85
+ ```
86
+
87
+ For LangChain integration:
88
+ ```bash
89
+ pip install debtstack-ai[langchain]
90
+ ```
91
+
92
+ ## Quick Start
93
+
94
+ ```python
95
+ from debtstack import DebtStackClient
96
+ import asyncio
97
+
98
+ async def main():
99
+ async with DebtStackClient(api_key="your-api-key") as client:
100
+
101
+ # Screen for high-leverage companies
102
+ risky = await client.search_companies(
103
+ sector="Telecommunications",
104
+ min_leverage=4.0,
105
+ fields="ticker,name,net_leverage_ratio,interest_coverage",
106
+ sort="-net_leverage_ratio"
107
+ )
108
+
109
+ # Drill into the riskiest one
110
+ ticker = risky["data"][0]["ticker"]
111
+ bonds = await client.search_bonds(ticker=ticker, has_pricing=True)
112
+
113
+ # Check guarantor coverage on their notes
114
+ for bond in bonds["data"]:
115
+ guarantors = await client.get_guarantors(bond["cusip"])
116
+ print(f"{bond['name']}: {len(guarantors)} guarantors")
117
+
118
+ asyncio.run(main())
119
+ ```
120
+
121
+ ## Synchronous Usage
122
+
123
+ ```python
124
+ from debtstack import DebtStackSyncClient
125
+
126
+ client = DebtStackSyncClient(api_key="your-api-key")
127
+ result = client.search_companies(sector="Energy", min_leverage=3.0)
128
+ ```
129
+
130
+ ## What's In The Data
131
+
132
+ | Coverage | Count |
133
+ |----------|-------|
134
+ | Companies | 211 (S&P 100 + NASDAQ 100 + high-yield issuers) |
135
+ | Entities | 28,128 (subsidiaries, holdcos, JVs, VIEs) |
136
+ | Debt Instruments | 4,496 (bonds, loans, revolvers) with 97% document linkage |
137
+ | Bond Pricing | 3,557 bonds with FINRA TRACE pricing (updated 3x daily) |
138
+ | SEC Filing Sections | 14,511 (searchable full-text) |
139
+ | Covenants | 1,247 structured covenant records |
140
+
141
+ **Pre-computed metrics:** Leverage ratios, interest coverage, maturity profiles, structural subordination scores.
142
+
143
+ **Relationships:** Guarantor chains, issuer-entity links, parent-subsidiary hierarchies.
144
+
145
+ ## API Methods
146
+
147
+ | Method | What It Does |
148
+ |--------|--------------|
149
+ | `search_companies()` | Screen by leverage, sector, coverage, risk flags |
150
+ | `search_bonds()` | Filter by yield, spread, seniority, maturity |
151
+ | `resolve_bond()` | Look up CUSIP, ISIN, or "RIG 8% 2027" |
152
+ | `traverse_entities()` | Follow guarantor chains, map corporate structure |
153
+ | `search_pricing()` | FINRA TRACE bond prices, YTM, spreads |
154
+ | `search_documents()` | Full-text search across credit agreements, indentures |
155
+ | `batch()` | Run multiple queries in parallel |
156
+ | `get_changes()` | Track debt structure changes over time |
157
+
158
+ ## Examples
159
+
160
+ ### Which MAG7 company has the most debt?
161
+
162
+ ```python
163
+ result = await client.search_companies(
164
+ ticker="AAPL,MSFT,GOOGL,AMZN,NVDA,META,TSLA",
165
+ fields="ticker,name,total_debt,net_leverage_ratio",
166
+ sort="-total_debt",
167
+ limit=1
168
+ )
169
+ # Returns structured data in milliseconds, not minutes
170
+ ```
171
+
172
+ ### Find high-yield bonds trading at a discount
173
+
174
+ ```python
175
+ result = await client.search_bonds(
176
+ seniority="senior_unsecured",
177
+ min_ytm=8.0,
178
+ has_pricing=True,
179
+ sort="-pricing.ytm"
180
+ )
181
+ ```
182
+
183
+ ### Who guarantees a specific bond?
184
+
185
+ ```python
186
+ guarantors = await client.get_guarantors("893830AK8")
187
+ for g in guarantors:
188
+ print(f"{g['name']} ({g['entity_type']}) - {g['jurisdiction']}")
189
+
190
+ # Output:
191
+ # Transocean Ltd. (holdco) - Switzerland
192
+ # Transocean Inc. (finco) - Cayman Islands
193
+ # Transocean Offshore Deepwater Drilling Inc. (opco) - Delaware
194
+ # ... 42 more entities
195
+ ```
196
+
197
+ ### Search for covenant language
198
+
199
+ ```python
200
+ result = await client.search_documents(
201
+ q="maintenance covenant",
202
+ section_type="credit_agreement",
203
+ ticker="CHTR"
204
+ )
205
+ # Returns matching sections with highlighted snippets
206
+ ```
207
+
208
+ ## LangChain Integration
209
+
210
+ ```python
211
+ from debtstack.langchain import DebtStackToolkit
212
+ from langchain.agents import AgentExecutor, create_openai_functions_agent
213
+ from langchain_openai import ChatOpenAI
214
+ from langchain import hub
215
+
216
+ toolkit = DebtStackToolkit(api_key="your-api-key")
217
+ tools = toolkit.get_tools()
218
+
219
+ llm = ChatOpenAI(temperature=0, model="gpt-4")
220
+ prompt = hub.pull("hwchase17/openai-functions-agent")
221
+ agent = create_openai_functions_agent(llm, tools, prompt)
222
+ agent_executor = AgentExecutor(agent=agent, tools=tools)
223
+
224
+ result = agent_executor.invoke({
225
+ "input": "Which telecom companies are most at risk of default?"
226
+ })
227
+ ```
228
+
229
+ ## MCP Server (Claude Desktop)
230
+
231
+ Add to `~/.config/claude/mcp.json`:
232
+
233
+ ```json
234
+ {
235
+ "mcpServers": {
236
+ "debtstack-ai": {
237
+ "command": "python",
238
+ "args": ["-m", "debtstack.mcp_server"],
239
+ "env": {
240
+ "DEBTSTACK_API_KEY": "your-api-key"
241
+ }
242
+ }
243
+ }
244
+ }
245
+ ```
246
+
247
+ Then ask Claude:
248
+ - "Which energy companies have near-term maturities and high leverage?"
249
+ - "Who guarantees the Transocean 8% 2027 notes?"
250
+ - "Compare Charter's debt structure to Altice"
251
+
252
+ ## Pricing
253
+
254
+ DebtStack offers usage-based pricing with a free tier to get started.
255
+
256
+ See [debtstack.ai/pricing](https://debtstack.ai/pricing) for details.
257
+
258
+ ## Links
259
+
260
+ - **Docs:** [docs.debtstack.ai](https://docs.debtstack.ai)
261
+ - **Discord:** [discord.gg/debtstack-ai](https://discord.gg/debtstack-ai)
262
+ - **Issues:** [GitHub](https://github.com/debtstack-ai/debtstack-python/issues)
263
+
264
+ ## License
265
+
266
+ MIT
@@ -0,0 +1,226 @@
1
+ # DebtStack.ai Python SDK
2
+
3
+ **Corporate credit data for AI agents.**
4
+
5
+ [![PyPI](https://img.shields.io/pypi/v/debtstack-ai)](https://pypi.org/project/debtstack-ai/)
6
+ [![License](https://img.shields.io/badge/license-MIT-blue.svg)](LICENSE)
7
+
8
+ ## Why DebtStack?
9
+
10
+ Equity data is everywhere. Credit data isn't.
11
+
12
+ There's no "Yahoo Finance for bonds." Corporate debt structures, guarantor chains, and covenant details are buried in SEC filings—scattered across 10-Ks, 8-Ks, credit agreements, and indentures. An AI agent trying to answer "which telecom companies have leverage above 5x?" would need to read dozens of filings, extract the right numbers, and compute ratios manually.
13
+
14
+ **DebtStack fixes this.** We extract, normalize, and serve corporate credit data through an API built for AI agents.
15
+
16
+ ### Three Things You Can't Do Elsewhere
17
+
18
+ **1. Cross-Company Credit Queries**
19
+ ```python
20
+ # Find distressed telecom companies
21
+ GET /v1/companies?sector=Telecommunications&min_leverage=5&sort=-net_leverage_ratio
22
+ ```
23
+ Screen 177 companies by leverage, coverage ratios, or maturity risk in one call. No filing-by-filing analysis.
24
+
25
+ **2. Pre-Built Entity Relationships**
26
+ ```python
27
+ # Who guarantees this bond?
28
+ POST /v1/entities/traverse
29
+ {"start": {"type": "bond", "id": "893830AK8"}, "relationships": ["guarantees"]}
30
+ ```
31
+ Guarantor chains, parent-subsidiary hierarchies, structural subordination—mapped and queryable. This data exists nowhere else in machine-readable form.
32
+
33
+ **3. Agent-Ready Speed**
34
+ ```
35
+ < 100ms response time
36
+ ```
37
+ AI agents chain multiple calls. If each took 30 seconds (reading a filing), a portfolio analysis would take hours. DebtStack returns in milliseconds.
38
+
39
+ ---
40
+
41
+ ## Installation
42
+
43
+ ```bash
44
+ pip install debtstack-ai
45
+ ```
46
+
47
+ For LangChain integration:
48
+ ```bash
49
+ pip install debtstack-ai[langchain]
50
+ ```
51
+
52
+ ## Quick Start
53
+
54
+ ```python
55
+ from debtstack import DebtStackClient
56
+ import asyncio
57
+
58
+ async def main():
59
+ async with DebtStackClient(api_key="your-api-key") as client:
60
+
61
+ # Screen for high-leverage companies
62
+ risky = await client.search_companies(
63
+ sector="Telecommunications",
64
+ min_leverage=4.0,
65
+ fields="ticker,name,net_leverage_ratio,interest_coverage",
66
+ sort="-net_leverage_ratio"
67
+ )
68
+
69
+ # Drill into the riskiest one
70
+ ticker = risky["data"][0]["ticker"]
71
+ bonds = await client.search_bonds(ticker=ticker, has_pricing=True)
72
+
73
+ # Check guarantor coverage on their notes
74
+ for bond in bonds["data"]:
75
+ guarantors = await client.get_guarantors(bond["cusip"])
76
+ print(f"{bond['name']}: {len(guarantors)} guarantors")
77
+
78
+ asyncio.run(main())
79
+ ```
80
+
81
+ ## Synchronous Usage
82
+
83
+ ```python
84
+ from debtstack import DebtStackSyncClient
85
+
86
+ client = DebtStackSyncClient(api_key="your-api-key")
87
+ result = client.search_companies(sector="Energy", min_leverage=3.0)
88
+ ```
89
+
90
+ ## What's In The Data
91
+
92
+ | Coverage | Count |
93
+ |----------|-------|
94
+ | Companies | 211 (S&P 100 + NASDAQ 100 + high-yield issuers) |
95
+ | Entities | 28,128 (subsidiaries, holdcos, JVs, VIEs) |
96
+ | Debt Instruments | 4,496 (bonds, loans, revolvers) with 97% document linkage |
97
+ | Bond Pricing | 3,557 bonds with FINRA TRACE pricing (updated 3x daily) |
98
+ | SEC Filing Sections | 14,511 (searchable full-text) |
99
+ | Covenants | 1,247 structured covenant records |
100
+
101
+ **Pre-computed metrics:** Leverage ratios, interest coverage, maturity profiles, structural subordination scores.
102
+
103
+ **Relationships:** Guarantor chains, issuer-entity links, parent-subsidiary hierarchies.
104
+
105
+ ## API Methods
106
+
107
+ | Method | What It Does |
108
+ |--------|--------------|
109
+ | `search_companies()` | Screen by leverage, sector, coverage, risk flags |
110
+ | `search_bonds()` | Filter by yield, spread, seniority, maturity |
111
+ | `resolve_bond()` | Look up CUSIP, ISIN, or "RIG 8% 2027" |
112
+ | `traverse_entities()` | Follow guarantor chains, map corporate structure |
113
+ | `search_pricing()` | FINRA TRACE bond prices, YTM, spreads |
114
+ | `search_documents()` | Full-text search across credit agreements, indentures |
115
+ | `batch()` | Run multiple queries in parallel |
116
+ | `get_changes()` | Track debt structure changes over time |
117
+
118
+ ## Examples
119
+
120
+ ### Which MAG7 company has the most debt?
121
+
122
+ ```python
123
+ result = await client.search_companies(
124
+ ticker="AAPL,MSFT,GOOGL,AMZN,NVDA,META,TSLA",
125
+ fields="ticker,name,total_debt,net_leverage_ratio",
126
+ sort="-total_debt",
127
+ limit=1
128
+ )
129
+ # Returns structured data in milliseconds, not minutes
130
+ ```
131
+
132
+ ### Find high-yield bonds trading at a discount
133
+
134
+ ```python
135
+ result = await client.search_bonds(
136
+ seniority="senior_unsecured",
137
+ min_ytm=8.0,
138
+ has_pricing=True,
139
+ sort="-pricing.ytm"
140
+ )
141
+ ```
142
+
143
+ ### Who guarantees a specific bond?
144
+
145
+ ```python
146
+ guarantors = await client.get_guarantors("893830AK8")
147
+ for g in guarantors:
148
+ print(f"{g['name']} ({g['entity_type']}) - {g['jurisdiction']}")
149
+
150
+ # Output:
151
+ # Transocean Ltd. (holdco) - Switzerland
152
+ # Transocean Inc. (finco) - Cayman Islands
153
+ # Transocean Offshore Deepwater Drilling Inc. (opco) - Delaware
154
+ # ... 42 more entities
155
+ ```
156
+
157
+ ### Search for covenant language
158
+
159
+ ```python
160
+ result = await client.search_documents(
161
+ q="maintenance covenant",
162
+ section_type="credit_agreement",
163
+ ticker="CHTR"
164
+ )
165
+ # Returns matching sections with highlighted snippets
166
+ ```
167
+
168
+ ## LangChain Integration
169
+
170
+ ```python
171
+ from debtstack.langchain import DebtStackToolkit
172
+ from langchain.agents import AgentExecutor, create_openai_functions_agent
173
+ from langchain_openai import ChatOpenAI
174
+ from langchain import hub
175
+
176
+ toolkit = DebtStackToolkit(api_key="your-api-key")
177
+ tools = toolkit.get_tools()
178
+
179
+ llm = ChatOpenAI(temperature=0, model="gpt-4")
180
+ prompt = hub.pull("hwchase17/openai-functions-agent")
181
+ agent = create_openai_functions_agent(llm, tools, prompt)
182
+ agent_executor = AgentExecutor(agent=agent, tools=tools)
183
+
184
+ result = agent_executor.invoke({
185
+ "input": "Which telecom companies are most at risk of default?"
186
+ })
187
+ ```
188
+
189
+ ## MCP Server (Claude Desktop)
190
+
191
+ Add to `~/.config/claude/mcp.json`:
192
+
193
+ ```json
194
+ {
195
+ "mcpServers": {
196
+ "debtstack-ai": {
197
+ "command": "python",
198
+ "args": ["-m", "debtstack.mcp_server"],
199
+ "env": {
200
+ "DEBTSTACK_API_KEY": "your-api-key"
201
+ }
202
+ }
203
+ }
204
+ }
205
+ ```
206
+
207
+ Then ask Claude:
208
+ - "Which energy companies have near-term maturities and high leverage?"
209
+ - "Who guarantees the Transocean 8% 2027 notes?"
210
+ - "Compare Charter's debt structure to Altice"
211
+
212
+ ## Pricing
213
+
214
+ DebtStack offers usage-based pricing with a free tier to get started.
215
+
216
+ See [debtstack.ai/pricing](https://debtstack.ai/pricing) for details.
217
+
218
+ ## Links
219
+
220
+ - **Docs:** [docs.debtstack.ai](https://docs.debtstack.ai)
221
+ - **Discord:** [discord.gg/debtstack-ai](https://discord.gg/debtstack-ai)
222
+ - **Issues:** [GitHub](https://github.com/debtstack-ai/debtstack-python/issues)
223
+
224
+ ## License
225
+
226
+ MIT
@@ -0,0 +1,10 @@
1
+ """
2
+ DebtStack.ai Python SDK
3
+
4
+ Corporate credit data API for AI agents.
5
+ """
6
+
7
+ from .client import DebtStackClient, DebtStackSyncClient
8
+
9
+ __version__ = "0.1.0"
10
+ __all__ = ["DebtStackClient", "DebtStackSyncClient"]