Skip to content

Add key price read model updated by indexer on each trade event #417

@Chucks1093

Description

@Chucks1093

Summary

The client currently has no fast path to get the current key price for a creator. Every price lookup either requires a direct Soroban RPC call or a round-trip that is too slow for a list view with many creators. The server needs a lightweight price read model that the indexer keeps current so the client can get prices with a single database read.

Scope

  • Add a creator_price_snapshot table (or equivalent model) with fields: creator_id, current_price, price_24h_ago, last_trade_at, updated_at
  • Update the indexer to write to this table whenever a buy or sell event is processed
  • Expose current_price and price_change_24h fields on the creator detail and creator list responses
  • Add an index on creator_id for fast lookups

Acceptance Criteria

  • Price snapshot table exists and is seeded in development
  • Indexer writes a new snapshot row (or updates in place) on every trade event
  • Creator detail endpoint returns current_price and price_change_24h
  • Creator list endpoint includes the same fields without extra per-row queries
  • Integration test confirms price field updates after a simulated trade event

Coordinate on Telegram

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions