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:
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

asynctradier.utils.common.is_valid_expiration_date(expiration: str) bool[source]

Check if the given expiration date is in the valid format.

Parameters:

expiration (str) – The expiration date to be checked.

Returns:

True if the expiration date is valid, False otherwise.

Return type:

bool

asynctradier.utils.common.is_valid_option_type(option_type: str) bool[source]

Check if the given option type is valid.

Parameters:

option_type (str) – The option type to be checked.

Returns:

True if the option type is valid, False otherwise.

Return type:

bool