Main Content

timeseries

RequestCQGintraday tick data

Description

example

timeseries(c,s,startdate,enddate)requests CQG®raw intraday tick data asynchronously betweenstartdateandenddatefor CQG instrument nameswith CQG connectionc.

example

timeseries(c,s,startdate,enddate,[],x)requests CQG raw intraday tick data asynchronously without timed bar data using additional request propertiesx.

example

timeseries(c,s,startdate,enddate,intraday)requests CQG timed bar data asynchronously with the aggregated bar valueintraday.

example

timeseries(c,s,startdate,enddate,intraday,x)requests CQG timed bar data asynchronously with additional request propertiesx.

Examples

collapse all

To request intraday tick data for an instrument, 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 building and initializing the output data structure. For an example demonstrating these activities, seeRequest CQG Intraday Tick Data. SeeCQG API Reference Guideto learn more about event handlers and the API configuration properties.

Request intraday tick data for instrumentXYZ.XYZfor the last 2 days.XYZ.XYZis a sample instrument name. To request intraday tick data for your instrument, substitute the symbol name ininstrument.

仪器='XYZ.XYZ'; startdate = now - 2; enddate = now; timeseries(c,instrument,startdate,enddate)

MATLAB®writes the structure variablecqgTickDatato the Workspace browser.

DisplaycqgTickData.

cqgTickData
cqgTickData = Timestamp: {2x1 cell} Price: [2x1 double] Volume: [2x1 double] PriceType: {2x1 cell} CorrectionType: {2x1 cell} SalesConditionLabel: {2x1 cell} SalesConditionCode: [2x1 double] ContributorId: {2x1 cell} ContributorIdCode: [2x1 double] MarketState: {2x1 cell}

cqgTickDatareturns intraday tick data for the specified instrument.

Display the data in theTimestampproperty ofcqgTickData.

cqgTickData.Timestamp
ans = '4/17/2013 2:14:00 PM' '4/18/2013 2:14:00 PM'

Close the CQG connection.

close(c)

To request intraday tick data for an instrument with an additional property, 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 building and initializing the output data structure. For an example demonstrating these activities, seeRequest CQG Intraday Tick Data. SeeCQG API Reference Guideto learn more about event handlers and the API configuration properties.

Pass an additional optional request property by creating the structurex, and setting the optional property. To see only bid tick data, for example, setTickFilterto'tfBid'.

x.TickFilter ='tfBid';

TickFilterandSessionsFilter是唯一有效的额外可选properties for callingtimeserieswithout a timed bar request. For additional property values you can set, seeCQG API Reference Guide.

Request intraday tick data for instrumentXYZ.XYZfor the last 2 days using the additional optional request propertyx.XYZ.XYZis a sample instrument name. To request intraday tick data for your instrument, substitute the symbol name ininstrument.

仪器='XYZ.XYZ'; startdate = now - 2; enddate = now; timeseries(c,instrument,startdate,enddate,[],x)

MATLAB writes the variablecqgTickDatato the Workspace browser.

DisplaycqgTickData.

cqgTickData
cqgTickData = Timestamp: {2x1 cell} Price: [2x1 double] Volume: [2x1 double] PriceType: {2x1 cell} CorrectionType: {2x1 cell} SalesConditionLabel: {2x1 cell} SalesConditionCode: [2x1 double] ContributorId: {2x1 cell} ContributorIdCode: [2x1 double] MarketState: {2x1 cell}

cqgTickDatareturns intraday tick data for the specified instrument.

Display the data in theTimestampproperty ofcqgTickData.

cqgTickData.Timestamp
ans = '4/17/2013 2:14:00 PM' '4/18/2013 2:14:00 PM'

Close the CQG connection.

close(c)

To request timed bar data for an instrument, 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 building and initializing the output data structure. For an example demonstrating these activities, seeRequest CQG Intraday Tick Data. SeeCQG API Reference Guideto learn more about event handlers and the API configuration properties.

Request timed bar data for instrumentXYZ.XYZfor the last fraction of a day.XYZ.XYZis a sample instrument name. To request timed bar data for your instrument, substitute the symbol name ininstrument.

仪器='XYZ.XYZ'; startdate = now - .1; enddate = now; intraday = 1; timeseries(c,instrument,startdate,enddate,intraday)

MATLAB writes variablecqgTimedBarDatato the Workspace browser.

DisplaycqgTimedBarData.

cqgTimedBarData
cqgTimedBarData = 1.0e+09 * 0.0007 -2.1475 -2.1475 -2.1475 -2.1475 -2.1475 -2.1475 -2.1475 -2.1475 0.0007 -2.1475 -2.1475 -2.1475 -2.1475 -2.1475 -2.1475 -2.1475 -2.1475 0.0007 -2.1475 -2.1475 -2.1475 -2.1475 -2.1475 -2.1475 -2.1475 -2.1475 0.0007 -2.1475 -2.1475 -2.1475 -2.1475 -2.1475 -2.1475 -2.1475 -2.1475 0.0007 -2.1475 -2.1475 -2.1475 -2.1475 -2.1475 -2.1475 -2.1475 -2.1475 ...

cqgTimedBarDatareturns timed bar data for the specified instrument. The columns ofcqgTimedBarDatadisplay data corresponding to the timestamp, open price, high price, low price, close price, mid-price, HLC3, average price, and tick volume.

Close the CQG connection.

close(c)

To request timed bar data for an instrument with an additional property, 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 building and initializing the output data structure. For an example demonstrating these activities, seeRequest CQG Intraday Tick Data. SeeCQG API Reference Guideto learn more about event handlers and the API configuration properties.

Pass an additional optional request property by creating the structurex, and setting the optional property.

x.UpdatesEnabled = false;

For additional optional properties you can set, seeCQG API Reference Guide.

Request timed bar data for instrumentXYZ.XYZfor the last fraction of a day using the additional optional request propertyx.XYZ.XYZis a sample instrument name. To request timed bar data for your instrument, substitute the symbol name ininstrument.

仪器='XYZ.XYZ'; startdate = now - .1; enddate = now; intraday = 1; timeseries(c,instrument,startdate,enddate,intraday,x)

MATLAB writes the variablecqgTimedBarDatato the Workspace browser.

DisplaycqgTimedBarData.

cqgTimedBarData
cqgTimedBarData = 1.0e+09 * 0.0007 -2.1475 -2.1475 -2.1475 -2.1475 -2.1475 -2.1475 -2.1475 -2.1475 0.0007 -2.1475 -2.1475 -2.1475 -2.1475 -2.1475 -2.1475 -2.1475 -2.1475 0.0007 -2.1475 -2.1475 -2.1475 -2.1475 -2.1475 -2.1475 -2.1475 -2.1475 0.0007 -2.1475 -2.1475 -2.1475 -2.1475 -2.1475 -2.1475 -2.1475 -2.1475 0.0007 -2.1475 -2.1475 -2.1475 -2.1475 -2.1475 -2.1475 -2.1475 -2.1475 ...

cqgTimedBarDatareturns timed bar data for the specified instrument. The columns ofcqgTimedBarDatadisplay data corresponding to the timestamp, open price, high price, low price, close price, mid-price, HLC3, average price, and tick volume.

Close the CQG connection.

close(c)

Input Arguments

collapse all

CQG connection, specified as a CQG connection object created usingcqg.

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.

Data Types:char|string

Start date, specified as a character vector, string scalar, or numeric scalar.

Data Types:|char|string

End date, specified as a character vector, string scalar, or numeric scalar.

Data Types:|char|string

Aggregated bar value, specified as a numeric scalar from 1.0 to 1440.0. If you want to calltimeseriesto return intraday tick data with additional properties without timed bar data, then enter[]for this argument.

Data Types:

CQG request properties, specified as a CQG request properties structure. Create this structure by writing MATLAB code to set additional optional request properties. For additional optional properties you can set, seeCQG API Reference Guide.

Example:x.UpdatesEnabled = false;

Data Types:struct

Introduced in R2013b
tml>