forked from QuantBox/QuantBox_XAPI
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathXApi.Instrument.cs
42 lines (34 loc) · 1.32 KB
/
XApi.Instrument.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
using QuantBox.XAPI.Interface;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.InteropServices;
using System.Text;
namespace QuantBox.XAPI.Callback
{
public partial class XApi:IXInstrument
{
public DelegateOnRspQryInstrument OnRspQryInstrument
{
get { return OnRspQryInstrument_; }
set { OnRspQryInstrument_ = value; }
}
private DelegateOnRspQryInstrument OnRspQryInstrument_;
public void ReqQryInstrument(string szInstrument, string szExchange)
{
IntPtr szInstrumentPtr = Marshal.StringToHGlobalAnsi(szInstrument);
IntPtr szExchangePtr = Marshal.StringToHGlobalAnsi(szExchange);
proxy.XRequest((byte)RequestType.ReqQryInstrument, Handle, IntPtr.Zero, 0, 0,
szInstrumentPtr, 0, szExchangePtr, 0, IntPtr.Zero, 0);
Marshal.FreeHGlobal(szInstrumentPtr);
Marshal.FreeHGlobal(szExchangePtr);
}
private void _OnRspQryInstrument(IntPtr ptr1,int size1, double double1)
{
if (OnRspQryInstrument_ == null)
return;
InstrumentField obj = PInvokeUtility.GetObjectFromIntPtr<InstrumentField>(ptr1);
OnRspQryInstrument_(this, ref obj, size1, double1 != 0);
}
}
}