gitee.com/haifengat/gotap_dipper@v0.0.4-0.20231212021028-041a6fa876e5/trade/trade_lnx.go (about)

     1  package trade
     2  
     3  /*
     4  #cgo CPPFLAGS: -fPIC -I./
     5  #cgo linux LDFLAGS: -fPIC -L${SRCDIR}/../lib -Wl,-rpath ${SRCDIR}/../lib -ltaptrade -lstdc++
     6  
     7  #include "struct_cgo.h"
     8  
     9  void* CreateITapTradeAPINotify();
    10  void* CreateTradeAPI(struct TapAPIApplicationInfo *appInfo, int *res);
    11  void FreeITapTradeAPI(void* api);
    12  void* GetAPIVersion();
    13  void* GetErrorDescribe(int errorCode);
    14  
    15  // ********************** 调用函数 ******************
    16  int SetAPINotify(void* api,void  *pSpi);
    17  int SetHostAddress(void* api,char *IP,unsigned short port);
    18  int Login(void* api,struct TapAPITradeLoginAuth *loginAuth);
    19  int RequestVertificateCode(void* api,unsigned int *sessionID,char * ContactInfo);
    20  int SetVertificateCode(void* api,unsigned int *sessionID,struct TapAPISecondCertificationReq *req);
    21  int Disconnect(void* api);
    22  int ChangePassword(void* api,unsigned int *sessionID,struct TapAPIChangePasswordReq *req);
    23  int AuthPassword(void* api,unsigned int *sessionID,struct TapAPIAuthPasswordReq *req);
    24  int HaveCertainRight(void* api,int rightID);
    25  int QryTradingDate(void* api,unsigned int *sessionID);
    26  int SetReservedInfo(void* api,unsigned int *sessionID,char * info);
    27  int QryAccount(void* api,unsigned int *sessionID,struct TapAPIAccQryReq *qryReq);
    28  int QryFund(void* api,unsigned int *sessionID,struct TapAPIFundReq *qryReq);
    29  int QryExchange(void* api,unsigned int *sessionID);
    30  int QryCommodity(void* api,unsigned int *sessionID);
    31  int QryContract(void* api,unsigned int *sessionID,struct TapAPICommodity *qryReq);
    32  int InsertOrder(void* api,unsigned int *sessionID,char *ClientOrderNo,struct TapAPINewOrder *order);
    33  int CancelOrder(void* api,unsigned int *sessionID,struct TapAPIOrderCancelReq *order);
    34  int AmendOrder(void* api,unsigned int *sessionID,struct TapAPIAmendOrder *order);
    35  int ActivateOrder(void* api,unsigned int * sessionID,struct TapAPIOrderCancelReq * order);
    36  int QryOrder(void* api,unsigned int *sessionID,struct TapAPIOrderQryReq *qryReq);
    37  int QryOrderProcess(void* api,unsigned int *sessionID,struct TapAPIOrderProcessQryReq *qryReq);
    38  int QryFill(void* api,unsigned int *sessionID,struct TapAPIFillQryReq *qryReq);
    39  int QryPosition(void* api,unsigned int *sessionID,struct TapAPIPositionQryReq *qryReq);
    40  int QryPositionSummary(void* api,unsigned int *sessionID,struct TapAPIPositionQryReq *qryReq);
    41  int QryCurrency(void* api,unsigned int *sessionID);
    42  int QryAccountCashAdjust(void* api,unsigned int *sessionID,struct TapAPIAccountCashAdjustQryReq *qryReq);
    43  int QryTradeMessage(void* api,unsigned int *sessionID,struct TapAPITradeMessageReq *qryReq);
    44  int QryBill(void* api,unsigned int *sessionID,struct TapAPIBillQryReq *qryReq);
    45  int QryHisOrder(void* api,unsigned int *sessionID,struct TapAPIHisOrderQryReq *qryReq);
    46  int QryHisOrderProcess(void* api,unsigned int *sessionID,struct TapAPIHisOrderProcessQryReq *qryReq);
    47  int QryHisMatch(void* api,unsigned int *sessionID,struct TapAPIHisMatchQryReq *qryReq);
    48  int QryHisPosition(void* api,unsigned int *sessionID,struct TapAPIHisPositionQryReq *qryReq);
    49  int QryHisDelivery(void* api,unsigned int *sessionID,struct TapAPIHisDeliveryQryReq *qryReq);
    50  int QryAccountFeeRent(void* api,unsigned int *sessionID,struct TapAPIAccountFeeRentQryReq *qryReq);
    51  int QryAccountMarginRent(void* api,unsigned int *sessionID,struct TapAPIAccountMarginRentQryReq *qryReq);
    52  int InsertHKMarketOrder(void* api,unsigned int *sessionID,char *ClientBuyOrderNo,char *ClientSellOrderNo,struct TapAPIOrderMarketInsertReq *order);
    53  int CancelHKMarketOrder(void* api,unsigned int *sessionID,struct TapAPIOrderMarketDeleteReq *order);
    54  int OrderLocalRemove(void* api,unsigned int *sessionID,struct TapAPIOrderLocalRemoveReq *order);
    55  int OrderLocalInput(void* api,unsigned int *sessionID,struct TapAPIOrderLocalInputReq *order);
    56  int OrderLocalModify(void* api,unsigned int *sessionID,struct TapAPIOrderLocalModifyReq *order);
    57  int OrderLocalTransfer(void* api,unsigned int *sessionID,struct TapAPIOrderLocalTransferReq *order);
    58  int FillLocalInput(void* api,unsigned int *sessionID,struct TapAPIFillLocalInputReq *fill);
    59  int FillLocalRemove(void* api,unsigned int *sessionID,struct TapAPIFillLocalRemoveReq *fill);
    60  int QrySpotLock(void* api,unsigned int *sessionID,struct TapAPISpotLockQryReq *qryReq);
    61  int SubmitUserLoginInfo(void* api,unsigned int *sessionID,struct TapAPISubmitUserLoginInfo *qryReq);
    62  int InsertSpecialOrder(void* api,unsigned int *sessionID,char *clientorderno,struct TapAPISpecialOrderInsertReq *order);
    63  int QrySpecialOrder(void* api,unsigned int *sessionID,struct TapAPISpecialOrderQryReq *qryReq);
    64  int QryCombinePosition(void* api,unsigned int *sessionID,struct TapAPICombinePositionQryReq *qryReq);
    65  int QryUserTrustDevice(void* api,unsigned int *sessionID,struct TapAPIUserTrustDeviceQryReq *qryReq);
    66  int AddUserTrustDevice(void* api,unsigned int *sessionID,struct TapAPIUserTrustDeviceAddReq *qryReq);
    67  int DelUserTrustDevice(void* api,unsigned int *sessionID,struct TapAPIUserTrustDeviceDelReq *qryReq);
    68  int QryIPOInfo(void* api,unsigned int *sessionID,struct TapAPIIPOInfoQryReq *qryReq);
    69  int QryIPOStockQty(void* api,unsigned int *sessionID,struct TapAPIAvailableApplyQryReq *qryReq);
    70  int QryAccountIPO(void* api,unsigned int *sessionID,struct TapAPIAccountIPOQryReq *qryReq);
    71  int AddAccountIPO(void* api,unsigned int *sessionID,struct TapAPIAccountIPOAddReq *qryReq);
    72  int CancelAccountIPO(void* api,unsigned int *sessionID,struct TapAPIAccountIPOCancelReq *qryReq);
    73  int UnFreeze(void* api,struct TapAPITradeLoginAuth *loginAuth);
    74  int VerificateUnFreezeInfo(void* api,unsigned int *sessionID,struct TapAPIVerifyIdentityReq *qryReq);
    75  
    76  
    77  
    78  // ********************** 响应函数 ******************
    79  void SetOnConnect(void*, void*);
    80  void SetOnRspLogin(void*, void*);
    81  void SetOnRtnContactInfo(void*, void*);
    82  void SetOnRspRequestVertificateCode(void*, void*);
    83  void SetOnExpriationDate(void*, void*);
    84  void SetOnAPIReady(void*, void*);
    85  void SetOnDisconnect(void*, void*);
    86  void SetOnRspChangePassword(void*, void*);
    87  void SetOnRspAuthPassword(void*, void*);
    88  void SetOnRspQryTradingDate(void*, void*);
    89  void SetOnRspSetReservedInfo(void*, void*);
    90  void SetOnRspQryAccount(void*, void*);
    91  void SetOnRspQryFund(void*, void*);
    92  void SetOnRtnFund(void*, void*);
    93  void SetOnRspQryExchange(void*, void*);
    94  void SetOnRspQryCommodity(void*, void*);
    95  void SetOnRspQryContract(void*, void*);
    96  void SetOnRtnContract(void*, void*);
    97  void SetOnRspOrderAction(void*, void*);
    98  void SetOnRtnOrder(void*, void*);
    99  void SetOnRspQryOrder(void*, void*);
   100  void SetOnRspQryOrderProcess(void*, void*);
   101  void SetOnRspQryFill(void*, void*);
   102  void SetOnRtnFill(void*, void*);
   103  void SetOnRspQryPosition(void*, void*);
   104  void SetOnRtnPosition(void*, void*);
   105  void SetOnRspQryPositionSummary(void*, void*);
   106  void SetOnRtnPositionSummary(void*, void*);
   107  void SetOnRtnPositionProfit(void*, void*);
   108  void SetOnRspQryCurrency(void*, void*);
   109  void SetOnRspQryTradeMessage(void*, void*);
   110  void SetOnRtnTradeMessage(void*, void*);
   111  void SetOnRspQryHisOrder(void*, void*);
   112  void SetOnRspQryHisOrderProcess(void*, void*);
   113  void SetOnRspQryHisMatch(void*, void*);
   114  void SetOnRspQryHisPosition(void*, void*);
   115  void SetOnRspQryHisDelivery(void*, void*);
   116  void SetOnRspQryAccountCashAdjust(void*, void*);
   117  void SetOnRspQryBill(void*, void*);
   118  void SetOnRspQryAccountFeeRent(void*, void*);
   119  void SetOnRspQryAccountMarginRent(void*, void*);
   120  void SetOnRspHKMarketOrderInsert(void*, void*);
   121  void SetOnRspHKMarketOrderDelete(void*, void*);
   122  void SetOnHKMarketQuoteNotice(void*, void*);
   123  void SetOnRspOrderLocalRemove(void*, void*);
   124  void SetOnRspOrderLocalInput(void*, void*);
   125  void SetOnRspOrderLocalModify(void*, void*);
   126  void SetOnRspOrderLocalTransfer(void*, void*);
   127  void SetOnRspFillLocalInput(void*, void*);
   128  void SetOnRspFillLocalRemove(void*, void*);
   129  void SetOnRspQrySpotLock(void*, void*);
   130  void SetOnRtnSpotLock(void*, void*);
   131  void SetOnRspSubmitUserLoginInfo(void*, void*);
   132  void SetOnRspSpecialOrderAction(void*, void*);
   133  void SetOnRtnSpecialOrder(void*, void*);
   134  void SetOnRspQrySpecialOrder(void*, void*);
   135  void SetOnRspQryCombinePosition(void*, void*);
   136  void SetOnRtnCombinePosition(void*, void*);
   137  
   138  
   139  // Onxxx 为go 的 export所用
   140  void exOnConnect( char * HostAddress);
   141  void exOnRspLogin( int errorCode,  struct TapAPITradeLoginRspInfo *loginRspInfo);
   142  void exOnRtnContactInfo( int errorCode,  char isLast,  char * ContactInfo);
   143  void exOnRspRequestVertificateCode( unsigned int sessionID,  int errorCode,  struct TapAPIRequestVertificateCodeRsp *rsp);
   144  void exOnExpriationDate( char * date,  int days);
   145  void exOnAPIReady( int errorCode);
   146  void exOnDisconnect( int reasonCode);
   147  void exOnRspChangePassword( unsigned int sessionID,  int errorCode);
   148  void exOnRspAuthPassword( unsigned int sessionID,  int errorCode);
   149  void exOnRspQryTradingDate( unsigned int sessionID,  int errorCode,  struct TapAPITradingCalendarQryRsp *info);
   150  void exOnRspSetReservedInfo( unsigned int sessionID,  int errorCode,  char * info);
   151  void exOnRspQryAccount( unsigned int sessionID,  unsigned int errorCode,  char isLast,  struct TapAPIAccountInfo *info);
   152  void exOnRspQryFund( unsigned int sessionID,  int errorCode,  char isLast,  struct TapAPIFundData *info);
   153  void exOnRtnFund( struct TapAPIFundData *info);
   154  void exOnRspQryExchange( unsigned int sessionID,  int errorCode,  char isLast,  struct TapAPIExchangeInfo *info);
   155  void exOnRspQryCommodity( unsigned int sessionID,  int errorCode,  char isLast,  struct TapAPICommodityInfo *info);
   156  void exOnRspQryContract( unsigned int sessionID,  int errorCode,  char isLast,  struct TapAPITradeContractInfo *info);
   157  void exOnRtnContract( struct TapAPITradeContractInfo *info);
   158  void exOnRspOrderAction( unsigned int sessionID,  int errorCode,  struct TapAPIOrderActionRsp *info);
   159  void exOnRtnOrder( struct TapAPIOrderInfoNotice *info);
   160  void exOnRspQryOrder( unsigned int sessionID,  int errorCode,  char isLast,  struct TapAPIOrderInfo *info);
   161  void exOnRspQryOrderProcess( unsigned int sessionID,  int errorCode,  char isLast,  struct TapAPIOrderInfo *info);
   162  void exOnRspQryFill( unsigned int sessionID,  int errorCode,  char isLast,  struct TapAPIFillInfo *info);
   163  void exOnRtnFill( struct TapAPIFillInfo *info);
   164  void exOnRspQryPosition( unsigned int sessionID,  int errorCode,  char isLast,  struct TapAPIPositionInfo *info);
   165  void exOnRtnPosition( struct TapAPIPositionInfo *info);
   166  void exOnRspQryPositionSummary( unsigned int sessionID,  int errorCode,  char isLast,  struct TapAPIPositionSummary *info);
   167  void exOnRtnPositionSummary( struct TapAPIPositionSummary *info);
   168  void exOnRtnPositionProfit( struct TapAPIPositionProfitNotice *info);
   169  void exOnRspQryCurrency( unsigned int sessionID,  int errorCode,  char isLast,  struct TapAPICurrencyInfo *info);
   170  void exOnRspQryTradeMessage( unsigned int sessionID,  int errorCode,  char isLast,  struct TapAPITradeMessage *info);
   171  void exOnRtnTradeMessage( struct TapAPITradeMessage *info);
   172  void exOnRspQryHisOrder( unsigned int sessionID,  int errorCode,  char isLast,  struct TapAPIHisOrderQryRsp *info);
   173  void exOnRspQryHisOrderProcess( unsigned int sessionID,  int errorCode,  char isLast,  struct TapAPIHisOrderProcessQryReq *info);
   174  void exOnRspQryHisMatch( unsigned int sessionID,  int errorCode,  char isLast,  struct TapAPIHisMatchQryRsp *info);
   175  void exOnRspQryHisPosition( unsigned int sessionID,  int errorCode,  char isLast,  struct TapAPIHisPositionQryRsp *info);
   176  void exOnRspQryHisDelivery( unsigned int sessionID,  int errorCode,  char isLast,  struct TapAPIHisDeliveryQryRsp *info);
   177  void exOnRspQryAccountCashAdjust( unsigned int sessionID,  int errorCode,  char isLast,  struct TapAPIAccountCashAdjustQryRsp *info);
   178  void exOnRspQryBill( unsigned int sessionID,  int errorCode,  char isLast,  struct TapAPIBillQryRsp *info);
   179  void exOnRspQryAccountFeeRent( unsigned int sessionID,  int errorCode,  char isLast,  struct TapAPIAccountFeeRentQryRsp *info);
   180  void exOnRspQryAccountMarginRent( unsigned int sessionID,  int errorCode,  char isLast,  struct TapAPIAccountMarginRentQryRsp *info);
   181  void exOnRspHKMarketOrderInsert( unsigned int sessionID,  int errorCode,  struct TapAPIOrderMarketInsertReq *info);
   182  void exOnRspHKMarketOrderDelete( unsigned int sessionID,  int errorCode,  struct TapAPIOrderMarketDeleteReq *info);
   183  void exOnHKMarketQuoteNotice( struct TapAPIOrderQuoteMarketNotice *info);
   184  void exOnRspOrderLocalRemove( unsigned int sessionID,  int errorCode,  struct TapAPIOrderLocalRemoveRsp *info);
   185  void exOnRspOrderLocalInput( unsigned int sessionID,  int errorCode,  struct TapAPIOrderLocalInputReq *info);
   186  void exOnRspOrderLocalModify( unsigned int sessionID,  int errorCode,  struct TapAPIOrderLocalModifyReq *info);
   187  void exOnRspOrderLocalTransfer( unsigned int sessionID,  int errorCode,  struct TapAPIOrderLocalTransferReq *info);
   188  void exOnRspFillLocalInput( unsigned int sessionID,  int errorCode,  struct TapAPIFillLocalInputReq *info);
   189  void exOnRspFillLocalRemove( unsigned int sessionID,  int errorCode,  struct TapAPIFillLocalRemoveReq *info);
   190  void exOnRspQrySpotLock( unsigned int sessionID,  int errorCode,  char isLast,  struct TapAPISpotLockDataRsp *info);
   191  void exOnRtnSpotLock( struct TapAPISpotLockDataRsp *info);
   192  void exOnRspSubmitUserLoginInfo( unsigned int sessionID,  int errorCode,  char isLast);
   193  void exOnRspSpecialOrderAction( unsigned int sessionID,  int errorCode,  struct TapAPISpecialOrderInfo *info);
   194  void exOnRtnSpecialOrder( struct TapAPISpecialOrderInfo *info);
   195  void exOnRspQrySpecialOrder( unsigned int sessionID,  int errorCode,  char isLast,  struct TapAPISpecialOrderInfo *info);
   196  void exOnRspQryCombinePosition( unsigned int sessionID,  int errorCode,  char isLast,  struct TapAPICombinePositionInfo *info);
   197  void exOnRtnCombinePosition( struct TapAPICombinePositionInfo *info);
   198  
   199  
   200  #include <stdlib.h>
   201  #include <stdint.h>
   202  */
   203  import "C"
   204  
   205  import (
   206  	"errors"
   207  	"fmt"
   208  	"io"
   209  	"strings"
   210  	"unsafe"
   211  
   212  	"golang.org/x/text/encoding/simplifiedchinese"
   213  	"golang.org/x/text/transform"
   214  )
   215  
   216  func GBK(chars *C.char) string {
   217  	rd := transform.NewReader(strings.NewReader(C.GoString(chars)), simplifiedchinese.GBK.NewDecoder())
   218  	bs, _ := io.ReadAll(rd)
   219  	return string(bs)
   220  }
   221  
   222  var t *Trade
   223  
   224  // NewTrade
   225  //
   226  //	@param appID 外盘:""
   227  //	@param authCode
   228  //	@return *Trade
   229  func NewTrade(appID, authCode string) (*Trade, error) {
   230  	if t != nil {
   231  		return t, nil
   232  	}
   233  	t = &Trade{}
   234  
   235  	ver := t.GetITapTradeAPIVersion()
   236  	fmt.Println("版本号:", ver)
   237  
   238  	app := TapAPIApplicationInfo{
   239  		// AuthCode: def.TAPIAUTHCODE(),
   240  		// LogLevel: def.APILOGLEVEL_DEBUG,
   241  	}
   242  	if len(appID) > 0 {
   243  		copy(app.APPID[:], []byte(appID))
   244  	}
   245  	copy(app.AuthCode[:], authCode)
   246  	copy(app.KeyOperationLogPath[:], "./tap_trade_log")
   247  	var res TAPIINT32
   248  	t.CreateITapTradeAPI(&app, &res)
   249  	if t.api == nil { // 创建api失败
   250  		return nil, errors.New(t.GetITapErrorDescribe(res))
   251  	}
   252  	t.CreateITapTradeAPINotify()
   253  
   254  	t.RegCallBack()
   255  	t.SetSpi()
   256  	return t, nil
   257  }
   258  
   259  // Trade 交易接口
   260  type Trade struct {
   261  	api, spi unsafe.Pointer
   262  	// 定义响应函数变量
   263  	OnConnect                   func(HostAddress string)
   264  	OnRspLogin                  func(errorCode TAPIINT32, loginRspInfo *TapAPITradeLoginRspInfo)
   265  	OnRtnContactInfo            func(errorCode TAPIINT32, isLast TAPIYNFLAG, ContactInfo string)
   266  	OnRspRequestVertificateCode func(sessionID TAPIUINT32, errorCode TAPIINT32, rsp *TapAPIRequestVertificateCodeRsp)
   267  	OnExpriationDate            func(date string, days int)
   268  	OnAPIReady                  func(errorCode TAPIINT32)
   269  	OnDisconnect                func(reasonCode TAPIINT32)
   270  	OnRspChangePassword         func(sessionID TAPIUINT32, errorCode TAPIINT32)
   271  	OnRspAuthPassword           func(sessionID TAPIUINT32, errorCode TAPIINT32)
   272  	OnRspQryTradingDate         func(sessionID TAPIUINT32, errorCode TAPIINT32, info *TapAPITradingCalendarQryRsp)
   273  	OnRspSetReservedInfo        func(sessionID TAPIUINT32, errorCode TAPIINT32, info string)
   274  	OnRspQryAccount             func(sessionID TAPIUINT32, errorCode TAPIUINT32, isLast TAPIYNFLAG, info *TapAPIAccountInfo)
   275  	OnRspQryFund                func(sessionID TAPIUINT32, errorCode TAPIINT32, isLast TAPIYNFLAG, info *TapAPIFundData)
   276  	OnRtnFund                   func(info *TapAPIFundData)
   277  	OnRspQryExchange            func(sessionID TAPIUINT32, errorCode TAPIINT32, isLast TAPIYNFLAG, info *TapAPIExchangeInfo)
   278  	OnRspQryCommodity           func(sessionID TAPIUINT32, errorCode TAPIINT32, isLast TAPIYNFLAG, info *TapAPICommodityInfo)
   279  	OnRspQryContract            func(sessionID TAPIUINT32, errorCode TAPIINT32, isLast TAPIYNFLAG, info *TapAPITradeContractInfo)
   280  	OnRtnContract               func(info *TapAPITradeContractInfo)
   281  	OnRspOrderAction            func(sessionID TAPIUINT32, errorCode TAPIINT32, info *TapAPIOrderActionRsp)
   282  	OnRtnOrder                  func(info *TapAPIOrderInfoNotice)
   283  	OnRspQryOrder               func(sessionID TAPIUINT32, errorCode TAPIINT32, isLast TAPIYNFLAG, info *TapAPIOrderInfo)
   284  	OnRspQryOrderProcess        func(sessionID TAPIUINT32, errorCode TAPIINT32, isLast TAPIYNFLAG, info *TapAPIOrderInfo)
   285  	OnRspQryFill                func(sessionID TAPIUINT32, errorCode TAPIINT32, isLast TAPIYNFLAG, info *TapAPIFillInfo)
   286  	OnRtnFill                   func(info *TapAPIFillInfo)
   287  	OnRspQryPosition            func(sessionID TAPIUINT32, errorCode TAPIINT32, isLast TAPIYNFLAG, info *TapAPIPositionInfo)
   288  	OnRtnPosition               func(info *TapAPIPositionInfo)
   289  	OnRspQryPositionSummary     func(sessionID TAPIUINT32, errorCode TAPIINT32, isLast TAPIYNFLAG, info *TapAPIPositionSummary)
   290  	OnRtnPositionSummary        func(info *TapAPIPositionSummary)
   291  	OnRtnPositionProfit         func(info *TapAPIPositionProfitNotice)
   292  	OnRspQryCurrency            func(sessionID TAPIUINT32, errorCode TAPIINT32, isLast TAPIYNFLAG, info *TapAPICurrencyInfo)
   293  	OnRspQryTradeMessage        func(sessionID TAPIUINT32, errorCode TAPIINT32, isLast TAPIYNFLAG, info *TapAPITradeMessage)
   294  	OnRtnTradeMessage           func(info *TapAPITradeMessage)
   295  	OnRspQryHisOrder            func(sessionID TAPIUINT32, errorCode TAPIINT32, isLast TAPIYNFLAG, info *TapAPIHisOrderQryRsp)
   296  	OnRspQryHisOrderProcess     func(sessionID TAPIUINT32, errorCode TAPIINT32, isLast TAPIYNFLAG, info *TapAPIHisOrderProcessQryReq)
   297  	OnRspQryHisMatch            func(sessionID TAPIUINT32, errorCode TAPIINT32, isLast TAPIYNFLAG, info *TapAPIHisMatchQryRsp)
   298  	OnRspQryHisPosition         func(sessionID TAPIUINT32, errorCode TAPIINT32, isLast TAPIYNFLAG, info *TapAPIHisPositionQryRsp)
   299  	OnRspQryHisDelivery         func(sessionID TAPIUINT32, errorCode TAPIINT32, isLast TAPIYNFLAG, info *TapAPIHisDeliveryQryRsp)
   300  	OnRspQryAccountCashAdjust   func(sessionID TAPIUINT32, errorCode TAPIINT32, isLast TAPIYNFLAG, info *TapAPIAccountCashAdjustQryRsp)
   301  	OnRspQryBill                func(sessionID TAPIUINT32, errorCode TAPIINT32, isLast TAPIYNFLAG, info *TapAPIBillQryRsp)
   302  	OnRspQryAccountFeeRent      func(sessionID TAPIUINT32, errorCode TAPIINT32, isLast TAPIYNFLAG, info *TapAPIAccountFeeRentQryRsp)
   303  	OnRspQryAccountMarginRent   func(sessionID TAPIUINT32, errorCode TAPIINT32, isLast TAPIYNFLAG, info *TapAPIAccountMarginRentQryRsp)
   304  	OnRspHKMarketOrderInsert    func(sessionID TAPIUINT32, errorCode TAPIINT32, info *TapAPIOrderMarketInsertReq)
   305  	OnRspHKMarketOrderDelete    func(sessionID TAPIUINT32, errorCode TAPIINT32, info *TapAPIOrderMarketDeleteReq)
   306  	OnHKMarketQuoteNotice       func(info *TapAPIOrderQuoteMarketNotice)
   307  	OnRspOrderLocalRemove       func(sessionID TAPIUINT32, errorCode TAPIINT32, info *TapAPIOrderLocalRemoveRsp)
   308  	OnRspOrderLocalInput        func(sessionID TAPIUINT32, errorCode TAPIINT32, info *TapAPIOrderLocalInputReq)
   309  	OnRspOrderLocalModify       func(sessionID TAPIUINT32, errorCode TAPIINT32, info *TapAPIOrderLocalModifyReq)
   310  	OnRspOrderLocalTransfer     func(sessionID TAPIUINT32, errorCode TAPIINT32, info *TapAPIOrderLocalTransferReq)
   311  	OnRspFillLocalInput         func(sessionID TAPIUINT32, errorCode TAPIINT32, info *TapAPIFillLocalInputReq)
   312  	OnRspFillLocalRemove        func(sessionID TAPIUINT32, errorCode TAPIINT32, info *TapAPIFillLocalRemoveReq)
   313  	OnRspQrySpotLock            func(sessionID TAPIUINT32, errorCode TAPIINT32, isLast TAPIYNFLAG, info *TapAPISpotLockDataRsp)
   314  	OnRtnSpotLock               func(info *TapAPISpotLockDataRsp)
   315  	OnRspSubmitUserLoginInfo    func(sessionID TAPIUINT32, errorCode TAPIINT32, isLast TAPIYNFLAG)
   316  	OnRspSpecialOrderAction     func(sessionID TAPIUINT32, errorCode TAPIINT32, info *TapAPISpecialOrderInfo)
   317  	OnRtnSpecialOrder           func(info *TapAPISpecialOrderInfo)
   318  	OnRspQrySpecialOrder        func(sessionID TAPIUINT32, errorCode TAPIINT32, isLast TAPIYNFLAG, info *TapAPISpecialOrderInfo)
   319  	OnRspQryCombinePosition     func(sessionID TAPIUINT32, errorCode TAPIINT32, isLast TAPIYNFLAG, info *TapAPICombinePositionInfo)
   320  	OnRtnCombinePosition        func(info *TapAPICombinePositionInfo)
   321  }
   322  
   323  func (t *Trade) CreateITapTradeAPINotify() {
   324  	t.spi = C.CreateITapTradeAPINotify()
   325  }
   326  func (t *Trade) CreateITapTradeAPI(appInfo *TapAPIApplicationInfo, res *TAPIINT32) {
   327  	t.api = C.CreateTradeAPI((*C.struct_TapAPIApplicationInfo)(unsafe.Pointer(appInfo)), (*C.int)(unsafe.Pointer(res)))
   328  }
   329  func (t *Trade) FreeITapTradeAPI(api unsafe.Pointer) {
   330  	C.FreeITapTradeAPI(api)
   331  }
   332  func (t *Trade) GetITapTradeAPIVersion() string {
   333  	return C.GoString((*C.char)(C.GetAPIVersion()))
   334  }
   335  func (t *Trade) GetITapErrorDescribe(errorCode TAPIINT32) string {
   336  	return GBK((*C.char)(C.GetErrorDescribe(C.int(errorCode.Int32()))))
   337  }
   338  
   339  // 替代 SetAPINotify
   340  func (t *Trade) SetSpi() { C.SetAPINotify(t.api, t.spi) }
   341  
   342  // ********************** 调用函数 ******************
   343  
   344  func (t *Trade) SetAPINotify(pSpi unsafe.Pointer) C.int { return C.SetAPINotify(t.api, pSpi) }
   345  
   346  func (t *Trade) SetHostAddress(IP string, port TAPIUINT16) C.int {
   347  	ip := C.CString(IP)
   348  	defer C.free(unsafe.Pointer(ip))
   349  	return C.SetHostAddress(t.api, ip, C.ushort(port))
   350  }
   351  
   352  func (t *Trade) Login(loginAuth *TapAPITradeLoginAuth) C.int {
   353  	return C.Login(t.api, (*C.struct_TapAPITradeLoginAuth)(unsafe.Pointer(loginAuth)))
   354  }
   355  
   356  func (t *Trade) RequestVertificateCode(sessionID *TAPIUINT32, ContactInfo TAPISTR_40) C.int {
   357  	return C.RequestVertificateCode(t.api, (*C.uint)(unsafe.Pointer(sessionID)), (*C.char)(unsafe.Pointer(&ContactInfo[0])))
   358  }
   359  
   360  func (t *Trade) SetVertificateCode(sessionID *TAPIUINT32, req *TapAPISecondCertificationReq) C.int {
   361  	return C.SetVertificateCode(t.api, (*C.uint)(unsafe.Pointer(sessionID)), (*C.struct_TapAPISecondCertificationReq)(unsafe.Pointer(req)))
   362  }
   363  
   364  func (t *Trade) Disconnect() C.int { return C.Disconnect(t.api) }
   365  
   366  func (t *Trade) ChangePassword(sessionID *TAPIUINT32, req *TapAPIChangePasswordReq) C.int {
   367  	return C.ChangePassword(t.api, (*C.uint)(unsafe.Pointer(sessionID)), (*C.struct_TapAPIChangePasswordReq)(unsafe.Pointer(req)))
   368  }
   369  
   370  func (t *Trade) AuthPassword(sessionID *TAPIUINT32, req *TapAPIAuthPasswordReq) C.int {
   371  	return C.AuthPassword(t.api, (*C.uint)(unsafe.Pointer(sessionID)), (*C.struct_TapAPIAuthPasswordReq)(unsafe.Pointer(req)))
   372  }
   373  
   374  func (t *Trade) HaveCertainRight(rightID TAPIRightIDType) C.int {
   375  	return C.HaveCertainRight(t.api, C.int(TAPIINT32(rightID).Int32()))
   376  }
   377  
   378  func (t *Trade) QryTradingDate(sessionID *TAPIUINT32) C.int {
   379  	return C.QryTradingDate(t.api, (*C.uint)(unsafe.Pointer(sessionID)))
   380  }
   381  
   382  func (t *Trade) SetReservedInfo(sessionID *TAPIUINT32, info TAPISTR_50) C.int {
   383  	return C.SetReservedInfo(t.api, (*C.uint)(unsafe.Pointer(sessionID)), (*C.char)(unsafe.Pointer(&info[0])))
   384  }
   385  
   386  func (t *Trade) QryAccount(sessionID *TAPIUINT32, qryReq *TapAPIAccQryReq) C.int {
   387  	return C.QryAccount(t.api, (*C.uint)(unsafe.Pointer(sessionID)), (*C.struct_TapAPIAccQryReq)(unsafe.Pointer(qryReq)))
   388  }
   389  
   390  func (t *Trade) QryFund(sessionID *TAPIUINT32, qryReq *TapAPIFundReq) C.int {
   391  	return C.QryFund(t.api, (*C.uint)(unsafe.Pointer(sessionID)), (*C.struct_TapAPIFundReq)(unsafe.Pointer(qryReq)))
   392  }
   393  
   394  func (t *Trade) QryExchange(sessionID *TAPIUINT32) C.int {
   395  	return C.QryExchange(t.api, (*C.uint)(unsafe.Pointer(sessionID)))
   396  }
   397  
   398  func (t *Trade) QryCommodity(sessionID *TAPIUINT32) C.int {
   399  	return C.QryCommodity(t.api, (*C.uint)(unsafe.Pointer(sessionID)))
   400  }
   401  
   402  func (t *Trade) QryContract(sessionID *TAPIUINT32, qryReq *TapAPICommodity) C.int {
   403  	return C.QryContract(t.api, (*C.uint)(unsafe.Pointer(sessionID)), (*C.struct_TapAPICommodity)(unsafe.Pointer(qryReq)))
   404  }
   405  
   406  func (t *Trade) InsertOrder(sessionID *TAPIUINT32, ClientOrderNo *TAPISTR_50, order *TapAPINewOrder) C.int {
   407  	return C.InsertOrder(t.api, (*C.uint)(unsafe.Pointer(sessionID)), (*C.char)(unsafe.Pointer(&ClientOrderNo[0])), (*C.struct_TapAPINewOrder)(unsafe.Pointer(order)))
   408  }
   409  
   410  func (t *Trade) CancelOrder(sessionID *TAPIUINT32, order *TapAPIOrderCancelReq) C.int {
   411  	return C.CancelOrder(t.api, (*C.uint)(unsafe.Pointer(sessionID)), (*C.struct_TapAPIOrderCancelReq)(unsafe.Pointer(order)))
   412  }
   413  
   414  func (t *Trade) AmendOrder(sessionID *TAPIUINT32, order *TapAPIAmendOrder) C.int {
   415  	return C.AmendOrder(t.api, (*C.uint)(unsafe.Pointer(sessionID)), (*C.struct_TapAPIAmendOrder)(unsafe.Pointer(order)))
   416  }
   417  
   418  func (t *Trade) ActivateOrder(sessionID *TAPIUINT32, order *TapAPIOrderCancelReq) C.int {
   419  	return C.ActivateOrder(t.api, (*C.uint)(unsafe.Pointer(sessionID)), (*C.struct_TapAPIOrderCancelReq)(unsafe.Pointer(order)))
   420  }
   421  
   422  func (t *Trade) QryOrder(sessionID *TAPIUINT32, qryReq *TapAPIOrderQryReq) C.int {
   423  	return C.QryOrder(t.api, (*C.uint)(unsafe.Pointer(sessionID)), (*C.struct_TapAPIOrderQryReq)(unsafe.Pointer(qryReq)))
   424  }
   425  
   426  func (t *Trade) QryOrderProcess(sessionID *TAPIUINT32, qryReq *TapAPIOrderProcessQryReq) C.int {
   427  	return C.QryOrderProcess(t.api, (*C.uint)(unsafe.Pointer(sessionID)), (*C.struct_TapAPIOrderProcessQryReq)(unsafe.Pointer(qryReq)))
   428  }
   429  
   430  func (t *Trade) QryFill(sessionID *TAPIUINT32, qryReq *TapAPIFillQryReq) C.int {
   431  	return C.QryFill(t.api, (*C.uint)(unsafe.Pointer(sessionID)), (*C.struct_TapAPIFillQryReq)(unsafe.Pointer(qryReq)))
   432  }
   433  
   434  func (t *Trade) QryPosition(sessionID *TAPIUINT32, qryReq *TapAPIPositionQryReq) C.int {
   435  	return C.QryPosition(t.api, (*C.uint)(unsafe.Pointer(sessionID)), (*C.struct_TapAPIPositionQryReq)(unsafe.Pointer(qryReq)))
   436  }
   437  
   438  func (t *Trade) QryPositionSummary(sessionID *TAPIUINT32, qryReq *TapAPIPositionQryReq) C.int {
   439  	return C.QryPositionSummary(t.api, (*C.uint)(unsafe.Pointer(sessionID)), (*C.struct_TapAPIPositionQryReq)(unsafe.Pointer(qryReq)))
   440  }
   441  
   442  func (t *Trade) QryCurrency(sessionID *TAPIUINT32) C.int {
   443  	return C.QryCurrency(t.api, (*C.uint)(unsafe.Pointer(sessionID)))
   444  }
   445  
   446  func (t *Trade) QryAccountCashAdjust(sessionID *TAPIUINT32, qryReq *TapAPIAccountCashAdjustQryReq) C.int {
   447  	return C.QryAccountCashAdjust(t.api, (*C.uint)(unsafe.Pointer(sessionID)), (*C.struct_TapAPIAccountCashAdjustQryReq)(unsafe.Pointer(qryReq)))
   448  }
   449  
   450  func (t *Trade) QryTradeMessage(sessionID *TAPIUINT32, qryReq *TapAPITradeMessageReq) C.int {
   451  	return C.QryTradeMessage(t.api, (*C.uint)(unsafe.Pointer(sessionID)), (*C.struct_TapAPITradeMessageReq)(unsafe.Pointer(qryReq)))
   452  }
   453  
   454  func (t *Trade) QryBill(sessionID *TAPIUINT32, qryReq *TapAPIBillQryReq) C.int {
   455  	return C.QryBill(t.api, (*C.uint)(unsafe.Pointer(sessionID)), (*C.struct_TapAPIBillQryReq)(unsafe.Pointer(qryReq)))
   456  }
   457  
   458  func (t *Trade) QryHisOrder(sessionID *TAPIUINT32, qryReq *TapAPIHisOrderQryReq) C.int {
   459  	return C.QryHisOrder(t.api, (*C.uint)(unsafe.Pointer(sessionID)), (*C.struct_TapAPIHisOrderQryReq)(unsafe.Pointer(qryReq)))
   460  }
   461  
   462  func (t *Trade) QryHisOrderProcess(sessionID *TAPIUINT32, qryReq *TapAPIHisOrderProcessQryReq) C.int {
   463  	return C.QryHisOrderProcess(t.api, (*C.uint)(unsafe.Pointer(sessionID)), (*C.struct_TapAPIHisOrderProcessQryReq)(unsafe.Pointer(qryReq)))
   464  }
   465  
   466  func (t *Trade) QryHisMatch(sessionID *TAPIUINT32, qryReq *TapAPIHisMatchQryReq) C.int {
   467  	return C.QryHisMatch(t.api, (*C.uint)(unsafe.Pointer(sessionID)), (*C.struct_TapAPIHisMatchQryReq)(unsafe.Pointer(qryReq)))
   468  }
   469  
   470  func (t *Trade) QryHisPosition(sessionID *TAPIUINT32, qryReq *TapAPIHisPositionQryReq) C.int {
   471  	return C.QryHisPosition(t.api, (*C.uint)(unsafe.Pointer(sessionID)), (*C.struct_TapAPIHisPositionQryReq)(unsafe.Pointer(qryReq)))
   472  }
   473  
   474  func (t *Trade) QryHisDelivery(sessionID *TAPIUINT32, qryReq *TapAPIHisDeliveryQryReq) C.int {
   475  	return C.QryHisDelivery(t.api, (*C.uint)(unsafe.Pointer(sessionID)), (*C.struct_TapAPIHisDeliveryQryReq)(unsafe.Pointer(qryReq)))
   476  }
   477  
   478  func (t *Trade) QryAccountFeeRent(sessionID *TAPIUINT32, qryReq *TapAPIAccountFeeRentQryReq) C.int {
   479  	return C.QryAccountFeeRent(t.api, (*C.uint)(unsafe.Pointer(sessionID)), (*C.struct_TapAPIAccountFeeRentQryReq)(unsafe.Pointer(qryReq)))
   480  }
   481  
   482  func (t *Trade) QryAccountMarginRent(sessionID *TAPIUINT32, qryReq *TapAPIAccountMarginRentQryReq) C.int {
   483  	return C.QryAccountMarginRent(t.api, (*C.uint)(unsafe.Pointer(sessionID)), (*C.struct_TapAPIAccountMarginRentQryReq)(unsafe.Pointer(qryReq)))
   484  }
   485  
   486  func (t *Trade) InsertHKMarketOrder(sessionID *TAPIUINT32, ClientBuyOrderNo TAPISTR_50, ClientSellOrderNo TAPISTR_50, order *TapAPIOrderMarketInsertReq) C.int {
   487  	return C.InsertHKMarketOrder(t.api, (*C.uint)(unsafe.Pointer(sessionID)), (*C.char)(unsafe.Pointer(&ClientBuyOrderNo[0])), (*C.char)(unsafe.Pointer(&ClientSellOrderNo[0])), (*C.struct_TapAPIOrderMarketInsertReq)(unsafe.Pointer(order)))
   488  }
   489  
   490  func (t *Trade) CancelHKMarketOrder(sessionID *TAPIUINT32, order *TapAPIOrderMarketDeleteReq) C.int {
   491  	return C.CancelHKMarketOrder(t.api, (*C.uint)(unsafe.Pointer(sessionID)), (*C.struct_TapAPIOrderMarketDeleteReq)(unsafe.Pointer(order)))
   492  }
   493  
   494  func (t *Trade) OrderLocalRemove(sessionID *TAPIUINT32, order *TapAPIOrderLocalRemoveReq) C.int {
   495  	return C.OrderLocalRemove(t.api, (*C.uint)(unsafe.Pointer(sessionID)), (*C.struct_TapAPIOrderLocalRemoveReq)(unsafe.Pointer(order)))
   496  }
   497  
   498  func (t *Trade) OrderLocalInput(sessionID *TAPIUINT32, order *TapAPIOrderLocalInputReq) C.int {
   499  	return C.OrderLocalInput(t.api, (*C.uint)(unsafe.Pointer(sessionID)), (*C.struct_TapAPIOrderLocalInputReq)(unsafe.Pointer(order)))
   500  }
   501  
   502  func (t *Trade) OrderLocalModify(sessionID *TAPIUINT32, order *TapAPIOrderLocalModifyReq) C.int {
   503  	return C.OrderLocalModify(t.api, (*C.uint)(unsafe.Pointer(sessionID)), (*C.struct_TapAPIOrderLocalModifyReq)(unsafe.Pointer(order)))
   504  }
   505  
   506  func (t *Trade) OrderLocalTransfer(sessionID *TAPIUINT32, order *TapAPIOrderLocalTransferReq) C.int {
   507  	return C.OrderLocalTransfer(t.api, (*C.uint)(unsafe.Pointer(sessionID)), (*C.struct_TapAPIOrderLocalTransferReq)(unsafe.Pointer(order)))
   508  }
   509  
   510  func (t *Trade) FillLocalInput(sessionID *TAPIUINT32, fill *TapAPIFillLocalInputReq) C.int {
   511  	return C.FillLocalInput(t.api, (*C.uint)(unsafe.Pointer(sessionID)), (*C.struct_TapAPIFillLocalInputReq)(unsafe.Pointer(fill)))
   512  }
   513  
   514  func (t *Trade) FillLocalRemove(sessionID *TAPIUINT32, fill *TapAPIFillLocalRemoveReq) C.int {
   515  	return C.FillLocalRemove(t.api, (*C.uint)(unsafe.Pointer(sessionID)), (*C.struct_TapAPIFillLocalRemoveReq)(unsafe.Pointer(fill)))
   516  }
   517  
   518  func (t *Trade) QrySpotLock(sessionID *TAPIUINT32, qryReq *TapAPISpotLockQryReq) C.int {
   519  	return C.QrySpotLock(t.api, (*C.uint)(unsafe.Pointer(sessionID)), (*C.struct_TapAPISpotLockQryReq)(unsafe.Pointer(qryReq)))
   520  }
   521  
   522  func (t *Trade) SubmitUserLoginInfo(sessionID *TAPIUINT32, qryReq *TapAPISubmitUserLoginInfo) C.int {
   523  	return C.SubmitUserLoginInfo(t.api, (*C.uint)(unsafe.Pointer(sessionID)), (*C.struct_TapAPISubmitUserLoginInfo)(unsafe.Pointer(qryReq)))
   524  }
   525  
   526  func (t *Trade) InsertSpecialOrder(sessionID *TAPIUINT32, clientorderno TAPISTR_50, order *TapAPISpecialOrderInsertReq) C.int {
   527  	return C.InsertSpecialOrder(t.api, (*C.uint)(unsafe.Pointer(sessionID)), (*C.char)(unsafe.Pointer(&clientorderno[0])), (*C.struct_TapAPISpecialOrderInsertReq)(unsafe.Pointer(order)))
   528  }
   529  
   530  func (t *Trade) QrySpecialOrder(sessionID *TAPIUINT32, qryReq *TapAPISpecialOrderQryReq) C.int {
   531  	return C.QrySpecialOrder(t.api, (*C.uint)(unsafe.Pointer(sessionID)), (*C.struct_TapAPISpecialOrderQryReq)(unsafe.Pointer(qryReq)))
   532  }
   533  
   534  func (t *Trade) QryCombinePosition(sessionID *TAPIUINT32, qryReq *TapAPICombinePositionQryReq) C.int {
   535  	return C.QryCombinePosition(t.api, (*C.uint)(unsafe.Pointer(sessionID)), (*C.struct_TapAPICombinePositionQryReq)(unsafe.Pointer(qryReq)))
   536  }
   537  
   538  func (t *Trade) QryUserTrustDevice(sessionID *TAPIUINT32, qryReq *TapAPIUserTrustDeviceQryReq) C.int {
   539  	return C.QryUserTrustDevice(t.api, (*C.uint)(unsafe.Pointer(sessionID)), (*C.struct_TapAPIUserTrustDeviceQryReq)(unsafe.Pointer(qryReq)))
   540  }
   541  
   542  func (t *Trade) AddUserTrustDevice(sessionID *TAPIUINT32, qryReq *TapAPIUserTrustDeviceAddReq) C.int {
   543  	return C.AddUserTrustDevice(t.api, (*C.uint)(unsafe.Pointer(sessionID)), (*C.struct_TapAPIUserTrustDeviceAddReq)(unsafe.Pointer(qryReq)))
   544  }
   545  
   546  func (t *Trade) DelUserTrustDevice(sessionID *TAPIUINT32, qryReq *TapAPIUserTrustDeviceDelReq) C.int {
   547  	return C.DelUserTrustDevice(t.api, (*C.uint)(unsafe.Pointer(sessionID)), (*C.struct_TapAPIUserTrustDeviceDelReq)(unsafe.Pointer(qryReq)))
   548  }
   549  
   550  func (t *Trade) QryIPOInfo(sessionID *TAPIUINT32, qryReq *TapAPIIPOInfoQryReq) C.int {
   551  	return C.QryIPOInfo(t.api, (*C.uint)(unsafe.Pointer(sessionID)), (*C.struct_TapAPIIPOInfoQryReq)(unsafe.Pointer(qryReq)))
   552  }
   553  
   554  func (t *Trade) QryIPOStockQty(sessionID *TAPIUINT32, qryReq *TapAPIAvailableApplyQryReq) C.int {
   555  	return C.QryIPOStockQty(t.api, (*C.uint)(unsafe.Pointer(sessionID)), (*C.struct_TapAPIAvailableApplyQryReq)(unsafe.Pointer(qryReq)))
   556  }
   557  
   558  func (t *Trade) QryAccountIPO(sessionID *TAPIUINT32, qryReq *TapAPIAccountIPOQryReq) C.int {
   559  	return C.QryAccountIPO(t.api, (*C.uint)(unsafe.Pointer(sessionID)), (*C.struct_TapAPIAccountIPOQryReq)(unsafe.Pointer(qryReq)))
   560  }
   561  
   562  func (t *Trade) AddAccountIPO(sessionID *TAPIUINT32, qryReq *TapAPIAccountIPOAddReq) C.int {
   563  	return C.AddAccountIPO(t.api, (*C.uint)(unsafe.Pointer(sessionID)), (*C.struct_TapAPIAccountIPOAddReq)(unsafe.Pointer(qryReq)))
   564  }
   565  
   566  func (t *Trade) CancelAccountIPO(sessionID *TAPIUINT32, qryReq *TapAPIAccountIPOCancelReq) C.int {
   567  	return C.CancelAccountIPO(t.api, (*C.uint)(unsafe.Pointer(sessionID)), (*C.struct_TapAPIAccountIPOCancelReq)(unsafe.Pointer(qryReq)))
   568  }
   569  
   570  func (t *Trade) UnFreeze(loginAuth *TapAPITradeLoginAuth) C.int {
   571  	return C.UnFreeze(t.api, (*C.struct_TapAPITradeLoginAuth)(unsafe.Pointer(loginAuth)))
   572  }
   573  
   574  func (t *Trade) VerificateUnFreezeInfo(sessionID *TAPIUINT32, qryReq *TapAPIVerifyIdentityReq) C.int {
   575  	return C.VerificateUnFreezeInfo(t.api, (*C.uint)(unsafe.Pointer(sessionID)), (*C.struct_TapAPIVerifyIdentityReq)(unsafe.Pointer(qryReq)))
   576  }
   577  
   578  // ********************** 响应函数 ******************
   579  func (t *Trade) RegCallBack() {
   580  	C.SetOnConnect(t.spi, C.exOnConnect)
   581  	C.SetOnRspLogin(t.spi, C.exOnRspLogin)
   582  	C.SetOnRtnContactInfo(t.spi, C.exOnRtnContactInfo)
   583  	C.SetOnRspRequestVertificateCode(t.spi, C.exOnRspRequestVertificateCode)
   584  	C.SetOnExpriationDate(t.spi, C.exOnExpriationDate)
   585  	C.SetOnAPIReady(t.spi, C.exOnAPIReady)
   586  	C.SetOnDisconnect(t.spi, C.exOnDisconnect)
   587  	C.SetOnRspChangePassword(t.spi, C.exOnRspChangePassword)
   588  	C.SetOnRspAuthPassword(t.spi, C.exOnRspAuthPassword)
   589  	C.SetOnRspQryTradingDate(t.spi, C.exOnRspQryTradingDate)
   590  	C.SetOnRspSetReservedInfo(t.spi, C.exOnRspSetReservedInfo)
   591  	C.SetOnRspQryAccount(t.spi, C.exOnRspQryAccount)
   592  	C.SetOnRspQryFund(t.spi, C.exOnRspQryFund)
   593  	C.SetOnRtnFund(t.spi, C.exOnRtnFund)
   594  	C.SetOnRspQryExchange(t.spi, C.exOnRspQryExchange)
   595  	C.SetOnRspQryCommodity(t.spi, C.exOnRspQryCommodity)
   596  	C.SetOnRspQryContract(t.spi, C.exOnRspQryContract)
   597  	C.SetOnRtnContract(t.spi, C.exOnRtnContract)
   598  	C.SetOnRspOrderAction(t.spi, C.exOnRspOrderAction)
   599  	C.SetOnRtnOrder(t.spi, C.exOnRtnOrder)
   600  	C.SetOnRspQryOrder(t.spi, C.exOnRspQryOrder)
   601  	C.SetOnRspQryOrderProcess(t.spi, C.exOnRspQryOrderProcess)
   602  	C.SetOnRspQryFill(t.spi, C.exOnRspQryFill)
   603  	C.SetOnRtnFill(t.spi, C.exOnRtnFill)
   604  	C.SetOnRspQryPosition(t.spi, C.exOnRspQryPosition)
   605  	C.SetOnRtnPosition(t.spi, C.exOnRtnPosition)
   606  	C.SetOnRspQryPositionSummary(t.spi, C.exOnRspQryPositionSummary)
   607  	C.SetOnRtnPositionSummary(t.spi, C.exOnRtnPositionSummary)
   608  	C.SetOnRtnPositionProfit(t.spi, C.exOnRtnPositionProfit)
   609  	C.SetOnRspQryCurrency(t.spi, C.exOnRspQryCurrency)
   610  	C.SetOnRspQryTradeMessage(t.spi, C.exOnRspQryTradeMessage)
   611  	C.SetOnRtnTradeMessage(t.spi, C.exOnRtnTradeMessage)
   612  	C.SetOnRspQryHisOrder(t.spi, C.exOnRspQryHisOrder)
   613  	C.SetOnRspQryHisOrderProcess(t.spi, C.exOnRspQryHisOrderProcess)
   614  	C.SetOnRspQryHisMatch(t.spi, C.exOnRspQryHisMatch)
   615  	C.SetOnRspQryHisPosition(t.spi, C.exOnRspQryHisPosition)
   616  	C.SetOnRspQryHisDelivery(t.spi, C.exOnRspQryHisDelivery)
   617  	C.SetOnRspQryAccountCashAdjust(t.spi, C.exOnRspQryAccountCashAdjust)
   618  	C.SetOnRspQryBill(t.spi, C.exOnRspQryBill)
   619  	C.SetOnRspQryAccountFeeRent(t.spi, C.exOnRspQryAccountFeeRent)
   620  	C.SetOnRspQryAccountMarginRent(t.spi, C.exOnRspQryAccountMarginRent)
   621  	C.SetOnRspHKMarketOrderInsert(t.spi, C.exOnRspHKMarketOrderInsert)
   622  	C.SetOnRspHKMarketOrderDelete(t.spi, C.exOnRspHKMarketOrderDelete)
   623  	C.SetOnHKMarketQuoteNotice(t.spi, C.exOnHKMarketQuoteNotice)
   624  	C.SetOnRspOrderLocalRemove(t.spi, C.exOnRspOrderLocalRemove)
   625  	C.SetOnRspOrderLocalInput(t.spi, C.exOnRspOrderLocalInput)
   626  	C.SetOnRspOrderLocalModify(t.spi, C.exOnRspOrderLocalModify)
   627  	C.SetOnRspOrderLocalTransfer(t.spi, C.exOnRspOrderLocalTransfer)
   628  	C.SetOnRspFillLocalInput(t.spi, C.exOnRspFillLocalInput)
   629  	C.SetOnRspFillLocalRemove(t.spi, C.exOnRspFillLocalRemove)
   630  	C.SetOnRspQrySpotLock(t.spi, C.exOnRspQrySpotLock)
   631  	C.SetOnRtnSpotLock(t.spi, C.exOnRtnSpotLock)
   632  	C.SetOnRspSubmitUserLoginInfo(t.spi, C.exOnRspSubmitUserLoginInfo)
   633  	C.SetOnRspSpecialOrderAction(t.spi, C.exOnRspSpecialOrderAction)
   634  	C.SetOnRtnSpecialOrder(t.spi, C.exOnRtnSpecialOrder)
   635  	C.SetOnRspQrySpecialOrder(t.spi, C.exOnRspQrySpecialOrder)
   636  	C.SetOnRspQryCombinePosition(t.spi, C.exOnRspQryCombinePosition)
   637  	C.SetOnRtnCombinePosition(t.spi, C.exOnRtnCombinePosition)
   638  
   639  }
   640  
   641  //export exOnConnect
   642  func exOnConnect(HostAddress *C.char) {
   643  	if t.OnConnect != nil {
   644  		t.OnConnect(GBK(HostAddress))
   645  	} else {
   646  		fmt.Println("OnConnect")
   647  	}
   648  }
   649  
   650  //export exOnRspLogin
   651  func exOnRspLogin(errorCode C.int, loginRspInfo *C.struct_TapAPITradeLoginRspInfo) {
   652  	if t.OnRspLogin != nil {
   653  		t.OnRspLogin(FromCint32(errorCode), (*TapAPITradeLoginRspInfo)(unsafe.Pointer(loginRspInfo)))
   654  	} else {
   655  		fmt.Println("OnRspLogin")
   656  	}
   657  }
   658  
   659  //export exOnRtnContactInfo
   660  func exOnRtnContactInfo(errorCode C.int, isLast C.char, ContactInfo *C.char) {
   661  	if t.OnRtnContactInfo != nil {
   662  		t.OnRtnContactInfo(FromCint32(errorCode), TAPIYNFLAG(isLast), GBK(ContactInfo))
   663  	} else {
   664  		fmt.Println("OnRtnContactInfo")
   665  	}
   666  }
   667  
   668  //export exOnRspRequestVertificateCode
   669  func exOnRspRequestVertificateCode(sessionID C.uint, errorCode C.int, rsp *C.struct_TapAPIRequestVertificateCodeRsp) {
   670  	if t.OnRspRequestVertificateCode != nil {
   671  		t.OnRspRequestVertificateCode(FromCuint32(sessionID), FromCint32(errorCode), (*TapAPIRequestVertificateCodeRsp)(unsafe.Pointer(rsp)))
   672  	} else {
   673  		fmt.Println("OnRspRequestVertificateCode")
   674  	}
   675  }
   676  
   677  //export exOnExpriationDate
   678  func exOnExpriationDate(date *C.char, days C.int) {
   679  	if t.OnExpriationDate != nil {
   680  		t.OnExpriationDate(GBK(date), int(days))
   681  	} else {
   682  		fmt.Println("OnExpriationDate")
   683  	}
   684  }
   685  
   686  //export exOnAPIReady
   687  func exOnAPIReady(errorCode C.int) {
   688  	if t.OnAPIReady != nil {
   689  		t.OnAPIReady(FromCint32(errorCode))
   690  	} else {
   691  		fmt.Println("OnAPIReady")
   692  	}
   693  }
   694  
   695  //export exOnDisconnect
   696  func exOnDisconnect(reasonCode C.int) {
   697  	if t.OnDisconnect != nil {
   698  		t.OnDisconnect(FromCint32(reasonCode))
   699  	} else {
   700  		fmt.Println("OnDisconnect")
   701  	}
   702  }
   703  
   704  //export exOnRspChangePassword
   705  func exOnRspChangePassword(sessionID C.uint, errorCode C.int) {
   706  	if t.OnRspChangePassword != nil {
   707  		t.OnRspChangePassword(FromCuint32(sessionID), FromCint32(errorCode))
   708  	} else {
   709  		fmt.Println("OnRspChangePassword")
   710  	}
   711  }
   712  
   713  //export exOnRspAuthPassword
   714  func exOnRspAuthPassword(sessionID C.uint, errorCode C.int) {
   715  	if t.OnRspAuthPassword != nil {
   716  		t.OnRspAuthPassword(FromCuint32(sessionID), FromCint32(errorCode))
   717  	} else {
   718  		fmt.Println("OnRspAuthPassword")
   719  	}
   720  }
   721  
   722  //export exOnRspQryTradingDate
   723  func exOnRspQryTradingDate(sessionID C.uint, errorCode C.int, info *C.struct_TapAPITradingCalendarQryRsp) {
   724  	if t.OnRspQryTradingDate != nil {
   725  		t.OnRspQryTradingDate(FromCuint32(sessionID), FromCint32(errorCode), (*TapAPITradingCalendarQryRsp)(unsafe.Pointer(info)))
   726  	} else {
   727  		fmt.Println("OnRspQryTradingDate")
   728  	}
   729  }
   730  
   731  //export exOnRspSetReservedInfo
   732  func exOnRspSetReservedInfo(sessionID C.uint, errorCode C.int, info *C.char) {
   733  	if t.OnRspSetReservedInfo != nil {
   734  		t.OnRspSetReservedInfo(FromCuint32(sessionID), FromCint32(errorCode), GBK(info))
   735  	} else {
   736  		fmt.Println("OnRspSetReservedInfo")
   737  	}
   738  }
   739  
   740  //export exOnRspQryAccount
   741  func exOnRspQryAccount(sessionID C.uint, errorCode C.uint, isLast C.char, info *C.struct_TapAPIAccountInfo) {
   742  	if t.OnRspQryAccount != nil {
   743  		t.OnRspQryAccount(FromCuint32(sessionID), FromUint32(uint32(errorCode)), TAPIYNFLAG(isLast), (*TapAPIAccountInfo)(unsafe.Pointer(info)))
   744  	} else {
   745  		fmt.Println("OnRspQryAccount")
   746  	}
   747  }
   748  
   749  //export exOnRspQryFund
   750  func exOnRspQryFund(sessionID C.uint, errorCode C.int, isLast C.char, info *C.struct_TapAPIFundData) {
   751  	if t.OnRspQryFund != nil {
   752  		t.OnRspQryFund(FromCuint32(sessionID), FromCint32(errorCode), TAPIYNFLAG(isLast), (*TapAPIFundData)(unsafe.Pointer(info)))
   753  	} else {
   754  		fmt.Println("OnRspQryFund")
   755  	}
   756  }
   757  
   758  //export exOnRtnFund
   759  func exOnRtnFund(info *C.struct_TapAPIFundData) {
   760  	if t.OnRtnFund != nil {
   761  		t.OnRtnFund((*TapAPIFundData)(unsafe.Pointer(info)))
   762  	} else {
   763  		fmt.Println("OnRtnFund")
   764  	}
   765  }
   766  
   767  //export exOnRspQryExchange
   768  func exOnRspQryExchange(sessionID C.uint, errorCode C.int, isLast C.char, info *C.struct_TapAPIExchangeInfo) {
   769  	if t.OnRspQryExchange != nil {
   770  		t.OnRspQryExchange(FromCuint32(sessionID), FromCint32(errorCode), TAPIYNFLAG(isLast), (*TapAPIExchangeInfo)(unsafe.Pointer(info)))
   771  	} else {
   772  		fmt.Println("OnRspQryExchange")
   773  	}
   774  }
   775  
   776  //export exOnRspQryCommodity
   777  func exOnRspQryCommodity(sessionID C.uint, errorCode C.int, isLast C.char, info *C.struct_TapAPICommodityInfo) {
   778  	if t.OnRspQryCommodity != nil {
   779  		t.OnRspQryCommodity(FromCuint32(sessionID), FromCint32(errorCode), TAPIYNFLAG(isLast), (*TapAPICommodityInfo)(unsafe.Pointer(info)))
   780  	} else {
   781  		fmt.Println("OnRspQryCommodity")
   782  	}
   783  }
   784  
   785  //export exOnRspQryContract
   786  func exOnRspQryContract(sessionID C.uint, errorCode C.int, isLast C.char, info *C.struct_TapAPITradeContractInfo) {
   787  	if t.OnRspQryContract != nil {
   788  		t.OnRspQryContract(FromCuint32(sessionID), FromCint32(errorCode), TAPIYNFLAG(isLast), (*TapAPITradeContractInfo)(unsafe.Pointer(info)))
   789  	} else {
   790  		fmt.Println("OnRspQryContract")
   791  	}
   792  }
   793  
   794  //export exOnRtnContract
   795  func exOnRtnContract(info *C.struct_TapAPITradeContractInfo) {
   796  	if t.OnRtnContract != nil {
   797  		t.OnRtnContract((*TapAPITradeContractInfo)(unsafe.Pointer(info)))
   798  	} else {
   799  		fmt.Println("OnRtnContract")
   800  	}
   801  }
   802  
   803  //export exOnRspOrderAction
   804  func exOnRspOrderAction(sessionID C.uint, errorCode C.int, info *C.struct_TapAPIOrderActionRsp) {
   805  	if t.OnRspOrderAction != nil {
   806  		t.OnRspOrderAction(FromCuint32(sessionID), FromCint32(errorCode), (*TapAPIOrderActionRsp)(unsafe.Pointer(info)))
   807  	} else {
   808  		fmt.Println("OnRspOrderAction")
   809  	}
   810  }
   811  
   812  //export exOnRtnOrder
   813  func exOnRtnOrder(info *C.struct_TapAPIOrderInfoNotice) {
   814  	if t.OnRtnOrder != nil {
   815  		t.OnRtnOrder((*TapAPIOrderInfoNotice)(unsafe.Pointer(info)))
   816  	} else {
   817  		fmt.Println("OnRtnOrder")
   818  	}
   819  }
   820  
   821  //export exOnRspQryOrder
   822  func exOnRspQryOrder(sessionID C.uint, errorCode C.int, isLast C.char, info *C.struct_TapAPIOrderInfo) {
   823  	if t.OnRspQryOrder != nil {
   824  		t.OnRspQryOrder(FromCuint32(sessionID), FromCint32(errorCode), TAPIYNFLAG(isLast), (*TapAPIOrderInfo)(unsafe.Pointer(info)))
   825  	} else {
   826  		fmt.Println("OnRspQryOrder")
   827  	}
   828  }
   829  
   830  //export exOnRspQryOrderProcess
   831  func exOnRspQryOrderProcess(sessionID C.uint, errorCode C.int, isLast C.char, info *C.struct_TapAPIOrderInfo) {
   832  	if t.OnRspQryOrderProcess != nil {
   833  		t.OnRspQryOrderProcess(FromCuint32(sessionID), FromCint32(errorCode), TAPIYNFLAG(isLast), (*TapAPIOrderInfo)(unsafe.Pointer(info)))
   834  	} else {
   835  		fmt.Println("OnRspQryOrderProcess")
   836  	}
   837  }
   838  
   839  //export exOnRspQryFill
   840  func exOnRspQryFill(sessionID C.uint, errorCode C.int, isLast C.char, info *C.struct_TapAPIFillInfo) {
   841  	if t.OnRspQryFill != nil {
   842  		t.OnRspQryFill(FromCuint32(sessionID), FromCint32(errorCode), TAPIYNFLAG(isLast), (*TapAPIFillInfo)(unsafe.Pointer(info)))
   843  	} else {
   844  		fmt.Println("OnRspQryFill")
   845  	}
   846  }
   847  
   848  //export exOnRtnFill
   849  func exOnRtnFill(info *C.struct_TapAPIFillInfo) {
   850  	if t.OnRtnFill != nil {
   851  		t.OnRtnFill((*TapAPIFillInfo)(unsafe.Pointer(info)))
   852  	} else {
   853  		fmt.Println("OnRtnFill")
   854  	}
   855  }
   856  
   857  //export exOnRspQryPosition
   858  func exOnRspQryPosition(sessionID C.uint, errorCode C.int, isLast C.char, info *C.struct_TapAPIPositionInfo) {
   859  	if t.OnRspQryPosition != nil {
   860  		t.OnRspQryPosition(FromCuint32(sessionID), FromCint32(errorCode), TAPIYNFLAG(isLast), (*TapAPIPositionInfo)(unsafe.Pointer(info)))
   861  	} else {
   862  		fmt.Println("OnRspQryPosition")
   863  	}
   864  }
   865  
   866  //export exOnRtnPosition
   867  func exOnRtnPosition(info *C.struct_TapAPIPositionInfo) {
   868  	if t.OnRtnPosition != nil {
   869  		t.OnRtnPosition((*TapAPIPositionInfo)(unsafe.Pointer(info)))
   870  	} else {
   871  		fmt.Println("OnRtnPosition")
   872  	}
   873  }
   874  
   875  //export exOnRspQryPositionSummary
   876  func exOnRspQryPositionSummary(sessionID C.uint, errorCode C.int, isLast C.char, info *C.struct_TapAPIPositionSummary) {
   877  	if t.OnRspQryPositionSummary != nil {
   878  		t.OnRspQryPositionSummary(FromCuint32(sessionID), FromCint32(errorCode), TAPIYNFLAG(isLast), (*TapAPIPositionSummary)(unsafe.Pointer(info)))
   879  	} else {
   880  		fmt.Println("OnRspQryPositionSummary")
   881  	}
   882  }
   883  
   884  //export exOnRtnPositionSummary
   885  func exOnRtnPositionSummary(info *C.struct_TapAPIPositionSummary) {
   886  	if t.OnRtnPositionSummary != nil {
   887  		t.OnRtnPositionSummary((*TapAPIPositionSummary)(unsafe.Pointer(info)))
   888  	} else {
   889  		fmt.Println("OnRtnPositionSummary")
   890  	}
   891  }
   892  
   893  //export exOnRtnPositionProfit
   894  func exOnRtnPositionProfit(info *C.struct_TapAPIPositionProfitNotice) {
   895  	if t.OnRtnPositionProfit != nil {
   896  		t.OnRtnPositionProfit((*TapAPIPositionProfitNotice)(unsafe.Pointer(info)))
   897  	} else {
   898  		fmt.Println("OnRtnPositionProfit")
   899  	}
   900  }
   901  
   902  //export exOnRspQryCurrency
   903  func exOnRspQryCurrency(sessionID C.uint, errorCode C.int, isLast C.char, info *C.struct_TapAPICurrencyInfo) {
   904  	if t.OnRspQryCurrency != nil {
   905  		t.OnRspQryCurrency(FromCuint32(sessionID), FromCint32(errorCode), TAPIYNFLAG(isLast), (*TapAPICurrencyInfo)(unsafe.Pointer(info)))
   906  	} else {
   907  		fmt.Println("OnRspQryCurrency")
   908  	}
   909  }
   910  
   911  //export exOnRspQryTradeMessage
   912  func exOnRspQryTradeMessage(sessionID C.uint, errorCode C.int, isLast C.char, info *C.struct_TapAPITradeMessage) {
   913  	if t.OnRspQryTradeMessage != nil {
   914  		t.OnRspQryTradeMessage(FromCuint32(sessionID), FromCint32(errorCode), TAPIYNFLAG(isLast), (*TapAPITradeMessage)(unsafe.Pointer(info)))
   915  	} else {
   916  		fmt.Println("OnRspQryTradeMessage")
   917  	}
   918  }
   919  
   920  //export exOnRtnTradeMessage
   921  func exOnRtnTradeMessage(info *C.struct_TapAPITradeMessage) {
   922  	if t.OnRtnTradeMessage != nil {
   923  		t.OnRtnTradeMessage((*TapAPITradeMessage)(unsafe.Pointer(info)))
   924  	} else {
   925  		fmt.Println("OnRtnTradeMessage")
   926  	}
   927  }
   928  
   929  //export exOnRspQryHisOrder
   930  func exOnRspQryHisOrder(sessionID C.uint, errorCode C.int, isLast C.char, info *C.struct_TapAPIHisOrderQryRsp) {
   931  	if t.OnRspQryHisOrder != nil {
   932  		t.OnRspQryHisOrder(FromCuint32(sessionID), FromCint32(errorCode), TAPIYNFLAG(isLast), (*TapAPIHisOrderQryRsp)(unsafe.Pointer(info)))
   933  	} else {
   934  		fmt.Println("OnRspQryHisOrder")
   935  	}
   936  }
   937  
   938  //export exOnRspQryHisOrderProcess
   939  func exOnRspQryHisOrderProcess(sessionID C.uint, errorCode C.int, isLast C.char, info *C.struct_TapAPIHisOrderProcessQryReq) {
   940  	if t.OnRspQryHisOrderProcess != nil {
   941  		t.OnRspQryHisOrderProcess(FromCuint32(sessionID), FromCint32(errorCode), TAPIYNFLAG(isLast), (*TapAPIHisOrderProcessQryReq)(unsafe.Pointer(info)))
   942  	} else {
   943  		fmt.Println("OnRspQryHisOrderProcess")
   944  	}
   945  }
   946  
   947  //export exOnRspQryHisMatch
   948  func exOnRspQryHisMatch(sessionID C.uint, errorCode C.int, isLast C.char, info *C.struct_TapAPIHisMatchQryRsp) {
   949  	if t.OnRspQryHisMatch != nil {
   950  		t.OnRspQryHisMatch(FromCuint32(sessionID), FromCint32(errorCode), TAPIYNFLAG(isLast), (*TapAPIHisMatchQryRsp)(unsafe.Pointer(info)))
   951  	} else {
   952  		fmt.Println("OnRspQryHisMatch")
   953  	}
   954  }
   955  
   956  //export exOnRspQryHisPosition
   957  func exOnRspQryHisPosition(sessionID C.uint, errorCode C.int, isLast C.char, info *C.struct_TapAPIHisPositionQryRsp) {
   958  	if t.OnRspQryHisPosition != nil {
   959  		t.OnRspQryHisPosition(FromCuint32(sessionID), FromCint32(errorCode), TAPIYNFLAG(isLast), (*TapAPIHisPositionQryRsp)(unsafe.Pointer(info)))
   960  	} else {
   961  		fmt.Println("OnRspQryHisPosition")
   962  	}
   963  }
   964  
   965  //export exOnRspQryHisDelivery
   966  func exOnRspQryHisDelivery(sessionID C.uint, errorCode C.int, isLast C.char, info *C.struct_TapAPIHisDeliveryQryRsp) {
   967  	if t.OnRspQryHisDelivery != nil {
   968  		t.OnRspQryHisDelivery(FromCuint32(sessionID), FromCint32(errorCode), TAPIYNFLAG(isLast), (*TapAPIHisDeliveryQryRsp)(unsafe.Pointer(info)))
   969  	} else {
   970  		fmt.Println("OnRspQryHisDelivery")
   971  	}
   972  }
   973  
   974  //export exOnRspQryAccountCashAdjust
   975  func exOnRspQryAccountCashAdjust(sessionID C.uint, errorCode C.int, isLast C.char, info *C.struct_TapAPIAccountCashAdjustQryRsp) {
   976  	if t.OnRspQryAccountCashAdjust != nil {
   977  		t.OnRspQryAccountCashAdjust(FromCuint32(sessionID), FromCint32(errorCode), TAPIYNFLAG(isLast), (*TapAPIAccountCashAdjustQryRsp)(unsafe.Pointer(info)))
   978  	} else {
   979  		fmt.Println("OnRspQryAccountCashAdjust")
   980  	}
   981  }
   982  
   983  //export exOnRspQryBill
   984  func exOnRspQryBill(sessionID C.uint, errorCode C.int, isLast C.char, info *C.struct_TapAPIBillQryRsp) {
   985  	if t.OnRspQryBill != nil {
   986  		t.OnRspQryBill(FromCuint32(sessionID), FromCint32(errorCode), TAPIYNFLAG(isLast), (*TapAPIBillQryRsp)(unsafe.Pointer(info)))
   987  	} else {
   988  		fmt.Println("OnRspQryBill")
   989  	}
   990  }
   991  
   992  //export exOnRspQryAccountFeeRent
   993  func exOnRspQryAccountFeeRent(sessionID C.uint, errorCode C.int, isLast C.char, info *C.struct_TapAPIAccountFeeRentQryRsp) {
   994  	if t.OnRspQryAccountFeeRent != nil {
   995  		t.OnRspQryAccountFeeRent(FromCuint32(sessionID), FromCint32(errorCode), TAPIYNFLAG(isLast), (*TapAPIAccountFeeRentQryRsp)(unsafe.Pointer(info)))
   996  	} else {
   997  		fmt.Println("OnRspQryAccountFeeRent")
   998  	}
   999  }
  1000  
  1001  //export exOnRspQryAccountMarginRent
  1002  func exOnRspQryAccountMarginRent(sessionID C.uint, errorCode C.int, isLast C.char, info *C.struct_TapAPIAccountMarginRentQryRsp) {
  1003  	if t.OnRspQryAccountMarginRent != nil {
  1004  		t.OnRspQryAccountMarginRent(FromCuint32(sessionID), FromCint32(errorCode), TAPIYNFLAG(isLast), (*TapAPIAccountMarginRentQryRsp)(unsafe.Pointer(info)))
  1005  	} else {
  1006  		fmt.Println("OnRspQryAccountMarginRent")
  1007  	}
  1008  }
  1009  
  1010  //export exOnRspHKMarketOrderInsert
  1011  func exOnRspHKMarketOrderInsert(sessionID C.uint, errorCode C.int, info *C.struct_TapAPIOrderMarketInsertReq) {
  1012  	if t.OnRspHKMarketOrderInsert != nil {
  1013  		t.OnRspHKMarketOrderInsert(FromCuint32(sessionID), FromCint32(errorCode), (*TapAPIOrderMarketInsertReq)(unsafe.Pointer(info)))
  1014  	} else {
  1015  		fmt.Println("OnRspHKMarketOrderInsert")
  1016  	}
  1017  }
  1018  
  1019  //export exOnRspHKMarketOrderDelete
  1020  func exOnRspHKMarketOrderDelete(sessionID C.uint, errorCode C.int, info *C.struct_TapAPIOrderMarketDeleteReq) {
  1021  	if t.OnRspHKMarketOrderDelete != nil {
  1022  		t.OnRspHKMarketOrderDelete(FromCuint32(sessionID), FromCint32(errorCode), (*TapAPIOrderMarketDeleteReq)(unsafe.Pointer(info)))
  1023  	} else {
  1024  		fmt.Println("OnRspHKMarketOrderDelete")
  1025  	}
  1026  }
  1027  
  1028  //export exOnHKMarketQuoteNotice
  1029  func exOnHKMarketQuoteNotice(info *C.struct_TapAPIOrderQuoteMarketNotice) {
  1030  	if t.OnHKMarketQuoteNotice != nil {
  1031  		t.OnHKMarketQuoteNotice((*TapAPIOrderQuoteMarketNotice)(unsafe.Pointer(info)))
  1032  	} else {
  1033  		fmt.Println("OnHKMarketQuoteNotice")
  1034  	}
  1035  }
  1036  
  1037  //export exOnRspOrderLocalRemove
  1038  func exOnRspOrderLocalRemove(sessionID C.uint, errorCode C.int, info *C.struct_TapAPIOrderLocalRemoveRsp) {
  1039  	if t.OnRspOrderLocalRemove != nil {
  1040  		t.OnRspOrderLocalRemove(FromCuint32(sessionID), FromCint32(errorCode), (*TapAPIOrderLocalRemoveRsp)(unsafe.Pointer(info)))
  1041  	} else {
  1042  		fmt.Println("OnRspOrderLocalRemove")
  1043  	}
  1044  }
  1045  
  1046  //export exOnRspOrderLocalInput
  1047  func exOnRspOrderLocalInput(sessionID C.uint, errorCode C.int, info *C.struct_TapAPIOrderLocalInputReq) {
  1048  	if t.OnRspOrderLocalInput != nil {
  1049  		t.OnRspOrderLocalInput(FromCuint32(sessionID), FromCint32(errorCode), (*TapAPIOrderLocalInputReq)(unsafe.Pointer(info)))
  1050  	} else {
  1051  		fmt.Println("OnRspOrderLocalInput")
  1052  	}
  1053  }
  1054  
  1055  //export exOnRspOrderLocalModify
  1056  func exOnRspOrderLocalModify(sessionID C.uint, errorCode C.int, info *C.struct_TapAPIOrderLocalModifyReq) {
  1057  	if t.OnRspOrderLocalModify != nil {
  1058  		t.OnRspOrderLocalModify(FromCuint32(sessionID), FromCint32(errorCode), (*TapAPIOrderLocalModifyReq)(unsafe.Pointer(info)))
  1059  	} else {
  1060  		fmt.Println("OnRspOrderLocalModify")
  1061  	}
  1062  }
  1063  
  1064  //export exOnRspOrderLocalTransfer
  1065  func exOnRspOrderLocalTransfer(sessionID C.uint, errorCode C.int, info *C.struct_TapAPIOrderLocalTransferReq) {
  1066  	if t.OnRspOrderLocalTransfer != nil {
  1067  		t.OnRspOrderLocalTransfer(FromCuint32(sessionID), FromCint32(errorCode), (*TapAPIOrderLocalTransferReq)(unsafe.Pointer(info)))
  1068  	} else {
  1069  		fmt.Println("OnRspOrderLocalTransfer")
  1070  	}
  1071  }
  1072  
  1073  //export exOnRspFillLocalInput
  1074  func exOnRspFillLocalInput(sessionID C.uint, errorCode C.int, info *C.struct_TapAPIFillLocalInputReq) {
  1075  	if t.OnRspFillLocalInput != nil {
  1076  		t.OnRspFillLocalInput(FromCuint32(sessionID), FromCint32(errorCode), (*TapAPIFillLocalInputReq)(unsafe.Pointer(info)))
  1077  	} else {
  1078  		fmt.Println("OnRspFillLocalInput")
  1079  	}
  1080  }
  1081  
  1082  //export exOnRspFillLocalRemove
  1083  func exOnRspFillLocalRemove(sessionID C.uint, errorCode C.int, info *C.struct_TapAPIFillLocalRemoveReq) {
  1084  	if t.OnRspFillLocalRemove != nil {
  1085  		t.OnRspFillLocalRemove(FromCuint32(sessionID), FromCint32(errorCode), (*TapAPIFillLocalRemoveReq)(unsafe.Pointer(info)))
  1086  	} else {
  1087  		fmt.Println("OnRspFillLocalRemove")
  1088  	}
  1089  }
  1090  
  1091  //export exOnRspQrySpotLock
  1092  func exOnRspQrySpotLock(sessionID C.uint, errorCode C.int, isLast C.char, info *C.struct_TapAPISpotLockDataRsp) {
  1093  	if t.OnRspQrySpotLock != nil {
  1094  		t.OnRspQrySpotLock(FromCuint32(sessionID), FromCint32(errorCode), TAPIYNFLAG(isLast), (*TapAPISpotLockDataRsp)(unsafe.Pointer(info)))
  1095  	} else {
  1096  		fmt.Println("OnRspQrySpotLock")
  1097  	}
  1098  }
  1099  
  1100  //export exOnRtnSpotLock
  1101  func exOnRtnSpotLock(info *C.struct_TapAPISpotLockDataRsp) {
  1102  	if t.OnRtnSpotLock != nil {
  1103  		t.OnRtnSpotLock((*TapAPISpotLockDataRsp)(unsafe.Pointer(info)))
  1104  	} else {
  1105  		fmt.Println("OnRtnSpotLock")
  1106  	}
  1107  }
  1108  
  1109  //export exOnRspSubmitUserLoginInfo
  1110  func exOnRspSubmitUserLoginInfo(sessionID C.uint, errorCode C.int, isLast C.char) {
  1111  	if t.OnRspSubmitUserLoginInfo != nil {
  1112  		t.OnRspSubmitUserLoginInfo(FromCuint32(sessionID), FromCint32(errorCode), TAPIYNFLAG(isLast))
  1113  	} else {
  1114  		fmt.Println("OnRspSubmitUserLoginInfo")
  1115  	}
  1116  }
  1117  
  1118  //export exOnRspSpecialOrderAction
  1119  func exOnRspSpecialOrderAction(sessionID C.uint, errorCode C.int, info *C.struct_TapAPISpecialOrderInfo) {
  1120  	if t.OnRspSpecialOrderAction != nil {
  1121  		t.OnRspSpecialOrderAction(FromCuint32(sessionID), FromCint32(errorCode), (*TapAPISpecialOrderInfo)(unsafe.Pointer(info)))
  1122  	} else {
  1123  		fmt.Println("OnRspSpecialOrderAction")
  1124  	}
  1125  }
  1126  
  1127  //export exOnRtnSpecialOrder
  1128  func exOnRtnSpecialOrder(info *C.struct_TapAPISpecialOrderInfo) {
  1129  	if t.OnRtnSpecialOrder != nil {
  1130  		t.OnRtnSpecialOrder((*TapAPISpecialOrderInfo)(unsafe.Pointer(info)))
  1131  	} else {
  1132  		fmt.Println("OnRtnSpecialOrder")
  1133  	}
  1134  }
  1135  
  1136  //export exOnRspQrySpecialOrder
  1137  func exOnRspQrySpecialOrder(sessionID C.uint, errorCode C.int, isLast C.char, info *C.struct_TapAPISpecialOrderInfo) {
  1138  	if t.OnRspQrySpecialOrder != nil {
  1139  		t.OnRspQrySpecialOrder(FromCuint32(sessionID), FromCint32(errorCode), TAPIYNFLAG(isLast), (*TapAPISpecialOrderInfo)(unsafe.Pointer(info)))
  1140  	} else {
  1141  		fmt.Println("OnRspQrySpecialOrder")
  1142  	}
  1143  }
  1144  
  1145  //export exOnRspQryCombinePosition
  1146  func exOnRspQryCombinePosition(sessionID C.uint, errorCode C.int, isLast C.char, info *C.struct_TapAPICombinePositionInfo) {
  1147  	if t.OnRspQryCombinePosition != nil {
  1148  		t.OnRspQryCombinePosition(FromCuint32(sessionID), FromCint32(errorCode), TAPIYNFLAG(isLast), (*TapAPICombinePositionInfo)(unsafe.Pointer(info)))
  1149  	} else {
  1150  		fmt.Println("OnRspQryCombinePosition")
  1151  	}
  1152  }
  1153  
  1154  //export exOnRtnCombinePosition
  1155  func exOnRtnCombinePosition(info *C.struct_TapAPICombinePositionInfo) {
  1156  	if t.OnRtnCombinePosition != nil {
  1157  		t.OnRtnCombinePosition((*TapAPICombinePositionInfo)(unsafe.Pointer(info)))
  1158  	} else {
  1159  		fmt.Println("OnRtnCombinePosition")
  1160  	}
  1161  }