该帮助的版本不再更新,请参见https://www.jmp.com/support/help/zh-cn/15.2 获取最新的版本.


To create a data feed object, use the Open Datafeed() function with arguments specifying details about the connection:
No arguments are required. You can simply create the data feed object and then send messages to it. Messages might include connecting to a port or setting up a script to process the data coming in. However, you would typically set up the basic operation of the data feed in the Open Datafeed() function and subsequently send messages as needed to manage the data feed. Any of the options below work both as options inside Open Datafeed() or as messages sent to a data feed object.
It’s a good idea to store a reference to the object in a global variable, such as feed above, so that you can easily send messages to the object. You can store a reference to an existing object by using a subscript; for example, to store a reference to the second data feed created:
To connect to a live data source, use Connect( ) and specify details for the port. Each setting takes only one argument; in this syntax summary the symbol | between argument choices means “or.” The Port specification is needed if you want to connect, otherwise the object still works, but is not connected to a data feed. The last three items, DTR_DSR, RTS_CTS, and XON_XOFF, are Boolean to specify which control characters are sent back and forth to indicate when the data feed is ready to get data. Typically, you would turn on at most one of them.
This command creates a scriptable data feed object and stores a reference to it in the global variable feed. The Connect() argument starts up a thread to watch a communications port and collect lines. The thread collects characters until it has a line, and then appends it to the line queue and schedules an event to call the script.
Set Script() attaches a script to the data feed object. This script is triggered by the Open Datafeed message whenever a line of data arrives. The argument for Set Script() is simply the script to run, or a global containing a script.
A data feed script typically uses Get Line to get a copy of one line and then does something with that line. Often it parses the line for data and adds it to some data table.