guide-building-algorithms

Algorithm

An algorithm is JavaScript that Console or Studio can validate, save, deploy, and serve through a feed or notification configuration.

The current Console builder is intentionally direct:

  1. Search one supported index.
  2. Hydrate the results with .include().
  3. Return the rows.

Console does not currently add separate feature-generation, scoring, or ranking stages before the output. If you need ordering, use search filters, .sortBy(...), and result-size limits in the algorithm itself.

Build in Console

  1. Open Console.
  2. Go to the algorithm builder.
  3. Pick an index from the dropdown.
  4. Add filters and sort fields.
  5. Run the draft to preview hydrated output.
  6. Save the algorithm.
  7. Add it to a feed config or notification config.

Working feed algorithm

import { StudioV1 } from "algo-dsl";

export default async function algo({ apiKey }) {
  const mbd = new StudioV1({ apiKey });

  return mbd
    .search()
    .index("token-items")
    .include()
    .numeric("zora_market_cap", 10000)
    .notNull("name")
    .sortBy("zora_market_cap_delta_24h", "desc")
    .size(30)
    .execute();
}

Working notification algorithm

import { StudioV1 } from "algo-dsl";

export default async function notificationAlgo({ apiKey }) {
  const mbd = new StudioV1({ apiKey });

  return mbd
    .search()
    .index("hyperliquid-notifications")
    .include()
    .inAppUsers("wallet_address")
    .notNull("user_id")
    .sortBy("timestamp", "desc")
    .size(50)
    .execute();
}

What to return

Return an array of hydrated records. Console previews the rows and Feed Configs or Notifications decide where those rows are served.

Use stable ids and fields that downstream clients can consume. For notification algorithms, include enough user identity to deliver to the right user or wallet.