本文整理匯總了C#中StockSharp.InteractiveBrokers.Native.IBSocket.ReadLongDateTime方法的典型用法代碼示例。如果您正苦於以下問題:C# IBSocket.ReadLongDateTime方法的具體用法?C# IBSocket.ReadLongDateTime怎麽用?C# IBSocket.ReadLongDateTime使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類StockSharp.InteractiveBrokers.Native.IBSocket
的用法示例。
在下文中一共展示了IBSocket.ReadLongDateTime方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。
示例1: ReadHistoricalData
private void ReadHistoricalData(IBSocket socket, ServerVersions version)
{
var requestId = socket.ReadInt();
if (version >= ServerVersions.V2)
{
//Read Start Date String
/*String startDateStr = */
socket.ReadStr();
/*String endDateStr = */
socket.ReadStr();
//completedIndicator += ("-" + startDateStr + "-" + endDateStr);
}
var secId = GetSecurityId(requestId);
var itemCount = socket.ReadInt();
for (var i = 0; i < itemCount; i++)
{
//Comes in as seconds
//2 - dates are returned as a long integer specifying the number of seconds since 1/1/1970 GMT.
var time = socket.ReadLongDateTime();
var open = socket.ReadDecimal();
var high = socket.ReadDecimal();
var low = socket.ReadDecimal();
var close = socket.ReadDecimal();
var volume = socket.ReadInt();
var wap = socket.ReadDecimal();
/* hasGaps */
socket.ReadStr().To<bool>();
var barCount = -1;
if (version >= ServerVersions.V3)
barCount = socket.ReadInt();
SendOutMessage(new TimeFrameCandleMessage
{
OpenPrice = open,
HighPrice = high,
LowPrice = low,
ClosePrice = close,
TotalVolume = volume,
OpenTime = time,
TotalTicks = barCount,
SecurityId = secId,
OriginalTransactionId = requestId,
State = CandleStates.Finished,
IsFinished = i == (itemCount - 1)
});
}
}
示例2: ReadRealTimeBars
private void ReadRealTimeBars(IBSocket socket)
{
var requestId = socket.ReadInt();
var time = socket.ReadLongDateTime();
var open = socket.ReadDecimal();
var high = socket.ReadDecimal();
var low = socket.ReadDecimal();
var close = socket.ReadDecimal();
var volume = socket.ReadLong();
var wap = socket.ReadDecimal();
var count = socket.ReadInt();
SendOutMessage(new TimeFrameCandleMessage
{
OpenPrice = open,
HighPrice = high,
LowPrice = low,
ClosePrice = close,
TotalVolume = volume,
OpenTime = time,
CloseVolume = count,
SecurityId = GetSecurityId(requestId),
OriginalTransactionId = requestId,
});
//realTimeBar(reqId, time, open, high, low, close, volume, wap, count);
}
示例3: OnProcessResponse
private bool OnProcessResponse(IBSocket socket)
{
var str = socket.ReadStr(false);
if (str.IsEmpty())
{
socket.AddErrorLog(LocalizedStrings.Str2524);
return false;
}
var message = (ResponseMessages)str.To<int>();
socket.AddDebugLog("Msg: {0}", message);
if (message == ResponseMessages.Error)
return false;
var version = (ServerVersions)socket.ReadInt();
switch (message)
{
case ResponseMessages.CurrentTime:
{
// http://www.interactivebrokers.com/en/software/api/apiguide/java/currenttime.htm
var time = socket.ReadLongDateTime();
OnProcessTimeShift(TimeHelper.NowWithOffset - time);
break;
}
case ResponseMessages.ErrorMessage:
{
if (version < ServerVersions.V2)
{
OnProcessMarketDataError(socket.ReadStr());
}
else
{
var id = socket.ReadInt();
var code = socket.ReadInt();
var msg = socket.ReadStr();
socket.AddInfoLog(() => msg);
if (id == -1)
break;
switch ((NotifyCodes)code)
{
case NotifyCodes.OrderCancelled:
{
OnProcessOrderCancelled(id);
break;
}
case NotifyCodes.OrderCannotTransmit:
case NotifyCodes.OrderCannotTransmitId:
case NotifyCodes.OrderCannotTransmitIncomplete:
case NotifyCodes.OrderDuplicateId:
case NotifyCodes.OrderFilled:
case NotifyCodes.OrderNotMatchPrev:
case NotifyCodes.OrderPriceOutOfRange:
case NotifyCodes.OrderSubmitFailed:
case NotifyCodes.OrderVolumeTooSmall:
case NotifyCodes.Rejected:
{
OnProcessOrderError(id, msg);
break;
}
case NotifyCodes.SecurityNoDefinition:
OnProcessSecurityLookupNoFound(id);
break;
default:
OnProcessMarketDataError(LocalizedStrings.Str2525Params.Put(msg, id, code));
break;
}
}
break;
}
case ResponseMessages.VerifyMessageApi:
{
/*int version =*/
socket.ReadInt();
/*var apiData = */
socket.ReadStr();
//eWrapper().verifyMessageAPI(apiData);
break;
}
case ResponseMessages.VerifyCompleted:
{
/*int version =*/
socket.ReadInt();
var isSuccessfulStr = socket.ReadStr();
var isSuccessful = "true".CompareIgnoreCase(isSuccessfulStr);
/*var errorText = */
socket.ReadStr();
if (isSuccessful)
{
//.........這裏部分代碼省略.........