mirror of
https://github.com/OpenBB-finance/OpenBB.git
synced 2026-11-26 11:12:50 +00:00
feat: options chains
This commit is contained in:
@@ -4,7 +4,7 @@ from datetime import (
|
||||
date as dateType,
|
||||
datetime,
|
||||
)
|
||||
from typing import List, Optional, Set, Union
|
||||
from typing import Optional
|
||||
|
||||
from pydantic import Field, field_validator
|
||||
|
||||
@@ -23,11 +23,8 @@ class OptionsChainsQueryParams(QueryParams):
|
||||
|
||||
@classmethod
|
||||
@field_validator("symbol", mode="before", check_fields=False)
|
||||
def upper_symbol(cls, v: Union[str, List[str], Set[str]]):
|
||||
"""Convert symbol to uppercase."""
|
||||
if isinstance(v, str):
|
||||
return v.upper()
|
||||
return ",".join([symbol.upper() for symbol in list(v)])
|
||||
def upper_symbol(cls, v: str) -> str:
|
||||
return v.upper()
|
||||
|
||||
|
||||
class OptionsChainsData(Data):
|
||||
|
||||
@@ -27,6 +27,8 @@ class CboeOptionsChainsQueryParams(OptionsChainsQueryParams):
|
||||
Source: https://www.cboe.com/
|
||||
"""
|
||||
|
||||
__validator_dict__ = {"check_single": ("symbol",)}
|
||||
|
||||
use_cache: bool = Field(
|
||||
default=True,
|
||||
description="When True, the company directories will be cached for"
|
||||
|
||||
@@ -28,6 +28,8 @@ class IntrinioOptionsChainsQueryParams(OptionsChainsQueryParams):
|
||||
source: https://docs.intrinio.com/documentation/web_api/get_options_chain_eod_v2
|
||||
"""
|
||||
|
||||
__validator_dict__ = {"check_single": ("symbol",)}
|
||||
|
||||
date: Optional[dateType] = Field(
|
||||
default=None, description="The end-of-day date for options chains data."
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user