# Developer guide Guide on how to use AA Eveprices from your own alliance auth applications. ## Application hook When possible you should declare in your application a `PricesToPreloadListHook`. This hook will be used by AA Eveprices to know a list of prices you want to have available and updated regularly. \ The type ids listed in this hook will be added to the regular update cycle. ```{eval-rst} .. autoclass:: eveprices.hooks.PricesToPreloadListHook :members: __init__ ``` ```py from allianceauth import hooks from eveprices.hooks import PricesToPreloadListHook @hooks.register("price_preload_hook") def register_price_preload_list(): return PricesToPreloadListHook([35, 36, 37]) ``` ```{note} It is prefered that you use a hook to define prices that need to be updated in order to do a single bulk price update. This ease the load of the price providers compared to doing dozens (if not thousands) of requests for a single item each. ``` ## Query prices In order to query prices from the database you can use the methods that are linked to the `TypePrice` manager: ```python from eveprices.models import TypePrice TRITANIUM_TYPE_ID = 34 tritanium_price = TypePrice.objects.get_type_price_immediate(TRITANIUM_TYPE_ID) ``` ```{eval-rst} .. automodule:: eveprices.providers :members: PriceInformation .. automodule:: eveprices.models :members: TypePrice, TypePriceManager ``` When working on data loaded through your `PricesToPreloadListHook` you can use the methods with immediate in their definition. These methods won't check when the type price was last updated and query the database value immediatly. If you need the price of a type not sourced through a `PricesToPreloadListHook` you can use other methods. They will check when the price was last updated, and you can choose what's the maximum time before you want them updated. ## Templatetags Template tags are available to display type prices in templates ```{eval-rst} .. automodule:: eveprices.templatetags.eveprices :members: ``` Example: ```html {% load eveprices %} {% get_type_price_immediate 33 %} {% get_type_price_immediate_humanize 34 %} ```