Welcome Guest, you are in: Login
CTS Futures
Home
Pricing
FAQ

T4 Desktop
User Guide
Scripting Guide
Release Notes

Mobile and Web
T4 Mobile
T4 WebTrader

Admins
T4 Admin Guide

Developers
API 4.0 Guide
API 4.0 Reference
FIX API




Search the wiki
»

Requesting Chart Data for a Market

RSS
Chart data is requested via a Market object using one of the BeginRequestChartData methods. Chart data is retrieved asynchronously, so these methods will always return immediately. When calling BeginRequestChartData, you will supply a callback method that will be called when the chart data is ready.

The BeginRequestChartData method returns an IChartDataRequest object. You can obtain the unique chart data request ID via the RequestID property of this object.

Example chart data request:

Private Sub RequestChartData()

Dim dtEnddate As DateTime = DateTime.Now
Dim dtStartDate As DateTime = dtEndDate.AddDays(-60)
Dim enBarType As T4.ChartDataType = ChartDataType.Day

' Request bar data.
Dim oReq As T4.API.IChartDataRequest = Me.moMarket.BeginRequestChartData( dtStartDate, dtEnddate, enBarType, AddressOf IChartDataRequest_ChartDataComplete)

Trace.WriteLine(String.Format("RequestChartData(), Start Date: {0:MM/dd/yyyy}, End Date: {1:MM/dd/yyyy}, RequestID: {2}", dtStartDate, dtEnddate, oReq.RequestID))

End Sub

Private Sub IChartDataRequest_ChartDataComplete(ByVal poRequest As T4.API.IChartDataRequest)

' Process the bar data.

End Sub

Once the chart data retrieval has completed, the callback supplied on the request method will be called. The IChartDataRequest object returned as a result of calling BeginRequestChartData is the sole argument supplied to the callback. This object will contain all of the details of the original request, and the chart data.

Note: There is no need to lock to lock the Market object when making chart data requests nor when processing the chart data returned in the IChartDataRequest object.

Note: If you make multiple requests for data on the same or different markets then you may not receive the responses in the same order that you requested the data.

Trade how you want, where you want

support@ctsfutures.com (312) 939 0164

141 W. Jackson Blvd., Suite 211A, Chicago, IL 60604

© 2009-2012 Cunningham Trading Systems Inc. All rights reserved.