Skip to content

Exchange

Access exchange information from FIO.

Exchange

Bases: AbstractExchange, AbstractEndpoint

get

get(exchange_ticker, timeout=None)

Gets a single exchange ticker from FIO

Parameters:

Name Type Description Default
exchange_ticker str

Exchange Ticker (e.g., "DW.AI1")

required
timeout float

Request timeout in seconds. Defaults to None.

None

Raises:

Type Description
ExchangeTickerNotFound

Exchange ticker was not found

Returns:

Name Type Description
ExchangeTicker ExchangeTickerFull

Exchange ticker

Source code in fio_wrapper/endpoints/endpoints_v1/exchange.py
def get(
    self, exchange_ticker: str, timeout: Optional[float] = None
) -> ExchangeTickerFull:
    """Gets a single exchange ticker from FIO

    Args:
        exchange_ticker (str): Exchange Ticker (e.g., "DW.AI1")
        timeout (float, optional): Request timeout in seconds. Defaults to None.

    Raises:
        ExchangeTickerNotFound: Exchange ticker was not found

    Returns:
        ExchangeTicker: Exchange ticker
    """
    self._validate_exchangeticker(exchange_ticker=exchange_ticker)

    (status, data) = self.adapter.get(
        endpoint=self.urls.exchange_get_url(exchange_ticker=exchange_ticker),
        err_codes=[204],
        timeout=timeout,
    )

    if status == 200:
        return ExchangeTickerFull.model_validate(data)
    elif status == 204:
        raise ExchangeTickerNotFound("Exchangeticker not found")

all

all(timeout=None)

Gets all simple exchange ticker from FIO

Parameters:

Name Type Description Default
timeout float

Request timeout in seconds. Defaults to None.

None

Returns:

Name Type Description
ExchangeTickerList ExchangeTickerList

Exchange ticker

Source code in fio_wrapper/endpoints/endpoints_v1/exchange.py
def all(self, timeout: Optional[float] = None) -> ExchangeTickerList:
    """Gets all simple exchange ticker from FIO

    Args:
        timeout (float, optional): Request timeout in seconds. Defaults to None.

    Returns:
        ExchangeTickerList: Exchange ticker
    """
    (_, data) = self.adapter.get(
        endpoint=self.urls.exchange_get_all_url(), timeout=timeout
    )

    return ExchangeTickerList.model_validate(data)

full

full(timeout=None)

Gets a complete list of all exchange information from FIO

Parameters:

Name Type Description Default
timeout float

Request timeout in seconds. Defaults to None.

None

Returns:

Name Type Description
ExchangeTickerFullList ExchangeTickerFullList

Exchange ticker full

Source code in fio_wrapper/endpoints/endpoints_v1/exchange.py
def full(self, timeout: Optional[float] = None) -> ExchangeTickerFullList:
    """Gets a complete list of all exchange information from FIO

    Args:
        timeout (float, optional): Request timeout in seconds. Defaults to None.

    Returns:
        ExchangeTickerFullList: Exchange ticker full
    """
    (_, data) = self.adapter.get(
        endpoint=self.urls.exchange_get_full_url(), timeout=timeout
    )

    return ExchangeTickerFullList.model_validate(data)

get_orders

get_orders(company_code, timeout=None)

Gets a companies order data from FIO

Parameters:

Name Type Description Default
company_code str

Company code (1-4 characters)

required
timeout float

Request timeout in seconds. Defaults to None.

None

Returns:

Name Type Description
OrderList OrderList

Orders

Source code in fio_wrapper/endpoints/endpoints_v1/exchange.py
def get_orders(
    self, company_code: str, timeout: Optional[float] = None
) -> OrderList:
    """Gets a companies order data from FIO

    Args:
        company_code (str): Company code (1-4 characters)
        timeout (float, optional): Request timeout in seconds. Defaults to None.

    Returns:
        OrderList: Orders
    """
    # 1 to 4 character company code
    validate_company_code(company_code=company_code)

    (_, data) = self.adapter.get(
        endpoint=self.urls.exchange_get_orders_companycode(
            company_code=company_code
        ),
        timeout=timeout,
    )

    return OrderList.model_validate(data)

get_orders_exchange

1
2
3
get_orders_exchange(
    company_code, exchange_code, timeout=None
)

Gets a companies order data for a specific exchange from FIO

Parameters:

Name Type Description Default
company_code str

Company code (1-4 characters)

required
exchange_code str

Exchange code (e.g., "AI1")

required
timeout float

Request timeout in seconds. Defaults to None.

None

Returns:

Name Type Description
OrderList OrderList

Orders

Source code in fio_wrapper/endpoints/endpoints_v1/exchange.py
def get_orders_exchange(
    self, company_code: str, exchange_code: str, timeout: Optional[float] = None
) -> OrderList:
    """Gets a companies order data for a specific exchange from FIO

    Args:
        company_code (str): Company code (1-4 characters)
        exchange_code (str): Exchange code (e.g., "AI1")
        timeout (float, optional): Request timeout in seconds. Defaults to None.

    Returns:
        OrderList: Orders
    """
    validate_company_code(company_code=company_code)
    validate_exchange_code(exchange_code=exchange_code)

    (_, data) = self.adapter.get(
        endpoint=self.urls.exchange_get_orders_companycode_exchange(
            company_code=company_code, exchange_code=exchange_code
        ),
        timeout=timeout,
    )

    return OrderList.model_validate(data)