I have different trades that I want to group by Entry date and Symbol.
This is the Origin Data: (these are all values I get from the User)
Date Time Symbol Ordertype Price Shares (Note for you)
01/01/20 09:30:00 ABC B $5.00 500 (Day Trade)
01/01/20 10:30:00 ABC S $7.00 500 (Day Trade)
02/01/20 15:00:00 XYZ B $10.00 250 (Multi Day Trade)
04/01/20 10:00:00 XYZ S $20.00 250 (Multi Day Trade)
...
This is the Goal: (Entry Date = first order day)
EntryDate Symbol Profit TotalShares Type
01/01/20 ABC 1000.00 1000 Day Trade
02/01/20 XYZ 2500.00 500 Multi Day Trade
As I also have MULTI-DAY Trades (where the order date is different) I can not group by "Date";
I thought about adding a calculated column like "remaining Position" or something in this direction ...
As I am relatively new to advanced SQL I hope someone can share his thoughts on this ...
Also do I only have orderdate in the origin table but the goal is to find the date of the first order of the trade and display it as "EntryDate" – Nov 17 '20 at 12:02