private static void QryInstrumentDepthMarketData(TraderAdapter trader) { try { foreach (var kv in Utils.InstrumentToInstrumentInfo) { Thread.Sleep(1000); Utils.WriteLine(string.Format("查询{0}...", kv.Key)); var ins = new ThostFtdcQryDepthMarketDataField { InstrumentID = kv.Key }; trader.ReqQryDepthMarketData(ins, TraderAdapter.RequestId++); } Utils.WriteLine("查询合约详情完毕!!!"); Thread.Sleep(1000); } catch (Exception ex) { Utils.WriteException(ex); } }
private void btnQryMktData_Click(object sender, EventArgs e) { if (TraderApi != null && !string.IsNullOrEmpty(txtQryMktData.Text)) { var req = new ThostFtdcQryDepthMarketDataField(); req.InstrumentID = txtQryMktData.Text; req.ExchangeID = ""; TraderApi.ReqQryDepthMarketData(req, ++this.iRequestID); } }
/// <summary> ///请求查询行情 /// </summary> public int ReqQryDepthMarketData(ThostFtdcQryDepthMarketDataField pQryDepthMarketData, int nRequestID) { return(Interop.TdReqQryDepthMarketData(Handle, pQryDepthMarketData, nRequestID)); }
public static extern int TdReqQryDepthMarketData(IntPtr pApi, ThostFtdcQryDepthMarketDataField pQryDepthMarketData, int nRequestID);
/// <summary> /// 请求查询行情 /// </summary> void ReqQryDepthMarketData() { ThostFtdcQryDepthMarketDataField req = new ThostFtdcQryDepthMarketDataField(); req.InstrumentID = INSTRUMENT_ID; int iResult = api.ReqQryDepthMarketData(req, ++iRequestID); Console.WriteLine("--->>> 请求查询行情: " + ((iResult == 0) ? "成功" : "失败")); }