realtime
Subscribe to CQG instrument
Syntax
Description
Examples
Subscribe to the CQG Instrument
To subscribe to the CQG instrument and
get current data, create the connection c
using cqg
and startUp
.
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, see Request CQG Real-Time Data.
See CQG API Reference Guide to 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 variable cqgDataEZC
to
the Workspace browser.
Display cqgDataEZC
.
cqgDataEZC(1,1)
ans = Price: {15x1 cell} Volume: {15x1 cell} ServerTimestamp: {15x1 cell} Timestamp: {15x1 cell} Type: {15x1 cell} Name: {15x1 cell} IsValid: {15x1 cell} Instrument: {15x1 cell} HasVolume: {15x1 cell}
cqgDataEZC
returns the current quotes for
the security.
Display data in the Price
property
of cqgDataEZC
.
cqgDataEZC(1,1).Price
ans = [-2.1475e+09] [-2.1475e+09] [-2.1475e+09] [ 660.5000] [] [] [-2.1475e+09] [-2.1475e+09] [-2.1475e+09] [-2.1475e+09] [-2.1475e+09] [-2.1475e+09] [-2.1475e+09] [ 660.5000] [-2.1475e+09]
Close the CQG connection.
close(c)
Input Arguments
c
— CQG connection
connection object
CQG connection, specified as a CQG connection object
created using cqg
.
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, see Tradable Symbols.
Data Types: char
| string
Version History
Introduced in R2013b
MATLAB コマンド
次の MATLAB コマンドに対応するリンクがクリックされました。
コマンドを MATLAB コマンド ウィンドウに入力して実行してください。Web ブラウザーは MATLAB コマンドをサポートしていません。
Select a Web Site
Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .
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.
Americas
- América Latina (Español)
- Canada (English)
- United States (English)
Europe
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)