Most implementers need to at least occasionally query for a list of markets (known as assets in Hook's API), and the active instruments within that market.
1. Querying the assets
Use the getAssets GraphQL query to fetch assets.
query { assets { id baseCurrency supportedInstrumentTypes name symbol preferredSubaccount marketHash mmBips imBips }}
The initial snapshot includes the instrumentHash (which is the unique ID in the payload) as well as the best bid and offer. Subsequent updates will be sent when the mark price or bid/offer changes. In the case of options, new options will be added or removed as prices change and options expire. This subscription is automatically updated with these additional instruments.
3. Subscribing to the full-depth orderbook
Use the orderbook GraphQL subscription to watch the orderbook for a given instrument. The instrument hash is the ID from the bbo subscription above.
subscription { orderbook(instrumentHash: "0x194add7922e3fd9e6c17ca58efc31f97e6b891d13ea1919c751926daf98dd8a6") { eventType timestamp bidLevels { direction size price } askLevels { direction size price } }}
The askLevels includes the current firm offers to sell the instrument. The size and price are both represented in 10^18 decimals. The price reflectes the price in the market's BaseCurrency, which was retrieved above in the asset query.