I use an API called WindAPI , which has provided financial data from China's markets. This API provides a call to the wsq () method , which will provide RealTime price data for the user program through a callback function !
I am writing some simple codes in C # trying to use this wsq () method, but I am not getting any results. It is interesting that there should be some error in the codes, but simply cannot find it! I am new to C # and programming, so if this is a rookie mistake, don't laugh at me :)
Here are the codes, I will give as many comments as possible so that you can quickly find a misunderstanding.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using WAPIWrapperCSharp;
using WindCommon;
namespace WSQ2String
{
class WSQ2StringSample
{
static void Main()
{
Console.Write("Begin......");
Console.ReadLine();
WindAPI w = new WindAPI();
Console.WriteLine("New API created!");
w.start();
Console.WriteLine("API log on!");
int errorId = 0;
ulong reqId = w.wsq(ref errorId, "150195.sz", "rt_date, rt_time, rt_lastest", "", myCallback);
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......");
string s = WindDataMethod.WindDataToString(wd, "wsq");
Console.Write(s);
}
}
}
I understand that when I request a data service using w.wsq (), when prices change ( that event ), myCallback () will be called and export the data to the screen!
The reason I add readline () is to prevent the main program from working too quickly and to end the event (price change). In this situation, myCallback () will not have a chance to be called!
But when I run the codes, after the appearance of "errorId = 0" I wait a few minutes and do not get any results! I confirmed that the price has changed (usually it changed within a few seconds).
Here is the result that I get, and I can’t find the reason .... (I just type the lines on the screen)
>>Begin......
>>New API created!
>>API log on!
>>errorId = 0
, !
, - ....
!
:
, zip .
dll API .
dll
, - ?