Running Sum - Tracking

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance



Hi,

I've got trades that are sorted by ID in a query. The query keeps a running
sum of the cummulative quantity bought and sold. When this cummulative total
gets to zero, it means the position was closed at that point. What I want to
do is add the IDs of the trades that made it go to Closed to a new table...

Thus if I have:

ID TradeDate Ticker B/S Qty Cummulative
4306 01/08/06 XPU6 B 4 4
5328 10/08/06 XPU6 S -4 0
5488 19/08/06 XPU6 B 6 6

Basically, in the above, I've gone from Long 4 to Closed out with Trade IDs
4306 and 5328. What I want to do is somehow track those IDs as having been
closed out, I could then append these numbers to a 'closed out' table which
can then be used to filter these off future open position queries.

Does anyone have any ideas/suggestions as to how I could do this?

Any help/thoughts appreciated.

--
Message posted via AccessMonster.com
http://www.accessmonster.com/Uwe/Forums.aspx/access-modules/200609/1

.



Relevant Pages

  • Re: Date Comparison
    ... query - any type of query. ... existing records for completed trades (i.e. there is BOTH a start and ... There will always be some live trades. ...
    (microsoft.public.access.queries)
  • Unique Index resulting in full table scan
    ... Trades: A wide table with about 1.8 million rows. ... CurveRef: Used to link a trade to curves. ... Has 3 columns: TradeId, ... When I write a query like ...
    (comp.databases.sybase)
  • Indexing properties that belong to types
    ... Our database has a table of types. ... to query my trades where the sub_trade type has a particular id. ... explain plan shows a full table scan, so unsurpisingly, the SQL is very ... Is there any way I can index this query? ...
    (comp.databases.oracle.misc)
  • RE: Subquery?
    ... from (trades as A inner join trades as B on B.tName = A.tName) inner join ... tDate, tName, tTrans, tAmt, tPrc ... I am trying to write a query for all tDates where I can get all of the data ... for any of the tNames where tTrans has both Buys and Sells. ...
    (microsoft.public.access.queries)