Take the 2-minute tour ×
Quantitative Finance Stack Exchange is a question and answer site for finance professionals and academics. It's 100% free, no registration required.

thanks a lot for your discussions on the original post.

following your suggestions, let me re-phrase a bit :

kdb is known for its efficiency, and such efficiency comes at a terrible price. However, with computational power so cheap this days, there must be a sweet spot where we can achieve a comparable efficiency of data manipulation, at a more reasonable cost.

For instance, if a KDB license cost a small shop $200K per year (I dont know how much it actually cost, do you know?), maybe there is a substitute solution: e.g., we pay 50K to build a decent cluster, storing all data onto a network file system, and parallelize all the data queries. This solution might not be as fast or as elegant as KDB, but it would be much more affordable and most important -- you take full control of it.

what do you think? is there anything like this?

share|improve this question
1  
I'm not sure what you mean. The main trick used by KDB is to store the data in columns instead of rows. This has the advantage that if one column is selected all the data can be read in one long read. This can also be done in Python. –  Bob Jansen Apr 1 '12 at 10:52
1  
1) Storing each tick as a separate record/row is neither sensible nor feasible (as you already mentioned). The most common approach is to split tick data by day and store days of data as plain arrays, either in files or in database LOBs. Such approach makes the amount of data perfectly manageable. 2) possible duplicate of What is the best data structure/implementation for representing a time series? –  wburzyns Apr 1 '12 at 18:50
    
The minimal 2-core setup of kdb+ is actually pretty reasonable: $25K per year including maintenance. –  user2303 Apr 19 '13 at 1:53
add comment

6 Answers

At discretelogics we just released a file format to store time series in flat files called "TeaFiles". In addition to raw data they can store the binary item layout and a description of the contents.

C#, C++, Python APIs are available open source, licensed under the GPL, see discretelogics.com/teafiles/

Using memory mapping, read performance reaches that of in-memory array processing for sequential usage of a file, as is the case for back testing.

The C# API at Codeplex holds micro benchmarks. Summing up a file with a single 8 byte double reaches 500 million operations per second on an older test machine. Using a Tick Item with int64 / double / int for Time/Price/Volume is 100 million operations.

Disclosure: self promotion + interest in discussing time series persistence

share|improve this answer
1  
+1 I like the idea. How do you handle cross-sectional time series? Will we be able to embed you visualization API into a custom app? –  SRKX Apr 8 '12 at 9:07
    
thank you! by cross-sectional time series you mean the analysis of several series like computing an index or stat arb, right? about embedding - our code base would allow embed-able components. we thought already about offering that. i take your question as valuable input for our product road map. at the moment our visualization tools TeaHouse/TeaShell are windows / XAML. our persistence layer is cross OS/app and we plan visualization on html5 architecture for the future. our decisions will be customer driven, so your vote counts. we are thankful for any feedback and inside into your needs. –  thomas - discretelogics Apr 8 '12 at 11:58
    
are there any benchmarks say this vs hdfs or other formats? –  pyCthon Jan 22 '13 at 22:25
1  
Benchmarks about raw time series data access using TeaFiles are included in the C#/C++ sources, see teafiles.codeplex.com/wikipage?title=Benchmarks. A benchmark against HDFS would first need to specify what to measure. TeaFiles perform 1:1 to raw data structs in files, as they are nothing else + allow memory mapping. This is hardly to beat at first. Read ahead, prefetching allow going beyond in some situations. HDFS would be a layer above raw file storage and we have it on our roadmap to take simple file persistence to the next level. For management not for performance reasons tough. –  thomas - discretelogics Jan 23 '13 at 0:06
1  
A little late to the party here but the link in the answer is now dead. –  chollida Jun 23 at 17:22
show 1 more comment

As of April 2014, the 32-bit version of kdb+ ist now free (as in beer). KX systems have removed:

  • the 4h timeout
  • the requirement to reinstall every 3 months
  • the restrictive non-commercial license

The only limitation vs. the 64-bit version is that you can only address up to 4GB of memory per process. But work around this by writing a multiprocessing system (and you'll get to use your CPUs in parallel too).

share|improve this answer
    
I was not aware of that, thanks a lot for this update, +1 –  Matt Wolf May 20 at 7:39
add comment

KDB is useful for two reasons: - Storage of data; and easy access to the data (i.e. querying ticks..etc) - Rich query language that supports many Quant functions

however; what KDB does not do well; is the quant query language.

I have evaluated KDB, Matlab, and R. So far R is the winner.

I have not found any fast solution for storing and retrieving data; compared to using flat binary files; which are divided by month for ease of acces. My app can read 1 million of tick data in 3 seconds; and do backtesting accordingly.

for retail traders; i suggest you use flat files (binary instead of text; for quick read/write). MT4 data structure is a good example to follow.

It is cheap, free, and fast!!!

share|improve this answer
9  
How do you compare a database system and two scientific-oriented programming languages? –  SRKX Apr 2 '12 at 15:56
    
can you rephrase your question? –  alpha Apr 3 '12 at 0:05
2  
KDB is a database. Matlab and R are programming languages/environments. Q is KDB's programming language and would be somewhat comparable strictly as a language to J. –  Steve Apr 8 '12 at 22:20
    
Unless you're intending to leverage Q though, there is no point to investing in KDB. As a pure tick warehouse it is inferior to other column stores. –  Chuu Jul 24 '13 at 20:39
1  
@Chuu, do you have any data to back up your claim? –  Datageek Apr 7 at 11:07
show 3 more comments

You could look into Pandas, a Python library that integrates with PyTables. It was created by someone at AQR and has some similar features as kdb.

share|improve this answer
add comment

Have a look at Kona which is a FOSS project trying to be compatible. Also Tom Szczesny has done some work on its predecessors namely A. I hope this helps.

Also if you are not looking for a perfect substitute you can have a look at other Time Series Databases like InfluexDB, Java Chronicles, OpenTSDB, KairosDB which are all Open Source. There are commercial ones as well out of which OneTick is targeted at Tick Data management.

share|improve this answer
add comment

I don't like KDB+/q. For KDB+ experts, I am not picking a fight. The following is just my own understanding on KDB+ and TimeSeries Database. You're warmly welcome to correct me if anything wrong in your eyes :).

First of all, during my near one year's KDB+/q development experience, I never ever find a paper based benchmark result indicating KDB+/q significantly out performs other storage system in time. By storage system, I don't limit the scope to disk based RDBMS. So I don't know why everybody in quant finance is talking about KDB+ and impressed by its efficiency without data backing their points.

Second, I once talked with an Oracle Certificated DBA about KDB+. From my description, the first word he came up is an in-memory cache not even a full fledge database. Maybe he is right to some extent, isn't he?

Next is the so-called TimeSeries. More than one manager advocating KDB+ from different positions and companies talked to me KDB+ is a TimeSeries Database. However, I don't think TimeSeries is a feature of KDB+, whose real feature is the column oriented storage engine. That is to say with a column oriented storage engine, that KDB+ is friendly to store TimeSeries data. While in these days, column oriented storage engine does not belong to KDB+ exclusive. For traditional RDBMS, like MySQL, you can also find corresponding column storage engines in the open source communities.

The last and the most important, I want to talk about the developer friendliness. KDB+ is distributed along with a DSL, which is q. q is very developer unfriendly. When an error encountered, it just raise the error type, without any line information for you to anchor, which increase the difficulty to bug fixing and code maintenance.

Alternatives to KDB+ I can come up with:

  1. to give the system column oriented storage, a traditional K-V store works, even a column storage backed RDBMS;
  2. for the in-memory feature, a lot of open source implementation of in-memory cache, like redis, memcached, etc.

The key feature for the alternative, I think, is that the API is written in standard C/C++. You could have a lot of utilities to ease your development.

share|improve this answer
1  
While not definitive as far as speed goes, it certainly helps that the entire executable is roughly 400kb, depending on the version, meaning it can live entirely in CPU cache. –  afekz Jun 23 at 11:04
    
@afekz Thank you for your comments. But if not for speed, why do people bothering the cache? :p Yes, you're right this may be one of the pros for KDB. –  Summer_More_More_Tea Jun 23 at 12:12
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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