Skip to content

Latest commit

 

History

History
47 lines (35 loc) · 1.04 KB

stratanalyzer.rst

File metadata and controls

47 lines (35 loc) · 1.04 KB

stratanalyzer -- Strategy analyzers

Strategy analyzers provide an extensible way to attach different calculations to strategy executions.

.. automodule:: pyalgotrade.stratanalyzer
    :members: StrategyAnalyzer
    :show-inheritance:

Returns

.. automodule:: pyalgotrade.stratanalyzer.returns
    :members: Returns
    :show-inheritance:

Sharpe Ratio

.. automodule:: pyalgotrade.stratanalyzer.sharpe
    :members: SharpeRatio
    :show-inheritance:

DrawDown

.. automodule:: pyalgotrade.stratanalyzer.drawdown
    :members: DrawDown
    :show-inheritance:

Trades

.. automodule:: pyalgotrade.stratanalyzer.trades
    :members: Trades
    :member-order: bysource
    :show-inheritance:

Example

Save this code as sma_crossover.py:

.. literalinclude:: ../samples/sma_crossover.py

and save this code in a different file:

.. literalinclude:: ../samples/sample-strategy-analyzer.py

The output should look like this:

.. literalinclude:: ../samples/sample-strategy-analyzer.output