Results 1 to 8 of 8
  1. #1
    XC80 is offline Novice
    Windows XP Access 2010 32bit
    Join Date
    Nov 2014
    Posts
    3

    Formula for calculating cumulative volume and averages

    Hi,

    I'm trying to create a database that will calculate an ongoing volume and average price for stocks that I am trading.

    For example,
    I have been buying stock ABC over the past 5 days and want to know what my current vol and avg price is.


    I want to create a form where I can enter the following fields each day:

    Ticker
    Traded Shares
    Traded Price

    Once I put in the Ticker, Traded Shares, and Traded Price, I'd like to see an output that shows my total volume and avg price for all the previous days I've traded the same symbol.

    I was able to do this in excel but its very ugly. I was hoping I could do this in access but am unable to figure out how to get this going.

    Thanks

  2. #2
    ranman256's Avatar
    ranman256 is offline VIP
    Windows Vista Access 2010 32bit
    Join Date
    Apr 2014
    Location
    Kentucky
    Posts
    9,524
    you would add the daily prices everyday to a table.

    then make a query on that table that Sums the volume, and Avg price.

  3. #3
    June7's Avatar
    June7 is online now VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,902
    Or build a report with Grouping & Sorting features and aggregate calcs in header/footer sections. Report allows display of detail records as well as summary data.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  4. #4
    XC80 is offline Novice
    Windows XP Access 2010 32bit
    Join Date
    Nov 2014
    Posts
    3
    Thanks... I have the table populated. How/where do I write this query?

    Also, I have a column that has my initial order... Say 100,000 shares of ABC.
    Once this order is filled and say I get a new order at a future date for 125,000 shares of ABC, how do I get Access to start over when finding the new vol and avg price?

  5. #5
    ranman256's Avatar
    ranman256 is offline VIP
    Windows Vista Access 2010 32bit
    Join Date
    Apr 2014
    Location
    Kentucky
    Posts
    9,524
    start new query
    add the table
    bring down the fields you want
    click the grouping (sum) icon
    change to SUM or AVG under your field.

    (also: google building queries in Access)

  6. #6
    June7's Avatar
    June7 is online now VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,902
    What do you mean by 'start over'?

    Apply date range filter criteria to the dataset if you want to limit calculation to a specific period.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  7. #7
    XC80 is offline Novice
    Windows XP Access 2010 32bit
    Join Date
    Nov 2014
    Posts
    3
    My first order could be to buy 500,000 shares of ABX.
    If this order takes me two days to complete and on
    DAY 1: I buy 250,000 shares at $14.00
    DAY 2: I buy 250,000 shares at $14.02
    This would complete my 500,000 shares order @ an average price of $14.01.

    At some point in the future I can get another order to buy 750,000 shares of ABX, and this could take me a few days to complete but I wouldn't want any of the new order to include the previous order of 500,000 that I've already completed.

  8. #8
    June7's Avatar
    June7 is online now VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,902
    That would be 3 records in the table.

    Apply filter criteria that excludes records you don't want in the calculation.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 1
    Last Post: 04-29-2014, 12:20 AM
  2. Replies: 9
    Last Post: 11-26-2013, 12:02 PM
  3. Calculating a new field using a formula
    By mccambe21 in forum Queries
    Replies: 1
    Last Post: 09-04-2013, 12:16 PM
  4. Need help in calculating cumulative
    By Abd-Radhi in forum Access
    Replies: 1
    Last Post: 03-28-2012, 04:40 PM
  5. Replies: 23
    Last Post: 06-30-2010, 02:05 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums