To subscribe to the CQG instrument and get current data, create the connectioncusingcqgandstartUp. Register an event handler for tracking events associated with connection status. Set up the API configuration properties. Then, register an event handler for tracking events associated with instrument subscription. For an example demonstrating these activities, seeRequest CQG Real-Time Data. SeeCQG API Reference Guideto learn more about event handlers and the API configuration properties.
With the connection established, subscribe to the instrument. The instrument name must be formatted in the CQG long symbol view. For example, to subscribe to a security tied to corn, type the following.
instrument =“F.US.EZC”; realtime(c,instrument)
MATLAB®writes the structure variablecqgDataEZCto the Workspace browser.
CQG connection, specified as a CQG connection object created usingcqg.
s—CQG instrument name character vector|string scalar
CQG instrument name, specified as a character vector or string scalar that identifies the instrument or security. For a list of CQG instrument names, seeTradable Symbols.
You can also select a web site from the following list:
How to Get Best Site Performance
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.