py_alpaca_api.models.watchlist_model

Attributes

KEY_PROCESSORS

Classes

AssetModel

WatchlistModel

Functions

extract_class_data(data_dict, field_processors, data_class)

Extracts and processes data from a dictionary based on a given data class and field processors.

process_assets(...)

Process a list of assets.

watchlist_class_from_dict(→ WatchlistModel)

param data_dict:

A dictionary containing the data needed to create a WatchlistModel object.

Module Contents

class py_alpaca_api.models.watchlist_model.AssetModel[source]
id: str
asset_class: str
easy_to_borrow: bool
exchange: str
fractionable: bool
maintenance_margin_requirement: float
marginable: bool
name: str
shortable: bool
status: str
symbol: str
tradable: bool
py_alpaca_api.models.watchlist_model.KEY_PROCESSORS[source]
py_alpaca_api.models.watchlist_model.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:
  • data_dict (dict) – The dictionary containing the data to be processed.

  • field_processors (Dict) – A dictionary of field processors.

  • data_class (type[Any]) – The data class used to define the fields and types.

Returns:

A dictionary containing processed data, with keys corresponding to the fields of the data class.

Return type:

dict

Raises:

KeyError – When a field processor is not found for a specific data type.

class py_alpaca_api.models.watchlist_model.WatchlistModel[source]
id: str[source]
account_id: str[source]
created_at: datetime.datetime[source]
updated_at: datetime.datetime[source]
name: str[source]
assets: list[py_alpaca_api.models.asset_model.AssetModel][source]
py_alpaca_api.models.watchlist_model.process_assets(assets: list[dict]) list[py_alpaca_api.models.asset_model.AssetModel][source]

Process a list of assets.

This function takes a list of asset dictionaries and returns a list of AssetModel objects. Each asset dictionary should contain the necessary information to create an AssetModel object.

Parameters:

assets (List[Dict]) – A list of asset dictionaries.

Returns:

A list of AssetModel objects.

Return type:

List[AssetModel]

py_alpaca_api.models.watchlist_model.watchlist_class_from_dict(data_dict: dict) WatchlistModel[source]
Parameters:

data_dict – A dictionary containing the data needed to create a WatchlistModel object.

Returns:

A new instance of the WatchlistModel created from the data in the input dictionary.