I can see the logic in what both you and Xitian are saying but the reason I thought about separating them was so I could end up with a clear distinction when I look at a transaction as to what were the opening trades and what were the closing trades. I have attached two screen shots showing two different transactions in Betfair, one is opened by a Buy and closed by a Sell and the other is opened by a Sell and closed with a Buy. (BTW I didn't create the form, someone else did it for me on an Access help forum but they didn't give any explanation so I am still getting my head around what they did and if it is what I want)Ethanol wrote:I'd definitely consider amalgamating the OpeningTrades and ClosingTrades tables into a new Trades table. Both tables perform the same function.
If all the trades were all in the one TradesTable I don't see how I could differentiate between what trade opened a transaction and what closed it (perhaps the date?). The end result would be 0 shares held in both transactions but it wouldn't be clear if I Bought first and then Sold or vice versa. Or am I missing something?
Ethanol wrote:I'd also personally remove the BuyOrSell field, as it's redundant. To record this information, you could instead use a positive or negative value in the Stake field (which I presume is the quantity of shares purchased, so I'd probably name it Quantity). This makes general queries more natural; e.g. if you buy 50 shares, then sell 50 shares, then you own 0 shares. No "IF" queries on the BuyOrSell field, just a quick "SUM".
I agree with these two interlinked points. I had thought about your second point previously, I accidentally said a trade was closed when in fact it wasn't when messing about with the database. Your idea about entering a Sell of shares as a Negative value and a Buy as a Positive value and then summing the position would avoid this as you say.Ethanol wrote:Be careful with the TransactionClosed field from the IndividualTransaction (Transactions) table. If my thoughts are correct, then this should only ever be flagged when the sum of Stake (or Quantity) from the new Trades table is zero. Presently, you could flag a trade as closed which still has an open position. There are checks that can be put in place to prevent this, but it all depends on how fastidious you wish to be!
So I will do away with the BuyOrSell Field and replace it as you suggest with a negative or positive value in the newly named Quantity Field, replacing the Stake Field.
One thing I would like to be able to do though is still include the word Buy or Sell when showing the trades as I find this helps my brain when looking at the transactions (though this isn't essential and something I can add later when I have the bare bones of the Database sorted).
I have now removed the IndividualTransaction Table but Kept the TransactionsInACompany as I need to be able to link the trades to each transaction eg. When doing a long term transaction in a company I want to keep this separate to any short term transactions I may do in the same company whilst the long term transaction is still open. So I think it correct to keep it. I have attached a new Relationship Table screen grab (the other changes discussed in this post have not been made yet though).Ethanol wrote:The TransactionsInACompany seems redundant, as it holds the same level of data as IndividualTransaction. I'd be amalgamating these into a new Transactions table.
MassivelyEthanol wrote:I hope this info helps.
