search for: next_pric

Displaying 1 result from an estimated 1 matches for "next_pric".

Did you mean: next_price
2006 Jan 03
2
For loop gets exponentially slower as dataset gets larger...
...ee vectors are date_, id, and price. The data is ordered (sorted) by code and date_. (The matrix contains daily prices for several thousand stocks, and has ~2 million “rows”. If a stock did not trade on a particular date, its price is set to “NA”) I wish to add a fourth vector that is “next_price”. (“Next price” is the current price as long as the current price is not “NA”. If the current price is NA, the “next_price” is the next price that the security with this same ID trades. If the stock does not trade again, “next_price” is set to NA.) I wrote the following loop to calculate...