asynctradier.utils.common module
- asynctradier.utils.common.build_option_symbol(symbol: str, expiration_date: str, strike: float, option_type: str) str[source]
Build an option symbol based on the given parameters.
- Parameters:
symbol (str) – The underlying symbol.
expiration_date (str) – The expiration date of the option in the format “YYYY-MM-DD”.
strike (float) – The strike price of the option.
option_type (str) – The type of the option, either “CALL” or “PUT”.
- Returns:
The option symbol.
- Return type:
str
- Raises:
InvalidExiprationDate – If the expiration date is not in the valid format.
InvalidOptionType – If the option type is not valid.
- asynctradier.utils.common.is_valid_datetime(datetime: str) bool[source]
Check if the given datetime is in the valid format.
- Parameters:
datetime (str) – The datetime to be checked.
- Returns:
True if the datetime is valid, False otherwise.
- Return type:
bool