Skip to content

fshahy/dankbit

Repository files navigation

Dankbit

Structural options analytics for Deribit — built on Odoo 18.

Aggregates all BTC and ETH options trades for a given expiry and renders Delta and Dollar Gamma (GEX) curves across a configurable price range. Designed for understanding where dealers are structurally positioned — gamma walls, pin risk, and hedging pressure — not for tracking real-time flow.

Dankbit Chart


What it shows

Curve Colour Description
Delta Green Aggregate taker portfolio delta across spot prices
Gamma (GEX) Violet Dollar gamma — Γ × S² — dealer hedging pressure
Taker P&L Red Aggregate payoff at expiry (optional)

The chart footer shows net volume separately for calls and puts (in BTC or ETH). Positive = takers net bought, negative = takers net sold.

The blue vertical line marks current spot. Current delta at spot is shown below the chart.

Reading the gamma curve: negative GEX means takers are net short gamma → market makers are net long gamma → MMs sell into rallies and buy dips, pinning spot. The deepest trough is the primary gamma wall.

Trading futures with GEX:

  • Avoid directional trades when GEX is negative (violet filled area) — MMs are net long gamma and hedge by fading every move. The market tends to pin and mean-revert. Breakouts fail.
  • Prefer directional trades when GEX is positive (no fill) — MMs are net short gamma and must hedge pro-cyclically (buy into rallies, sell into dips), adding fuel to trending moves.

Architecture

Deribit WebSocket API  ──►  dankbit_ws (Python)  ──►  PostgreSQL
                                                            │
                                                        Odoo 18
                                                            │
                                                     /<instrument>

Two Docker services:

  • web — Odoo 18 with the dankbit addon. Serves chart pages and the Odoo backend.
  • dankbit_ws — Lightweight Python service. Authenticates with Deribit's WebSocket API using API credentials and streams option trades directly into PostgreSQL.

URLs

URL Description
/BTC-7MAY26 BTC options for a specific expiry
/ETH-30MAY26 ETH options for a specific expiry
/help Payoff diagram reference

Expiry codes follow Deribit's naming convention (e.g. 7MAY26). Refer to Deribit for available expiries.

Charts auto-refresh every 5 minutes by default (configurable in Settings).


Setup

Prerequisites

  • Docker and Docker Compose
  • Deribit API credentials (DERIBIT_KEY, DERIBIT_SECRET) — set in .env

1. Clone

git clone https://github.com/fshahy/dankbit.git
cd dankbit

2. Set permissions

export UID=$(id -u)
export GID=$(id -g)

3. Start

docker compose up -d

4. Initialise Odoo

Open http://localhost:8069, create a database (any name — set DANKBIT_POSTGRES_DB in .env to match), then install the Dankbit app from the Apps menu.

The database starts empty. Trades accumulate in real time via the WebSocket service. Charts become more meaningful as more trades are collected — a fresh instance will show sparse data until enough history builds up.

5. Enable cron jobs

Two scheduled actions run automatically once a day:

  • Dankbit - Get Last Trades — ensures no trades were missed (e.g. during brief downtime) by pulling recent history from the Deribit REST API
  • Dankbit - Delete Expired Trades — archives expired instruments

The WebSocket service (dankbit_ws) handles real-time ingestion automatically on startup.


Configuration

Settings → Dankbit:

Parameter Description Default
From Price (BTC) Left edge of BTC chart 100,000
To Price (BTC) Right edge of BTC chart 150,000
Steps (BTC) Price step size 100
From / To / Steps (ETH) Same for ETH 2000 / 5000 / 50
Refresh Interval Page auto-refresh in seconds 60
Deribit API timeout HTTP request timeout 5s

Stack

  • Odoo 18 — web framework, ORM, scheduler
  • PostgreSQL 14 — trade storage
  • matplotlib / numpy / scipy — server-side chart rendering (no pyplot, Agg backend)
  • websockets — anonymous Deribit WebSocket client
  • Docker Compose — single-command deployment

Project layout

dankbit/
├── my_addons/dankbit/
│   ├── controllers/
│   │   ├── main.py          # HTTP routes → chart PNG
│   │   ├── delta.py         # Black-Scholes delta aggregation
│   │   ├── gamma.py         # Dollar gamma (GEX) aggregation
│   │   └── options.py       # Matplotlib figure builder
│   ├── models/
│   │   └── trade.py         # Trade model, Deribit REST fetcher
│   └── wizard/
│       └── plot_wizard.py   # Backend plot wizard for selected trades
├── dankbit_ws_service/
│   └── dankbit_ws_batch.py  # WebSocket trade ingester
├── config/
│   └── odoo.conf
└── docker-compose.yml

Inspiration

Inspired by Thales OSS.

License

MIT

About

Structural options analytics for Deribit. Reveals dealer gamma positioning, pin risk, and hedging pressure for BTC and ETH expiries.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors