Skip to main content

pulse-freqtrade

Freqtrade adapter for PULSE Protocol — control trading bots and inject AI signals using a universal semantic interface.

PyPI version License


What is this?

PULSE Protocol is an open-source semantic messaging standard for AI-to-AI communication. pulse-freqtrade bridges PULSE with Freqtrade — the most popular open-source crypto trading bot framework.

Three things you can do:

  1. Control a Freqtrade bot via PULSE messages (same interface as Binance, Bybit, OpenAI adapters)
  2. Inject AI signals into a running Freqtrade strategy from any external AI agent (Claude, GPT, custom)
  3. Monitor multiple bots in one dashboard and coordinate risk across them

Installation

pip install pulse-freqtrade

If you want to use PulseStrategy inside Freqtrade:

pip install pulse-freqtrade[freqtrade]

Quick Start

1. Control a running Freqtrade bot

First, start Freqtrade with the REST API enabled:

freqtrade trade --config config.json --enable-rest-api

Then control it via PULSE:

from pulse_freqtrade import FreqtradeAdapter
from pulse.message import PulseMessage

adapter = FreqtradeAdapter(
    url="http://localhost:8080",
    username="freqtrader",
    password="SuperSecurePassword",
)
adapter.connect()

# Check open trades
msg = PulseMessage(action="ACT.QUERY.STATUS", parameters={})
response = adapter.send(msg)
print(response.content["parameters"]["result"])

# Force buy
msg = PulseMessage(
    action="ACT.TRANSACT.REQUEST",
    parameters={"pair": "BTC/USDT", "stake_amount": 100},
)
adapter.send(msg)

# Stop the bot
adapter.send(PulseMessage(action="ACT.STOP", parameters={}))

2. Inject AI signals into a Freqtrade strategy

Strategy file (my_strategy.py in Freqtrade's user_data/strategies/):

from pulse_freqtrade import PulseStrategy, SignalListener

class MyAIStrategy(PulseStrategy):
    timeframe = "1h"
    pulse_agent_id = "my-claude-driven-bot"

    # Start signal listener on init (AI agents POST signals here)
    listener = SignalListener(port=9999)
    listener.start()

    def populate_entry_trend(self, dataframe, metadata):
        # Check PULSE signals from AI agents
        signals = self.get_pulse_signals(metadata["pair"])
        if signals:
            signal = signals[0]
            direction = signal.content["parameters"].get("direction")
            confidence = signal.content["parameters"].get("confidence", 0)

            if direction == "long" and confidence > 0.8:
                dataframe["enter_long"] = 1
                return dataframe

        # Fallback: your standard logic
        dataframe.loc[dataframe["rsi"] < 30, "enter_long"] = 1
        return dataframe

    def populate_exit_trend(self, dataframe, metadata):
        signals = self.get_pulse_signals(metadata["pair"])
        if signals:
            direction = signals[0].content["parameters"].get("direction")
            if direction == "short":
                dataframe["exit_long"] = 1
                return dataframe

        dataframe.loc[dataframe["rsi"] > 70, "exit_long"] = 1
        return dataframe

External AI agent (any Python script, can run on different machine):

import requests

# Claude/GPT analysis says BTC is oversold → send BUY signal
requests.post("http://your-freqtrade-server:9999/", json={
    "action": "ACT.RECOMMEND.ACTION",
    "parameters": {
        "pair": "BTC/USDT",
        "direction": "long",
        "confidence": 0.92,
        "reason": "RSI < 25, bullish divergence",
        "agent_id": "claude-analyst",
    }
})

3. Signal format conversion

from pulse_freqtrade import SignalConverter

# Freqtrade signal → PULSE
ft_signal = {"pair": "BTC/USDT", "signal": 1, "confidence": 0.85}
pulse_msg = SignalConverter.freqtrade_to_pulse(ft_signal)

# PULSE → Freqtrade
ft_signal = SignalConverter.pulse_to_freqtrade(pulse_msg)
print(ft_signal["signal"])  # 1

Supported PULSE Actions

PULSE Action Freqtrade Operation
ACT.QUERY.STATUS GET /api/v1/status (open trades)
ACT.QUERY.BALANCE GET /api/v1/balance
ACT.QUERY.LIST GET /api/v1/trades (history)
ACT.QUERY.DATA GET /api/v1/pair_candles (OHLCV)
ACT.QUERY.PROFIT GET /api/v1/profit
ACT.TRANSACT.REQUEST POST /api/v1/forcebuy
ACT.CANCEL POST /api/v1/forcesell
ACT.START POST /api/v1/start
ACT.STOP POST /api/v1/stop
ACT.RELOAD POST /api/v1/reload_config

Why PULSE + Freqtrade?

Without PULSE With PULSE
Each bot has its own API One interface for all bots
Hard to inject external signals signal_bus.push(msg) — done
No cross-bot coordination MultiBotCoordinator monitors all
Custom signal formats everywhere Standard semantic messages
Manual monitoring PULSE audit trail for every trade

Examples

examples/
  01_control_bot.py          — Control bot, query trades and balance
  02_ai_signal_injection.py  — AI agent sends signals to strategy
  03_multi_bot_arbitrage.py  — Monitor and coordinate multiple bots

PULSE Ecosystem

Package Description
pulse-protocol Core protocol
pulse-openai OpenAI/GPT adapter
pulse-anthropic Claude adapter
pulse-binance Binance exchange
pulse-bybit Bybit exchange
pulse-freqtrade Freqtrade bot

License

Apache 2.0 — free forever, open source.

Release files for pulse-freqtrade 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for pulse-freqtrade 0.1.0
File Size Uploaded
pulse_freqtrade-0.1.0.tar.gz 17.4 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for pulse-freqtrade 0.1.0
File Interpreter ABI Platform
pulse_freqtrade-0.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 32.4 kB

Release files / pulse_freqtrade-0.1.0.tar.gz

Download URL pulse_freqtrade-0.1.0.tar.gz
Size 17.4 kB
Tags Source
SHA-256 checksum
How to use checksums
52d00c671792d0c7f920be95bf35f743168141a305ead9c8ff05ed60779aabfb
BLAKE2b-256 checksum
How to use checksums
df73f7afe09b999fe04609f9b8d3ba32cc5c50505ab58c964e3256587c714ef5
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.14.3

Release files / pulse_freqtrade-0.1.0-py3-none-any.whl

Download URL pulse_freqtrade-0.1.0-py3-none-any.whl
Size 15.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
0816d78d7d6c9a8f6a429c1f76bab33ece86912ae86f4d8eb90d1e083cdee952
BLAKE2b-256 checksum
How to use checksums
d9dcb6a1e71438c5cc8e6b70b7ff86f9247faff063d512601b1a09dc0c3b3141
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.14.3

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page