marketstack-python-client 1.0.0__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.
- marketstack/__init__.py +1 -0
- marketstack/client/__init__.py +0 -0
- marketstack/client/http.py +36 -0
- marketstack/client/marketstack.py +148 -0
- marketstack/models/__init__.py +0 -0
- marketstack/models/bond.py +47 -0
- marketstack/models/cik_code.py +26 -0
- marketstack/models/commodity.py +83 -0
- marketstack/models/company.py +278 -0
- marketstack/models/concept.py +65 -0
- marketstack/models/currency.py +23 -0
- marketstack/models/dividend.py +27 -0
- marketstack/models/eod.py +48 -0
- marketstack/models/etf.py +129 -0
- marketstack/models/exchange.py +117 -0
- marketstack/models/index.py +47 -0
- marketstack/models/intraday.py +43 -0
- marketstack/models/pagination.py +42 -0
- marketstack/models/split.py +24 -0
- marketstack/models/stockprice.py +31 -0
- marketstack/models/ticker.py +159 -0
- marketstack/models/ticker_info.py +197 -0
- marketstack/models/timezone.py +21 -0
- marketstack/namespaces/__init__.py +0 -0
- marketstack/namespaces/bond/__init__.py +1 -0
- marketstack/namespaces/bond/bond.py +12 -0
- marketstack/namespaces/bondlist/__init__.py +1 -0
- marketstack/namespaces/bondlist/bondlist.py +12 -0
- marketstack/namespaces/cikcode/__init__.py +1 -0
- marketstack/namespaces/cikcode/cikcode.py +12 -0
- marketstack/namespaces/commodities/__init__.py +1 -0
- marketstack/namespaces/commodities/commodities.py +12 -0
- marketstack/namespaces/commoditieshistory/__init__.py +1 -0
- marketstack/namespaces/commoditieshistory/commoditieshistory.py +12 -0
- marketstack/namespaces/company_facts/__init__.py +1 -0
- marketstack/namespaces/company_facts/company_facts.py +12 -0
- marketstack/namespaces/companyname/__init__.py +1 -0
- marketstack/namespaces/companyname/companyname.py +12 -0
- marketstack/namespaces/companyratings/__init__.py +1 -0
- marketstack/namespaces/companyratings/companyratings.py +12 -0
- marketstack/namespaces/concept/__init__.py +1 -0
- marketstack/namespaces/concept/concept.py +12 -0
- marketstack/namespaces/currencies/__init__.py +1 -0
- marketstack/namespaces/currencies/currencies.py +12 -0
- marketstack/namespaces/dividends/__init__.py +1 -0
- marketstack/namespaces/dividends/dividends.py +12 -0
- marketstack/namespaces/eod/__init__.py +1 -0
- marketstack/namespaces/eod/eod.py +20 -0
- marketstack/namespaces/etfholdings/__init__.py +1 -0
- marketstack/namespaces/etfholdings/etfholdings.py +12 -0
- marketstack/namespaces/etflist/__init__.py +1 -0
- marketstack/namespaces/etflist/etflist.py +12 -0
- marketstack/namespaces/exchanges/__init__.py +1 -0
- marketstack/namespaces/exchanges/exchanges.py +109 -0
- marketstack/namespaces/frames/__init__.py +1 -0
- marketstack/namespaces/frames/frames.py +12 -0
- marketstack/namespaces/indexinfo/__init__.py +1 -0
- marketstack/namespaces/indexinfo/indexinfo.py +12 -0
- marketstack/namespaces/indexlist/__init__.py +1 -0
- marketstack/namespaces/indexlist/indexlist.py +12 -0
- marketstack/namespaces/intraday/__init__.py +1 -0
- marketstack/namespaces/intraday/intraday.py +20 -0
- marketstack/namespaces/splits/__init__.py +1 -0
- marketstack/namespaces/splits/splits.py +12 -0
- marketstack/namespaces/stockprice/__init__.py +1 -0
- marketstack/namespaces/stockprice/stockprice.py +12 -0
- marketstack/namespaces/submissions/__init__.py +1 -0
- marketstack/namespaces/submissions/submissions.py +12 -0
- marketstack/namespaces/tickerinfo/__init__.py +1 -0
- marketstack/namespaces/tickerinfo/tickerinfo.py +12 -0
- marketstack/namespaces/tickers/__init__.py +1 -0
- marketstack/namespaces/tickers/tickers.py +150 -0
- marketstack/namespaces/tickerslist/__init__.py +1 -0
- marketstack/namespaces/tickerslist/tickerslist.py +12 -0
- marketstack/namespaces/timezones/__init__.py +1 -0
- marketstack/namespaces/timezones/timezones.py +12 -0
- marketstack_python_client-1.0.0.dist-info/METADATA +182 -0
- marketstack_python_client-1.0.0.dist-info/RECORD +81 -0
- marketstack_python_client-1.0.0.dist-info/WHEEL +5 -0
- marketstack_python_client-1.0.0.dist-info/licenses/LICENSE +21 -0
- marketstack_python_client-1.0.0.dist-info/top_level.txt +1 -0
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
from pydantic import BaseModel
|
|
2
|
+
from typing import Union
|
|
3
|
+
from types import NoneType
|
|
4
|
+
from .pagination import Pagniation, PaginationRequest
|
|
5
|
+
from typing import TypedDict
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
class CurrenciesRequest(PaginationRequest, total=False):
|
|
9
|
+
pass
|
|
10
|
+
|
|
11
|
+
class Currency(BaseModel):
|
|
12
|
+
code: str
|
|
13
|
+
"""Three-letter currency code."""
|
|
14
|
+
name: str
|
|
15
|
+
"""Currency name."""
|
|
16
|
+
symbol: str
|
|
17
|
+
"""Currency symbol."""
|
|
18
|
+
symbol_native: Union[NoneType, str] = None
|
|
19
|
+
"""Native currency symbol."""
|
|
20
|
+
|
|
21
|
+
class CurrenciesResponse(BaseModel):
|
|
22
|
+
pagination: Pagniation
|
|
23
|
+
data: list["Currency"]
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
from pydantic import BaseModel
|
|
2
|
+
from typing import Union
|
|
3
|
+
from types import NoneType
|
|
4
|
+
from .pagination import Pagniation, PaginationRequest
|
|
5
|
+
from typing import TypedDict
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
class DividendsRequest(PaginationRequest, total=False):
|
|
9
|
+
symbols: Union[NoneType, str] = None
|
|
10
|
+
"""Filter by stock symbols."""
|
|
11
|
+
date_from: Union[NoneType, str] = None
|
|
12
|
+
"""Start date."""
|
|
13
|
+
date_to: Union[NoneType, str] = None
|
|
14
|
+
"""End date."""
|
|
15
|
+
|
|
16
|
+
class DividendItem(BaseModel):
|
|
17
|
+
dividend: float
|
|
18
|
+
payment_date: Union[NoneType, str] = None
|
|
19
|
+
record_date: Union[NoneType, str] = None
|
|
20
|
+
declaration_date: Union[NoneType, str] = None
|
|
21
|
+
distr_freq: Union[NoneType, str] = None
|
|
22
|
+
date: str
|
|
23
|
+
symbol: str
|
|
24
|
+
|
|
25
|
+
class DividendsResponse(BaseModel):
|
|
26
|
+
pagination: Pagniation
|
|
27
|
+
data: list["DividendItem"]
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
from pydantic import BaseModel
|
|
2
|
+
from typing import Union
|
|
3
|
+
from types import NoneType
|
|
4
|
+
from .pagination import Pagniation, PaginationRequest
|
|
5
|
+
from typing import TypedDict
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
class EODRequest(PaginationRequest, total=False):
|
|
9
|
+
symbols: Union[NoneType, str] = None
|
|
10
|
+
"""Filter by stock symbols."""
|
|
11
|
+
exchange: Union[NoneType, str] = None
|
|
12
|
+
"""Filter by stock exchange."""
|
|
13
|
+
date_from: Union[NoneType, str] = None
|
|
14
|
+
"""Start date."""
|
|
15
|
+
date_to: Union[NoneType, str] = None
|
|
16
|
+
"""End date."""
|
|
17
|
+
|
|
18
|
+
class EODLatestRequest(PaginationRequest, total=False):
|
|
19
|
+
symbols: Union[NoneType, str] = None
|
|
20
|
+
"""Filter by stock symbols."""
|
|
21
|
+
exchange: Union[NoneType, str] = None
|
|
22
|
+
"""Filter by stock exchange."""
|
|
23
|
+
|
|
24
|
+
class EODBar(BaseModel):
|
|
25
|
+
open: Union[NoneType, float] = None
|
|
26
|
+
high: Union[NoneType, float] = None
|
|
27
|
+
low: Union[NoneType, float] = None
|
|
28
|
+
close: Union[NoneType, float] = None
|
|
29
|
+
volume: Union[NoneType, float] = None
|
|
30
|
+
adj_open: Union[NoneType, float] = None
|
|
31
|
+
adj_high: Union[NoneType, float] = None
|
|
32
|
+
adj_low: Union[NoneType, float] = None
|
|
33
|
+
adj_close: Union[NoneType, float] = None
|
|
34
|
+
adj_volume: Union[NoneType, float] = None
|
|
35
|
+
split_factor: Union[NoneType, float] = None
|
|
36
|
+
dividend: Union[NoneType, float] = None
|
|
37
|
+
name: Union[NoneType, str] = None
|
|
38
|
+
exchange_code: Union[NoneType, str] = None
|
|
39
|
+
asset_type: Union[NoneType, str] = None
|
|
40
|
+
price_currency: Union[NoneType, str] = None
|
|
41
|
+
symbol: str
|
|
42
|
+
exchange: Union[NoneType, str] = None
|
|
43
|
+
date: str
|
|
44
|
+
"""Timestamp in ISO 8601 format."""
|
|
45
|
+
|
|
46
|
+
class EODResponse(BaseModel):
|
|
47
|
+
pagination: Pagniation
|
|
48
|
+
data: list["EODBar"]
|
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
from pydantic import BaseModel
|
|
2
|
+
from typing import Union
|
|
3
|
+
from types import NoneType
|
|
4
|
+
from .pagination import Pagniation, PaginationRequest
|
|
5
|
+
from typing import TypedDict
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
class ETFHoldingsRequest(PaginationRequest, total=False):
|
|
9
|
+
ticker: Union[NoneType, str] = None
|
|
10
|
+
"""Filter by stock ticker symbol."""
|
|
11
|
+
date_from: Union[NoneType, str] = None
|
|
12
|
+
"""Start date."""
|
|
13
|
+
date_to: Union[NoneType, str] = None
|
|
14
|
+
"""End date."""
|
|
15
|
+
|
|
16
|
+
class ETFListRequest(PaginationRequest, total=False):
|
|
17
|
+
ticker: Union[NoneType, str] = None
|
|
18
|
+
"""Filter by stock ticker symbol."""
|
|
19
|
+
status: Union[NoneType, str] = None
|
|
20
|
+
"""Filter by status."""
|
|
21
|
+
date_from: Union[NoneType, str] = None
|
|
22
|
+
"""Start date."""
|
|
23
|
+
date_to: Union[NoneType, str] = None
|
|
24
|
+
"""End date."""
|
|
25
|
+
|
|
26
|
+
class ETFAttributes(BaseModel):
|
|
27
|
+
series_name: str
|
|
28
|
+
"""Name of the ETF series held by the fund."""
|
|
29
|
+
series_id: str
|
|
30
|
+
"""ID of the ETF held by the fund."""
|
|
31
|
+
series_lei: str
|
|
32
|
+
"""Legal Entity Identifier of the ETF series."""
|
|
33
|
+
ticker: str
|
|
34
|
+
"""ETF ticker."""
|
|
35
|
+
isin: str
|
|
36
|
+
"""International Securities Identification Number."""
|
|
37
|
+
date_report_period: str
|
|
38
|
+
"""Start date of the report period."""
|
|
39
|
+
end_report_period: str
|
|
40
|
+
"""End date of the report period."""
|
|
41
|
+
final_filing: bool
|
|
42
|
+
"""Indicates whether this is the final filing."""
|
|
43
|
+
|
|
44
|
+
class ETFHoldingSecurity(BaseModel):
|
|
45
|
+
lei: Union[NoneType, str] = None
|
|
46
|
+
"""Legal Entity Identifier."""
|
|
47
|
+
isin: Union[NoneType, str] = None
|
|
48
|
+
"""International Securities Identification Number."""
|
|
49
|
+
name: Union[NoneType, str] = None
|
|
50
|
+
"""Holding name."""
|
|
51
|
+
cusip: Union[NoneType, str] = None
|
|
52
|
+
"""U.S./Canada security identifier (CUSIP)."""
|
|
53
|
+
title: Union[NoneType, str] = None
|
|
54
|
+
"""Holding title."""
|
|
55
|
+
units: Union[NoneType, str] = None
|
|
56
|
+
"""Unit type."""
|
|
57
|
+
balance: Union[NoneType, str] = None
|
|
58
|
+
"""Holding balance."""
|
|
59
|
+
currency: Union[NoneType, str] = None
|
|
60
|
+
"""Currency code."""
|
|
61
|
+
value_usd: Union[NoneType, str] = None
|
|
62
|
+
"""Holding value in USD."""
|
|
63
|
+
percent_value: Union[NoneType, str] = None
|
|
64
|
+
"""Portfolio percentage weight."""
|
|
65
|
+
asset_category: Union[NoneType, str] = None
|
|
66
|
+
"""Asset category."""
|
|
67
|
+
cash_collateral: Union[NoneType, str] = None
|
|
68
|
+
"""Cash collateral flag (Y/N)."""
|
|
69
|
+
non_cash_collateral: Union[NoneType, str] = None
|
|
70
|
+
"""Non-cash collateral flag (Y/N)."""
|
|
71
|
+
fair_value_level: Union[NoneType, str] = None
|
|
72
|
+
"""Fair value hierarchy level (1/2/3)."""
|
|
73
|
+
invested_country: Union[NoneType, str] = None
|
|
74
|
+
"""ISO country code where the security is invested."""
|
|
75
|
+
issuer_category: Union[NoneType, str] = None
|
|
76
|
+
"""Issuer category (e.g., CORP)."""
|
|
77
|
+
loan_by_fund: Union[NoneType, str] = None
|
|
78
|
+
"""Security on loan by the fund (Y/N)."""
|
|
79
|
+
payoff_profile: Union[NoneType, str] = None
|
|
80
|
+
"""Payoff profile (e.g., Long, Short)."""
|
|
81
|
+
restricted_sec: Union[NoneType, str] = None
|
|
82
|
+
"""Restricted security flag (Y/N)."""
|
|
83
|
+
|
|
84
|
+
class ETFSignature(BaseModel):
|
|
85
|
+
date_signed: str
|
|
86
|
+
"""Signature date."""
|
|
87
|
+
name_of_applicant: str
|
|
88
|
+
"""Name of the applicant."""
|
|
89
|
+
signature: str
|
|
90
|
+
"""Signature text."""
|
|
91
|
+
signer_name: str
|
|
92
|
+
"""Name of the signer."""
|
|
93
|
+
title: str
|
|
94
|
+
"""Signer's title."""
|
|
95
|
+
|
|
96
|
+
class ETFHoldingsBasics(BaseModel):
|
|
97
|
+
fund_name: str
|
|
98
|
+
"""Fund name."""
|
|
99
|
+
file_number: str
|
|
100
|
+
"""SEC file number."""
|
|
101
|
+
cik: str
|
|
102
|
+
"""SEC CIK of the main trust fund."""
|
|
103
|
+
reg_lei: str
|
|
104
|
+
"""Legal Entity Identifier of the fund."""
|
|
105
|
+
|
|
106
|
+
class ETFHoldingsSecurityContainer(BaseModel):
|
|
107
|
+
investment_security: "ETFHoldingSecurity"
|
|
108
|
+
|
|
109
|
+
class ETFHoldingsOutput(BaseModel):
|
|
110
|
+
attributes: "ETFAttributes"
|
|
111
|
+
signature: "ETFSignature"
|
|
112
|
+
holdings: list[ETFHoldingsSecurityContainer]
|
|
113
|
+
|
|
114
|
+
class ETFHoldingsResponse(BaseModel):
|
|
115
|
+
basics: ETFHoldingsBasics
|
|
116
|
+
output: ETFHoldingsOutput
|
|
117
|
+
|
|
118
|
+
class ETFListItem(BaseModel):
|
|
119
|
+
ticker: str
|
|
120
|
+
"""ETF ticker symbol."""
|
|
121
|
+
|
|
122
|
+
class ETFListResponse(BaseModel):
|
|
123
|
+
pagination: Pagniation
|
|
124
|
+
data: list["ETFListItem"]
|
|
125
|
+
|
|
126
|
+
|
|
127
|
+
# Rebuild models to resolve forward references
|
|
128
|
+
ETFHoldingsResponse.model_rebuild()
|
|
129
|
+
ETFHoldingsOutput.model_rebuild()
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
from pydantic import BaseModel, Field
|
|
2
|
+
from typing import Union
|
|
3
|
+
from types import NoneType
|
|
4
|
+
from .pagination import Pagniation, PaginationRequest
|
|
5
|
+
from .eod import EODBar
|
|
6
|
+
from .intraday import IntradayResponse, IntradayBar
|
|
7
|
+
from typing import TypedDict
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
class ExchangesRequest(PaginationRequest, total=False):
|
|
11
|
+
search: Union[NoneType, str] = None
|
|
12
|
+
"""Search for exchanges."""
|
|
13
|
+
|
|
14
|
+
class ExchangeTickersRequest(PaginationRequest, total=False):
|
|
15
|
+
search: Union[NoneType, str] = None
|
|
16
|
+
"""Search for tickers."""
|
|
17
|
+
|
|
18
|
+
class ExchangeDateTime(BaseModel):
|
|
19
|
+
"""Date value serialized as an object (PHP DateTime) in ticker-embedded exchanges."""
|
|
20
|
+
date: str
|
|
21
|
+
"""Date/time string (e.g. 2005-06-27 00:00:00.000000)."""
|
|
22
|
+
timezone_type: int
|
|
23
|
+
timezone: str
|
|
24
|
+
|
|
25
|
+
class Exchange(BaseModel):
|
|
26
|
+
name: str
|
|
27
|
+
"""Name of the stock exchange."""
|
|
28
|
+
acronym: Union[NoneType, str] = None
|
|
29
|
+
"""Acronym of the stock exchange."""
|
|
30
|
+
mic: str
|
|
31
|
+
"""MIC identification of the exchange."""
|
|
32
|
+
country: Union[NoneType, str] = None
|
|
33
|
+
"""Country of the stock exchange."""
|
|
34
|
+
country_code: Union[NoneType, str] = None
|
|
35
|
+
"""Three-letter country code of the exchange."""
|
|
36
|
+
city: Union[NoneType, str] = None
|
|
37
|
+
"""City where the exchange is located."""
|
|
38
|
+
website: Union[NoneType, str] = None
|
|
39
|
+
"""Website URL of the exchange."""
|
|
40
|
+
operating_mic: Union[NoneType, str] = None
|
|
41
|
+
"""Operating Market Identifier Code."""
|
|
42
|
+
oprt_sgmt: Union[NoneType, str] = None
|
|
43
|
+
"""Indicates operating MIC vs market segment MIC."""
|
|
44
|
+
legal_entity_name: Union[NoneType, str] = None
|
|
45
|
+
"""Legal entity name."""
|
|
46
|
+
exchange_lei: Union[NoneType, str] = None
|
|
47
|
+
"""Exchange Legal Entity Identifier (LEI)."""
|
|
48
|
+
market_category_code: Union[NoneType, str] = None
|
|
49
|
+
"""Market category code."""
|
|
50
|
+
exchange_status: Union[NoneType, str] = None
|
|
51
|
+
"""Current status of the exchange."""
|
|
52
|
+
date_creation: Union[NoneType, str] = None
|
|
53
|
+
"""Creation date."""
|
|
54
|
+
date_last_update: Union[NoneType, str] = None
|
|
55
|
+
"""Last update date."""
|
|
56
|
+
date_last_validation: Union[NoneType, str] = None
|
|
57
|
+
"""Last validation date."""
|
|
58
|
+
date_expiry: Union[NoneType, str] = None
|
|
59
|
+
"""Expiry date."""
|
|
60
|
+
comments: Union[NoneType, str] = None
|
|
61
|
+
"""Additional comments."""
|
|
62
|
+
|
|
63
|
+
class ExchangesResponse(BaseModel):
|
|
64
|
+
pagination: Pagniation
|
|
65
|
+
data: list["Exchange"]
|
|
66
|
+
|
|
67
|
+
class ExchangeMicTicker(BaseModel):
|
|
68
|
+
name: str
|
|
69
|
+
"""Company or instrument name."""
|
|
70
|
+
symbol: str
|
|
71
|
+
"""Ticker symbol."""
|
|
72
|
+
has_intraday: bool
|
|
73
|
+
"""Indicates if intraday data is available."""
|
|
74
|
+
has_eod: bool
|
|
75
|
+
"""Indicates if end-of-day data is available."""
|
|
76
|
+
|
|
77
|
+
class ExchangeMicTickersData(Exchange):
|
|
78
|
+
tickers: list[ExchangeMicTicker]
|
|
79
|
+
|
|
80
|
+
class ExchangeMicTickersResponse(BaseModel):
|
|
81
|
+
pagination: Pagniation
|
|
82
|
+
data: ExchangeMicTickersData
|
|
83
|
+
|
|
84
|
+
class ExchangesMicEodData(Exchange):
|
|
85
|
+
eod: list["EODBar"]
|
|
86
|
+
|
|
87
|
+
class ExchangesMicEod(BaseModel):
|
|
88
|
+
pagination: Pagniation
|
|
89
|
+
data: ExchangesMicEodData
|
|
90
|
+
|
|
91
|
+
|
|
92
|
+
class ExchangesMicIntradayData(Exchange):
|
|
93
|
+
intraday: "IntradayResponse"
|
|
94
|
+
|
|
95
|
+
|
|
96
|
+
class ExchangesMicIntraday(BaseModel):
|
|
97
|
+
pagination: Pagniation
|
|
98
|
+
data: ExchangesMicIntradayData
|
|
99
|
+
|
|
100
|
+
|
|
101
|
+
class ExchangesMicIntradayLatestData(Exchange):
|
|
102
|
+
intraday: list["IntradayBar"]
|
|
103
|
+
|
|
104
|
+
|
|
105
|
+
class ExchangesMicIntradayLatest(BaseModel):
|
|
106
|
+
pagination: Pagniation
|
|
107
|
+
data: ExchangesMicIntradayLatestData
|
|
108
|
+
|
|
109
|
+
|
|
110
|
+
ExchangeMicTickersResponse.model_rebuild()
|
|
111
|
+
ExchangeMicTickersData.model_rebuild()
|
|
112
|
+
ExchangesMicEod.model_rebuild()
|
|
113
|
+
ExchangesMicEodData.model_rebuild()
|
|
114
|
+
ExchangesMicIntraday.model_rebuild()
|
|
115
|
+
ExchangesMicIntradayData.model_rebuild()
|
|
116
|
+
ExchangesMicIntradayLatest.model_rebuild()
|
|
117
|
+
ExchangesMicIntradayLatestData.model_rebuild()
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
from pydantic import BaseModel, RootModel
|
|
2
|
+
from typing import Union
|
|
3
|
+
from types import NoneType
|
|
4
|
+
from .pagination import Pagniation, PaginationRequest
|
|
5
|
+
from typing import TypedDict
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
class IndexInfoRequest(TypedDict, total=False):
|
|
9
|
+
index: Union[NoneType, str] = None
|
|
10
|
+
"""Specify market index code."""
|
|
11
|
+
|
|
12
|
+
class IndexListRequest(PaginationRequest, total=False):
|
|
13
|
+
pass
|
|
14
|
+
|
|
15
|
+
class IndexInfoItem(BaseModel):
|
|
16
|
+
benchmark: str
|
|
17
|
+
"""Benchmark name of the market index."""
|
|
18
|
+
region: str
|
|
19
|
+
"""Region of the index."""
|
|
20
|
+
country: str
|
|
21
|
+
"""Country of the index."""
|
|
22
|
+
price: str
|
|
23
|
+
"""Current index price."""
|
|
24
|
+
price_change_day: str
|
|
25
|
+
"""Absolute day change."""
|
|
26
|
+
percentage_day: str
|
|
27
|
+
"""Day change in percent."""
|
|
28
|
+
percentage_week: str
|
|
29
|
+
"""Week change in percent."""
|
|
30
|
+
percentage_month: str
|
|
31
|
+
"""Month change in percent."""
|
|
32
|
+
percentage_year: str
|
|
33
|
+
"""Year change in percent."""
|
|
34
|
+
date: str
|
|
35
|
+
"""Date of the quote."""
|
|
36
|
+
|
|
37
|
+
class IndexInfoResponse(RootModel[list[IndexInfoItem]]):
|
|
38
|
+
pass
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
class IndexListItem(BaseModel):
|
|
42
|
+
benchmark: str
|
|
43
|
+
"""Benchmark code of the market index."""
|
|
44
|
+
|
|
45
|
+
class IndexListResponse(BaseModel):
|
|
46
|
+
pagination: Pagniation
|
|
47
|
+
data: list["IndexListItem"]
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
from pydantic import BaseModel
|
|
2
|
+
from typing import Union
|
|
3
|
+
from types import NoneType
|
|
4
|
+
from .pagination import Pagniation, PaginationRequest
|
|
5
|
+
from typing import TypedDict
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
class IntradayRequest(PaginationRequest, total=False):
|
|
9
|
+
symbols: Union[NoneType, str] = None
|
|
10
|
+
"""Filter by stock symbols."""
|
|
11
|
+
exchange: Union[NoneType, str] = None
|
|
12
|
+
"""Filter by stock exchange."""
|
|
13
|
+
interval: Union[NoneType, str] = None
|
|
14
|
+
"""Specify intraday data interval."""
|
|
15
|
+
after_hours: Union[NoneType, bool] = None
|
|
16
|
+
"""Include after hours data."""
|
|
17
|
+
date_from: Union[NoneType, str] = None
|
|
18
|
+
"""Start date."""
|
|
19
|
+
date_to: Union[NoneType, str] = None
|
|
20
|
+
"""End date."""
|
|
21
|
+
|
|
22
|
+
class IntradayBar(BaseModel):
|
|
23
|
+
open: Union[NoneType, float] = None
|
|
24
|
+
high: Union[NoneType, float] = None
|
|
25
|
+
low: Union[NoneType, float] = None
|
|
26
|
+
mid: Union[NoneType, float] = None
|
|
27
|
+
last_size: Union[NoneType, int] = None
|
|
28
|
+
bid_size: Union[NoneType, float] = None
|
|
29
|
+
bid_price: Union[NoneType, float] = None
|
|
30
|
+
ask_price: Union[NoneType, float] = None
|
|
31
|
+
ask_size: Union[NoneType, float] = None
|
|
32
|
+
last: Union[NoneType, float] = None
|
|
33
|
+
close: Union[NoneType, float] = None
|
|
34
|
+
volume: Union[NoneType, float] = None
|
|
35
|
+
marketstack_last: Union[NoneType, float] = None
|
|
36
|
+
symbol: str
|
|
37
|
+
exchange: Union[NoneType, str] = None
|
|
38
|
+
date: str
|
|
39
|
+
"""Timestamp in ISO 8601 format."""
|
|
40
|
+
|
|
41
|
+
class IntradayResponse(BaseModel):
|
|
42
|
+
pagination: Pagniation
|
|
43
|
+
data: list["IntradayBar"]
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
from typing import Literal, TypeAlias, Annotated, TypedDict, Union
|
|
2
|
+
from types import NoneType
|
|
3
|
+
from pydantic import AfterValidator, BaseModel
|
|
4
|
+
import re
|
|
5
|
+
|
|
6
|
+
def validate_date_string(v: str) -> str:
|
|
7
|
+
if re.match(r"^\d{4}-\d{2}-\d{2}$", v) is None:
|
|
8
|
+
raise ValueError("Invalid date format. Expected YYYY-MM-DD.")
|
|
9
|
+
return v
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
Sort: TypeAlias = Literal["ASC", "DESC", "asc", "desc"]
|
|
13
|
+
DateString: TypeAlias = Annotated[
|
|
14
|
+
str,
|
|
15
|
+
AfterValidator(validate_date_string),
|
|
16
|
+
]
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
class PaginationRequest(TypedDict):
|
|
20
|
+
sort: Union[NoneType, Sort] = None
|
|
21
|
+
"""Sort order of the results by date.
|
|
22
|
+
|
|
23
|
+
Available values : DESC, ASC, desc, asc
|
|
24
|
+
Default value : DESC
|
|
25
|
+
"""
|
|
26
|
+
limit: Union[NoneType, int] = None
|
|
27
|
+
"""Specify a limit of results to return. Default value is 100.
|
|
28
|
+
Default value : 100"""
|
|
29
|
+
offset: Union[NoneType, int] = None
|
|
30
|
+
"""Specify an offset for pagination. Default offset value is 0.
|
|
31
|
+
Default value : 0"""
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
class Pagniation(BaseModel):
|
|
35
|
+
limit: int
|
|
36
|
+
offset: int
|
|
37
|
+
count: int
|
|
38
|
+
total: int
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
Pagination = Pagniation
|
|
42
|
+
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
from pydantic import BaseModel
|
|
2
|
+
from typing import Union
|
|
3
|
+
from types import NoneType
|
|
4
|
+
from .pagination import Pagniation, PaginationRequest
|
|
5
|
+
from typing import TypedDict
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
class SplitsRequest(PaginationRequest, total=False):
|
|
9
|
+
symbols: Union[NoneType, str] = None
|
|
10
|
+
"""Filter by stock symbols."""
|
|
11
|
+
date_from: Union[NoneType, str] = None
|
|
12
|
+
"""Start date."""
|
|
13
|
+
date_to: Union[NoneType, str] = None
|
|
14
|
+
"""End date."""
|
|
15
|
+
|
|
16
|
+
class SplitItem(BaseModel):
|
|
17
|
+
split_factor: float
|
|
18
|
+
stock_split: Union[NoneType, str] = None
|
|
19
|
+
date: str
|
|
20
|
+
symbol: str
|
|
21
|
+
|
|
22
|
+
class SplitsResponse(BaseModel):
|
|
23
|
+
pagination: Pagniation
|
|
24
|
+
data: list["SplitItem"]
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
from pydantic import BaseModel
|
|
2
|
+
from typing import Union
|
|
3
|
+
from types import NoneType
|
|
4
|
+
from .pagination import Pagniation, PaginationRequest
|
|
5
|
+
from typing import TypedDict
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
class StockPriceRequest(TypedDict, total=False):
|
|
9
|
+
ticker: Union[NoneType, str] = None
|
|
10
|
+
"""Filter by stock ticker symbol."""
|
|
11
|
+
exchange: Union[NoneType, str] = None
|
|
12
|
+
"""Filter by stock exchange."""
|
|
13
|
+
|
|
14
|
+
class StockPriceItem(BaseModel):
|
|
15
|
+
exchange_code: str
|
|
16
|
+
"""Exchange code."""
|
|
17
|
+
exchange_name: str
|
|
18
|
+
"""Exchange name."""
|
|
19
|
+
country: str
|
|
20
|
+
"""Exchange country."""
|
|
21
|
+
ticker: str
|
|
22
|
+
"""Ticker symbol."""
|
|
23
|
+
price: str
|
|
24
|
+
"""Last known price."""
|
|
25
|
+
currency: str
|
|
26
|
+
"""Trading currency."""
|
|
27
|
+
trade_last: str
|
|
28
|
+
"""Timestamp of the last known trade."""
|
|
29
|
+
|
|
30
|
+
class StockPriceResponse(BaseModel):
|
|
31
|
+
data: list["StockPriceItem"]
|