Skip to main content

QlikView App Dev

Discussion Board for collaboration related to QlikView App Development.

Skip the ticket, Chat with Qlik Support instead for instant assistance.
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Pair Buy and Sell data from trades


I want to create a document in QV to be able to analyse the trades that Investor has made.

What I have is the following:


46544268Pair 1Buy2.52E-05362.07790.009111.82E-0527/01/2018 3:26:00 PM
46419409Pair 1Sell0.0005120.001022.04E-0628/01/2018 9:22:00 AM
46378308Pair 2Buy2E-08398115.80.0079621.59E-0529/01/2018 11:44:00 PM
46242451Pair 2Sell7E-089050.3990.0006341.27E-0630/01/2018 10:50:00 AM
46238564Pair 1Sell6.93E-06800.0005541.11E-0630/01/2018 12:47:00 PM

What I need is to use this data to create report for each month for each pair:

What we have open and what we have closed (only buy or buy and sell).

The problem is that the buy and sell do not match the same amount, so there may be several buy records for one sell and one buy for multiple sell orders...

Also the time is different, so we have one day only buy next only sell, and some days buy and sell.

I am not sure if I have to aggregate the data in the load script, or afterwards in the sheets there is some SET analysis that can help me get what I need.

Also I will need to show how long each position was open before closing.

Any suggestions?

1 Reply
Not applicable

If possible one solution could be to end up with table with the following fields:





Buy AmountBuy PriceSell AmountSell PriceSell TimeFee
Time of Buy order(one per buy) Amount Total - fee divided by Amount Sum of all the sell orders in order to match the buy (if the buy is for 10 units and ther are 3 sells each for 4 units, it should use first two (8) + 2 from the 3rd) to get a total of 10 units Sum of Total- fee divided by Amount Time of last trade used Sum of fee for buy and sell