Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 934139
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T20:57:01+00:00 2026-05-15T20:57:01+00:00

I am trying to calculate sharpe ratio in java, but I am struggling to

  • 0

I am trying to calculate sharpe ratio in java, but I am struggling to find a “correct” dataset and result to test

Refering to http://www.hedgeco.net/blogs/2008/07/30/explaining-the-sharpe-ratio-again/

Investment Monthly Returns

Jan   Feb   Mar   Apr   May    June  Jul    Aug  Sep    Oct    Nov  Dec
1.64  5.85  9.22  3.51  -0.88  1.07  13.03  9.4  10.49  -5.08  n/a  n/a

Risk Free Rate 5%

However, I could not get what he got (2.56, instead I got 2.67 rounding error?)

Is this the right way (or commonly accepted way) to compute sharpe ratio?

My code (statistics computed using apache-commons-math)

    DescriptiveStatistics stats = new DescriptiveStatistics();
    for( double item : returns) {
        stats.addValue(item);
    }

    double mean = stats.getMean();

    double std = stats.getStandardDeviation();

    double sharpeRatio = (mean - (riskFreeReturn/12) ) / std * Math.sqrt(12);

    System.out.println("sharpeRatio="+ sharpeRatio);
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-15T20:57:02+00:00Added an answer on May 15, 2026 at 8:57 pm

    From the calculations the article links to, you have the right answer and the article displays the wrong results.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Trying to calculate sum of checked tr's. var totalqt=0; totalqt=totalqt + $(this).closest(tr).find(#qt).text(); It gets
Im trying to calculate the bitrate from a video, but Im not sure if
I'm trying to calculate the median of a set of values, but I don't
I am trying to calculate a SHA-1 Hash from a string, but when I
i am trying calculate the amount but having troble with jQuery .. can you
I am trying to calculate the difference between given two times and i find
Am trying to calculate the number of rows in a table depending on a
am trying to calculate mean and variance using 3X3 window over image(hXw) in opencv...here
I am trying to calculate number of users, cumulatively for the dellstore2 database. Looking
I'm trying to calculate the time it takes to receive all data from a

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.