Freqtrade adapter for PULSE Protocol — control bots and inject AI signals
Project description
pulse-freqtrade
Freqtrade adapter for PULSE Protocol — control trading bots and inject AI signals using a universal semantic interface.
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:
- Control a Freqtrade bot via PULSE messages (same interface as Binance, Bybit, OpenAI adapters)
- Inject AI signals into a running Freqtrade strategy from any external AI agent (Claude, GPT, custom)
- 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.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file pulse_freqtrade-0.1.0.tar.gz.
File metadata
- Download URL: pulse_freqtrade-0.1.0.tar.gz
- Upload date:
- Size: 17.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
52d00c671792d0c7f920be95bf35f743168141a305ead9c8ff05ed60779aabfb
|
|
| MD5 |
8cbd93da3a7f853108e58442915225d3
|
|
| BLAKE2b-256 |
df73f7afe09b999fe04609f9b8d3ba32cc5c50505ab58c964e3256587c714ef5
|
File details
Details for the file pulse_freqtrade-0.1.0-py3-none-any.whl.
File metadata
- Download URL: pulse_freqtrade-0.1.0-py3-none-any.whl
- Upload date:
- Size: 15.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0816d78d7d6c9a8f6a429c1f76bab33ece86912ae86f4d8eb90d1e083cdee952
|
|
| MD5 |
cccfe2379b90c2e9806739f4a0a9d710
|
|
| BLAKE2b-256 |
d9dcb6a1e71438c5cc8e6b70b7ff86f9247faff063d512601b1a09dc0c3b3141
|