Skip to content

Prisma RSPO Credit Order Book

Scrapes order book data from the Prisma PalmTrace Credit Trading platform and sends Discord alerts with a visual order book image.

Overview

Property Value
API https://api-platform.trade-and-traceability.prismabyrspo.org/public/v1/credit-trading/order-book
Auth None (public)
Product CSPKO (RSPO Mass Balance Credits)
Schedule Daily 17:00 SGT
Notification Discord #prices with order book image

Sample Output

Order Book

Storage

GCS

Raw JSON snapshots:

gs://calee_data/raw/prisma/order-book/{YYYYMMDD_HHMMSS}.json

Supabase

Table: prices.prisma_order_book

Column Type Description
timestamp TIMESTAMPTZ Order book snapshot time
product TEXT Credit type (CSPKO)
side TEXT bid or ask
quantity INTEGER Credits at this price level
price NUMERIC Price in USD

Unique constraint: (timestamp, product, side, price)

Commands

cd ofelia

# Run manually
docker compose exec scrapers python /app/prisma/main.py

# Run without Discord notification
docker compose exec scrapers python /app/prisma/main.py --no-notify

# Scrape different product
docker compose exec scrapers python /app/prisma/main.py --product CSPO

Sample Queries

-- Latest order book
SELECT side, price, quantity
FROM prices.prisma_order_book
WHERE timestamp = (SELECT MAX(timestamp) FROM prices.prisma_order_book)
ORDER BY side, price;

-- Best bid/ask spread over time
SELECT
    date_trunc('day', timestamp) AS date,
    MAX(CASE WHEN side = 'bid' THEN price END) AS best_bid,
    MIN(CASE WHEN side = 'ask' THEN price END) AS best_ask
FROM prices.prisma_order_book
GROUP BY 1
ORDER BY 1 DESC
LIMIT 14;