Free Trial

Alteryx Designer Desktop Discussions

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

MonteCarlo simulation parameters used to generate simulation data

patel_bm
8 - Asteroid

I have derived necessary information such as Mean, Std Deviation and number of days for which simulator need to generate data. This is calculated based on historical stock prices I have sourced using yahoo API.

SimulationParameters.JPG

 

I now want to generate 1000 stock price movement time series using this information. How can I dynamically configure Simulated Sampling tool to pick up the above information and generate values I need. 

 

I have attached a workflow that generates one time series using python and calculates stock price movements starting from 'Last_Adj Close'  for the specified number of days. I want data set with 1000 days worth simulated stock prices.

8 REPLIES 8
cpmonteiro
10 - Fireball
Hi Simple and very interesting! Note that every time you run it, the predicted curve price has a different behavior. This is a good way to teach about volatility on stock market, and why is so important to choose good business, diversify investments and stick it to the long term. Well, on my humble point of view. Thanks for sharing it!
patel_bm
8 - Asteroid

Thanks @cpmonteiro for the encouragement.

 

I want to create a full working sample workflow that fetches historical stock prices and generates Monte Carlo simulated prices for another year for us to further analyse them for VAR etc.

 

It's still work in progress.

danilang
19 - Altair
19 - Altair

Hi @patel_bm 

 

It seems like your python code is already generating the data you need.  Why not just increase NoofTradingDays to 1000?

 

Dan

patel_bm
8 - Asteroid

@danilang, I am sorry if it's not clear in terms what I want to achieve.

 

The aim is to create next year's worth(No of Trading Days) forecast repeated 1000 times. So overall we will end up with 1000*NoOfTradingDays number of data points.

 

Ideally even 1000 should be configurable as Iterations.

 

So what we want is 'Iterations' * 'NoOfTradingDays' number of data points.

 

My workflow generates One such time series. I want to extend it to repeat for 1000 times.

 

Hope this helps. 

AbhilashR
15 - Aurora
15 - Aurora

Hi @patel_bm, assuming you are looking to iterate your Python code 1000 times, I put together a solution to help you achieve this objective. I used a combination of Generate Rows and Batch Macro to achieve the result. 

Let us know if this helps.

patel_bm
8 - Asteroid

Hi @AbhilashR Thanks for the input. 

 

I also managed to iterate using similar method to generate multiple time series.

 

However I am now working to use Alteryx tool 'Simulated Sampling' to achieve the same result. I will post final version of the workflows with both variations(Python as well as Simulated Sampling tool).

 

Watch this space.

 

 

patel_bm
8 - Asteroid

@AbhilashR , @danilang @cpmonteiro 

 

Here's my solution to the simulation problem using both Python as well Alteryx tool of Simulation Sampling using batch macros. Please don't forget to disable one of the container when running the workflow as each takes up to 15 minuted to execute depending upon machine specification.

 

Pardon me for not producing best of visual report of the data generated but we seem to have resolved issue of generated simulated data. 

 

Thank you all for important inputs to the solution. Much appreciated.

patel_bm
8 - Asteroid

Sorry but the solution I posted earlier has a bug that simulated sample tool seed was static value. It was defeating the purpose of MonteCarlo simulation. I have modified the workflow to generate random seed every time prices are generated.

 

I was getting only one prince line in interactive chart and it was driving me mad.. Finally managed to resolve it.

 

Here's the revised workflow attached.

Labels
Top Solution Authors