Hi, I'm new to Stata. Probably this question has already been answered, but I couldn't locate it.
I have a time series, 390 prices each day (1 min) of SPY (ETF). Dataset has the following columns:
1. date (same for each 390 minutes)
2. time (9:30 to 15:59) - 390 each date
3. spy (the closing minute price)
4. Also t, which is just observation number (gen t=_n)
I need to compute simple returns (d.spy/l.spy). I need to do it within each group (date), so that first minute return of the each day would be missing, because we can't compute it based on yesterday's closing price. I tried bysort date, but I'm doing something wrong, cos' it gives me the error 'not sorted':
. by date: generate spy_r = d.spy/l.spy
not sorted
. by date time: generate spy_r = d.spy/l.spy
not sorted
Thank you!
Yuri.
Related Posts with How to compute intraday stock returns
Error 703Dear All, as per errors list shown here, error 703 corresponds to the situation "703. op. sys. refu…
Urgent Help NeededDear Forum, I am currently working on my Bachelor's Thesis, and my data results are not really maki…
Quantile Regression : LogicHi, I am working on a dataset where I am required to run quantile regressions. I want to understand …
Tagging different values of encrypted variableI am dealing with a dataset with monthly information on the different hospitals each health professi…
Help on Interpreting Negative Value Index dependent variableI am doing a linear regression with an index (values from -400 to 400) as my continuous dependent va…
Subscribe to:
Post Comments (Atom)
0 Response to How to compute intraday stock returns
Post a Comment