How to | Display Data Dynamically
Mathematica can collect, process, and display data dynamically and in real time. A large collection of curated data is built into Mathematica, which puts an extraordinary amount of information at your fingertips.
Use FinancialData to get the latest GE stock price:
Evaluating again will give the updated stock price:
Using Dynamic with the UpdateInterval option lets you query the current GE stock price at a regular time interval.
Here, the GE stock price is queried and displayed every 2 seconds:
For added clarity, you can include a time stamp to display when the price was retrieved. In the list before the price, the time stamp shows the year, month, day, hour, minute, and second that the price was retrieved:
Because the UpdateInterval is hard coded, the update happens even when the price does not change.
Store these prices in the variable . You can use this variable later to create a visualization of the prices:
Now, as long as this output is visible, the latest GE stock price will be appended to . The TrackedSymbols option is necessary to prevent the dynamic evaluation from triggering when saving the price values.
You can use this idea to create a dynamic visualization showing the progression of GE stock prices from the time of evaluation.
As becomes larger, this visualization can potentially take a long time to render. Dynamic evaluations have a six-second time out by default. You can override this by setting the SynchronousUpdating option to False: