For code/output blocks: Use ``` (aka backtick or grave accent) in a single line before and after the block. See:

Sharpe ratio with seconds-resolution data

  • I'm using a custom data set

    2020-04-16 09:29:00,3779.4,3778.2,1133760.0,3778.8
    2020-04-16 09:30:00,3781.0,3777.8,1133731.7857142857,3779.4
    2020-04-16 09:30:00,3779.4,3778.0,1133717.7721518988,3778.7
    2020-04-16 09:30:01,3779.2,3778.2,1133700.3956043955,3778.7

    Resampling with this:

            data1, timeframe=bt.TimeFrame.Seconds, compression=1)

    And trying to add Sharpe ration calculation like this:

    cerebro.addanalyzer(btanalyzers.SharpeRatio, _name='mysharpe',
                            timeframe=bt.TimeFrame.Seconds, factor=252, compression=60)

    I'm a bit unclear about the factor and the compression parameters for the SharpeRatio analyzer and what they should be for my timeframe?

    Thanks ahead of time for any help!

Log in to reply