Calculate stock's return bet. 2 dates

G

Guest

Hi, I am putting together a database that will store the stocks in an index
on a daily basis. I have a table that holds all of the stocks each day and
some data pertinent to that day ie price/ volume etc... (with the respective
date and stock id that are pkeys). I am trying to build a query that when I
any choose any 2 dates or a range of dates with differing frequencies (daily,
weekly, monthly, etc) I can calculate each stocks return and then avg, max,
min, etc. for each date and for whatever group I might select.

The calculation between the dates is what's throwing me off. Any assistance
would be greatly appreciated. Thank you very much.
 
E

Edward G

Looks to me like 3 queries.
First query contains Ticker, ClosingPrice, Date
In Date criteria enter [Enter start date]
Second query is the same except criteria is [Enter end date]
Third query is based on other two queries. Join queries by Ticker.
Use Ticker and ClosingPrice fields from first query and just ClosingPrice
from second query.
Gain is calculated field like.....Gain: [ClosingPrice2]-[ClosingPrice]
(I recommend in the second query renaming the ClosingPrice field so you
don't have to fuss with table names
in the third query to differentiate the 2 ClosingPrices).
As constructed you would have to make certain not to enter a Saturday or
Sunday for start and end dates because these will be null. Perhaps someone
else will offer the best method for avoiding this.

Ed G
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top