开发者

What is a good relational database design for stock market data?

开发者 https://www.devze.com 2023-03-07 01:52 出处:网络
Suppose there are two types of messages, QUOTE and TRADE.Both have different fields.For example TRADE has only a single price. QUOTE has both a bid and ask price.I want process messages in time or开发

Suppose there are two types of messages, QUOTE and TRADE. Both have different fields. For example TRADE has only a single price. QUOTE has both a bid and ask price. I want process messages in time or开发者_运维知识库der to do something like the following:

if (QUOTE) {
...
}
if (TRADE) {
...
}

My problem is the two messages are in different formats so I can't get them into the same database table. If I can't get them into the same database table how do I process sequentially? Any ideas for a suitable design?


The answer depends entirely on what you're doing and on where your app plugs into the data streams.

At one extreme, you might merely be answering customer quotes that you're pulling from an API, and basically implementing a cache. In this case two tables are fine.

At the other extreme, you might be monitoring real-time quotes for a high frequency trading platform, in which case the throughput will probably rule out using a database at all (things built around lisp, such as allegrograph, might be more appropriate), except to periodically collect aggregate statistics.


The short answer is, 'not really' For stock market and other time series data a key value store like Berkley DB or Mongo is pretty good. Also, a data format like NetCDF (http://en.wikipedia.org/wiki/NetCDF) will likely serve you better in the long run. It also depends on what kind of access you want and how much time you want to store.

You didn't indicate what you were doing with the data, which should inform your choices of storage more than anything. For example, a high-speed trading application will have different storage tradeoffs than a historical batch processing system (where Hadoop + NetCDF would be great). YMMV


Kdb+/q

Is a very good option for tick data. Used by major banks.

here is the info about that.

You can install a trail version and play with it.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号