Earliest Available Data
To find the earliest available data point for a given instrument and data type a function is in the API starting in v973.02 and v963 of TWS/IBG, IBApi::EClient::reqHeadTimestamp
-
client.reqHeadTimestamp(14001, ContractSamples.USStock(), "TRADES", 1, 1);
-
client.reqHeadTimestamp(4003, ContractSamples.USStock(), "TRADES", 1, 1);
-
client.reqHeadTimestamp(14001, ContractSamples.USStock(), "TRADES", 1, 1)
-
m_pClient->reqHeadTimestamp(14001, ContractSamples::EurGbpFx(), "MIDPOINT", 1, 1);
-
1 self.reqHeadTimeStamp(4101, ContractSamples.USStockAtSmart(),
"TRADES", 0, 1)
The resulting head timestamp is returned to the function IBApi.EWrapper.headTimestamp
-
public class EWrapperImpl : EWrapper
{
... public void headTimestamp(int reqId, string headTimestamp)
{
Console.WriteLine("Head time stamp. Request Id: {0}, Head time stamp: {1}", reqId, headTimestamp);
}
-
public class EWrapperImpl implements EWrapper {
... @Override
public void headTimestamp(int reqId, String headTimestamp) {
System.out.println(EWrapperMsgGenerator.headTimestamp(reqId, headTimestamp));
}
-
Public Class EWrapperImpl
Implements EWrapper
... Public Sub headTimestamp(requestId As Integer, timeStamp As String) Implements IBApi.EWrapper.headTimestamp
Console.WriteLine("Head time stamp. Request Id: {0}, Head time stamp: {1}", requestId, timeStamp)
End Sub
-
class TestCppClient : public EWrapper
{
... void TestCppClient::headTimestamp(int reqId, const std::string& headTimestamp) {
printf( "Head time stamp. ReqId: %d - Head time stamp: %s,\n", reqId, headTimestamp.c_str());
}
-
1 class TestWrapper(wrapper.EWrapper):
... 1 def headTimestamp(self, reqId:int, headTimestamp:str):
2 print(
"HeadTimestamp. ReqId:", reqId,
"HeadTimeStamp:", headTimestamp)
A reqHeadTimeStamp request can be cancelled with IBApi.EClient.cancelHeadTimestamp
-
client.cancelHeadTimestamp(14001);
-
client.cancelHeadTimestamp(4003);
-
client.cancelHeadTimestamp(14001)
-
m_pClient->cancelHeadTimestamp(14001);
-
1 self.cancelHeadTimeStamp(4101)