请帮助我,
我需要在OnTickHistoryResponse事件的形式中使用,所以当事件发生时我可以在控件中显示信息。
事件OnTickHistoryResponse附带一个名为ActivetickFeed的API,此事件OnTickHistoryResponse已经在API中,请您帮忙,我不知道如何使用该事件。
仅在文档中显示:Image
定义事件并为其分配方法的类是:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace ActiveTickFeedCOMCSExample
{
class ActiveTickFeed
{
public static ActiveTickFeedLib.Feed feed;
public static ActiveTickFeed instance;
public ActiveTickFeed()
{
//create new instance of IFeed
feed = new ActiveTickFeedLib.Feed();
feed.PrimaryServerHostname = "activetick1.activetick.com";
feed.BackupServerHostname = "activetick2.activetick.com";
feed.ServerPort = 443;
//connect all IFeedEvents events to local methods
feed.OnTickHistoryResponse += feed_OnTickHistoryResponse;
}
void feed_OnTickHistoryResponse(int originalRequestId, short tickHistoryResponseCode, string symbol, short symbolStatusCode, object records)
{
Form1.instance.AddData("Processing OnTickHistoryResponse........");
Form1.instance.AddData("ATTickHistoryResponseType: " + ((ActiveTickFeedLib.ATTickHistoryResponseEnum)tickHistoryResponseCode).ToString());
Form1.instance.AddData("ATSymbolStatus: " + ((ActiveTickFeedLib.ATSymbolStatusEnum)symbolStatusCode).ToString());
switch ((ActiveTickFeedLib.ATTickHistoryResponseEnum)tickHistoryResponseCode)
{
case ActiveTickFeedLib.ATTickHistoryResponseEnum.ATTickHistoryResponseSuccess:
case ActiveTickFeedLib.ATTickHistoryResponseEnum.ATTickHistoryResponseMaxLimitReached:
{
if ((ActiveTickFeedLib.ATSymbolStatusEnum)symbolStatusCode == ActiveTickFeedLib.ATSymbolStatusEnum.ATSymbolStatusSuccess)
{
if (records != null)
{
string[] recordsArray = (string[])records;
foreach (string s in recordsArray)
Form1.instance.AddData(s);
}
}
}
break;
case ActiveTickFeedLib.ATTickHistoryResponseEnum.ATTickHistoryResponseInvalidRequest:
break;
case ActiveTickFeedLib.ATTickHistoryResponseEnum.ATTickHistoryResponseDenied:
break;
}
}

答案 0 :(得分:0)
每当您发送“SendTickHistoryRequest”时,作为回复,您将收到“OnTickHistoryResponse”事件。所以事件订阅是不够的,请发送请求(SendTickHistoryRequest),你将得到一个响应事件。