Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Sharpe Ratio + Risk Free Rate

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Sharpe Ratio + Risk Free Rate

    Hi guys-

    I see where I can programmatically find the SharpeRatio() - based on a risk free rate of 0% - as well as GetSharpeRatio(double x) where x is the provided ratio.

    Any way to set this within a strategy, such as under Initialize(), so I can set whatever risk free rate I want?

    #2
    cgeorgan, you could unfortunately not set this from Initialize(), however with the GetSharpeRatio() it would be set at the times you request the Performance class statistics for your strategy.

    Comment


      #3
      Hi cgeorgam,

      You could always set iit as a private static member.

      private static double riskFreeRate = 0.0;

      If you need to change it then a static class will do the trick.
      This of course assumes that you are not worrying about thread safety.

      You can then modify it from within Initialize() if you wish.

      P.S. If you are concerned about it residing in the global namespace, or in global memory, put it inside your own namespace.

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by Geovanny Suaza, 02-11-2026, 06:32 PM
      0 responses
      637 views
      0 likes
      Last Post Geovanny Suaza  
      Started by Geovanny Suaza, 02-11-2026, 05:51 PM
      0 responses
      366 views
      1 like
      Last Post Geovanny Suaza  
      Started by Mindset, 02-09-2026, 11:44 AM
      0 responses
      107 views
      0 likes
      Last Post Mindset
      by Mindset
       
      Started by Geovanny Suaza, 02-02-2026, 12:30 PM
      0 responses
      569 views
      1 like
      Last Post Geovanny Suaza  
      Started by RFrosty, 01-28-2026, 06:49 PM
      0 responses
      571 views
      1 like
      Last Post RFrosty
      by RFrosty
       
      Working...
      X