-
Notifications
You must be signed in to change notification settings - Fork 2
/
gen_md_spi.go
216 lines (198 loc) · 8.71 KB
/
gen_md_spi.go
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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
// This file was automatically generated by ctpgen
package ctp
/*
#include <stdint.h>
#include "gen_types.h"
*/
import "C"
import "fmt"
type CThostFtdcMdSpi interface {
OnFrontConnected()
OnFrontDisconnected(nReason int)
OnHeartBeatWarning(nTimeLapse int)
OnRspUserLogin(pRspUserLogin *CThostFtdcRspUserLoginField, pRspInfo *CThostFtdcRspInfoField, nRequestID int, bIsLast bool)
OnRspUserLogout(pUserLogout *CThostFtdcUserLogoutField, pRspInfo *CThostFtdcRspInfoField, nRequestID int, bIsLast bool)
OnRspQryMulticastInstrument(pMulticastInstrument *CThostFtdcMulticastInstrumentField, pRspInfo *CThostFtdcRspInfoField, nRequestID int, bIsLast bool)
OnRspError(pRspInfo *CThostFtdcRspInfoField, nRequestID int, bIsLast bool)
OnRspSubMarketData(pSpecificInstrument *CThostFtdcSpecificInstrumentField, pRspInfo *CThostFtdcRspInfoField, nRequestID int, bIsLast bool)
OnRspUnSubMarketData(pSpecificInstrument *CThostFtdcSpecificInstrumentField, pRspInfo *CThostFtdcRspInfoField, nRequestID int, bIsLast bool)
OnRspSubForQuoteRsp(pSpecificInstrument *CThostFtdcSpecificInstrumentField, pRspInfo *CThostFtdcRspInfoField, nRequestID int, bIsLast bool)
OnRspUnSubForQuoteRsp(pSpecificInstrument *CThostFtdcSpecificInstrumentField, pRspInfo *CThostFtdcRspInfoField, nRequestID int, bIsLast bool)
OnRtnDepthMarketData(pDepthMarketData *CThostFtdcDepthMarketDataField)
OnRtnForQuoteRsp(pForQuoteRsp *CThostFtdcForQuoteRspField)
}
type CThostFtdcMdSpiBase struct {
}
func (b *CThostFtdcMdSpiBase) OnFrontConnected() {
fmt.Println("OnFrontConnected")
}
func (b *CThostFtdcMdSpiBase) OnFrontDisconnected(nReason int) {
fmt.Println("OnFrontDisconnected")
}
func (b *CThostFtdcMdSpiBase) OnHeartBeatWarning(nTimeLapse int) {
fmt.Println("OnHeartBeatWarning")
}
func (b *CThostFtdcMdSpiBase) OnRspUserLogin(pRspUserLogin *CThostFtdcRspUserLoginField, pRspInfo *CThostFtdcRspInfoField, nRequestID int, bIsLast bool) {
fmt.Println("OnRspUserLogin")
}
func (b *CThostFtdcMdSpiBase) OnRspUserLogout(pUserLogout *CThostFtdcUserLogoutField, pRspInfo *CThostFtdcRspInfoField, nRequestID int, bIsLast bool) {
fmt.Println("OnRspUserLogout")
}
func (b *CThostFtdcMdSpiBase) OnRspQryMulticastInstrument(pMulticastInstrument *CThostFtdcMulticastInstrumentField, pRspInfo *CThostFtdcRspInfoField, nRequestID int, bIsLast bool) {
fmt.Println("OnRspQryMulticastInstrument")
}
func (b *CThostFtdcMdSpiBase) OnRspError(pRspInfo *CThostFtdcRspInfoField, nRequestID int, bIsLast bool) {
fmt.Println("OnRspError")
}
func (b *CThostFtdcMdSpiBase) OnRspSubMarketData(pSpecificInstrument *CThostFtdcSpecificInstrumentField, pRspInfo *CThostFtdcRspInfoField, nRequestID int, bIsLast bool) {
fmt.Println("OnRspSubMarketData")
}
func (b *CThostFtdcMdSpiBase) OnRspUnSubMarketData(pSpecificInstrument *CThostFtdcSpecificInstrumentField, pRspInfo *CThostFtdcRspInfoField, nRequestID int, bIsLast bool) {
fmt.Println("OnRspUnSubMarketData")
}
func (b *CThostFtdcMdSpiBase) OnRspSubForQuoteRsp(pSpecificInstrument *CThostFtdcSpecificInstrumentField, pRspInfo *CThostFtdcRspInfoField, nRequestID int, bIsLast bool) {
fmt.Println("OnRspSubForQuoteRsp")
}
func (b *CThostFtdcMdSpiBase) OnRspUnSubForQuoteRsp(pSpecificInstrument *CThostFtdcSpecificInstrumentField, pRspInfo *CThostFtdcRspInfoField, nRequestID int, bIsLast bool) {
fmt.Println("OnRspUnSubForQuoteRsp")
}
func (b *CThostFtdcMdSpiBase) OnRtnDepthMarketData(pDepthMarketData *CThostFtdcDepthMarketDataField) {
fmt.Println("OnRtnDepthMarketData")
}
func (b *CThostFtdcMdSpiBase) OnRtnForQuoteRsp(pForQuoteRsp *CThostFtdcForQuoteRspField) {
fmt.Println("OnRtnForQuoteRsp")
}
func getCThostFtdcMdSpi(ptr uint64) CThostFtdcMdSpi {
value := getGoPtr(ptr)
if value == nil {
return nil
}
v := value.(CThostFtdcMdSpi)
return v
}
//export mdOnFrontConnected
func mdOnFrontConnected(ptr uint64) {
p := getCThostFtdcMdSpi(ptr)
if p != nil {
p.OnFrontConnected()
}
}
//export mdOnFrontDisconnected
func mdOnFrontDisconnected(ptr uint64, nReason int) {
p := getCThostFtdcMdSpi(ptr)
if p != nil {
gonReason := int(nReason)
p.OnFrontDisconnected(gonReason)
}
}
//export mdOnHeartBeatWarning
func mdOnHeartBeatWarning(ptr uint64, nTimeLapse int) {
p := getCThostFtdcMdSpi(ptr)
if p != nil {
gonTimeLapse := int(nTimeLapse)
p.OnHeartBeatWarning(gonTimeLapse)
}
}
//export mdOnRspUserLogin
func mdOnRspUserLogin(ptr uint64, pRspUserLogin *C.CThostFtdcRspUserLoginField, pRspInfo *C.CThostFtdcRspInfoField, nRequestID int, bIsLast C.int8_t) {
p := getCThostFtdcMdSpi(ptr)
if p != nil {
gopRspUserLogin := NewCThostFtdcRspUserLoginField(pRspUserLogin)
gopRspInfo := NewCThostFtdcRspInfoField(pRspInfo)
gonRequestID := int(nRequestID)
gobIsLast := c2goBool(bIsLast)
p.OnRspUserLogin(gopRspUserLogin, gopRspInfo, gonRequestID, gobIsLast)
}
}
//export mdOnRspUserLogout
func mdOnRspUserLogout(ptr uint64, pUserLogout *C.CThostFtdcUserLogoutField, pRspInfo *C.CThostFtdcRspInfoField, nRequestID int, bIsLast C.int8_t) {
p := getCThostFtdcMdSpi(ptr)
if p != nil {
gopUserLogout := NewCThostFtdcUserLogoutField(pUserLogout)
gopRspInfo := NewCThostFtdcRspInfoField(pRspInfo)
gonRequestID := int(nRequestID)
gobIsLast := c2goBool(bIsLast)
p.OnRspUserLogout(gopUserLogout, gopRspInfo, gonRequestID, gobIsLast)
}
}
//export mdOnRspQryMulticastInstrument
func mdOnRspQryMulticastInstrument(ptr uint64, pMulticastInstrument *C.CThostFtdcMulticastInstrumentField, pRspInfo *C.CThostFtdcRspInfoField, nRequestID int, bIsLast C.int8_t) {
p := getCThostFtdcMdSpi(ptr)
if p != nil {
gopMulticastInstrument := NewCThostFtdcMulticastInstrumentField(pMulticastInstrument)
gopRspInfo := NewCThostFtdcRspInfoField(pRspInfo)
gonRequestID := int(nRequestID)
gobIsLast := c2goBool(bIsLast)
p.OnRspQryMulticastInstrument(gopMulticastInstrument, gopRspInfo, gonRequestID, gobIsLast)
}
}
//export mdOnRspError
func mdOnRspError(ptr uint64, pRspInfo *C.CThostFtdcRspInfoField, nRequestID int, bIsLast C.int8_t) {
p := getCThostFtdcMdSpi(ptr)
if p != nil {
gopRspInfo := NewCThostFtdcRspInfoField(pRspInfo)
gonRequestID := int(nRequestID)
gobIsLast := c2goBool(bIsLast)
p.OnRspError(gopRspInfo, gonRequestID, gobIsLast)
}
}
//export mdOnRspSubMarketData
func mdOnRspSubMarketData(ptr uint64, pSpecificInstrument *C.CThostFtdcSpecificInstrumentField, pRspInfo *C.CThostFtdcRspInfoField, nRequestID int, bIsLast C.int8_t) {
p := getCThostFtdcMdSpi(ptr)
if p != nil {
gopSpecificInstrument := NewCThostFtdcSpecificInstrumentField(pSpecificInstrument)
gopRspInfo := NewCThostFtdcRspInfoField(pRspInfo)
gonRequestID := int(nRequestID)
gobIsLast := c2goBool(bIsLast)
p.OnRspSubMarketData(gopSpecificInstrument, gopRspInfo, gonRequestID, gobIsLast)
}
}
//export mdOnRspUnSubMarketData
func mdOnRspUnSubMarketData(ptr uint64, pSpecificInstrument *C.CThostFtdcSpecificInstrumentField, pRspInfo *C.CThostFtdcRspInfoField, nRequestID int, bIsLast C.int8_t) {
p := getCThostFtdcMdSpi(ptr)
if p != nil {
gopSpecificInstrument := NewCThostFtdcSpecificInstrumentField(pSpecificInstrument)
gopRspInfo := NewCThostFtdcRspInfoField(pRspInfo)
gonRequestID := int(nRequestID)
gobIsLast := c2goBool(bIsLast)
p.OnRspUnSubMarketData(gopSpecificInstrument, gopRspInfo, gonRequestID, gobIsLast)
}
}
//export mdOnRspSubForQuoteRsp
func mdOnRspSubForQuoteRsp(ptr uint64, pSpecificInstrument *C.CThostFtdcSpecificInstrumentField, pRspInfo *C.CThostFtdcRspInfoField, nRequestID int, bIsLast C.int8_t) {
p := getCThostFtdcMdSpi(ptr)
if p != nil {
gopSpecificInstrument := NewCThostFtdcSpecificInstrumentField(pSpecificInstrument)
gopRspInfo := NewCThostFtdcRspInfoField(pRspInfo)
gonRequestID := int(nRequestID)
gobIsLast := c2goBool(bIsLast)
p.OnRspSubForQuoteRsp(gopSpecificInstrument, gopRspInfo, gonRequestID, gobIsLast)
}
}
//export mdOnRspUnSubForQuoteRsp
func mdOnRspUnSubForQuoteRsp(ptr uint64, pSpecificInstrument *C.CThostFtdcSpecificInstrumentField, pRspInfo *C.CThostFtdcRspInfoField, nRequestID int, bIsLast C.int8_t) {
p := getCThostFtdcMdSpi(ptr)
if p != nil {
gopSpecificInstrument := NewCThostFtdcSpecificInstrumentField(pSpecificInstrument)
gopRspInfo := NewCThostFtdcRspInfoField(pRspInfo)
gonRequestID := int(nRequestID)
gobIsLast := c2goBool(bIsLast)
p.OnRspUnSubForQuoteRsp(gopSpecificInstrument, gopRspInfo, gonRequestID, gobIsLast)
}
}
//export mdOnRtnDepthMarketData
func mdOnRtnDepthMarketData(ptr uint64, pDepthMarketData *C.CThostFtdcDepthMarketDataField) {
p := getCThostFtdcMdSpi(ptr)
if p != nil {
gopDepthMarketData := NewCThostFtdcDepthMarketDataField(pDepthMarketData)
p.OnRtnDepthMarketData(gopDepthMarketData)
}
}
//export mdOnRtnForQuoteRsp
func mdOnRtnForQuoteRsp(ptr uint64, pForQuoteRsp *C.CThostFtdcForQuoteRspField) {
p := getCThostFtdcMdSpi(ptr)
if p != nil {
gopForQuoteRsp := NewCThostFtdcForQuoteRspField(pForQuoteRsp)
p.OnRtnForQuoteRsp(gopForQuoteRsp)
}
}