系统交易应用程序-在本地数据库中缓存历史数据?
大多数交易应用程序从商业提供商(例如 IQFeed 或支持交易 API 的经纪公司)接收数据馈送。将其存储在本地数据库中是否有优点?日内数据馈送的规模非常巨大,数据库将随着 50 只股票的 1 分钟数据而呈指数级增长,更不用说逐笔数据了。我怀疑这对于数据库备份来说将是一场噩梦,并且可能会影响性能。
如果您在 DVD 上或在线获取文本文件中的历史数据,那么将其存储在数据库中是唯一合理的选择,但是如果您通过 API 获取它仍然是一个好主意吗?
Most trading applications receive datafeed from commerical providers such as IQFeed or brokerages that support trading API. Is there merit in storing it in the local database? Intraday datafeed is just massive in size, and the database would grow exponentially with 1 minute data for just 50 stocks, never mind tick-by-tick data. I suspect this would be a nightmare for database backup and may impact performance.
If you get historical data in text files on DVD or online, then storing it in the database is the only logical choice, but would it be still a good idea if you get it through API?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
这实际上与存储空间有关。您绝对可以通过 API 来完成此操作,但请确保您不要使用为您执行自动交易的同一应用程序来完成此操作。
正如您所说,逐笔报价数据几乎是毫无疑问的,对于 1 分钟的数据来说,这意味着大约 400 根柱线/天,以及 50 个品种的 20000 根柱线。
计算空间可以据此计算,如果存储的是OLHC,可以用四个Int类型的值来实现。
正如另一个答案指出的那样,对于越来越多的符号,性能可能是一个问题,但对于 1 分钟柱上的 50 个符号来说,性能不应该是问题。
Its all about storage space really. You can definitely do it through API, but make sure you don't do it using the same application that is doing the automated trading for you.
As you said Tick Data is pretty much out of question, for a 1 minute data that would mean approximately 400 bars/day and 20000 bars for 50 symbols.
The calculation space can be calculated based on that, if you are storing OLHC it can be achieved with four values of type Int.
As the other answer pointed out, performance may be an issue with more and more symbols but shouldn't be a problem with 50 symbols on 1 minute bars.
这是一个性能问题。如果 API 足够快,那么就使用它。如果不是并且缓存会有所帮助,则缓存它。只有您的应用程序和使用模式才能确定这些陈述的真实性和必要性。
This is a performance question. If the API is fast enough, then use that. If it's not and caching will help, then cache it. Only your application and your usage patterns can determine how much truth and necessity apply to these statements.