Skip to main content

Delta Exchange (delta.exchange) broker adapter for freqtrade — installable freqtrade plugin (REST Phase-1, websockets Phase-2).

Project description

freqtrade-delta-exchange

A standalone, installable freqtrade adapter for Delta Exchange (delta.exchange) futures trading — packaged as a proper freqtrade plugin so it works with uv pip install / pip install even if the upstream pull request is never merged.

Why this exists

ccxt.delta exposes every required futures primitive (createOrder, setLeverage, setMarginMode, stop-market / trigger orders, fetchPositions, fetchFundingRate, and a testnet via set_sandbox_mode), but its has capability map under-reports them — so freqtrade's generic-Exchange validation refuses it. This adapter declares the real capabilities via _ft_has and maps the order / margin / stop plumbing freqtrade expects.

Status

  • Phase 1 (current): REST polling. Fully functional for live + demo trading. No websocket streaming yet (freqtrade falls back to REST polling).
  • Phase 2 (TODO): native websockets (wss://socket.delta.exchange candles / orders / positions / book), matching the official exchanges.

International vs Delta India

The adapter supports both. Delta India is a separate entity with different endpoints, markets, and currencies:

International Delta Delta India
Config flag (default) "india": true
Demo host testnet-api.delta.exchange cdn-ind.testnet.deltaex.org
Live host api.delta.exchange cdn.india.deltaex.org
BTC perp symbol BTC/USDT:USDT BTC/USD:USD
Settle currency USDT USD (stake_currency: "USD")

When "india": true:

  • "sandbox": truedemo/testnet cdn-ind.testnet.deltaex.org (paper, no real money)
  • "sandbox": falselive cdn.india.deltaex.org

Note: earlier assumptions that cdn.india.deltaex.org is "only a CDN" were wrong — it is a fully working trading API host (authenticates, serves markets and balances). It is the correct live host for Delta India.

Capability gaps handled the official way

ccxt.delta under-reports several futures capabilities. Each is handled via freqtrade's documented extension points — no global ccxt monkeypatch, no false has flags:

  • Funding-rate history: fetchFundingRateHistory raises "not supported yet". Override _fetch_funding_rate_history to return [] (freqtrade already gates it via exchange_has("fetchFundingRateHistory") → graceful skip, no back-adjustment).
  • Leverage tiers: fetchLeverageTiers unsupported. Declare it in _ft_has["exchange_has_overrides"] and override get_leverage_tiers() to return a permissive 0–100x tier (falls back to the config pair whitelist in backtest, where live markets aren't loaded).
  • Margin mode: set_margin_mode is NotSupported on Delta (defaults to cross); set_margin_mode() tolerates that silently.

Dry-run smoke test

user_data/strategies/dry_run_smoke/DryRunSmoke.py is a minimal always-enter strategy (1m, enter then exit next candle) for exercising the broker plumbing without waiting on a real signal. Pair it with freqtrade-delta-exchange/examples/delta-india-demo-smoke.config.json. For a direct (no-strategy) order test, place/cancel via the adapter's ccxt client on the demo host.

2FA (TOTP)

Delta API keys with 2FA enabled must sign every request with the current TOTP in the request password. Supply the base32 secret via the gitignored secrets file (totp_secret) and the adapter computes a fresh code at client init:

{ "exchange": { "key": "...", "secret": "...", "totp_secret": "JGFRS7RYJWMJWDKV" } }

Demo vs Live (International)

Goal Setting
Paper / demo trading "sandbox": truetestnet-api.delta.exchange
Live trading "sandbox": falseapi.delta.exchange

Delta India note: sandbox: true routes to the India demo/testnet host cdn-ind.testnet.deltaex.org (paper, no real money). sandbox: false is live api.india.delta.exchange.

Install

# From PyPI (published)
pip install freqtrade-delta-exchange

# Or, from a local checkout (editable)
uv pip install -e ./freqtrade-delta-exchange
# or
pip install -e ./freqtrade-delta-exchange

Use

// in your freqtrade config.json
{
  "exchange": {
    "name": "delta",             // resolves to the installed Delta adapter
    "sandbox": true,             // true = Delta testnet (demo/paper), false = live
    "key": "...",                // keep keys OUT of this file — see below
    "secret": "..."
  },
  "trading_mode": "futures",
  "margin_mode": "cross"
}

Never commit API keys. Put them in a separate gitignored file and layer it:

freqtrade trade -c config.json -c delta-secrets.json

delta-secrets.json:

{ "exchange": { "key": "YOUR_KEY", "secret": "YOUR_SECRET" } }

Demo vs Live

Goal Setting
Paper / demo trading "sandbox": truetestnet-api.delta.exchange
Live trading "sandbox": falseapi.delta.exchange

Contributing upstream

This adapter is structured to be submitted as a freqtrade PR (drop freqtrade_delta_exchange/delta.py into freqtrade/exchange/delta.py and add Delta to freqtrade/exchange/__init__.py + SUPPORTED_EXCHANGES).

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

freqtrade_delta_exchange-0.2.2.tar.gz (200.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

freqtrade_delta_exchange-0.2.2-py3-none-any.whl (14.9 kB view details)

Uploaded Python 3

File details

Details for the file freqtrade_delta_exchange-0.2.2.tar.gz.

File metadata

  • Download URL: freqtrade_delta_exchange-0.2.2.tar.gz
  • Upload date:
  • Size: 200.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.9.24 {"installer":{"name":"uv","version":"0.9.24","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for freqtrade_delta_exchange-0.2.2.tar.gz
Algorithm Hash digest
SHA256 27703e56d7973a1d1ee52c68eb7a3c981063cfa295e73811873b3ecdf14321e8
MD5 d5cf3e645ddda17176ad06c7e05eb797
BLAKE2b-256 1157ea24ea3bca938dbe59331626fc24dc76140e91e02769f793163d9f481ee0

See more details on using hashes here.

File details

Details for the file freqtrade_delta_exchange-0.2.2-py3-none-any.whl.

File metadata

  • Download URL: freqtrade_delta_exchange-0.2.2-py3-none-any.whl
  • Upload date:
  • Size: 14.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.9.24 {"installer":{"name":"uv","version":"0.9.24","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for freqtrade_delta_exchange-0.2.2-py3-none-any.whl
Algorithm Hash digest
SHA256 d0eeb2375a06852bac8a5fca6b36e9a780b10a068faa4795c6a3b900fe6d62b1
MD5 b89c16aac205430a34e2c44cb2d7aeb5
BLAKE2b-256 351ad956649be6f98b3bc284ced520d966ff6141f1bf5bb4fc8e0a737c5d2411

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page