3
$\begingroup$

I'm looking for a library to do some time series analysis in Java but I can't find anything suitable.

I've found plenty of libraries such as Math3 of JSAT but there's much I can you for my problem.

As an example, I'd like to compute standard deviation over time, moving average etc for a specific time series.

$\endgroup$
  • 2
    $\begingroup$ There is something weird in your second sentence... could you please correct it? $\endgroup$ – SRKX Dec 9 '14 at 8:34
5
$\begingroup$

I work with time series intensively, and I am experienced in Java and scripting languages such as MATLAB and R. I strongly suggest that you should cook up your own implementations in Java, and stop hunting for and relying on any off-the-shelf implementations. They are not reliable. One should be able to write std, corr, cov, ma, etc., easily by hand. Coding them independently can really enhance your comprehension of the underlying problem.

In short, Java is not a good tool for analysis. You may want to perform prototyping and research in MATLAB, R and Python, and implement the required features in Java after the preliminary research.

$\endgroup$
  • $\begingroup$ I think commons math is pretty reliable. Agree most other simple things are easier to code than to figure out something like TA-Lib for instance. apache commons math link $\endgroup$ – brian Sep 1 '14 at 4:14
  • $\begingroup$ Hi Brian, agree. I personally also use commons math as a utility library. However, I often write up a wrapper around these third-party implementations, so I can have a full control over the interface. $\endgroup$ – Simon Sep 1 '14 at 13:17
  • $\begingroup$ I agree that there is no obvious leader in the market but I don't think there shouldn't be one (i.e. it wouldn't be a bad thing if we could rely on something decent, like pandas for python). I'm actually amazed that nobody has seized this market already, although there are some candidates. For easy things such as standard deviation then re-implementing is fine, but for more complicated things it might be actually very helpful to use more efficient/optimized functions. $\endgroup$ – SRKX Dec 9 '14 at 8:31
  • 3
    $\begingroup$ I like your answer except for the recommendation that these things should be built from scratch by each user. While you're right that this is a highly valuable learning experience, it also is unproductive and very error-prone. Everything else you said, especially the advice on adding another tool, is spot-on. $\endgroup$ – user5352 Feb 25 '15 at 22:00
  • $\begingroup$ yes but what data structure would you use in java to hold financial time series? $\endgroup$ – Permian Jun 22 '18 at 12:32
1
$\begingroup$

You can try TimEL, a Java library I've been writing to evaluate expressions for time-series data.

$\endgroup$
1
$\begingroup$

Here is library for time series modelling. There are exponential smoothing models (simple, double, triple) with maximum likelihood estimation and another time series utility classes:

$\endgroup$
0
$\begingroup$

You might find TA-Lib useful:

TA-Lib is widely used by trading software developers requiring to perform technical analysis of financial market data.

    Includes 200 indicators such as ADX, MACD, RSI, Stochastic, Bollinger Bands etc... (more info)
    Candlestick pattern recognition
    Open-source API for C/C++, Java, Perl, Python and 100% Managed .NET

It is pretty useful and versatile: you can grow with it beyond just standard deviation and moving averages, and also to other programming languages, as mentioned above.

Good luck!

$\endgroup$
0
$\begingroup$

JFreeeChart provides a TimeSeries data structures with some basic functionality but not a lot of analytics. I have started writing my own and I may open source it if there is sufficient interest. Moving averages, deviations, correlations, returns and most of the easy stuff are already implemented, but I think it needs a few more interesting features before I can consider it truly useful.

$\endgroup$
0
$\begingroup$

Tablesaw is similar to Python's Pandas: https://github.com/jtablesaw/tablesaw

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.