M
manuhack
I've written a program in Python to get some data from a website. The
data structure is as follows. Every day there are new data. For each
day, there are many stocks. For each stock, there are two columns of
numbers namely price and volume. The numbers of data point
(price-volume pair) is not known nor equal for each stock.
Now the problem is how I should save the data in text (if you think I
should use database like MySQL, let me know) so that I can use C++
(with STL) to get the data for analysis. And when I get the data, I
usually get them stock by stock.
At the moment, I save the data like this: a folder for each stock is
made with the name being their stock code. Then two subfolders called
price and volume are made. Then for each subfolder, a text file named
by the date contains the price or volume. (For some reasons I didn't
merge these two in a file with a tab to separate the data)
But I still think there is a better way to do it. The crucial thing is
that for each day, I can put the data for all stock in every single day
in a format like this
Stock Name (may contain space) or Stock Code \n
Price \t Volume \n
....
Price \t Volume \n
Stock Name (may contain space) or Stock Code \n
Price \t Volume \n
....
Price \t Volume \n
....
Stock Name (may contain space) or Stock Code \n
Price \t Volume \n
....
Price \t Volume \n
However, this way I don't know how to extract the data for each stock
using C++, particularly using ifstream. Any suggestion is welcome!
Thanks and merry Xmas!
data structure is as follows. Every day there are new data. For each
day, there are many stocks. For each stock, there are two columns of
numbers namely price and volume. The numbers of data point
(price-volume pair) is not known nor equal for each stock.
Now the problem is how I should save the data in text (if you think I
should use database like MySQL, let me know) so that I can use C++
(with STL) to get the data for analysis. And when I get the data, I
usually get them stock by stock.
At the moment, I save the data like this: a folder for each stock is
made with the name being their stock code. Then two subfolders called
price and volume are made. Then for each subfolder, a text file named
by the date contains the price or volume. (For some reasons I didn't
merge these two in a file with a tab to separate the data)
But I still think there is a better way to do it. The crucial thing is
that for each day, I can put the data for all stock in every single day
in a format like this
Stock Name (may contain space) or Stock Code \n
Price \t Volume \n
....
Price \t Volume \n
Stock Name (may contain space) or Stock Code \n
Price \t Volume \n
....
Price \t Volume \n
....
Stock Name (may contain space) or Stock Code \n
Price \t Volume \n
....
Price \t Volume \n
However, this way I don't know how to extract the data for each stock
using C++, particularly using ifstream. Any suggestion is welcome!
Thanks and merry Xmas!