|
| 1 | +package ibapi |
| 2 | + |
| 3 | +import ( |
| 4 | + "github.com/scmhub/ibapi/protobuf" |
| 5 | + "google.golang.org/protobuf/proto" |
| 6 | +) |
| 7 | + |
| 8 | +// UpdateConfigAPISettings . |
| 9 | +func UpdateConfigAPISettings(reqID int32) *protobuf.UpdateConfigRequest { |
| 10 | + settings := &protobuf.ApiSettingsConfig{ |
| 11 | + TotalQuantityForMutualFunds: proto.Bool(true), |
| 12 | + DownloadOpenOrdersOnConnection: proto.Bool(true), |
| 13 | + IncludeVirtualFxPositions: proto.Bool(true), |
| 14 | + PrepareDailyPnL: proto.Bool(true), |
| 15 | + SendStatusUpdatesForVolatilityOrders: proto.Bool(true), |
| 16 | + EncodeApiMessages: proto.String("osCodePage"), |
| 17 | + SocketPort: proto.Int32(7497), |
| 18 | + UseNegativeAutoRange: proto.Bool(true), |
| 19 | + CreateApiMessageLogFile: proto.Bool(true), |
| 20 | + IncludeMarketDataInLogFile: proto.Bool(true), |
| 21 | + ExposeTradingScheduleToApi: proto.Bool(true), |
| 22 | + SplitInsuredDepositFromCashBalance: proto.Bool(true), |
| 23 | + SendZeroPositionsForTodayOnly: proto.Bool(true), |
| 24 | + UseAccountGroupsWithAllocationMethods: proto.Bool(true), |
| 25 | + LoggingLevel: proto.String("error"), |
| 26 | + MasterClientId: proto.Int32(3), |
| 27 | + BulkDataTimeout: proto.Int32(25), |
| 28 | + ComponentExchSeparator: proto.String("#"), |
| 29 | + RoundAccountValuesToNearestWholeNumber: proto.Bool(true), |
| 30 | + ShowAdvancedOrderRejectInUi: proto.Bool(true), |
| 31 | + RejectMessagesAboveMaxRate: proto.Bool(true), |
| 32 | + MaintainConnectionOnIncorrectFields: proto.Bool(true), |
| 33 | + CompatibilityModeNasdaqStocks: proto.Bool(true), |
| 34 | + SendInstrumentTimezone: proto.String("utc"), |
| 35 | + SendForexDataInCompatibilityMode: proto.Bool(true), |
| 36 | + MaintainAndResubmitOrdersOnReconnect: proto.Bool(true), |
| 37 | + HistoricalDataMaxSize: proto.Int32(4), |
| 38 | + AutoReportNettingEventContractTrades: proto.Bool(true), |
| 39 | + OptionExerciseRequestType: proto.String("final"), |
| 40 | + TrustedIPs: []string{"127.0.0.1"}, |
| 41 | + } |
| 42 | + |
| 43 | + return &protobuf.UpdateConfigRequest{ |
| 44 | + ReqId: proto.Int32(reqID), |
| 45 | + Api: &protobuf.ApiConfig{ |
| 46 | + Settings: settings, |
| 47 | + }, |
| 48 | + } |
| 49 | +} |
| 50 | + |
| 51 | +// UpdateOrdersConfig . |
| 52 | +func UpdateOrdersConfig(reqID int32) *protobuf.UpdateConfigRequest { |
| 53 | + orders := &protobuf.OrdersConfig{ |
| 54 | + SmartRouting: &protobuf.OrdersSmartRoutingConfig{ |
| 55 | + SeekPriceImprovement: proto.Bool(true), |
| 56 | + DoNotRouteToDarkPools: proto.Bool(true), |
| 57 | + }, |
| 58 | + } |
| 59 | + |
| 60 | + return &protobuf.UpdateConfigRequest{ |
| 61 | + ReqId: proto.Int32(reqID), |
| 62 | + Orders: orders, |
| 63 | + } |
| 64 | +} |
| 65 | + |
| 66 | +// UpdateMessageConfigConfirmMandatoryCapPriceAccepted . |
| 67 | +func UpdateMessageConfigConfirmMandatoryCapPriceAccepted(reqID int32) *protobuf.UpdateConfigRequest { |
| 68 | + messageID := proto.Int32(131) |
| 69 | + messageConfig := &protobuf.MessageConfig{ |
| 70 | + Id: messageID, |
| 71 | + Enabled: proto.Bool(false), |
| 72 | + } |
| 73 | + warning := &protobuf.UpdateConfigWarning{MessageId: messageID} |
| 74 | + |
| 75 | + return &protobuf.UpdateConfigRequest{ |
| 76 | + ReqId: proto.Int32(reqID), |
| 77 | + Messages: []*protobuf.MessageConfig{messageConfig}, |
| 78 | + AcceptedWarnings: []*protobuf.UpdateConfigWarning{warning}, |
| 79 | + } |
| 80 | +} |
| 81 | + |
| 82 | +// UpdateConfigOrderIDReset . |
| 83 | +func UpdateConfigOrderIDReset(reqID int32) *protobuf.UpdateConfigRequest { |
| 84 | + return &protobuf.UpdateConfigRequest{ |
| 85 | + ReqId: proto.Int32(reqID), |
| 86 | + ResetAPIOrderSequence: proto.Bool(true), |
| 87 | + } |
| 88 | +} |
0 commit comments