I was considering storing historical quotes in a database such as MySQL and interfacing with it for backtesting purposes. Has anyone explored this idea before?
Some concerns I have with this:
- The speed that MySQL could retrieve the data. This would obviously be a local database, so bandwidth issues are not a problem. However, if the tables stored intraday data, and you wanted to retrieve EOD, it could go through and compile the dataset from the intraday quotes, or possibly keep a separate table that updated with EOD nightly. How are the execution speeds in this case? I know MySQL is fairly efficient (and much faster than a simple file based database), but would storing this much data get out of hand?
- The database structure required to support a large number of quotes. You could potentially have a huge number of tables in your database (assuming you used one table per stock, etc. that you're tracking). Obviously a day's worth of intraday quotes will take up a good deal of space, especially taking into consideration the number of things you could possibly record (there are quite a few options quotes you could store per each equity).
- I plan to update the database with new quotes in realtime. Would this cause undue stress on the system by constantly writing new data to hundreds of tables at once? Also, while writing data, MySQL locks the table from being read from other connections, could this pose a problem?
- The size of the data accumulated shouldn't be a problem, since disk space is cheap. The only concern I would have with this is the amount of time it would take to search through 2gb+ of data.
Has anyone attempted a setup similar to this? If so, was MySQL your DB of choice? What's the most efficient or logical DB structure? Is there a much simpler/easier approach I am missing completely? Any thoughts/comments are much appreciated. Thanks!
-- Paccc
Some concerns I have with this:
- The speed that MySQL could retrieve the data. This would obviously be a local database, so bandwidth issues are not a problem. However, if the tables stored intraday data, and you wanted to retrieve EOD, it could go through and compile the dataset from the intraday quotes, or possibly keep a separate table that updated with EOD nightly. How are the execution speeds in this case? I know MySQL is fairly efficient (and much faster than a simple file based database), but would storing this much data get out of hand?
- The database structure required to support a large number of quotes. You could potentially have a huge number of tables in your database (assuming you used one table per stock, etc. that you're tracking). Obviously a day's worth of intraday quotes will take up a good deal of space, especially taking into consideration the number of things you could possibly record (there are quite a few options quotes you could store per each equity).
- I plan to update the database with new quotes in realtime. Would this cause undue stress on the system by constantly writing new data to hundreds of tables at once? Also, while writing data, MySQL locks the table from being read from other connections, could this pose a problem?
- The size of the data accumulated shouldn't be a problem, since disk space is cheap. The only concern I would have with this is the amount of time it would take to search through 2gb+ of data.
Has anyone attempted a setup similar to this? If so, was MySQL your DB of choice? What's the most efficient or logical DB structure? Is there a much simpler/easier approach I am missing completely? Any thoughts/comments are much appreciated. Thanks!
-- Paccc
