ojAlgo v47.1.1, ojAlgo-finance v2.1 & Financial Time Series Data

ojAlgo v47.1.1

  • Primarily this release has improvements to the optimisation code:
    • Extensive work on tuning the solvers (primarily the ConvexSolver)
    • Major refactoring of test cases (mainly for LinearSolver and IntegerSolver).
    • The presolve functionality has been improved, affecting all solvers.
    • MPS file parser improved to handle more cases
    • A couple of bugs fixed…
  • Refactoring/restructuring of the org.ojalgo.function (sub)packages. You will most likely need to update some import statements.
  • Fixed a couple of minor bugs related to eigenvalue decompositions.
  • New functionality that enable data “transformations” via functional interfaces.

Check the ojAlgo change-log for a more complete list of what’s new!

ojAlgo-finance v2.1.0

  • Adjustments for ojAlgo v47.1
  • Improvements to code that fetches historical data from Yahoo, IEX Trading or Alpha Vantage. It is now very easy to fetch data from different sources and have it automatically coordinated – same start and end dates, same frequency – so that computing things like covariance matrices becomes straight forward.

Example Code – Historical Financial Data

Console Output

class FinancialData

Range for MSFT is from 2018-11-30 to 2019-04-30
Range for AAPL is from 2014-04-30 to 2019-04-30
Range for IBM is from 1989-04-30 to 2019-04-30
Range for ORCL is from 1989-04-30 to 2019-04-30

Common range is from 2018-11-30 to 2019-04-30

Sample statistics (logarithmic differences on monthly data)
	MSFT:  Sample set Size=5, Mean=0.016963754617290227, Var=0.003898700343476474, StdDev=0.0624395735369523, Min=-0.08779088268545898, Max=0.0745334981716903
	IBM: Sample set Size=5, Mean=0.030422355449287154, Var=0.008393992685262789, StdDev=0.09161873544893964, Min=-0.08915711966527695, Max=0.16766968378644798
Correlation: 0.6181368931750267

  Apple   Monthly proc 	         Annual proc (6 months from now)
Expected: 1.1810740629349612 	 1.1810740629349612
StdDev:   0.24837454053493682 	 0.24837454053493682
Var:      0.06168991238594097 	 0.06168991238594097

 	  Apple 		 Oracle (1 year from now)
Current:  1.0 			 1.0
Expected: 1.3949359421376966 	 1.337730471536396
StdDev:   0.4194193574444725 	 0.31584482401600694
Var:      0.17591259739913417 	 0.09975795285770238

Simulate future Oracle: 1000 scenarios, take 12 incremental steps of size 'yearsPerMonth' (1/12)
Simulated sample set:  Sample set Size=1000, Mean=1.3368173052144632, Var=0.09925845188383686, StdDev=0.3150530937537939, Min=0.504248921172877, Max=3.6405224252854183
Simulated scenario:  { 1.0, 0.987953283856134, 0.9803778218751452, 1.0275292151500863, 0.9806568759600218, 1.0407422677990135, 1.2023135797767084, 1.2971232117765163, 1.308873281212413, 1.3496369871350853, 1.3994778062888376, 1.3165433881275048, 1.3702583762345444 }

This Post Has 2 Comments

  1. serhioms

    Regarding Example Code – Historical Financial Data. I have tried to run it for yahoo finance and got java error below

    sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target

    Have investigated but did not find any relevant solution or SSL certificate for yahoo finance.

    Could you advise please?

Leave a Reply