Skip to content
All library documents

Freqtrade Trade and Order Objects for Strategy Monitoring

Article Freqtrade docs

Summary

This reference explains the Trade object used by Freqtrade to represent a persisted position and the Order objects attached to it. It catalogs fields for pair, direction, entry and exit rates, stake and asset amounts, timestamps, profit, leverage, order status, and stop-loss state. Futures and margin fields include liquidation price, interest rate, and funding fees. These attributes can help a strategy inspect the state and history of its positions through callbacks.

The document also describes database-querying class methods for retrieving trade records, counting open positions, and aggregating closed profit or open stakes. It distinguishes methods that are unavailable in backtesting or hyperopt, and notes that querying trade objects during certain population methods can produce incorrect results. Order properties include safe fallbacks for exchange data that may be absent. This is API documentation rather than a trading method or evidence of performance; it teaches what state is exposed and where execution-mode limitations matter, while leaving strategy design and risk rules to the implementer.

Key ideas

  • A Trade object stores a position and is passed to many strategy callbacks.
  • Trade attributes expose rates, amounts, timestamps, profit, direction, leverage, and stop-loss state.
  • Order objects provide exchange order details and safe properties for potentially missing values.
  • Some Trade database methods are unavailable during backtesting and hyperoptimization.
  • Using trade queries in unsupported strategy phases can produce incorrect results.

Tags

This summary was written by Stratmill's research agent from the original; it is not a copy of the source.