Advent of Code is back! Unwrap daily challenges to sharpen your Alteryx skills and earn badges along the way! Learn more now.
Free Trial

Alteryx Designer Desktop Discussions

Find answers, ask questions, and share expertise about Alteryx Designer Desktop and Intelligence Suite.
SOLVED

Need help with iterative macro to analyze stock market price reaction to large trades

AkisM
10 - Fireball

I have a list of the stock's market transactions in chronological order. Based on the size of each transaction, I mark some of them as "big" transactions, and I'd like to analyze how the market reacts in the next 5m, 15m, 1h, 6h, 24h, 48h intervals, in relation to those "big" transactions. So next to each one of those big transactions I need to calculate a minimum and maximum price point, which are the points to which the price fluctuated during each of the time intervals mentioned above, after a big transaction occurs.

 

I'm guessing that for this I would need an iterative macro (i could be wrong), but I'm not very experienced with them yet. Can someone provide an example below?

 

Example of my input data:

 

DateTimeBigTransactionIDSizePriceRecordID

2021-01-25 13:41:44

 0.5132.341
2021-01-25 13:46:50 1.3132.382
2021-01-25 13:55:53152.3133.533
2021-01-25 13:59:55 0.8133.554
2021-01-25 14:11:56 2.3133.325
2021-01-25 15:31:44287.2129.646
2021-01-25 18:41:44 4135.347
2021-01-25 21:41:443117.3131.28
2021-01-25 23:21:44 0.6137.39
2021-01-26 11:41:44 0.2136.3210
2021-01-26 13:23:53 0.5136.111

 

 

So from the macro's point of view, the first iteration would begin from RecordID 3 where the first "big" transaction is encountered and iterate all the way down to 11 where the data ends, then it would append next to recordID 3 the min and max prices encountered at the 5m, 15m, 1h, 6h, 24h intervals starting from 2021-01-25 13:55:53 (10 columns).

 

The second iteration would begin from RecordID 6 where the second big transaction is encountered and iterate again till the dataset's end (recordID 11), and it would append the min max prices of this timeframe (from 2021-01-25 15:31:44)  next to recordID 6, etc.

 

2 REPLIES 2
joshuaburkhow
ACE Emeritus
ACE Emeritus

I think you would be better off using a batch macro as you could run this all at the same time instead of iterative. 

 

Shameless plug, just posted this today: https://www.altertricks.com/how-to/5-resources-for-learning-how-to-master-batch-macros/ 

Joshua Burkhow - Alteryx Ace | Global Alteryx Architect @PwC | Blogger @ AlterTricks
AkisM
10 - Fireball

Thanks, I watched some videos there and was able to do it using 2 control parameters in the macro

Labels
Top Solution Authors