111,128
社区成员
发帖
与我相关
我的任务
分享
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using WAPIWrapperCSharp; //接口dll
using WindCommon; //用于处理返回数据的格式转换,也是接口提供的
namespace WSQ2String
{
class WSQ2StringSample
{
//主程序
static void Main()
{
Console.Write("Begin......");
Console.ReadLine();
//----API登陆
WindAPI w = new WindAPI(); //生成接口实例
Console.WriteLine("New API created!");
w.start(); //登陆接口
Console.WriteLine("API started!");
//----订阅行情
int errorId = 0;
ulong reqId = w.wsq(ref errorId, "150195.sz", "rt_date, rt_time, rt_lastest", "", myCallback); //调用wsq方法订阅行情
Console.WriteLine("errorId = {0}", errorId);
//加入语句控制用户程序的向后执行
Console.ReadLine(); //在键入任意键后,我们便可以中止行情的订阅
w.cancelRequest(reqId);
w.stop();
Console.Write("End......");
Console.ReadLine();
}
//回调函数定义
static void myCallback(ulong reqId, WindData wd)
{
Console.WriteLine("wsq data gotback......");
//WindData类型转换,并输出到屏幕
string s = WindDataMethod.WindDataToString(wd, "wsq"); //接口提供的用于将其自定义的数据类型转换成string
Console.Write(s);
}
}
}
额,我采用类似的框架,调用了wind接口提供的wsi()方法,并成功输出到屏幕;
因此,在安装及使用接口方面,我认为应该是没有问题的。。。。
主要还是在回调的使用上。
