Skip to content
thereal-awetobyPublic

About

Resources

Stars

1 star

Watchers

1 watching

Forks

Repository files navigation

Priva

A bounded agent that trades tokenized U.S. stocks on Bitget paper — and does not publish the rule.

Spot and perpetual futures. Five-minute loop. Hard risk gates. The book stays inside the process. What leaves is a SHA-256 intent hash, not the strategy.

This is not FHE, not a TEE, and not a dark pool. Bitget still sees the fill.

Live desk · API health · Repo

Bitget AI Base Camp S2 · Agentic Trading · Open Theme · paper only (paptrading: 1)


Overview

Open the desk. Sign in. The running process is a worker, not a chat box.

Decision-maker Gemini chooses hold, buy, or sell each cycle (backend/app/agent_loop.py). Risk can still refuse.
Cycle Read → Model decides → Risk → Hash → Send. Any gate fails → nothing is sent
Demo https://priva-rho.vercel.app
Paper log priva-activity-csv-2026-09-30.csv (snapshot) · priva-activity-csv-2026-10-08.csv (full tape to 8 Oct) · priva_completed_trades.csv · priva_completed_trades_2026-10-08.csv
Risk $25k position · $1.5k daily loss · 5x · AAPL/TSLA allow-list · trade-only keys · kill switch
Privacy Hash of the intent. Fill still visible to the venue

One cycle (the Agentic unit). Every five minutes the worker:

  1. Read live Bitget marks for AAPL / TSLA
  2. Model decides — Gemini returns hold, buy, or sell. The built-in book is a hint only
  3. Risk — size, daily loss, leverage, allow-list
  4. Hash — SHA-256 fingerprint of the intent
  5. Send or refuse — Bitget paper (paptrading: 1). If Gemini is down, the cycle holds. If risk fails, nothing is sent. The row is still logged.

Hold is not a no-op. On hold, the worker still checks open spot and futures against take-profit and stop-loss.

Example row from the raw tape (pre-change veto era):

2026-09-29T12:45:08 · TSLAUSDT · sell · autonomous · blocked · gemini veto

New cycles log decision.source = model instead of a veto gate.

Observed paper tape (AAPL/TSLA only, major test account): equity ~$19,804 · desk total PnL −$135.32 · realized −$135.06 · win rate 49.54% · max drawdown −0.73%. Short window. No Sharpe. This account was used for heavy build and debug (risk probes, mapping misses, Gemini veto era), so the red PnL is expected test cost, not a live performance claim.


For users

Priva only talks to Bitget Demo Trading. Live keys will not work. The worker can place paper orders. It cannot withdraw.

1. Open Bitget Demo

  1. Sign in at bitget.com.
  2. Top nav → Futures.
  3. In the menu, open Demo trading (demo trading with zero funding risk).
  4. Confirm the header shows the green Demo badge. If it says Live, you are in the wrong venue.
Open Bitget Demo trading

2. Create a demo API key

Do this inside Demo, not on the live API-keys page.

  1. Top-right profile → API management.

  2. You should land on a page that says Create new demo trade API key (not a live key).

  3. Create one key. Set a passphrase. Save:

    • API key
    • API secret
    • Passphrase
  4. Permissions: trade only. No withdrawals. No transfers.

If the button says anything other than demo / paper, stop. That key must never be pasted into Priva.

Create a Bitget demo API key

3. Fund the paper account (optional)

Demo starts with paper USD / USDT. You can top it up:

  1. In the demo terminal, open the briefcase / Assets.
  2. Open Adjust demo trading funds.
  3. Add USDT (and USD if you want the spot side funded).

A ~$20,000 paper balance is enough to match the desk you see in the demo.

Adjust Bitget demo trading funds

4. Open Priva and connect

  1. Go to priva-rho.vercel.app.
  2. Create an account (email + password) or sign in.
  3. Open the Confirm your email address mail from Supabase Auth. Click Confirm email address. Until that link is used, sign-in stays blocked.
  4. You land on Connect your Bitget demo account.
  5. Paste API key, API secret, passphrase.
  6. Save. The desk stays locked until the paper key verifies.

Priva stores those credentials encrypted in a vault. The worker never holds your full exchange private key. Withdrawal permission is never requested.

Priva sign in and confirm email Connect Bitget demo account in Priva

5. Run the desk

Screen What to do
Control Center Confirm Worker running, Paper trading only. Watch spot + futures equity.
Risk & access Set caps first. Defaults: $25,000 position · $1,500 daily loss · 5x · AAPL + TSLA only.
Strategy Lab Leave Autonomous, or activate a built-in book, or write English / JSON and activate. The book is a hint. Gemini still chooses the send. Risk still gates.
Activity This is the tape. Turn on Show holds & evaluations. Export CSV when you want a replay.

Kill switch is one control: it stops the worker and can flash-close open futures.

6. Read one row

A useful Activity row has: time, mode (autonomous / strategy), symbol, model decision, risk ALLOW or BLOCK, intent hash, sent or not sent.

symbol not available on this market is a mapping miss, not a risk block. Filter those out when you read the tape. Logical names on the desk are AAPLUSDT / TSLAUSDT. Bitget spot tokens are RAAPLUSDT / RTSLAUSDT.

What Priva will not do

  • Use a live Bitget key
  • Withdraw or transfer
  • Hide the fill from Bitget
  • Trade names outside the allow-list
  • Run the loop if the demo key fails verification

Thesis

Public agents leak the book. Chat agents wait for a prompt. Over-permissioned keys can withdraw.

Priva’s bet: an unattended agent is only safe if those three are fixed in one product.

  1. Scheduled. A cycle every five minutes. Not a prompt.
  2. Gated. Size, daily loss, leverage, allow-list — checked before every send.
  3. Quiet. Strategy code never leaves the process. Activity stores a fingerprint of the decision. Change the logged intent and the hash no longer matches.

Gemini chooses hold, buy, or sell. The risk engine can still refuse. If Gemini is down, the cycle holds.

Autonomy without a wall is only faster risk. Privacy that pretends the exchange cannot see the order is a lie. Priva does neither.

  marks (AAPL / TSLA)
        |
        v
  +---------+   hold     +----------+
  |  Model  |----------->| not sent |--> log + wait
  +----+----+            +----------+
       | buy / sell
       v
  +---------+   fail
  |  Risk   |-----------> not sent
  +----+----+
       | pass
       v
  +---------+
  |  Hash   |  SHA-256 of the intent
  +----+----+
       v
  +---------+
  |  Send   |  Bitget paper, paptrading: 1
  +---------+

Who it is for

Self-directed Bitget retail who already touch tokenized U.S. stocks, will start on paper, and will not give a bot withdraw permission.

Not “all traders.”

Risk appetite Conservative to moderate. Paper first.
Capital Demo desk ~$20k notional. Live target after paper: $5k–$25k (matches the default cap).
Frequency One cycle / five minutes. Not HFT. Not click-trading.
Market Bitget tokenized U.S. stocks, spot + perps, AAPLUSDT / TSLAUSDT
Job to be done Connect a paper key, set the wall, pick Autonomous or a named book, leave. Export the tape.

Product

Desk — priva-rho.vercel.app

Screen What you should notice
Control Center Worker running, next cycle, spot + futures equity, kill switch, Autonomous / Strategy
Strategy Lab Four built-in books + custom English or JSON. Activate. Same risk spine. Book is a hint to the model.
Risk & access Caps are not suggestions. Trade only. No withdrawals. No transfers.
Activity Mode-separated tape. Intent hash on sends. CSV export is the replay.

Modes

  • Autonomous — built-in books as hints (momentum breakout, mean reversion, overnight gap, AAPL/TSLA pairs). Gemini chooses the action.
  • Strategy — the book the user activated is still a hint. The model does not get a side door around risk.

Default caps

$25,000 max position · $1,500 max daily loss · 5x max leverage · allow-list AAPL + TSLA only.


Privacy

Stays inside the agent What leaves
Strategy code / JSON book Normal Bitget paper order
Decision logic Fill, qty, price — visible to the venue
Full user private key Short intent hash in Activity

The landing line is: the agent trades on its own; the rule set stays inside; the ledger shows a hash, not the book that produced it.

Credentials sit in a Fernet vault (PRIVA_CREDENTIAL_ENCRYPTION_KEY). The worker never holds the user’s full exchange private key.


Paper numbers

Observed on the main demo test account. Not a backtest. Not out-of-sample. Desk UI as of 8 Oct 2026.

This account carried the heavy build work (risk probes, symbol mapping, Gemini veto era, strategy activation tests). The red PnL is test cost on paper, not a claim about live edge.

Observed
Paper equity ~$19,804
Desk total PnL −$135.32
Realized PnL −$135.06
Win rate 49.54%
Max drawdown −0.73%
Universe AAPLUSDT, TSLAUSDT
Live funds none

Export closes in priva_completed_trades_2026-10-08.csv: 36 closes, 34 with a PnL figure (sum −$79.65, 18 wins / 16 losses on those 34). Desk totals can differ slightly from the export sum (open lots, fees, multi-unit closes).

Worker downtime (Render free tier slept / cold starts before the keepalive cron). Large gaps in the tape are host pause, not “the agent chose silence”:

Quiet from (UTC) Quiet until (UTC) ~hours
2026-09-11 12:53 2026-09-16 09:34 ~117
2026-09-16 11:19 2026-09-22 15:43 ~148
2026-09-26 18:03 2026-09-28 15:20 ~45
2026-10-03 07:09 2026-10-08 15:17 ~128

Smaller overnight gaps also appear. After the health-ping cron, the worker stays warm. Early symbol not available rows were mapping misses. Many gemini veto / risk_rejected rows are the wall working (size, leverage, allow-list). Holds mean the cycle ran and chose not to send. There is no Sharpe on this window.

Paper log (keep all four):


Architecture

priva-web  (Next.js, Vercel)
    |
    |  Bearer <Supabase access token>
    v
backend   (FastAPI, Render)
    |-- agent_loop.py        5-minute worker + Gemini decide
    |-- strategy.py          books + English/JSON parse (hints)
    |-- risk_engine.py       caps, allow-list, kill
    |-- paper_execution.py   Bitget paper client
    |-- user_runtime.py      per-user worker
    |-- auth.py              Supabase
    v
Bitget demo  +  Supabase (auth, cycle log, encrypted keys)
Path Role
backend/app/agent_loop.py Cycle + model decision
backend/app/risk_engine.py Wall
backend/app/paper_execution.py Paper send
backend/app/strategy.py Books + parse + activate
backend/app/symbols.py AAPLUSDT → RAAPLUSDT, TSLAUSDT → RTSLAUSDT
backend/app/auth.py Session
priva-web/ Desk UI

Stack

  • Desk: Next.js (priva-web) on Vercel
  • Worker: FastAPI + Uvicorn (backend) on Render
  • Auth, logs, encrypted keys: Supabase
  • Venue: Bitget demo, hedge mode, paptrading: 1
  • Period: 5 minutes
  • Universe: AAPLUSDT, TSLAUSDT (MSFTUSDT blocked)

Quick start (builders)

Worker

cd backend
python -m venv .venv
source .venv/bin/activate          # Windows: .venv\Scripts\activate
pip install -r requirements.txt
python -m uvicorn app.main:app --host 127.0.0.1 --port 8001

Health: http://127.0.0.1:8001/health

cd backend && python -m pytest -q

Desk

cd priva-web
npm install
npm run dev

http://localhost:3000 — point the desk at the local API.

Production desk already uses https://priva-499h.onrender.com.


Environment

backend

Variable Point
AGENT_WATCHED_SYMBOLS AAPLUSDT,TSLAUSDT
SUPABASE_URL Project URL
SUPABASE_ANON_KEY Anon
SUPABASE_SERVICE_ROLE_KEY Server only — never ship to the browser
PRIVA_CREDENTIAL_ENCRYPTION_KEY Fernet, 44 chars
GEMINI_API_KEY Model decision. Missing key → hold
python -c "from cryptography.fernet import Fernet; print(Fernet.generate_key().decode())"

priva-web

Public env only: API base (https://priva-499h.onrender.com in prod) and Supabase URL + anon key. Same project as the worker.

Never put the service role key or Bitget secrets in NEXT_PUBLIC_*. Bitget API credentials are entered per user in the authenticated app and stored encrypted in Supabase; do not configure shared Bitget credentials in Render.


API

Open:

  • GET /health
  • GET /status

Bearer (Authorization: Bearer <Supabase access token>):

GET /strategies
POST /strategies/parse
POST /strategies/{id}/activate
GET /risk-settings
POST /risk-settings
POST /risk-check
POST /paper-trade
<<<<<<< HEAD
GET /dashboard
GET /account/balance
GET /account/balance-history
GET /pnl
GET /activity-log
GET /user/agent-loop
=======
GET  /dashboard
GET  /account/balance
GET  /account/balance-history
GET  /pnl
GET  /activity-log
GET  /user/agent-loop
>>>>>>> 46e6573202b328f55033d3f2cbf07b0653002240
POST /user/agent-settings
POST /kill-switch

What this repo is not

  • Live funds
  • Withdrawals or transfers
  • A universe past AAPL and TSLA
  • Hidden orders on Bitget
  • A 60-day out-of-sample Sharpe

License

Hackathon submission. Ask before you reuse the name or the desk.

About

Resources

Stars

1 star

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages