Hawk SDK
Installation
Authentication (one of):
Note
All timestamps are in UTC.
API Reference
Query any combination of hawk_ids and field_ids.
| Method | Description |
|---|---|
get_data(hawk_ids, field_ids, start_date, end_date, interval) |
Fetch data (use interval='snapshot' for point-in-time) |
get_latest_snapshot(hawk_ids, field_ids) |
Fetch most recent data available |
get_field_ids(field_names) |
Lookup field_ids by name |
get_all_fields() |
List all available fields |
get_data
def get_data(hawk_ids: List[int], field_ids: List[int], start_date: str, end_date: str, interval: str) -> DataObject
| Parameter | Type | Description |
|---|---|---|
hawk_ids |
List[int] |
Hawk IDs to query |
field_ids |
List[int] |
Field IDs to retrieve |
start_date |
str |
Start date (YYYY-MM-DD). Ignored for snapshot. |
end_date |
str |
End date (YYYY-MM-DD) or timestamp (YYYY-MM-DD HH:MM:SS) for snapshot |
interval |
str |
Data interval: 1d, 1h, etc. Use snapshot for point-in-time |
get_latest_snapshot
Returns DataFrame with columns: date, hawk_id, ticker, plus one column per field. Missing values are NaN.
get_field_ids
get_all_fields
Query supplemental data not tied to hawk_ids (identified by source and series_id).
from hawk_sdk.api import UniversalSupplemental
supplemental = UniversalSupplemental(environment="production")
| Method | Description |
|---|---|
get_data(sources, series_ids, start_date, end_date) |
Fetch data for specific series |
get_data_by_source(sources, start_date, end_date) |
Fetch all series for given sources |
get_latest_data(sources, series_ids) |
Fetch most recent data for each series |
get_all_series(source=None) |
List available series metadata |
get_available_sources() |
List available data sources |
get_data
def get_data(sources: List[str], series_ids: List[str], start_date: str, end_date: str) -> DataObject
| Parameter | Type | Description |
|---|---|---|
sources |
List[str] |
Data source identifiers (e.g., ['eia_petroleum']) |
series_ids |
List[str] |
Series codes (e.g., ['WCESTUS1', 'WCRFPUS2']) |
start_date |
str |
Start date (YYYY-MM-DD) |
end_date |
str |
End date (YYYY-MM-DD) |
get_data_by_source
Fetches all series for the given sources without specifying individual series_ids.
get_latest_data
Returns the most recent data point for each specified series.
get_all_series
Returns DataFrame with columns: source, series_id, name, description, frequency, unit.
get_available_sources
Lookup Hawk IDs from tickers.
get_hawk_ids
| Parameter | Type | Description |
|---|---|---|
tickers |
List[str] |
Ticker symbols to lookup |
All API methods return a DataObject with these methods:
| Method | Description |
|---|---|
to_df() |
Convert to pandas DataFrame |
to_csv(filename) |
Export to CSV |
to_xlsx(filename) |
Export to Excel |
show(n=5) |
Print first n rows |