Exemplo n.º 1
0
            void OnClose()
            {
                this._esunnyQuote.isConnect = false;

                Trace.WriteLine("行情连接中断!");

                EventProcessor.BeginInvoke(this._esunnyQuote.CloseResponse, this._esunnyQuote, new EsunnyEventArgs());
            }
            internal void OnOpen()
            {
                this.trader.isConnect = true;

                Trace.WriteLine("成功连接到交易服务器!");

                EventProcessor.BeginInvoke(this.trader.OpenResponse, this.trader, new EsunnyEventArgs());
            }
Exemplo n.º 3
0
            internal void OnOpen()
            {
                this._esunnyQuote.isConnect = true;

                Trace.WriteLine("成功连接到行情服务器!");

                EventProcessor.BeginInvoke(this._esunnyQuote.OpenResponse, this._esunnyQuote, new EsunnyEventArgs());
            }
            void OnClose()
            {
                this.trader.isConnect = false;

                Trace.WriteLine("连接中断!");

                EventProcessor.BeginInvoke(this.trader.CloseResponse, this.trader, new EsunnyEventArgs());
            }
            /// <summary>
            /// 市场状态查询应答
            /// </summary>
            /// <param name="rsp"></param>
            /// <param name="islast"></param>
            void OnQueryExchangeState(/*TEsExchangeStateRspField*/ IntPtr rsp, bool islast)
            {
                TEsExchangeStateRspField data = PInvokeUtility.GetObjectFromIntPtr <TEsExchangeStateRspField>(rsp);

                this.trader.exchangeStateList.Add(data);

                Trace.WriteLine(string.Format("【市场状态查询应答】{0} : {1} {2}", data.Exchange, data.ExchangeDateTime, data.ExchangeState));

                if (islast == true)
                {
                    EventProcessor.BeginInvoke(this.trader.QueryExchangeStateResponse, this.trader, new EsunnyEventArgs <List <TEsExchangeStateRspField> >(this.trader.exchangeStateList));
                }
            }
            /// <summary>
            /// 组合合约查询应答
            /// </summary>
            /// <param name="rsp"></param>
            /// <param name="islast"></param>
            void OnQueryCmbContract(/*TEsCmbContractRspField*/ IntPtr rsp, bool islast)
            {
                if (rsp != IntPtr.Zero)
                {
                    TEsCmbContractRspField data = PInvokeUtility.GetObjectFromIntPtr <TEsCmbContractRspField>(rsp);
                    this.trader.combinContractList.Add(data);

                    Trace.WriteLine(string.Format("【组合合约查询应答】{0} : {1} {2}", data.Exchange, data.CmbType, data.Contract1 + "/" + data.Contract2));
                }

                if (islast == true)
                {
                    EventProcessor.BeginInvoke(this.trader.QueryCmbContractResponse, this.trader, new EsunnyEventArgs <List <TEsCmbContractRspField> >(this.trader.combinContractList));
                }
            }
            /// <summary>
            /// 持仓查询应答
            /// </summary>
            /// <param name="rsp"></param>
            /// <param name="islast"></param>
            void OnQueryHold(/*TEsHoldRspField*/ IntPtr rsp, bool islast)
            {
                if (rsp != IntPtr.Zero)
                {
                    TEsHoldRspField data = PInvokeUtility.GetObjectFromIntPtr <TEsHoldRspField>(rsp);
                    this.trader.holdList.Add(data);

                    Trace.WriteLine(string.Format("【持仓查询应答】{0} : {1} {2}", data.Contract1, data.HoldPrice, data.HoldVol));
                }

                if (islast == true)
                {
                    EventProcessor.BeginInvoke(this.trader.QueryHoldResponse, this.trader, new EsunnyEventArgs <List <TEsHoldRspField> >(this.trader.holdList));
                }
            }
            /// <summary>
            /// 委托查询应答
            /// </summary>
            /// <param name="rsp"></param>
            /// <param name="islast"></param>
            void OnQueryOrder(/*TEsOrderInsertRspField*/ IntPtr rsp, bool islast)
            {
                if (rsp != IntPtr.Zero)
                {
                    TEsOrderInsertRspField data = PInvokeUtility.GetObjectFromIntPtr <TEsOrderInsertRspField>(rsp);
                    this.trader.orderList.Add(data);


                    Trace.WriteLine(string.Format("【委托查询应答】{0} : {1} {2}", data.ReqData.Contract1, data.OrderNo, data.OrderState));
                }

                if (islast == true)
                {
                    EventProcessor.BeginInvoke(this.trader.QueryOrderResponse, this.trader, new EsunnyEventArgs <List <TEsOrderInsertRspField> >(this.trader.orderList));
                }
            }
            /// <summary>
            /// 商品查询应答
            /// </summary>
            /// <param name="rsp"></param>
            /// <param name="islast"></param>
            void OnQueryCommodity(/*TEsCommodityRspField*/ IntPtr rsp, bool islast)
            {
                if (rsp != IntPtr.Zero)
                {
                    TEsCommodityRspField data = PInvokeUtility.GetObjectFromIntPtr <TEsCommodityRspField>(rsp);
                    this.trader.commodityList.Add(data);


                    Trace.WriteLine(string.Format("【商品查询应答】{0} : {1} {2}", data.Exchange, data.Name, data.Commodity));
                }

                if (islast == true)
                {
                    EventProcessor.BeginInvoke(this.trader.QueryCommodityResponse, this.trader, new EsunnyEventArgs <List <TEsCommodityRspField> >(this.trader.commodityList));
                }
            }
Exemplo n.º 10
0
            void OnLogin(TEsRspField rsp)
            {
                if (rsp.ErrorCode == 0)
                {
                    this.trader.isLogin = true;

                    StringBuilder s = new StringBuilder();
                    EsunnyWrapper.InvokeAPI(this.trader._instance, EsunnyWrapperAction.GetTradingDay, s);

                    Trace.WriteLine("交易日:" + s);
                }
                else
                {
                    PInvokeUtility.GetUnicodeString(rsp.ErrorInfo);
                    this.trader.isLogin = false;
                }


                EventProcessor.BeginInvoke(this.trader.LoginResponse, this.trader, new EsunnyEventArgs <TEsRspField>(rsp));
            }
Exemplo n.º 11
0
            /// <summary>
            /// 资金变化应答
            /// </summary>
            /// <param name="rsp"></param>
            void OnReturnMoney(TEsMoneyRspField rsp)
            {
                Trace.WriteLine(string.Format("【资金变化应答】{0} : {1} {2}", rsp.TBalance, rsp.TAvailable, rsp.FloatProfit));

                EventProcessor.BeginInvoke(this.trader.ReturnMoneyResponse, this.trader, new EsunnyEventArgs <TEsMoneyRspField>(rsp));
            }
Exemplo n.º 12
0
 /// <summary>
 /// 市场状态变化应答
 /// </summary>
 /// <param name="rsp"></param>
 void OnReturnExchangeState(TEsExchangeStateRspField rsp)
 {
     EventProcessor.BeginInvoke(this.trader.ReturnExchangeStateResponse, this.trader, new EsunnyEventArgs <TEsExchangeStateRspField>(rsp));
 }
Exemplo n.º 13
0
 /// <summary>
 /// 持仓变化应答
 /// </summary>
 /// <param name="rsp"></param>
 void OnReturnHold(TEsHoldRspField rsp)
 {
     Trace.WriteLine(string.Format("【持仓变化应答】{0} : {1} {2}", rsp.Contract1, rsp.HoldPrice, rsp.HoldVol));
     EventProcessor.BeginInvoke(this.trader.ReturnHoldResponse, this.trader, new EsunnyEventArgs <TEsHoldRspField>(rsp));
 }
Exemplo n.º 14
0
 /// <summary>
 /// 成交变化应答
 /// </summary>
 /// <param name="rsp"></param>
 void OnReturnMatch(TEsMatchRspField rsp)
 {
     Trace.WriteLine(string.Format("【成交查询应答】{0} : {1} {2}", rsp.Contract, rsp.MatchPrice, rsp.MatchVol));
     EventProcessor.BeginInvoke(this.trader.ReturnMatchResponse, this.trader, new EsunnyEventArgs <TEsMatchRspField>(rsp));
 }
Exemplo n.º 15
0
            /// <summary>
            /// 委托变化应答
            /// </summary>
            /// <param name="rsp"></param>
            void OnReturnOrder(TEsOrderInsertRspField rsp)
            {
                Trace.WriteLine(string.Format("【委托变化应答】{0} : {1} {2}", rsp.ReqData.Contract1, rsp.OrderState, rsp.MatchVol));

                EventProcessor.BeginInvoke(this.trader.ReturnOrderResponse, this.trader, new EsunnyEventArgs <TEsOrderInsertRspField>(rsp));
            }
Exemplo n.º 16
0
 void OnQuote(TEsQuoteRspField rsp)
 {
     Trace.WriteLine(string.Format("行情:{0} {1}", rsp.Contract, rsp.New));
     EventProcessor.BeginInvoke(this._esunnyQuote.QuoteResponse, this._esunnyQuote, new EsunnyEventArgs <TEsQuoteRspField>(rsp));
 }
Exemplo n.º 17
0
 void OnCombinQuote(TEsCmbQuoteRspField rsp)
 {
     EventProcessor.BeginInvoke(this._esunnyQuote.CombinQuoteResponse, this._esunnyQuote, new EsunnyEventArgs <TEsCmbQuoteRspField>(rsp));
 }
Exemplo n.º 18
0
 /// <summary>
 /// 修改密码应答
 /// </summary>
 /// <param name="rsp"></param>
 void OnSetPass(TEsRspField rsp)
 {
     EventProcessor.BeginInvoke(this.trader.SetPassResponse, this.trader, new EsunnyEventArgs <TEsRspField>(rsp));
 }