Beispiel #1
0
        public override void SubscribeBidAskBook(ASecurity s, int level)
        {
            try
            {
                string fields = "rt_time,rt_pre_settle,rt_pre_close,rt_open,rt_high,rt_low,rt_last";
                for (int i = 1; i <= Math.Min(level, 5); i++)
                {
                    fields += ",rt_bid?,rt_ask?,rt_bsize?,rt_asize?".Replace("?", i.ToString());
                }

                //注意:snaponly参数,false=持续更新
                long reqid = this._windapi.WSQ(s.GetWindCode(), fields, false, this.callBackOnSubscribeBidAskBook);
                if (reqid < 0)
                {
                    string msg = this._windapi.WErr((eWQErr)reqid, eLang.eCHN);
                    MessageManager.GetInstance().Add(MessageType.Error, msg);
                    throw new Exception(msg);
                }

                //异步执行时,将s对象临时保存于htAsyncObject
                this.htSubscribe.Add(reqid, s.bidaskbook);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Beispiel #2
0
        public override List <Option> GetOptionSet(ASecurity underlying)
        {
            try
            {
                long reqid = this._windapi.WSET("OptionChain", "date=" + DateTime.Today.ToString("yyyyMMdd") + ";us_code=" + underlying.GetWindCode() + ";option_var=;month=全部;call_put=全部", this.callBackOnGetOptionSet);
                if (reqid < 0)
                {
                    string msg = this._windapi.WErr((eWQErr)reqid, eLang.eCHN);
                    MessageManager.GetInstance().Add(MessageType.Error, msg);
                    throw new Exception(msg);
                }

                //等待回报数据
                this.waitCallBackData(reqid);

                //读取数据
                if (this.htOptionSets.Contains(underlying.code))
                {
                    return((List <Option>) this.htOptionSets[underlying.code]);
                }
                else
                {
                    return(null);
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }