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

1 次查看(过去 30 天)
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!

回答(1 个)

Shivam Lahoti
Shivam Lahoti 2024-2-18
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.

类别

Help CenterFile Exchange 中查找有关 Startup and Shutdown 的更多信息

产品


版本

R2021b

Community Treasure Hunt

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

Start Hunting!

Translated by