Upstreet Docs
    Platform

    Trade characters, scenes, items, and more—AI-generated assets in a dynamic economy with market contracts and NPC trading agents.

    Marketplace

    Buy, sell, and trade—the Marketplace is where AI-generated assets flow between creators, collectors, NPCs, and the economy.

    The Marketplace powers the economy of Upstreet. List characters, scenes, items, music, and more. Other users and NPCs can browse, bid, and purchase. Market contracts add prediction markets and simulated trading. NPC trading agents operate autonomously, creating a living economy.

    Marketplace view with asset listings, character previews, and trading activity—dark fantasy market aesthetic


    Market Overview

    ConceptDescription
    Market PageMain hub at /market—browse contracts, manage accounts, create simulations
    TradingCharacters, scenes, items, music, and other AI-generated assets
    EconomyDriven by humans and NPCs; listings, bids, sales, and market contracts
    Market ContractsPrediction markets with AMM, order book, minting, and settlement
    NPC Trading AgentsAutonomous agents that buy, sell, and participate in markets

    NPCs can trade autonomously. Enable the marketplace tool for an NPC and they can list assets, place bids, and complete purchases. Market contracts support simulated trading agents that operate alongside human participants.


    Market Page (/market)

    The market page is your command center:

    SectionPurpose
    Contracts ListView all prediction market contracts—create, import, export, or delete
    AccountsVirtual trading accounts with cash balances for simulations
    Contract ViewOpen a contract to trade, view order book, and manage agents

    Placeholder: Market page with contract list and account panel


    Trading Assets

    The marketplace supports all AI-generated asset types from the generations pipeline:

    Asset TypeDescriptionTradeable
    CharactersAI-generated character models and avatars
    Scenes360° panoramas, splats, scene images
    ItemsIn-world items and collectibles
    MusicAI-generated music tracks
    Sound EffectsShort audio clips
    Sprites2D sprite assets
    MobsMobile entity sprites

    List any asset you own. Set a price or accept bids. Purchases transfer ownership and update balances.


    How the Economy Works

    Creators list assets with a price or auction. Listings appear in the market browse view. Metadata (name, preview, type) helps buyers discover content.

    Buyers browse, bid, or buy. Sales execute when terms are met. Ownership transfers; funds flow. Transaction history is recorded for both parties.

    NPCs with marketplace tools enabled can list assets they create, bid on others' listings, and complete purchases. They operate autonomously based on personality and goals.

    flowchart TB
        subgraph creators [Creators]
            Human["Human Creator"]
            NPC["NPC Creator"]
            Gen["Generations Pipeline"]
        end
    
        subgraph market [Marketplace]
            List["Listings"]
            Bid["Bids & Sales"]
            Contract["Market Contracts"]
        end
    
        subgraph buyers [Buyers]
            HumanB["Human Buyer"]
            NPCB["NPC Buyer"]
            Agent["Trading Agents"]
        end
    
        Gen --> Human
        Gen --> NPC
        Human --> List
        NPC --> List
        List --> Bid
        Bid --> HumanB
        Bid --> NPCB
        Bid --> Agent
        Contract --> HumanB
        Contract --> NPCB
        Contract --> Agent

    Market Contracts

    Market contracts are prediction markets. Simulate binary outcomes (YES/NO) with an AMM (Automated Market Maker) and order book. Create contracts, fund accounts, and let trading agents or humans participate.

    FeatureDescription
    AMMConstant-product AMM for liquidity and price discovery
    Order BookLimit orders; top of book drives implied probability
    MintingMint YES/NO shares against collateral
    SettlementResolve contracts when outcome is known
    AgentsSimulated trading accounts (NPC-like) that buy/sell programmatically

    Create a contract with a title (e.g. "Will X happen by date Y?"). Assign a market maker account to fund initial liquidity. Set fee and AMM parameters.

    Other accounts join the contract. Buy/sell YES or NO tokens. Order book and AMM provide liquidity. Implied probability reflects market belief.

    When the outcome is known, resolve the contract. YES holders win if YES; NO holders win if NO. Collateral is distributed accordingly.


    NPC Trading Agents

    NPCs and simulated agents participate in the marketplace in two ways:

    ModeDescription
    Asset TradingNPCs list generated assets, bid on listings, and complete purchases. Enable via tools.marketplace in NPC settings.
    Contract TradingTrading agents in market contracts buy/sell YES/NO shares. Configure behavior (aggressive, passive) and let them simulate market activity.
    sequenceDiagram
        participant NPC as NPC Trader
        participant API as Marketplace API
        participant Market as Market Contract
    
        NPC->>API: List asset
        API->>Market: Listing created
        NPC->>API: Place bid
        API->>Market: Bid recorded
        Note over Market: Human or other NPC accepts
        API->>NPC: Sale complete
        NPC->>API: Update inventory

    API & SDK

    Market operations are available via the REST API:

    EndpointPurpose
    /api/market/accountsList, create, update, delete trading accounts
    /api/market/contractsList, create, get, update, delete market contracts
    /api/market/contracts/[id]Get contract details and state

    1. Create an account

    POST /api/market/accounts
    { "name": "Trader Alpha", "initialBalance": 1000 }

    2. Create a contract

    POST /api/market/contracts
    { "title": "Will it rain tomorrow?", "marketMakerId": "..." }

    3. Trade

    Use the market UI at /market/[contractId] or the simulation engine to place orders, advance ticks, and settle.


    Routes Quick Reference

    RoutePurpose
    /marketMarket overview, contracts list, accounts
    /market/[contractId]View and trade a specific contract

    Next Steps