Freqtrade vs Hummingbot for crypto strategies
Choose the workflow by how a strategy reacts between closes. A signal such as closing above an average can be evaluated on completed candles. A two-sided quoting model needs to know whether an entry filled, how much inventory remains and whether the offer can be placed before the next market event.
| Workload | Start in Freqtrade | Start in Hummingbot |
|---|---|---|
| Candle-driven entry and exit | Use an explicit timeframe, pin the strategy inputs, and run look-ahead checks before a dry-run. | Use the matching controller or script and verify how its event cadence relates to the strategy’s candle clock. |
| Market-making trial | Define order refresh and inventory separately in the trial and check the assumptions of the candle simulator. | Start with a compatible controller. Document quote refresh, connector mode and allowed inventory. Replay an unmatched order and a reconnect. |
| Reviewing results | Compare the trade export with the candle signals and actual availability at the stop or target. | Review both the report and the raw fill log. Verify the resolution and fee input when using the Dashboard backtester. |
Freqtrade backtest assumptions · Freqtrade look-ahead analysis · Hummingbot controllers · Dashboard backtest controls
Keep price paths separate from the chart
Two sequences can have the same open, high, low and close. The order in which two limits become executable is lost when those sequences are collapsed into candles. That ordering matters if the strategy must own an asset before offering to sell it. Finer history reduces ambiguity. The experiment still requires an explicit fill assumption.
Screenshots and examples
Ask what one candle can prove about two limit orders
Identical OHLC with different fills and inventory
Inventory changes with fills. Ending equity is cash plus the value of any remaining inventory.| Case | Buy fills | Sell fills | Ending units | Marked P&L, USD |
|---|---|---|---|---|
| A | 1 | 1 | 0 | 1.0 |
| B | 1 | 0 | 10 | 0.5005 |
| C | 0 | 0 | 0 | 0.0 |
| D | 1 | 1 | 0 | 1.0 |
The fixture begins flat and buys ten units at 99.90 USD. It may offer those units at 100.10 USD once the buy fills. Both sides pay 5 basis points. In A the low comes first and both orders fill. The result is 1 USD after fees. In B the high comes first, with the same OHLC. The sell was not yet active. The position ends at ten units and a marked result of 0.5005 USD at the 100 close.
C repeats A and only fills when a trade moves strictly beyond the price. Neither touch qualifies. D moves one cent through both limits and produces the same two fills as A. The test uses the limit price for each fill. Validate depth, queue position and latency separately when you have event data.
Compare the log before increasing size
Use the same decision timestamp, active order ID, fill price, quantity and fee. If one run fills both sides on the same candle, check whether both orders were active in the required order and whether the input had enough temporal detail to establish it.
Reproduce the result in Python
import json
from decimal import Decimal as D
BID, ASK = D("99.90"), D("100.10")
SIZE, INITIAL_CASH, FEE = D(10), D(5000), D("0.0005")
def replay(path, cross_only):
inventory, cash, buys, sells = D(0), INITIAL_CASH, 0, 0
for price in path:
bid_reached = price < BID if cross_only else price <= BID
ask_reached = price > ASK if cross_only else price >= ASK
if inventory == 0 and buys == 0 and bid_reached:
inventory = SIZE
cash -= SIZE * BID * (1 + FEE)
buys += 1
elif inventory > 0 and ask_reached:
cash += inventory * ASK * (1 - FEE)
inventory = D(0)
sells += 1
result = cash + path[-1] * inventory - INITIAL_CASH
return [buys, sells, int(inventory), float(result)]
def run():
down_first = list(map(D, ("100", "99.90", "100.10", "100")))
up_first = list(map(D, ("100", "100.10", "99.90", "100")))
through = list(map(D, ("100", "99.89", "100.11", "100")))
settings = [("A", down_first, False), ("B", up_first, False),
("C", down_first, True), ("D", through, True)]
rows = [[name, *replay(path, cross_only)] for name, path, cross_only in settings]
assert rows[0][1:] == [1, 1, 0, 1.0]
assert rows[1][1:] == [1, 0, 10, 0.5005]
assert rows[2][1:] == [0, 0, 0, 0]
assert rows[3][1:] == [1, 1, 0, 1.0]
return rows
if __name__ == "__main__":
print(json.dumps(run()))Change the trade sequence and compare inventory after each event. Crypto bot frameworks by workflow · How market and limit orders behave in a fixture.