From 65ae418d9353d87c227cc78392695f20ce604b6f Mon Sep 17 00:00:00 2001 From: hadrianl <137150224@qq.com> Date: Wed, 28 Apr 2021 12:18:41 +0800 Subject: [PATCH] fix ReqScannerSubscription --- client.go | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/client.go b/client.go index 47570e4..bdcfabc 100644 --- a/client.go +++ b/client.go @@ -2248,7 +2248,7 @@ call this func to subcribe a scanner which could scan the market. For internal use only.Use default value XYZ. */ func (ic *IbClient) ReqScannerSubscription(reqID int64, subscription *ScannerSubscription, scannerSubscriptionOptions []TagValue, scannerSubscriptionFilterOptions []TagValue) { - if ic.serverVersion < mMIN_SERVER_VER_SCANNER_GENERIC_OPTS { + if ic.serverVersion < mMIN_SERVER_VER_SCANNER_GENERIC_OPTS && len(scannerSubscriptionFilterOptions) > 0 { ic.wrapper.Error(NO_VALID_ID, UPDATE_TWS.code, UPDATE_TWS.msg+" It does not support API scanner subscription generic filter options") return } @@ -2286,6 +2286,17 @@ func (ic *IbClient) ReqScannerSubscription(reqID int64, subscription *ScannerSub subscription.ScannerSettingPairs, subscription.StockTypeFilter) + if ic.serverVersion >= mMIN_SERVER_VER_SCANNER_GENERIC_OPTS { + var scannerSubscriptionFilterOptionsBuffer bytes.Buffer + for _, tv := range scannerSubscriptionFilterOptions { + scannerSubscriptionFilterOptionsBuffer.WriteString(tv.Tag) + scannerSubscriptionFilterOptionsBuffer.WriteString("=") + scannerSubscriptionFilterOptionsBuffer.WriteString(tv.Value) + scannerSubscriptionFilterOptionsBuffer.WriteString(";") + } + fields = append(fields, scannerSubscriptionFilterOptionsBuffer.Bytes()) + } + if ic.serverVersion >= mMIN_SERVER_VER_LINKING { var scannerSubscriptionOptionsBuffer bytes.Buffer for _, tv := range scannerSubscriptionOptions {