wu :: forums
« wu :: forums - data structures for stock history »

Welcome, Guest. Please Login or Register.
Dec 4th, 2024, 1:01am

RIDDLES SITE WRITE MATH! Home Home Help Help Search Search Members Members Login Login Register Register
   wu :: forums
   riddles
   cs
(Moderators: Icarus, towr, ThudnBlunder, william wu, Grimbal, SMQ, Eigenray)
   data structures for stock history
« Previous topic | Next topic »
Pages: 1  Reply Reply Notify of replies Notify of replies Send Topic Send Topic Print Print
   Author  Topic: data structures for stock history  (Read 3744 times)
inexorable
Full Member
***





   


Posts: 211
data structures for stock history  
« on: Aug 3rd, 2011, 11:58am »
Quote Quote Modify Modify

Suppose that you have access to a file which contains the closing price for 10,000 stock tickers on each day over a period of 10 years. Suppose also that you must create a component of a computer program which will be called thousands to hundreds of thousands of times per day on many different days to:
(A) Retrieve the closing price associated with a given stock ticker for a given date.
(B) Iterate through all stock tickers that have price information available on a given date.  
(C) Find the last date before a given date for which a given stock ticker had closing price information available.  
What data structures would you use to organize this stock information to best satisfy (A), (B) and (C)?
 
 
IP Logged
towr
wu::riddles Moderator
Uberpuzzler
*****



Some people are average, some are just mean.

   


Gender: male
Posts: 13730
Re: data structures for stock history  
« Reply #1 on: Aug 3rd, 2011, 1:14pm »
Quote Quote Modify Modify

You could use b-trees to build indexes on those properties. Or just throw it in a relational database.
IP Logged

Wikipedia, Google, Mathworld, Integer sequence DB
inexorable
Full Member
***





   


Posts: 211
Re: data structures for stock history  
« Reply #2 on: Aug 4th, 2011, 11:59am »
Quote Quote Modify Modify

I think solution expected was using inmemory data structures(like bigtable, memcached etc), assuming you have clusters of machines available at your disposal.
IP Logged
agent_purge
Newbie
*





   


Posts: 4
Re: data structures for stock history  
« Reply #3 on: Aug 6th, 2011, 10:27am »
Quote Quote Modify Modify

For A and B, keep an index on dates. At each leaf, keep another index (B tree) on stocks for that date.
 
For C, another data structure is needed. You can keep information about gaps in dates for each stock indexed by stock. This data structure should not take much space as date entries are compressed into intervals.
IP Logged
Neetasha
Newbie
*





   


Posts: 2
data structures for stock history  
« Reply #4 on: Sep 15th, 2011, 9:21pm »
Quote Quote Modify Modify

Data structures are generally based on the ability of a computer to fetch and store data at any place in its memory, specified by an address,a bit string that can be itself stored in memory and manipulated by the program.You could use b-trees to build indexes on those properties.
IP Logged
Pages: 1  Reply Reply Notify of replies Notify of replies Send Topic Send Topic Print Print

« Previous topic | Next topic »

Powered by YaBB 1 Gold - SP 1.4!
Forum software copyright © 2000-2004 Yet another Bulletin Board