The trading house is a bit of a different beast than the regular inventory and you cannot simply hook into it in the events mentioned by Baertram, because it will only fully initialize the first time you actually visit a guild store.
The best way I have found so far is to hook into TRADING_HOUSE:SetCurrentMode and use a flag to run the code only the first time it is called.
Lua Code:
local ranInitialSetup = false
ZO_PreHook(TRADING_HOUSE, "SetCurrentMode", function()
if(ranInitialSetup) then return end
ranInitialSetup = true
-- do your setup here
end)
or you can use AwesomeGuildStore as a dependency for your addon and listen to its AFTER_INITIAL_SETUP callback, with the additional advantage that it will already have applied its changes.
Lua Code:
local AGS = AwesomeGuildStore
AGS:RegisterCallback(AGS.callback.AFTER_INITIAL_SETUP, function()
-- do your setup here
end)