← Back to docs
External DB guide

Connect your data with Supabase

The easiest way to feed your own metrics (fear & greed, on-chain data) into strategies via ctx.data(). The Supabase free tier is enough, and the connection string is stored only on your agent machine — the soritrading server never sees your data or password.

Before you start — Your agent must be installed and paired (check the Assets screen). If your data already lives in another Postgres, start from step 3.
1

Create a Supabase project

Create a free project at supabase.com. Pick a region close to your agent (VPS).

2

Create a table and load data

Use the SQL editor or Table Editor. Minimum: a timestamp column and a value column. Example: fear_greed(ts bigint, v numeric) — epoch seconds recommended (ms/ISO auto-detected).

No data to load? — this is where most people stop

Starting from free public data is the fastest path. We provide open-source fetchers that fill your DB with Fear & Greed, Bitcoin hash rate, US policy rate, VIX and more — all free, no API key. The fetcher **creates the table for you** (ts, v). That makes this whole step 2 disappear: one command loads the data, one more installs the cron schedule. ★ Loading uses a WRITE account. The read-only account in step 3 is a separate one, used by the agent to read.

Open the public-data guide →
3

Create a READ-ONLY account (important)

Validation only needs reads. Paste the SQL below into the Supabase SQL editor — the real defense if the connection string ever leaks.

create role readonly_bot login password 'replace-with-strong-password';
grant usage on schema public to readonly_bot;
grant select on all tables in schema public to readonly_bot;
alter default privileges in schema public grant select on tables to readonly_bot;
4

Copy the connection string

Open Project Overview → Get connected in the project dashboard, copy the URL under Direct, then replace only the user name and password with the read-only role from step 3. Pooler options appear in the same place. ★ Supabase can rename these UI labels — the URL itself tells you which mode you copied: · host is db.your project ref.supabase.co (direct) → user is plain readonly_bot · host contains pooler.supabase.com → user is readonly_bot.your project ref (keep the ref after the dot — removing it is rejected) ★ On the free tier the direct connection (5432) is IPv6-only — if your agent server has no IPv6, use the Session mode (pooler) URL.

5

Connect, then let the AI take over

Assets → External DB: enter an alias (main) and the URL — the connection is verified immediately. Then in chat: "use my fear_greed table in a strategy" — the AI registers the dataset, reads the verification report, writes a strategy using ctx.data('fg') and runs the backtest. No data to load yet? Start from the free public datasets at /guide/datasets (Fear & Greed and others).

Good to know
  • Free projects pause after ~1 week of inactivity — the agent's 10-minute verification usually counts as activity and keeps it awake.
  • Live updates (notify mode) work only with Session-mode URLs (transaction pooling does not support LISTEN).
  • Backtest results carry a data fingerprint (rows, hash) — if your DB changes, fingerprints differ, and results with different fingerprints are not the same experiment.