py_alpaca_api.models.model_utils
Attributes
Functions
|
Returns the string value of a specific key within a dictionary. |
|
Parses a date value from a dictionary using a specified key. |
|
|
|
|
|
Extracts and processes data from a dictionary based on a given data class and field processors. |
Module Contents
- py_alpaca_api.models.model_utils.get_dict_str_value(data_dict: dict, key: str) str[source]
Returns the string value of a specific key within a dictionary.
- py_alpaca_api.models.model_utils.parse_date(data_dict: dict, key: str) str[source]
Parses a date value from a dictionary using a specified key.
- py_alpaca_api.models.model_utils.get_dict_int_value(data_dict: dict, key: str) int[source]
- Parameters:
data_dict – A dictionary containing key-value pairs.
key – The key whose corresponding value is to be returned.
- Returns:
The integer value associated with the given key in the data_dict. If the key is not present or the corresponding value is not an integer, 0 is returned.
- Return type:
- py_alpaca_api.models.model_utils.extract_class_data(data_dict: dict, field_processors: dict, data_class: type[Any])[source]
Extracts and processes data from a dictionary based on a given data class and field processors.
- Parameters:
- Returns:
A dictionary containing processed data, with keys corresponding to the fields of the data class.
- Return type:
- Raises:
KeyError – When a field processor is not found for a specific data type.