tickerapi 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.
- tickerapi-0.1.0/PKG-INFO +216 -0
- tickerapi-0.1.0/README.md +188 -0
- tickerapi-0.1.0/pyproject.toml +39 -0
- tickerapi-0.1.0/tickerapi/__init__.py +40 -0
- tickerapi-0.1.0/tickerapi/async_client.py +436 -0
- tickerapi-0.1.0/tickerapi/client.py +434 -0
- tickerapi-0.1.0/tickerapi/exceptions.py +53 -0
- tickerapi-0.1.0/tickerapi/py.typed +0 -0
- tickerapi-0.1.0/tickerapi/types.py +112 -0
tickerapi-0.1.0/PKG-INFO
ADDED
|
@@ -0,0 +1,216 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: tickerapi
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Python SDK for the TickerAPI financial data API
|
|
5
|
+
Project-URL: Homepage, https://tickerapi.ai
|
|
6
|
+
Project-URL: Documentation, https://tickerapi.ai/docs
|
|
7
|
+
Project-URL: Repository, https://github.com/tickerapi/tickerapi-python
|
|
8
|
+
Project-URL: Issues, https://github.com/tickerapi/tickerapi-python/issues
|
|
9
|
+
Author-email: TickerAPI <support@tickerapi.ai>
|
|
10
|
+
License-Expression: MIT
|
|
11
|
+
Keywords: api,crypto,etf,finance,market-data,stocks,ticker
|
|
12
|
+
Classifier: Development Status :: 4 - Beta
|
|
13
|
+
Classifier: Intended Audience :: Developers
|
|
14
|
+
Classifier: Intended Audience :: Financial and Insurance Industry
|
|
15
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
16
|
+
Classifier: Programming Language :: Python :: 3
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.8
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.9
|
|
19
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
20
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
21
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
22
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
23
|
+
Classifier: Topic :: Office/Business :: Financial :: Investment
|
|
24
|
+
Classifier: Typing :: Typed
|
|
25
|
+
Requires-Python: >=3.8
|
|
26
|
+
Requires-Dist: httpx>=0.24.0
|
|
27
|
+
Description-Content-Type: text/markdown
|
|
28
|
+
|
|
29
|
+
# TickerAPI Python SDK
|
|
30
|
+
|
|
31
|
+
[](https://pypi.org/project/tickerapi/)
|
|
32
|
+
[](https://pypi.org/project/tickerapi/)
|
|
33
|
+
|
|
34
|
+
The official Python SDK for [TickerAPI](https://tickerapi.ai) -- financial data and market intelligence API.
|
|
35
|
+
|
|
36
|
+
- Sync and async clients
|
|
37
|
+
- Full type hints for IDE autocompletion
|
|
38
|
+
- Typed exceptions for every error class
|
|
39
|
+
- Rate limit information on every response
|
|
40
|
+
|
|
41
|
+
**Full API documentation:** [https://tickerapi.ai/docs](https://tickerapi.ai/docs)
|
|
42
|
+
|
|
43
|
+
## Installation
|
|
44
|
+
|
|
45
|
+
```bash
|
|
46
|
+
pip install tickerapi
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
## Quick Start
|
|
50
|
+
|
|
51
|
+
### Synchronous
|
|
52
|
+
|
|
53
|
+
```python
|
|
54
|
+
from tickerapi import TickerAPI
|
|
55
|
+
|
|
56
|
+
client = TickerAPI("your_api_key")
|
|
57
|
+
|
|
58
|
+
# Get a ticker summary
|
|
59
|
+
result = client.summary("AAPL")
|
|
60
|
+
print(result["data"])
|
|
61
|
+
|
|
62
|
+
# Rate limit info is included on every response
|
|
63
|
+
print(result["rate_limits"]["requests_remaining"])
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
### Asynchronous
|
|
67
|
+
|
|
68
|
+
```python
|
|
69
|
+
import asyncio
|
|
70
|
+
from tickerapi import AsyncTickerAPI
|
|
71
|
+
|
|
72
|
+
async def main():
|
|
73
|
+
async with AsyncTickerAPI("your_api_key") as client:
|
|
74
|
+
result = await client.summary("AAPL")
|
|
75
|
+
print(result["data"])
|
|
76
|
+
|
|
77
|
+
asyncio.run(main())
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
## Endpoints
|
|
81
|
+
|
|
82
|
+
### Summary
|
|
83
|
+
|
|
84
|
+
Get a detailed summary for a single ticker.
|
|
85
|
+
|
|
86
|
+
```python
|
|
87
|
+
result = client.summary("AAPL")
|
|
88
|
+
result = client.summary("AAPL", timeframe="weekly")
|
|
89
|
+
result = client.summary("AAPL", date="2025-01-15")
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
### Compare
|
|
93
|
+
|
|
94
|
+
Compare multiple tickers side-by-side.
|
|
95
|
+
|
|
96
|
+
```python
|
|
97
|
+
result = client.compare(["AAPL", "MSFT", "GOOGL"])
|
|
98
|
+
result = client.compare("AAPL,MSFT,GOOGL", timeframe="weekly")
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
### Watchlist
|
|
102
|
+
|
|
103
|
+
Post a list of tickers to get watchlist data.
|
|
104
|
+
|
|
105
|
+
```python
|
|
106
|
+
result = client.watchlist(["AAPL", "MSFT", "TSLA"])
|
|
107
|
+
result = client.watchlist(["AAPL", "MSFT"], timeframe="weekly")
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
### Assets
|
|
111
|
+
|
|
112
|
+
List all available assets.
|
|
113
|
+
|
|
114
|
+
```python
|
|
115
|
+
result = client.assets()
|
|
116
|
+
```
|
|
117
|
+
|
|
118
|
+
### Scan: Oversold
|
|
119
|
+
|
|
120
|
+
Find oversold assets across markets.
|
|
121
|
+
|
|
122
|
+
```python
|
|
123
|
+
result = client.scan_oversold()
|
|
124
|
+
result = client.scan_oversold(
|
|
125
|
+
asset_class="stock",
|
|
126
|
+
min_severity="deep_oversold",
|
|
127
|
+
sort_by="severity",
|
|
128
|
+
limit=10,
|
|
129
|
+
)
|
|
130
|
+
```
|
|
131
|
+
|
|
132
|
+
### Scan: Breakouts
|
|
133
|
+
|
|
134
|
+
Detect breakout patterns.
|
|
135
|
+
|
|
136
|
+
```python
|
|
137
|
+
result = client.scan_breakouts(direction="bullish", asset_class="stock", limit=20)
|
|
138
|
+
```
|
|
139
|
+
|
|
140
|
+
### Scan: Unusual Volume
|
|
141
|
+
|
|
142
|
+
Spot unusual volume activity.
|
|
143
|
+
|
|
144
|
+
```python
|
|
145
|
+
result = client.scan_unusual_volume(min_ratio_band="high", limit=10)
|
|
146
|
+
```
|
|
147
|
+
|
|
148
|
+
### Scan: Valuation
|
|
149
|
+
|
|
150
|
+
Find valuation outliers.
|
|
151
|
+
|
|
152
|
+
```python
|
|
153
|
+
result = client.scan_valuation(direction="undervalued", sort_by="pe_vs_history")
|
|
154
|
+
```
|
|
155
|
+
|
|
156
|
+
### Scan: Insider Activity
|
|
157
|
+
|
|
158
|
+
Track notable insider trading activity.
|
|
159
|
+
|
|
160
|
+
```python
|
|
161
|
+
result = client.scan_insider_activity(direction="buying", sort_by="net_ratio", limit=15)
|
|
162
|
+
```
|
|
163
|
+
|
|
164
|
+
## Error Handling
|
|
165
|
+
|
|
166
|
+
The SDK raises typed exceptions for all API errors:
|
|
167
|
+
|
|
168
|
+
```python
|
|
169
|
+
from tickerapi import TickerAPI, TickerAPIError, RateLimitError, NotFoundError
|
|
170
|
+
|
|
171
|
+
client = TickerAPI("your_api_key")
|
|
172
|
+
|
|
173
|
+
try:
|
|
174
|
+
result = client.summary("INVALID_TICKER")
|
|
175
|
+
except NotFoundError as e:
|
|
176
|
+
print(f"Ticker not found: {e.message}")
|
|
177
|
+
except RateLimitError as e:
|
|
178
|
+
print(f"Rate limited! Resets at: {e.reset}")
|
|
179
|
+
print(f"Upgrade: {e.upgrade_url}")
|
|
180
|
+
except TickerAPIError as e:
|
|
181
|
+
print(f"API error [{e.status_code}]: {e.message}")
|
|
182
|
+
```
|
|
183
|
+
|
|
184
|
+
### Exception Hierarchy
|
|
185
|
+
|
|
186
|
+
| Exception | Status Code | Description |
|
|
187
|
+
|---|---|---|
|
|
188
|
+
| `TickerAPIError` | any | Base exception for all API errors |
|
|
189
|
+
| `AuthenticationError` | 401 | Invalid or missing API key |
|
|
190
|
+
| `ForbiddenError` | 403 | Endpoint restricted to higher tier |
|
|
191
|
+
| `NotFoundError` | 404 | Asset not found |
|
|
192
|
+
| `RateLimitError` | 429 | Rate limit exceeded |
|
|
193
|
+
| `DataUnavailableError` | 503 | Data temporarily unavailable |
|
|
194
|
+
|
|
195
|
+
All exceptions include `status_code`, `error_type`, `message`, and optionally `upgrade_url` and `reset` attributes.
|
|
196
|
+
|
|
197
|
+
## Rate Limits
|
|
198
|
+
|
|
199
|
+
Every response includes a `rate_limits` dict parsed from the API headers:
|
|
200
|
+
|
|
201
|
+
```python
|
|
202
|
+
result = client.summary("AAPL")
|
|
203
|
+
limits = result["rate_limits"]
|
|
204
|
+
|
|
205
|
+
print(limits["request_limit"]) # Total request limit
|
|
206
|
+
print(limits["requests_remaining"]) # Requests remaining
|
|
207
|
+
print(limits["request_reset"]) # Reset timestamp
|
|
208
|
+
print(limits["hourly_request_limit"]) # Hourly limit
|
|
209
|
+
print(limits["hourly_requests_remaining"]) # Hourly remaining
|
|
210
|
+
```
|
|
211
|
+
|
|
212
|
+
## Links
|
|
213
|
+
|
|
214
|
+
- [TickerAPI Website](https://tickerapi.ai)
|
|
215
|
+
- [API Documentation](https://tickerapi.ai/docs)
|
|
216
|
+
- [PyPI Package](https://pypi.org/project/tickerapi/)
|
|
@@ -0,0 +1,188 @@
|
|
|
1
|
+
# TickerAPI Python SDK
|
|
2
|
+
|
|
3
|
+
[](https://pypi.org/project/tickerapi/)
|
|
4
|
+
[](https://pypi.org/project/tickerapi/)
|
|
5
|
+
|
|
6
|
+
The official Python SDK for [TickerAPI](https://tickerapi.ai) -- financial data and market intelligence API.
|
|
7
|
+
|
|
8
|
+
- Sync and async clients
|
|
9
|
+
- Full type hints for IDE autocompletion
|
|
10
|
+
- Typed exceptions for every error class
|
|
11
|
+
- Rate limit information on every response
|
|
12
|
+
|
|
13
|
+
**Full API documentation:** [https://tickerapi.ai/docs](https://tickerapi.ai/docs)
|
|
14
|
+
|
|
15
|
+
## Installation
|
|
16
|
+
|
|
17
|
+
```bash
|
|
18
|
+
pip install tickerapi
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
## Quick Start
|
|
22
|
+
|
|
23
|
+
### Synchronous
|
|
24
|
+
|
|
25
|
+
```python
|
|
26
|
+
from tickerapi import TickerAPI
|
|
27
|
+
|
|
28
|
+
client = TickerAPI("your_api_key")
|
|
29
|
+
|
|
30
|
+
# Get a ticker summary
|
|
31
|
+
result = client.summary("AAPL")
|
|
32
|
+
print(result["data"])
|
|
33
|
+
|
|
34
|
+
# Rate limit info is included on every response
|
|
35
|
+
print(result["rate_limits"]["requests_remaining"])
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
### Asynchronous
|
|
39
|
+
|
|
40
|
+
```python
|
|
41
|
+
import asyncio
|
|
42
|
+
from tickerapi import AsyncTickerAPI
|
|
43
|
+
|
|
44
|
+
async def main():
|
|
45
|
+
async with AsyncTickerAPI("your_api_key") as client:
|
|
46
|
+
result = await client.summary("AAPL")
|
|
47
|
+
print(result["data"])
|
|
48
|
+
|
|
49
|
+
asyncio.run(main())
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
## Endpoints
|
|
53
|
+
|
|
54
|
+
### Summary
|
|
55
|
+
|
|
56
|
+
Get a detailed summary for a single ticker.
|
|
57
|
+
|
|
58
|
+
```python
|
|
59
|
+
result = client.summary("AAPL")
|
|
60
|
+
result = client.summary("AAPL", timeframe="weekly")
|
|
61
|
+
result = client.summary("AAPL", date="2025-01-15")
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
### Compare
|
|
65
|
+
|
|
66
|
+
Compare multiple tickers side-by-side.
|
|
67
|
+
|
|
68
|
+
```python
|
|
69
|
+
result = client.compare(["AAPL", "MSFT", "GOOGL"])
|
|
70
|
+
result = client.compare("AAPL,MSFT,GOOGL", timeframe="weekly")
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
### Watchlist
|
|
74
|
+
|
|
75
|
+
Post a list of tickers to get watchlist data.
|
|
76
|
+
|
|
77
|
+
```python
|
|
78
|
+
result = client.watchlist(["AAPL", "MSFT", "TSLA"])
|
|
79
|
+
result = client.watchlist(["AAPL", "MSFT"], timeframe="weekly")
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
### Assets
|
|
83
|
+
|
|
84
|
+
List all available assets.
|
|
85
|
+
|
|
86
|
+
```python
|
|
87
|
+
result = client.assets()
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
### Scan: Oversold
|
|
91
|
+
|
|
92
|
+
Find oversold assets across markets.
|
|
93
|
+
|
|
94
|
+
```python
|
|
95
|
+
result = client.scan_oversold()
|
|
96
|
+
result = client.scan_oversold(
|
|
97
|
+
asset_class="stock",
|
|
98
|
+
min_severity="deep_oversold",
|
|
99
|
+
sort_by="severity",
|
|
100
|
+
limit=10,
|
|
101
|
+
)
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
### Scan: Breakouts
|
|
105
|
+
|
|
106
|
+
Detect breakout patterns.
|
|
107
|
+
|
|
108
|
+
```python
|
|
109
|
+
result = client.scan_breakouts(direction="bullish", asset_class="stock", limit=20)
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
### Scan: Unusual Volume
|
|
113
|
+
|
|
114
|
+
Spot unusual volume activity.
|
|
115
|
+
|
|
116
|
+
```python
|
|
117
|
+
result = client.scan_unusual_volume(min_ratio_band="high", limit=10)
|
|
118
|
+
```
|
|
119
|
+
|
|
120
|
+
### Scan: Valuation
|
|
121
|
+
|
|
122
|
+
Find valuation outliers.
|
|
123
|
+
|
|
124
|
+
```python
|
|
125
|
+
result = client.scan_valuation(direction="undervalued", sort_by="pe_vs_history")
|
|
126
|
+
```
|
|
127
|
+
|
|
128
|
+
### Scan: Insider Activity
|
|
129
|
+
|
|
130
|
+
Track notable insider trading activity.
|
|
131
|
+
|
|
132
|
+
```python
|
|
133
|
+
result = client.scan_insider_activity(direction="buying", sort_by="net_ratio", limit=15)
|
|
134
|
+
```
|
|
135
|
+
|
|
136
|
+
## Error Handling
|
|
137
|
+
|
|
138
|
+
The SDK raises typed exceptions for all API errors:
|
|
139
|
+
|
|
140
|
+
```python
|
|
141
|
+
from tickerapi import TickerAPI, TickerAPIError, RateLimitError, NotFoundError
|
|
142
|
+
|
|
143
|
+
client = TickerAPI("your_api_key")
|
|
144
|
+
|
|
145
|
+
try:
|
|
146
|
+
result = client.summary("INVALID_TICKER")
|
|
147
|
+
except NotFoundError as e:
|
|
148
|
+
print(f"Ticker not found: {e.message}")
|
|
149
|
+
except RateLimitError as e:
|
|
150
|
+
print(f"Rate limited! Resets at: {e.reset}")
|
|
151
|
+
print(f"Upgrade: {e.upgrade_url}")
|
|
152
|
+
except TickerAPIError as e:
|
|
153
|
+
print(f"API error [{e.status_code}]: {e.message}")
|
|
154
|
+
```
|
|
155
|
+
|
|
156
|
+
### Exception Hierarchy
|
|
157
|
+
|
|
158
|
+
| Exception | Status Code | Description |
|
|
159
|
+
|---|---|---|
|
|
160
|
+
| `TickerAPIError` | any | Base exception for all API errors |
|
|
161
|
+
| `AuthenticationError` | 401 | Invalid or missing API key |
|
|
162
|
+
| `ForbiddenError` | 403 | Endpoint restricted to higher tier |
|
|
163
|
+
| `NotFoundError` | 404 | Asset not found |
|
|
164
|
+
| `RateLimitError` | 429 | Rate limit exceeded |
|
|
165
|
+
| `DataUnavailableError` | 503 | Data temporarily unavailable |
|
|
166
|
+
|
|
167
|
+
All exceptions include `status_code`, `error_type`, `message`, and optionally `upgrade_url` and `reset` attributes.
|
|
168
|
+
|
|
169
|
+
## Rate Limits
|
|
170
|
+
|
|
171
|
+
Every response includes a `rate_limits` dict parsed from the API headers:
|
|
172
|
+
|
|
173
|
+
```python
|
|
174
|
+
result = client.summary("AAPL")
|
|
175
|
+
limits = result["rate_limits"]
|
|
176
|
+
|
|
177
|
+
print(limits["request_limit"]) # Total request limit
|
|
178
|
+
print(limits["requests_remaining"]) # Requests remaining
|
|
179
|
+
print(limits["request_reset"]) # Reset timestamp
|
|
180
|
+
print(limits["hourly_request_limit"]) # Hourly limit
|
|
181
|
+
print(limits["hourly_requests_remaining"]) # Hourly remaining
|
|
182
|
+
```
|
|
183
|
+
|
|
184
|
+
## Links
|
|
185
|
+
|
|
186
|
+
- [TickerAPI Website](https://tickerapi.ai)
|
|
187
|
+
- [API Documentation](https://tickerapi.ai/docs)
|
|
188
|
+
- [PyPI Package](https://pypi.org/project/tickerapi/)
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["hatchling"]
|
|
3
|
+
build-backend = "hatchling.build"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "tickerapi"
|
|
7
|
+
version = "0.1.0"
|
|
8
|
+
description = "Python SDK for the TickerAPI financial data API"
|
|
9
|
+
readme = "README.md"
|
|
10
|
+
license = "MIT"
|
|
11
|
+
requires-python = ">=3.8"
|
|
12
|
+
authors = [
|
|
13
|
+
{ name = "TickerAPI", email = "support@tickerapi.ai" },
|
|
14
|
+
]
|
|
15
|
+
keywords = ["finance", "stocks", "crypto", "etf", "market-data", "api", "ticker"]
|
|
16
|
+
classifiers = [
|
|
17
|
+
"Development Status :: 4 - Beta",
|
|
18
|
+
"Intended Audience :: Developers",
|
|
19
|
+
"Intended Audience :: Financial and Insurance Industry",
|
|
20
|
+
"License :: OSI Approved :: MIT License",
|
|
21
|
+
"Programming Language :: Python :: 3",
|
|
22
|
+
"Programming Language :: Python :: 3.8",
|
|
23
|
+
"Programming Language :: Python :: 3.9",
|
|
24
|
+
"Programming Language :: Python :: 3.10",
|
|
25
|
+
"Programming Language :: Python :: 3.11",
|
|
26
|
+
"Programming Language :: Python :: 3.12",
|
|
27
|
+
"Programming Language :: Python :: 3.13",
|
|
28
|
+
"Topic :: Office/Business :: Financial :: Investment",
|
|
29
|
+
"Typing :: Typed",
|
|
30
|
+
]
|
|
31
|
+
dependencies = [
|
|
32
|
+
"httpx>=0.24.0",
|
|
33
|
+
]
|
|
34
|
+
|
|
35
|
+
[project.urls]
|
|
36
|
+
Homepage = "https://tickerapi.ai"
|
|
37
|
+
Documentation = "https://tickerapi.ai/docs"
|
|
38
|
+
Repository = "https://github.com/tickerapi/tickerapi-python"
|
|
39
|
+
Issues = "https://github.com/tickerapi/tickerapi-python/issues"
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
"""TickerAPI Python SDK - Financial data at your fingertips.
|
|
2
|
+
|
|
3
|
+
Usage::
|
|
4
|
+
|
|
5
|
+
from tickerapi import TickerAPI
|
|
6
|
+
|
|
7
|
+
client = TickerAPI("your_api_key")
|
|
8
|
+
result = client.summary("AAPL")
|
|
9
|
+
|
|
10
|
+
For async usage::
|
|
11
|
+
|
|
12
|
+
from tickerapi import AsyncTickerAPI
|
|
13
|
+
|
|
14
|
+
async with AsyncTickerAPI("your_api_key") as client:
|
|
15
|
+
result = await client.summary("AAPL")
|
|
16
|
+
"""
|
|
17
|
+
|
|
18
|
+
from .async_client import AsyncTickerAPI
|
|
19
|
+
from .client import TickerAPI
|
|
20
|
+
from .exceptions import (
|
|
21
|
+
AuthenticationError,
|
|
22
|
+
DataUnavailableError,
|
|
23
|
+
ForbiddenError,
|
|
24
|
+
NotFoundError,
|
|
25
|
+
RateLimitError,
|
|
26
|
+
TickerAPIError,
|
|
27
|
+
)
|
|
28
|
+
|
|
29
|
+
__all__ = [
|
|
30
|
+
"TickerAPI",
|
|
31
|
+
"AsyncTickerAPI",
|
|
32
|
+
"TickerAPIError",
|
|
33
|
+
"AuthenticationError",
|
|
34
|
+
"ForbiddenError",
|
|
35
|
+
"NotFoundError",
|
|
36
|
+
"RateLimitError",
|
|
37
|
+
"DataUnavailableError",
|
|
38
|
+
]
|
|
39
|
+
|
|
40
|
+
__version__ = "0.1.0"
|