历史(c,s,startdate,enddate,period)请求CQG.®historical data asynchronously with bar sizeperiodbetweenstartdate和enddatefor CQG instrument nameswith CQG connectionc。
To request daily historical data for an instrument, create the connectioncusingCQG.和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 building and initializing the output data structure. For an example demonstrating these activities, seeRequest CQG Historical Data。看到CQG.API参考指南to learn more about event handlers and the API configuration properties.
Request historical daily data for instrumentXYZ.XYZ在过去的10天。XYZ.XYZis a sample instrument name. To request historical data for your instrument, substitute the symbol name ininstrument。
Each row incqghistorydata.represents data for 1 day. The columns incqghistorydata.show the numerical representation of the timestamp, the close price, and the open price for the instrument during the day.
Close the CQG connection.
close(c)
RequestCQG.Historical Data with Additional Request Properties
To request daily historical data for an instrument with an additional property, create the connectioncusingCQG.和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 building and initializing the output data structure. For an example demonstrating these activities, seeRequest CQG Historical Data。看到CQG.API参考指南to learn more about event handlers and the API configuration properties.
Pass an additional optional request property by creating the structurex和setting the optional property.
x.UpdatesEnabled = false;
For additional optional properties you can set, seeCQG.API参考指南。
Request historical daily data for instrumentXYZ.XYZ使用其他可选请求属性的最后10天x。XYZ.XYZis a sample instrument name. To request historical data for your instrument, substitute the symbol name ininstrument。
Each row incqghistorydata.represents data for 1 day. The columns incqghistorydata.show the numerical representation of the timestamp, the close price, and the open price for the instrument during the day.
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, see可口符号。
Data Types:char|string
startdate—Start date character vector|string scalar|数字标量
Start date, specified as a character vector, string scalar, or numeric scalar.
Data Types:double|char|string
enddate—End date character vector|string scalar|数字标量
End date, specified as a character vector, string scalar, or numeric scalar.
酒吧尺寸, specified as one of the above values predetermined by the CQG API that denotes the length of time to collect data.
x—CQG.request properties 请求属性结构
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参考指南。
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.