@@ -12,48 +12,46 @@ public partial class XApi
12
12
public DelegateOnRspQryHistoricalTicks OnRspQryHistoricalTicks ;
13
13
public DelegateOnRspQryHistoricalBars OnRspQryHistoricalBars ;
14
14
15
- public void ReqQryHistoricalTicks ( string szInstrument , string szExchange , int datetime1 , int datetime2 )
15
+ public void ReqQryHistoricalTicks ( ref HistoricalDataRequestField request )
16
16
{
17
- IntPtr szInstrumentPtr = Marshal . StringToHGlobalAnsi ( szInstrument ) ;
18
- IntPtr szExchangePtr = Marshal . StringToHGlobalAnsi ( szExchange ) ;
17
+ IntPtr ptr = Marshal . AllocHGlobal ( Marshal . SizeOf ( typeof ( HistoricalDataRequestField ) ) ) ;
18
+ Marshal . StructureToPtr ( request , ptr , false ) ;
19
19
20
20
proxy . XRequest ( ( byte ) RequestType . ReqQryHistoricalTicks , Handle , IntPtr . Zero , 0 , 0 ,
21
- szInstrumentPtr , datetime1 , szExchangePtr , datetime2 , IntPtr . Zero , 0 ) ;
21
+ ptr , 0 , IntPtr . Zero , 0 , IntPtr . Zero , 0 ) ;
22
22
23
- Marshal . FreeHGlobal ( szInstrumentPtr ) ;
24
- Marshal . FreeHGlobal ( szExchangePtr ) ;
23
+ Marshal . FreeHGlobal ( ptr ) ;
25
24
}
26
25
27
- public void ReqQryHistoricalBars ( string szInstrument , string szExchange , int datetime1 , int datetime2 , long barSize )
26
+ public void ReqQryHistoricalBars ( ref HistoricalDataRequestField request )
28
27
{
29
- IntPtr szInstrumentPtr = Marshal . StringToHGlobalAnsi ( szInstrument ) ;
30
- IntPtr szExchangePtr = Marshal . StringToHGlobalAnsi ( szExchange ) ;
28
+ IntPtr ptr = Marshal . AllocHGlobal ( Marshal . SizeOf ( typeof ( HistoricalDataRequestField ) ) ) ;
29
+ Marshal . StructureToPtr ( request , ptr , false ) ;
31
30
32
- proxy . XRequest ( ( byte ) RequestType . ReqQryHistoricalBars , Handle , IntPtr . Zero , barSize , 0 ,
33
- szInstrumentPtr , datetime1 , szExchangePtr , datetime2 , IntPtr . Zero , 0 ) ;
31
+ proxy . XRequest ( ( byte ) RequestType . ReqQryHistoricalBars , Handle , IntPtr . Zero , 0 , 0 ,
32
+ ptr , 0 , IntPtr . Zero , 0 , IntPtr . Zero , 0 ) ;
34
33
35
- Marshal . FreeHGlobal ( szInstrumentPtr ) ;
36
- Marshal . FreeHGlobal ( szExchangePtr ) ;
34
+ Marshal . FreeHGlobal ( ptr ) ;
37
35
}
38
36
39
37
40
- private void _OnRspQryHistoricalTicks ( IntPtr ptr1 , int size1 , double double1 )
38
+ private void _OnRspQryHistoricalTicks ( IntPtr ptr1 , int size1 , double double1 , double double2 )
41
39
{
42
40
if ( OnRspQryHistoricalTicks == null )
43
41
return ;
44
42
45
43
DepthMarketDataField obj = PInvokeUtility . GetObjectFromIntPtr < DepthMarketDataField > ( ptr1 ) ;
46
44
47
- OnRspQryHistoricalTicks ( this , ref obj , size1 , double1 != 0 ) ;
45
+ OnRspQryHistoricalTicks ( this , ref obj , size1 , double1 != 0 , ( int ) double2 ) ;
48
46
}
49
- private void _OnRspQryHistoricalBars ( IntPtr ptr1 , int size1 , double double1 )
47
+ private void _OnRspQryHistoricalBars ( IntPtr ptr1 , int size1 , double double1 , double double2 )
50
48
{
51
49
if ( OnRspQryHistoricalBars == null )
52
50
return ;
53
51
54
52
BarField obj = PInvokeUtility . GetObjectFromIntPtr < BarField > ( ptr1 ) ;
55
53
56
- OnRspQryHistoricalBars ( this , ref obj , size1 , double1 != 0 ) ;
54
+ OnRspQryHistoricalBars ( this , ref obj , size1 , double1 != 0 , ( int ) double2 ) ;
57
55
}
58
56
}
59
57
}
0 commit comments