Skip to content

LocalMarket

Access local market information from FIO.

LocalMarket

Bases: AbstractLocalMarket, AbstractEndpoint

planet

planet(planet, timeout=None)

Gets local market ads for planet

Parameters:

Name Type Description Default
planet str

PlanetId, PlanetNaturalId, PlanetName

required
timeout float

Request timeout in seconds. Defaults to None.

None

Raises:

Type Description
PlanetNotFound

Planet not found

Returns:

Name Type Description
LocalMarketAds LocalMarketAds

List of ads

Source code in fio_wrapper/endpoints/endpoints_v1/localmarket.py
def planet(self, planet: str, timeout: Optional[float] = None) -> LocalMarketAds:
    """Gets local market ads for planet

    Args:
        planet (str): PlanetId, PlanetNaturalId, PlanetName
        timeout (float, optional): Request timeout in seconds. Defaults to None.

    Raises:
        PlanetNotFound: Planet not found

    Returns:
        LocalMarketAds: List of ads
    """
    (status, data) = self.adapter.get(
        endpoint=self.urls.localmarket_planet_url(planet),
        err_codes=[204],
        timeout=timeout,
    )

    if status == 200:
        return LocalMarketAds.model_validate(data)
    elif status == 204:
        raise PlanetNotFound("Planet not found")

planet_buy

planet_buy(planet, timeout=None)

Gets all BUY ads from the planets local market

Parameters:

Name Type Description Default
planet str

PlanetId, PlanetNaturalId, PlanetName

required
timeout float

Request timeout in seconds. Defaults to None.

None

Raises:

Type Description
PlanetOrAdsNotFound

Planet not found or no ads

Returns:

Name Type Description
LocalMarketAdList LocalMarketAdList

List of planet local market BUY ads

Source code in fio_wrapper/endpoints/endpoints_v1/localmarket.py
def planet_buy(
    self, planet: str, timeout: Optional[float] = None
) -> LocalMarketAdList:
    """Gets all BUY ads from the planets local market

    Args:
        planet (str): PlanetId, PlanetNaturalId, PlanetName
        timeout (float, optional): Request timeout in seconds. Defaults to None.

    Raises:
        PlanetOrAdsNotFound: Planet not found or no ads

    Returns:
        LocalMarketAdList: List of planet local market BUY ads
    """
    (status, data) = self._planet_type(planet=planet, adtype="BUY", timeout=timeout)

    if status == 200:
        return LocalMarketAdList.model_validate(data)
    elif status == 204:
        raise PlanetOrAdsNotFound("Planet not found or no ads on planet")

planet_sell

planet_sell(planet, timeout=None)

Gets all SELL ads from planets local market

Parameters:

Name Type Description Default
planet str

PlanetId, PlanetNaturalId, PlanetName

required
timeout float

Request timeout in seconds. Defaults to None.

None

Raises:

Type Description
PlanetOrAdsNotFound

Planet not found or no ads

Returns:

Name Type Description
LocalMarketAdList LocalMarketAdList

List of planet local market SELL ads

Source code in fio_wrapper/endpoints/endpoints_v1/localmarket.py
def planet_sell(
    self, planet: str, timeout: Optional[float] = None
) -> LocalMarketAdList:
    """Gets all SELL ads from planets local market

    Args:
        planet (str): PlanetId, PlanetNaturalId, PlanetName
        timeout (float, optional): Request timeout in seconds. Defaults to None.

    Raises:
        PlanetOrAdsNotFound: Planet not found or no ads

    Returns:
        LocalMarketAdList: List of planet local market SELL ads
    """
    (status, data) = self._planet_type(
        planet=planet, adtype="SELL", timeout=timeout
    )

    if status == 200:
        return LocalMarketAdList.model_validate(data)
    elif status == 204:
        raise PlanetOrAdsNotFound("Planet not found or no ads on planet")

planet_shipping

planet_shipping(planet, timeout=None)

Gets a list of planets shipping ads

Parameters:

Name Type Description Default
planet str

PlanetId, PlanetNaturalId, PlanetName

required
timeout float

Request timeout in seconds. Defaults to None.

None

Raises:

Type Description
PlanetOrAdsNotFound

Planet not found or no ads

Returns:

Name Type Description
LocalMarketShippingAdList LocalMarketShippingAdList

List of planet local market SHIPPING ads

Source code in fio_wrapper/endpoints/endpoints_v1/localmarket.py
def planet_shipping(
    self, planet: str, timeout: Optional[float] = None
) -> LocalMarketShippingAdList:
    """Gets a list of planets shipping ads

    Args:
        planet (str): PlanetId, PlanetNaturalId, PlanetName
        timeout (float, optional): Request timeout in seconds. Defaults to None.

    Raises:
        PlanetOrAdsNotFound: Planet not found or no ads

    Returns:
        LocalMarketShippingAdList: List of planet local market SHIPPING ads
    """
    (status, data) = self._planet_type(
        planet=planet, adtype="SHIP", timeout=timeout
    )

    if status == 200:
        return LocalMarketShippingAdList.model_validate(data)
    elif status == 204:
        raise PlanetOrAdsNotFound("Planet not found or no ads on planet")

shipping_from

shipping_from(planet, timeout=None)

Gets a list of SHIPPING ads starting from planet

Parameters:

Name Type Description Default
planet str

PlanetId, PlanetNaturalId, PlanetName

required
timeout float

Request timeout in seconds. Defaults to None.

None

Raises:

Type Description
PlanetOrAdsNotFound

Planet not found or no ads

Returns:

Name Type Description
LocalMarketShippingAdList LocalMarketShippingAdList

List of shipping ads from planet

Source code in fio_wrapper/endpoints/endpoints_v1/localmarket.py
def shipping_from(
    self, planet: str, timeout: Optional[float] = None
) -> LocalMarketShippingAdList:
    """Gets a list of SHIPPING ads starting from planet

    Args:
        planet (str): PlanetId, PlanetNaturalId, PlanetName
        timeout (float, optional): Request timeout in seconds. Defaults to None.

    Raises:
        PlanetOrAdsNotFound: Planet not found or no ads

    Returns:
        LocalMarketShippingAdList: List of shipping ads from planet
    """
    (status, data) = self.adapter.get(
        endpoint=self.urls.localmarket_shipping_source_url(planet=planet),
        err_codes=[204],
        timeout=timeout,
    )

    if status == 200:
        return LocalMarketShippingAdList.model_validate(data)
    elif status == 204:
        raise PlanetOrAdsNotFound("Planet not found or no ads on planet")

shipping_to

shipping_to(planet, timeout=None)

Gets a list of SHIPPING ads ending at planet

Parameters:

Name Type Description Default
planet str

PlanetId, PlanetNaturalId, PlanetName

required
timeout float

Request timeout in seconds. Defaults to None.

None

Raises:

Type Description
PlanetOrAdsNotFound

Planet not found or no ads

Returns:

Name Type Description
LocalMarketShippingAdList LocalMarketShippingAdList

List of shipping ads to planet

Source code in fio_wrapper/endpoints/endpoints_v1/localmarket.py
def shipping_to(
    self, planet: str, timeout: Optional[float] = None
) -> LocalMarketShippingAdList:
    """Gets a list of SHIPPING ads ending at planet

    Args:
        planet (str): PlanetId, PlanetNaturalId, PlanetName
        timeout (float, optional): Request timeout in seconds. Defaults to None.

    Raises:
        PlanetOrAdsNotFound: Planet not found or no ads

    Returns:
        LocalMarketShippingAdList: List of shipping ads to planet
    """
    (status, data) = self.adapter.get(
        endpoint=self.urls.localmarket_shipping_destination_url(planet=planet),
        err_codes=[204],
        timeout=timeout,
    )

    if status == 200:
        return LocalMarketShippingAdList.model_validate(data)
    elif status == 204:
        raise PlanetOrAdsNotFound("Planet not found or no ads on planet")

company

company(companycode, timeout=None)

Gets a list of all ads of the specified company

Parameters:

Name Type Description Default
companycode str

Company Code (e.g., "SKYP")

required
timeout float

Request timeout in seconds. Defaults to None.

None

Raises:

Type Description
CompanyOrAdsNotFound

Company not found or company has no ads

Returns:

Name Type Description
LocalMarketAds LocalMarketAds

List of local market ads of company

Source code in fio_wrapper/endpoints/endpoints_v1/localmarket.py
def company(
    self, companycode: str, timeout: Optional[float] = None
) -> LocalMarketAds:
    """Gets a list of all ads of the specified company

    Args:
        companycode (str): Company Code (e.g., "SKYP")
        timeout (float, optional): Request timeout in seconds. Defaults to None.

    Raises:
        CompanyOrAdsNotFound: Company not found or company has no ads

    Returns:
        LocalMarketAds: List of local market ads of company
    """
    (status, data) = self.adapter.get(
        endpoint=self.urls.localmarket_company_url(companycode=companycode),
        err_codes=[204],
        timeout=timeout,
    )

    if status == 200:
        return LocalMarketAds.model_validate(data)
    elif status == 204:
        raise CompanyOrAdsNotFound("Company not found or no ads from company")