How to update the price of an option every minute with real time data?

1 view (last 30 days)
I am using the datafeed toolbox, connecting it to money.net.
I get the real time price of a stock, and using the binomial trees I get the price.
How can I update the price of the option every minute? because it takes 1 or 2 seconds to run the binomial tree with 100000 steps,so it is difficult to get an instantaneous update.
Thanks in advance!

Answers (1)

Shivam Lahoti
Shivam Lahoti on 18 Feb 2024
Hi GIUSEPPE,
I understand that you want to manage the minute-by-minute updates of option prices in MATLAB while accounting for the 1 to 2 seconds needed for binomial tree calculations. For this, you can indeed implement a timer mechanism. Utilize MATLAB's timer, start, and stop functions to orchestrate a script that triggers a custom function at the onset of each minute. This function would obtain the latest stock price from Money.net. Following this, it would execute the custom binomial tree model.
After the calculation, the script should proceed to update the display or storage based on your setup, which could involve refreshing a GUI element or writing the new data to a file. Set the timer's Period to 60 seconds to achieve consistent execution every minute and adjust the StartDelay property to synchronize the first execution with the beginning of the next minute.
To learn more about the timer function, please refer to the following documentation:
I hope this was helpful.
Regards,
Shivam.

Products


Release

R2021b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!