Data Retrieval
API reference for sovai.get_data
Module: sovai.get_data
Classes
ApiRequestHandler
ApiRequestHandlerclass ApiRequestHandlerCentralized handler for API requests with robust error handling, automatic retry capability, and consistent response processing.
This class encapsulates all HTTP communication logic, providing:
Consistent authentication and headers
Configurable retry policies with exponential backoff
Proper error handling and logging
Timeout management
Attributes
base_urltokenverify_sslmax_retriesbackoff_factortimeoutheaders(Dict[str, str])logger
Methods
__init__()
__init__()Initialize the API request handler.
Parameters
base_url
str
Base URL for the API token: Authentication token verify_ssl: Whether to verify SSL certificates max_retries: Maximum number of retry attempts for failed requests backoff_factor: Factor to determine wait time between retries timeout: Tuple of (connection timeout, read timeout) in seconds logger: Optional logger instance; uses module logger if not provided
get()
get()Make a GET request to the API with proper error handling and retry logic.
Parameters
endpoint
str
API endpoint path params: Query parameters stream: Whether to stream the response body: Optional request body
Returns
requests.Response object
Functions
data()
data()Main function to retrieve data from the API. Caches results to disk in 'cache/' directory (Parquet for DataFrames, Pickle for Figures). Cache files older than 12 hours are automatically cleaned up.
Parameters
endpoint
str
—
tickers
Optional[Union[str, List[str]]]
Default: None
chart
Optional[str]
Default: None
columns
Optional[Union[str, List[str]]]
Default: None
version
Optional[str]
Default: None
start_date
Optional[str]
Default: None
end_date
Optional[str]
Default: None
plot
bool
Default: False
limit
Optional[int]
Default: None
params
Optional[Dict[str, Any]]
Default: None
body
Optional[Dict[str, Any]]
Default: None
use_polars
bool
Default: False
purge_cache
bool
Default: False
parquet
bool
Default: True
frequency
Optional[str]
Default: None
verbose
bool
Default: False
full_history
bool
Default: False
source
Optional[str]
Default: None
Returns: Union[DataFrameType, go.Figure, None]
Last updated