Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

How to link pair of rows to one another

Hi,

I got a dataset with hava "long" and "short" fields (in red). I need to make them "paird". look at the colored fields and you'll understend how they should be paird together.

I need to add a new field, lets say "PairRecordId" that will hold for each record its pair record.

for example, see the colored records. each pair has the same color. I would like that record with ID 61430 will have in its PairRecordId field the value 61428,

that record ID 61436 will have in its PairRecordId field the value 61433,

and hat record ID 61440 will have in its PairRecordId field the value 61431.

How can i achieve it?

Thanks, Guy

AssetId

MaturityDateTime

StrikePrice

ID

Current Rate

PosType

LongQty

ShortQty

Pos_Result

SettlPrice

long

short

PNL

Symbol

RecordDate

586

12/08/2015 20:00:00.00

  1. 1.089

61428

  1. 1.08904

ASF

7

0

buy

49

7

0

$0.00

EURUSD

12/8/2015 19:35

586

12/08/2015 20:00:00.00

  1. 1.089

61430

  1. 1.08873

ASF

0

0

sell

31

0

7

$0.00

EURUSD

12/8/2015 19:37

586

12/08/2015 20:00:00.00

  1. 1.089

61431

  1. 1.08889

ASF

1

0

buy

34

1

0

$0.00

EURUSD

12/8/2015 19:39

586

12/08/2015 20:00:00.00

  1. 1.089

61433

  1. 1.0889

ASF

0

6

sell

43

0

7

$0.00

EURUSD

12/8/2015 19:40

586

12/08/2015 20:00:00.00

  1. 1.089

61436

  1. 1.08921

ASF

1

0

buy

68

7

0

$0.00

EURUSD

12/8/2015 19:43

586

12/08/2015 20:00:00.00

  1. 1.089

61440

  1. 1.08871

ASF

0

0

sell

23

0

1

$0.00

EURUSD

12/8/2015 19:46

2 Replies
prieper
Master II
Master II

What would be the criteria to make this match?

I do not see a common field, which these pairs do share.

Peter

Not applicable
Author

Hi,

Each long filed should have its corresponding short field. So 7 in the short field should have its 7 in the long field.

Then this couple is done, and the next couple should be matched.

Thanks