├── .gitignore ├── LICENSE ├── README.md ├── account_summary_tags.go ├── available_algo_params.go ├── bar.go ├── client.go ├── client_test.go ├── client_utils.go ├── commission_and_fees_report.go ├── common_defs.go ├── connection.go ├── contract.go ├── contract_condition.go ├── contract_samples.go ├── contract_test.go ├── decimal.go ├── decoder.go ├── decoder_utils.go ├── depth_mkt_data_description.go ├── errors.go ├── examples ├── basic │ └── basic.go └── blocking │ └── blocking.go ├── execution.go ├── execution_condition.go ├── fa_allocation_sample.go ├── family_code.go ├── go.mod ├── go.sum ├── histogram_data.go ├── historical_session.go ├── historical_tick.go ├── historical_tick_bid_ask.go ├── historical_tick_last.go ├── ineligibility_reason.go ├── logger.go ├── margin_condition.go ├── message.go ├── news_provider.go ├── operator_condition.go ├── order.go ├── order_cancel.go ├── order_condition.go ├── order_decoder.go ├── order_sample.go ├── order_state.go ├── percent_change_condition.go ├── price_condition.go ├── price_increment.go ├── proto ├── CancelOrderRequest.proto ├── ComboLeg.proto ├── Contract.proto ├── DeltaNeutralContract.proto ├── ErrorMessage.proto ├── Execution.proto ├── ExecutionDetails.proto ├── ExecutionDetailsEnd.proto ├── ExecutionFilter.proto ├── ExecutionRequest.proto ├── GlobalCancelRequest.proto ├── OpenOrder.proto ├── OpenOrdersEnd.proto ├── Order.proto ├── OrderAllocation.proto ├── OrderCancel.proto ├── OrderCondition.proto ├── OrderState.proto ├── OrderStatus.proto ├── PlaceOrderRequest.proto ├── SoftDollarTier.proto └── proto.md ├── protobuf ├── CancelOrderRequest.pb.go ├── ComboLeg.pb.go ├── Contract.pb.go ├── DeltaNeutralContract.pb.go ├── ErrorMessage.pb.go ├── Execution.pb.go ├── ExecutionDetails.pb.go ├── ExecutionDetailsEnd.pb.go ├── ExecutionFilter.pb.go ├── ExecutionRequest.pb.go ├── GlobalCancelRequest.pb.go ├── OpenOrder.pb.go ├── OpenOrdersEnd.pb.go ├── Order.pb.go ├── OrderAllocation.pb.go ├── OrderCancel.pb.go ├── OrderCondition.pb.go ├── OrderState.pb.go ├── OrderStatus.pb.go ├── PlaceOrderRequest.pb.go └── SoftDollarTier.pb.go ├── reader.go ├── scanner.go ├── scanner_subscription_samples.go ├── server_versions.go ├── soft_dollar_tier.go ├── tag_value.go ├── tick_attrib.go ├── tick_attrib_bid_ask.go ├── tick_attrib_last.go ├── tick_type.go ├── time_condition.go ├── utils.go ├── volume_condition.go ├── wrapper.go └── wsh_event_data.go /.gitignore: -------------------------------------------------------------------------------- 1 | # If you prefer the allow list template instead of the deny list, see community template: 2 | # https://github.com/github/gitignore/blob/main/community/Golang/Go.AllowList.gitignore 3 | # 4 | # Binaries for programs and plugins 5 | *.exe 6 | *.exe~ 7 | *.dll 8 | *.so 9 | *.dylib 10 | 11 | # Test binary, built with `go test -c` 12 | *.test 13 | 14 | # Output of the go coverage tool, specifically when used with LiteIDE 15 | *.out 16 | 17 | # Dependency directories (remove the comment below to include it) 18 | # vendor/ 19 | 20 | # Go workspace file 21 | go.work 22 | go.work.sum 23 | 24 | # env file 25 | .env 26 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2025 SCM 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | [![Go Report Card](https://goreportcard.com/badge/github.com/scmhub/ibapi)](https://goreportcard.com/report/github.com/scmhub/ibapi) 2 | [![Go Reference](https://pkg.go.dev/badge/github.com/scmhub/ibapi.svg)](https://pkg.go.dev/github.com/scmhub/ibapi) 3 | [![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](https://opensource.org/licenses/MIT) 4 | 5 | # Unofficial Golang Interactive Brokers API 6 | 7 | `ibapi` package provides an **unofficial** Golang implementation of the [Interactive Brokers](https://www.interactivebrokers.com/en/home.php) API. It is designed to mirror the official Python or C++ [tws-api](https://github.com/InteractiveBrokers) provided by Interactive Brokers. 8 | **We will do our best to keep it in sync** with the official API releases to ensure compatibility and feature parity, but users should be aware that this is a community-driven project and may lag behind the official versions at times. 9 | 10 | > [!CAUTION] 11 | > This package is in the **beta phase**. While functional, it may still have bugs or incomplete features. Please test extensively in non-production environments. 12 | 13 | ## Getting Started 14 | 15 | ### Prerequisites 16 | - **Go** version 1.23 or higher (recommended) 17 | - An **Interactive Brokers** account with TWS or IB Gateway installed and running 18 | 19 | ### Installation 20 | Install the package via `go get`: 21 | ```bash 22 | go get -u github.com/scmhub/ibapi 23 | ``` 24 | 25 | ## Usage 26 | Here’s a basic example to connect and place an order using this package: 27 | ```go 28 | package main 29 | 30 | import ( 31 | "math/rand" 32 | "time" 33 | 34 | "github.com/scmhub/ibapi" 35 | ) 36 | 37 | const ( 38 | IB_HOST = "127.0.0.1" 39 | IB_PORT = 7497 40 | ) 41 | 42 | func main() { 43 | // We set logger for pretty logs to console 44 | log := ibapi.Logger() 45 | ibapi.SetConsoleWriter() 46 | 47 | // New IB CLient 48 | ib := ibapi.NewEClient(nil) 49 | 50 | // Connect client 51 | if err := ib.Connect(IB_HOST, IB_PORT, rand.Int63n(999999)); err != nil { 52 | log.Error().Err(err) 53 | return 54 | } 55 | 56 | // Create and place order 57 | id := 1 58 | eurusd := &ibapi.Contract{Symbol: "EUR", SecType: "CASH", Currency: "USD", Exchange: "IDEALPRO"} 59 | limitOrder := ibapi.LimitOrder("BUY", ibapi.StringToDecimal("20000"), 1.08) 60 | ib.PlaceOrder(id, eurusd, limitOrder) 61 | 62 | time.Sleep(1 * time.Second) 63 | 64 | err := ib.Disconnect() 65 | if err != nil { 66 | log.Error().Err(err).Msg("Disconnect") 67 | } 68 | } 69 | ``` 70 | 71 | For more information on how to use this package, please refer to the [GoDoc](https://pkg.go.dev/github.com/scmhub/ibapi) documentation. 72 | 73 | ## Acknowledgments 74 | - Some portions of the code were adapted from [hadrianl](https://github.com/hadrianl/ibapi). Thanks to them for their valuable work! 75 | - Decimals are implemented with the [fixed](https://github.com/robaho/fixed) package 76 | 77 | ## Notice of Non-Affiliation and Disclaimer 78 | > [!CAUTION] 79 | > This project is in the **beta phase** and is still undergoing testing and development. Users are advised to thoroughly test the software in non-production environments before relying on it for live trading. Features may be incomplete, and bugs may exist. Use at your own risk. 80 | 81 | > [!IMPORTANT] 82 | >This project is **not affiliated** with Interactive Brokers Group, Inc. All references to Interactive Brokers, including trademarks, logos, and brand names, belong to their respective owners. The use of these names is purely for informational purposes and does not imply endorsement by Interactive Brokers. 83 | 84 | > [!IMPORTANT] 85 | >The authors of this package make **no guarantees** regarding the software's reliability, accuracy, or suitability for any particular purpose, including trading or financial decisions. **No liability** will be accepted for any financial losses, damages, or misinterpretations arising from the use of this software. 86 | 87 | ## License 88 | Distributed under the MIT License. See [LICENSE](./LICENSE) for more information. 89 | 90 | ## Author 91 | **Philippe Chavanne** - [contact](https://scm.cx/contact) 92 | -------------------------------------------------------------------------------- /account_summary_tags.go: -------------------------------------------------------------------------------- 1 | package ibapi 2 | 3 | import "strings" 4 | 5 | // AccountSummaryTags . 6 | type AccountSummaryTags = string 7 | 8 | const ( 9 | AccountType AccountSummaryTags = "AccountType" 10 | NetLiquidation AccountSummaryTags = "NetLiquidation" 11 | TotalCashValue AccountSummaryTags = "TotalCashValue" 12 | SettledCash AccountSummaryTags = "SettledCash" 13 | AccruedCash AccountSummaryTags = "AccruedCash" 14 | BuyingPower AccountSummaryTags = "BuyingPower" 15 | EquityWithLoanValue AccountSummaryTags = "EquityWithLoanValue" 16 | PreviousEquityWithLoanValue AccountSummaryTags = "PreviousEquityWithLoanValue" 17 | GrossPositionValue AccountSummaryTags = "GrossPositionValue" 18 | ReqTEquity AccountSummaryTags = "ReqTEquity" 19 | ReqTMargin AccountSummaryTags = "ReqTMargin" 20 | SMA AccountSummaryTags = "SMA" 21 | InitMarginReq AccountSummaryTags = "InitMarginReq" 22 | MaintMarginReq AccountSummaryTags = "MaintMarginReq" 23 | AvailableFunds AccountSummaryTags = "AvailableFunds" 24 | ExcessLiquidity AccountSummaryTags = "ExcessLiquidity" 25 | Cushion AccountSummaryTags = "Cushion" 26 | FullInitMarginReq AccountSummaryTags = "FullInitMarginReq" 27 | FullMaintMarginReq AccountSummaryTags = "FullMaintMarginReq" 28 | FullAvailableFunds AccountSummaryTags = "FullAvailableFunds" 29 | FullExcessLiquidity AccountSummaryTags = "FullExcessLiquidity" 30 | LookAheadNextChange AccountSummaryTags = "LookAheadNextChange" 31 | LookAheadInitMarginReq AccountSummaryTags = "LookAheadInitMarginReq" 32 | LookAheadMaintMarginReq AccountSummaryTags = "LookAheadMaintMarginReq" 33 | LookAheadAvailableFunds AccountSummaryTags = "LookAheadAvailableFunds" 34 | LookAheadExcessLiquidity AccountSummaryTags = "LookAheadExcessLiquidity" 35 | HighestSeverity AccountSummaryTags = "HighestSeverity" 36 | DayTradesRemaining AccountSummaryTags = "DayTradesRemaining" 37 | Leverage AccountSummaryTags = "Leverage" 38 | ) 39 | 40 | func GetAllTags() string { 41 | tags := []AccountSummaryTags{ 42 | AccountType, 43 | NetLiquidation, 44 | TotalCashValue, 45 | SettledCash, 46 | AccruedCash, 47 | BuyingPower, 48 | EquityWithLoanValue, 49 | PreviousEquityWithLoanValue, 50 | GrossPositionValue, 51 | ReqTEquity, 52 | ReqTMargin, 53 | SMA, 54 | InitMarginReq, 55 | MaintMarginReq, 56 | AvailableFunds, 57 | ExcessLiquidity, 58 | Cushion, 59 | FullInitMarginReq, 60 | FullMaintMarginReq, 61 | FullAvailableFunds, 62 | FullExcessLiquidity, 63 | LookAheadNextChange, 64 | LookAheadInitMarginReq, 65 | LookAheadMaintMarginReq, 66 | LookAheadAvailableFunds, 67 | LookAheadExcessLiquidity, 68 | HighestSeverity, 69 | DayTradesRemaining, 70 | Leverage, 71 | } 72 | return strings.Join(tags, ",") 73 | } 74 | -------------------------------------------------------------------------------- /bar.go: -------------------------------------------------------------------------------- 1 | package ibapi 2 | 3 | import "fmt" 4 | 5 | // Bar . 6 | type Bar struct { 7 | Date string 8 | Open float64 9 | High float64 10 | Low float64 11 | Close float64 12 | Volume Decimal 13 | Wap Decimal 14 | BarCount int64 15 | } 16 | 17 | func NewBar() Bar { 18 | b := Bar{} 19 | b.Volume = UNSET_DECIMAL 20 | b.Wap = UNSET_DECIMAL 21 | return b 22 | } 23 | 24 | func (b Bar) String() string { 25 | return fmt.Sprintf("Date: %s, Open: %f, High: %f, Low: %f, Close: %f, Volume: %s, WAP: %s, BarCount: %d", 26 | b.Date, b.Open, b.High, b.Low, b.Close, DecimalMaxString(b.Volume), DecimalMaxString(b.Wap), b.BarCount) 27 | } 28 | 29 | // RealTimeBar . 30 | type RealTimeBar struct { 31 | Time int64 32 | EndTime int64 33 | Open float64 34 | High float64 35 | Low float64 36 | Close float64 37 | Volume Decimal 38 | Wap Decimal 39 | Count int64 40 | } 41 | 42 | func NewRealTimeBar() RealTimeBar { 43 | rtb := RealTimeBar{} 44 | rtb.Volume = UNSET_DECIMAL 45 | rtb.Wap = UNSET_DECIMAL 46 | return rtb 47 | } 48 | 49 | func (rb RealTimeBar) String() string { 50 | return fmt.Sprintf("Time: %d, Open: %f, High: %f, Low: %f, Close: %f, Volume: %s, Wap: %s, Count: %d", 51 | rb.Time, rb.Open, rb.High, rb.Low, rb.Close, DecimalMaxString(rb.Volume), DecimalMaxString(rb.Wap), rb.Count) 52 | } 53 | -------------------------------------------------------------------------------- /commission_and_fees_report.go: -------------------------------------------------------------------------------- 1 | package ibapi 2 | 3 | import "fmt" 4 | 5 | // CommissionAndFeesReport . 6 | type CommissionAndFeesReport struct { 7 | ExecID string 8 | CommissionAndFees float64 9 | Currency string 10 | RealizedPNL float64 11 | Yield float64 12 | YieldRedemptionDate int64 // YYYYMMDD format 13 | } 14 | 15 | func NewCommissionAndFeesReport() CommissionAndFeesReport { 16 | return CommissionAndFeesReport{} 17 | } 18 | 19 | func (cr CommissionAndFeesReport) String() string { 20 | return fmt.Sprintf("ExecId: %s, CommissionAndFees: %f, Currency: %s, RealizedPnL: %f, Yield: %f, YieldRedemptionDate: %d", 21 | cr.ExecID, 22 | cr.CommissionAndFees, 23 | cr.Currency, 24 | cr.RealizedPNL, 25 | cr.Yield, 26 | cr.YieldRedemptionDate) 27 | } 28 | -------------------------------------------------------------------------------- /common_defs.go: -------------------------------------------------------------------------------- 1 | package ibapi 2 | 3 | import ( 4 | "fmt" 5 | "math" 6 | ) 7 | 8 | const ( 9 | UNSET_INT int64 = math.MaxInt32 10 | UNSET_LONG int64 = math.MaxInt64 11 | UNSET_FLOAT float64 = math.MaxFloat64 12 | INFINITY_STRING string = "Infinity" 13 | ) 14 | 15 | var INFINITY_FLOAT float64 = math.Inf(1) 16 | 17 | type TickerID = int64 18 | 19 | type OrderID = int64 20 | 21 | type FaDataType int64 22 | 23 | const ( 24 | GROUPS FaDataType = 1 25 | ALIASES FaDataType = 3 26 | ) 27 | 28 | func (fa FaDataType) String() string { 29 | switch fa { 30 | case GROUPS: 31 | return "GROUPS" 32 | case ALIASES: 33 | return "ALIASES" 34 | default: 35 | return "" 36 | } 37 | } 38 | 39 | type MarketDataType int64 40 | 41 | const ( 42 | REALTIME MarketDataType = 1 43 | FROZEN MarketDataType = 2 44 | DELAYED MarketDataType = 3 45 | DELAYED_FROZEN MarketDataType = 4 46 | ) 47 | 48 | func (mdt MarketDataType) String() string { 49 | switch mdt { 50 | case REALTIME: 51 | return "REALTIME" 52 | case FROZEN: 53 | return "FROZEN" 54 | case DELAYED: 55 | return "DELAYED" 56 | case DELAYED_FROZEN: 57 | return "DELAYED_FROZEN" 58 | } 59 | return "" 60 | } 61 | 62 | // SmartComponent . 63 | type SmartComponent struct { 64 | BitNumber int64 65 | Exchange string 66 | ExchangeLetter string 67 | } 68 | 69 | func NewSmartComponent() SmartComponent { 70 | return SmartComponent{} 71 | } 72 | 73 | func (s SmartComponent) String() string { 74 | return fmt.Sprintf("BitNumber: %d, Exchange: %s, ExchangeLetter: %s", s.BitNumber, s.Exchange, s.ExchangeLetter) 75 | } 76 | 77 | // FundAssetType . 78 | type FundAssetType string 79 | 80 | const ( 81 | FundAssetTypeNone FundAssetType = "" 82 | FundAssetTypeOthers FundAssetType = "000" 83 | FundAssetTypeMoneyMarket FundAssetType = "001" 84 | FundAssetTypeFixedIncome FundAssetType = "002" 85 | FundAssetTypeMultiAsset FundAssetType = "003" 86 | FundAssetTypeEquity FundAssetType = "004" 87 | FundAssetTypeSector FundAssetType = "005" 88 | FundAssetTypeGuaranteed FundAssetType = "006" 89 | FundAssetTypeAlternative FundAssetType = "007" 90 | ) 91 | 92 | func getFundAssetType(fat string) FundAssetType { 93 | switch fat { 94 | case string(FundAssetTypeOthers): 95 | return FundAssetTypeOthers 96 | case string(FundAssetTypeMoneyMarket): 97 | return FundAssetTypeMoneyMarket 98 | case string(FundAssetTypeFixedIncome): 99 | return FundAssetTypeFixedIncome 100 | case string(FundAssetTypeMultiAsset): 101 | return FundAssetTypeMultiAsset 102 | case string(FundAssetTypeEquity): 103 | return FundAssetTypeEquity 104 | case string(FundAssetTypeSector): 105 | return FundAssetTypeSector 106 | case string(FundAssetTypeGuaranteed): 107 | return FundAssetTypeGuaranteed 108 | case string(FundAssetTypeAlternative): 109 | return FundAssetTypeAlternative 110 | default: 111 | return FundAssetTypeNone 112 | } 113 | } 114 | 115 | // FundDistributionPolicyIndicator . 116 | type FundDistributionPolicyIndicator string 117 | 118 | const ( 119 | FundDistributionPolicyIndicatorNone FundDistributionPolicyIndicator = "" 120 | FundDistributionPolicyIndicatorAccumulationFund FundDistributionPolicyIndicator = "N" 121 | FundDistributionPolicyIndicatorIncomeFund FundDistributionPolicyIndicator = "Y" 122 | ) 123 | 124 | func getFundDistributionPolicyIndicator(fat string) FundDistributionPolicyIndicator { 125 | switch fat { 126 | case string(FundDistributionPolicyIndicatorAccumulationFund): 127 | return FundDistributionPolicyIndicatorAccumulationFund 128 | case string(FundDistributionPolicyIndicatorIncomeFund): 129 | return FundDistributionPolicyIndicatorIncomeFund 130 | default: 131 | return FundDistributionPolicyIndicatorNone 132 | } 133 | } 134 | 135 | type OptionExerciseType int 136 | 137 | const ( 138 | OptionExerciseTypeNone OptionExerciseType = -1 139 | OptionExerciseTypeExercise OptionExerciseType = 1 140 | OptionExerciseTypeLapse OptionExerciseType = 2 141 | OptionExerciseTypeDoNothing OptionExerciseType = 3 142 | OptionExerciseTypeAssigned OptionExerciseType = 100 143 | OptionExerciseTypeAutoexerciseClearing OptionExerciseType = 101 144 | OptionExerciseTypeExpired OptionExerciseType = 102 145 | OptionExerciseTypeNetting OptionExerciseType = 103 146 | OptionExerciseTypeAutoexerciseTrading OptionExerciseType = 104 147 | ) 148 | 149 | func (e OptionExerciseType) String() string { 150 | switch e { 151 | case OptionExerciseTypeNone: 152 | return "None" 153 | case OptionExerciseTypeExercise: 154 | return "Exercise" 155 | case OptionExerciseTypeLapse: 156 | return "Lapse" 157 | case OptionExerciseTypeDoNothing: 158 | return "DoNothing" 159 | case OptionExerciseTypeAssigned: 160 | return "Assigned" 161 | case OptionExerciseTypeAutoexerciseClearing: 162 | return "AutoexerciseClearing" 163 | case OptionExerciseTypeExpired: 164 | return "Expired" 165 | case OptionExerciseTypeNetting: 166 | return "Netting" 167 | case OptionExerciseTypeAutoexerciseTrading: 168 | return "AutoexerciseTrading" 169 | default: 170 | return "Unknown" 171 | } 172 | } 173 | -------------------------------------------------------------------------------- /connection.go: -------------------------------------------------------------------------------- 1 | package ibapi 2 | 3 | import ( 4 | "fmt" 5 | "net" 6 | "time" 7 | ) 8 | 9 | const ( 10 | maxReconnectAttempts = 3 11 | reconnectDelay = 500 * time.Millisecond 12 | ) 13 | 14 | // Connection is a TCPConn wrapper. 15 | type Connection struct { 16 | *net.TCPConn 17 | host string 18 | port int 19 | isConnected bool 20 | numBytesSent int 21 | numMsgSent int 22 | numBytesRecv int 23 | numMsgRecv int 24 | } 25 | 26 | func (c *Connection) Write(bs []byte) (int, error) { 27 | n, err := c.TCPConn.Write(bs) 28 | if err != nil { 29 | log.Warn().Err(err).Msg("Write error detected, attempting to reconnect...") 30 | if err := c.reconnect(); err != nil { 31 | return 0, fmt.Errorf("write failed and reconnection failed: %w", err) 32 | } 33 | // Retry write after successful reconnection 34 | return c.TCPConn.Write(bs) 35 | } 36 | 37 | c.numBytesSent += n 38 | c.numMsgSent++ 39 | 40 | log.Trace().Int("nBytes", n).Msg("conn write") 41 | 42 | return n, err 43 | } 44 | 45 | func (c *Connection) Read(bs []byte) (int, error) { 46 | n, err := c.TCPConn.Read(bs) 47 | 48 | c.numBytesRecv += n 49 | c.numMsgRecv++ 50 | 51 | log.Trace().Int("nBytes", n).Msg("conn read") 52 | 53 | return n, err 54 | } 55 | 56 | func (c *Connection) reset() { 57 | c.numBytesSent = 0 58 | c.numBytesRecv = 0 59 | c.numMsgSent = 0 60 | c.numMsgRecv = 0 61 | } 62 | 63 | func (c *Connection) connect(host string, port int) error { 64 | c.host = host 65 | c.port = port 66 | c.reset() 67 | 68 | address := fmt.Sprintf("%v:%v", c.host, c.port) 69 | addr, err := net.ResolveTCPAddr("tcp4", address) 70 | if err != nil { 71 | log.Error().Err(err).Str("host", address).Msg("failed to resove tcp address") 72 | return err 73 | } 74 | 75 | c.TCPConn, err = net.DialTCP("tcp4", nil, addr) 76 | if err != nil { 77 | log.Error().Err(err).Any("address", addr).Msg("failed to dial tcp") 78 | return err 79 | } 80 | 81 | log.Debug().Any("address", c.TCPConn.RemoteAddr()).Msg("tcp socket connected") 82 | c.isConnected = true 83 | 84 | return nil 85 | } 86 | 87 | func (c *Connection) reconnect() error { 88 | attempts := 0 89 | backoff := reconnectDelay // Start with base delay 90 | 91 | for attempts < maxReconnectAttempts { 92 | log.Info(). 93 | Int("attempt", attempts+1). 94 | Int("maxAttempts", maxReconnectAttempts). 95 | Msg("Attempting to reconnect") 96 | 97 | err := c.connect(c.host, c.port) 98 | if err == nil { 99 | log.Info().Msg("Reconnection successful") 100 | return nil 101 | } 102 | 103 | attempts++ 104 | if attempts == maxReconnectAttempts { 105 | return fmt.Errorf("failed to reconnect after %d attempts", attempts) 106 | } 107 | 108 | time.Sleep(backoff) 109 | backoff *= 2 // Exponential backoff 110 | } 111 | 112 | return fmt.Errorf("failed to reconnect after %d attempts", attempts) 113 | } 114 | 115 | func (c *Connection) disconnect() error { 116 | log.Trace(). 117 | Int("nMsgSent", c.numMsgSent).Int("nBytesSent", c.numBytesSent). 118 | Int("nMsgRecv", c.numMsgRecv).Int("nBytesRecv", c.numBytesRecv). 119 | Msg("conn disconnect") 120 | c.isConnected = false 121 | return c.Close() 122 | } 123 | 124 | func (c *Connection) IsConnected() bool { 125 | return c.isConnected 126 | } 127 | -------------------------------------------------------------------------------- /contract_condition.go: -------------------------------------------------------------------------------- 1 | package ibapi 2 | 3 | import "fmt" 4 | 5 | type ContractCondition interface { 6 | OperatorCondition 7 | } 8 | 9 | var _ OperatorCondition = (*contractCondition)(nil) 10 | 11 | type contractCondition struct { 12 | *operatorCondition 13 | ConID int64 14 | Exchange string 15 | } 16 | 17 | func newContractCondition(condType OrderConditionType) *contractCondition { 18 | return &contractCondition{operatorCondition: newOperatorCondition(condType)} 19 | } 20 | 21 | func (cc *contractCondition) decode(msgBuf *MsgBuffer) { 22 | cc.operatorCondition.decode(msgBuf) 23 | cc.ConID = msgBuf.decodeInt64() 24 | cc.Exchange = msgBuf.decodeString() 25 | } 26 | 27 | func (cc contractCondition) makeFields() []any { 28 | return append(cc.operatorCondition.makeFields(), cc.ConID, cc.Exchange) 29 | } 30 | 31 | func (cc contractCondition) String() string { 32 | return fmt.Sprintf("%v of %v", cc.TypeName(), cc.ConID) 33 | } 34 | -------------------------------------------------------------------------------- /contract_test.go: -------------------------------------------------------------------------------- 1 | package ibapi 2 | 3 | import ( 4 | "encoding/json" 5 | "testing" 6 | ) 7 | 8 | func TestContractComplexJSON(t *testing.T) { 9 | // Create a complex contract 10 | contract := NewContract() 11 | contract.Symbol = "SPREAD" 12 | contract.SecType = "BAG" 13 | contract.Currency = "USD" 14 | contract.Exchange = "SMART" 15 | 16 | // Add combo legs 17 | leg1 := NewComboLeg() 18 | leg1.ConID = 12345 19 | leg1.Ratio = 1 20 | leg1.Action = "BUY" 21 | leg1.Exchange = "SMART" 22 | leg1.OpenClose = int64(OPEN_POS) 23 | 24 | leg2 := NewComboLeg() 25 | leg2.ConID = 67890 26 | leg2.Ratio = 1 27 | leg2.Action = "SELL" 28 | leg2.Exchange = "SMART" 29 | leg2.OpenClose = int64(CLOSE_POS) 30 | 31 | contract.ComboLegs = []ComboLeg{leg1, leg2} 32 | 33 | // Add delta neutral contract 34 | contract.DeltaNeutralContract = &DeltaNeutralContract{ 35 | ConID: 11111, 36 | Delta: 0.5, 37 | Price: 150.0, 38 | } 39 | 40 | // Marshal to JSON 41 | data, err := json.Marshal(contract) 42 | if err != nil { 43 | t.Fatalf("Failed to marshal: %v", err) 44 | } 45 | 46 | // Verify JSON structure 47 | var jsonMap map[string]any 48 | if err := json.Unmarshal(data, &jsonMap); err != nil { 49 | t.Fatalf("Failed to parse JSON: %v", err) 50 | } 51 | 52 | // Check combo legs 53 | legs, ok := jsonMap["comboLegs"].([]any) 54 | if !ok || len(legs) != 2 { 55 | t.Error("Expected 2 combo legs in JSON") 56 | } 57 | 58 | // Check delta neutral 59 | delta, ok := jsonMap["deltaNeutralContract"].(map[string]any) 60 | if !ok { 61 | t.Error("Expected deltaNeutralContract in JSON") 62 | } 63 | if delta["conId"].(float64) != 11111 { 64 | t.Errorf("Expected deltaNeutralContract.conId = 11111, got %v", delta["conId"]) 65 | } 66 | 67 | // Unmarshal back to contract 68 | var decoded Contract 69 | if err := json.Unmarshal(data, &decoded); err != nil { 70 | t.Fatalf("Failed to unmarshal: %v", err) 71 | } 72 | // Equal check 73 | if !decoded.Equal(contract) { 74 | t.Errorf("Decoded contract not equal to original:\nOriginal: %+v\nDecoded: %+v", 75 | contract, decoded) 76 | } 77 | // Verify combo legs 78 | if len(decoded.ComboLegs) != 2 { 79 | t.Fatalf("Expected 2 combo legs, got %d", len(decoded.ComboLegs)) 80 | } 81 | if decoded.ComboLegs[0].ConID != 12345 { 82 | t.Errorf("Expected first leg ConID 12345, got %d", decoded.ComboLegs[0].ConID) 83 | } 84 | if decoded.ComboLegs[1].ConID != 67890 { 85 | t.Errorf("Expected second leg ConID 67890, got %d", decoded.ComboLegs[1].ConID) 86 | } 87 | 88 | // Verify delta neutral contract 89 | if decoded.DeltaNeutralContract == nil { 90 | t.Fatal("Expected non-nil DeltaNeutralContract") 91 | } 92 | if decoded.DeltaNeutralContract.ConID != 11111 { 93 | t.Errorf("Expected DeltaNeutralContract.ConID 11111, got %d", 94 | decoded.DeltaNeutralContract.ConID) 95 | } 96 | if decoded.DeltaNeutralContract.Delta != 0.5 { 97 | t.Errorf("Expected DeltaNeutralContract.Delta 0.5, got %f", 98 | decoded.DeltaNeutralContract.Delta) 99 | } 100 | } 101 | -------------------------------------------------------------------------------- /decimal.go: -------------------------------------------------------------------------------- 1 | package ibapi 2 | 3 | import ( 4 | "errors" 5 | 6 | "github.com/robaho/fixed" 7 | ) 8 | 9 | var UNSET_DECIMAL = Decimal(fixed.NaN) 10 | var ZERO = Decimal(fixed.ZERO) 11 | var ONE = Decimal(fixed.NewF(1)) 12 | 13 | // Decimal implements Fixed from "github.com/robaho/fixed". 14 | type Decimal fixed.Fixed 15 | 16 | func (d Decimal) String() string { 17 | return fixed.Fixed(d).String() 18 | } 19 | 20 | func (d Decimal) Int() int64 { 21 | return fixed.Fixed(d).Int() 22 | } 23 | 24 | func (d Decimal) Float() float64 { 25 | return fixed.Fixed(d).Float() 26 | } 27 | 28 | func (d Decimal) MarshalBinary() ([]byte, error) { 29 | return fixed.Fixed(d).MarshalBinary() 30 | } 31 | 32 | func (d *Decimal) UnmarshalBinary(data []byte) error { 33 | var f fixed.Fixed 34 | err := f.UnmarshalBinary(data) 35 | if err != nil { 36 | return err 37 | } 38 | *d = Decimal(f) 39 | return nil 40 | } 41 | 42 | func StringToDecimal(s string) Decimal { 43 | d, _ := StringToDecimalErr(s) 44 | return d 45 | } 46 | 47 | func StringToDecimalErr(s string) (Decimal, error) { 48 | if s == "" || s == "2147483647" || s == "9223372036854775807" || s == "1.7976931348623157E308" || s == "-9223372036854775808" { 49 | return UNSET_DECIMAL, errors.New("unset decimal") 50 | } 51 | f, err := fixed.NewSErr(s) 52 | if err != nil { 53 | return UNSET_DECIMAL, err 54 | } 55 | return Decimal(f), nil 56 | } 57 | 58 | func DecimalToString(d Decimal) string { 59 | return fixed.Fixed(d).String() 60 | } 61 | -------------------------------------------------------------------------------- /depth_mkt_data_description.go: -------------------------------------------------------------------------------- 1 | package ibapi 2 | 3 | import "fmt" 4 | 5 | // DepthMktDataDescription . 6 | type DepthMktDataDescription struct { 7 | Exchange string 8 | SecType string 9 | ListingExch string 10 | ServiceDataType string 11 | AggGroup int64 12 | } 13 | 14 | func NewDepthMktDataDescription() DepthMktDataDescription { 15 | dmdd := DepthMktDataDescription{} 16 | dmdd.AggGroup = UNSET_INT 17 | return dmdd 18 | } 19 | 20 | // DepthMktDataDescription . 21 | func (d DepthMktDataDescription) String() string { 22 | return fmt.Sprintf("Exchange: %s, SecType: %s, ListingExchange: %s, ServiceDataType: %s, AggGroup: %s", 23 | d.Exchange, d.SecType, d.ListingExch, d.ServiceDataType, IntMaxString(d.AggGroup)) 24 | } 25 | -------------------------------------------------------------------------------- /errors.go: -------------------------------------------------------------------------------- 1 | package ibapi 2 | 3 | const ( 4 | NO_VALID_ID int64 = -1 5 | ) 6 | 7 | // CodeMsgPair is IB internal errors. 8 | type CodeMsgPair struct { 9 | Code int64 10 | Msg string 11 | } 12 | 13 | func (cmp CodeMsgPair) Error() string { 14 | return cmp.Msg 15 | } 16 | 17 | func (cmp CodeMsgPair) Equal(other CodeMsgPair) bool { 18 | return cmp.Code != 0 && other.Code != 0 && cmp.Code == other.Code 19 | } 20 | 21 | var ( 22 | ALREADY_CONNECTED = CodeMsgPair{501, "Already connected."} 23 | CONNECT_FAIL = CodeMsgPair{502, "Couldn't connect to TWS. Confirm that 'Enable ActiveX and Socket EClients' is enabled and connection port is the same as 'Socket Port' on the TWS 'Edit->Global Configuration...->API->Settings' menu. Live Trading ports: TWS: 7496; IB Gateway: 4001. Simulated Trading ports for new installations of version 954.1 or newer: TWS: 7497; IB Gateway: 4002"} 24 | UPDATE_TWS = CodeMsgPair{503, "The TWS is out of date and must be upgraded."} 25 | NOT_CONNECTED = CodeMsgPair{504, "Not connected"} 26 | UNKNOWN_ID = CodeMsgPair{505, "Fatal Error: Unknown message id."} 27 | UNSUPPORTED_VERSION = CodeMsgPair{506, "Unsupported version"} 28 | BAD_LENGTH = CodeMsgPair{507, "Bad message length"} 29 | BAD_MESSAGE = CodeMsgPair{508, "Bad message"} 30 | SOCKET_EXCEPTION = CodeMsgPair{509, "Exception caught while reading socket - "} 31 | FAIL_CREATE_SOCK = CodeMsgPair{520, "Failed to create socket"} 32 | SSL_FAIL = CodeMsgPair{530, "SSL specific error: "} 33 | INVALID_SYMBOL = CodeMsgPair{579, "Invalid symbol in string - "} 34 | FA_PROFILE_NOT_SUPPORTED = CodeMsgPair{585, "FA Profile is not supported anymore, use FA Group instead - "} 35 | ) 36 | -------------------------------------------------------------------------------- /examples/basic/basic.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "strings" 5 | "time" 6 | 7 | "github.com/scmhub/ibapi" 8 | ) 9 | 10 | const ( 11 | host = "localhost" 12 | port = 7497 13 | ) 14 | 15 | var orderID int64 16 | 17 | func nextID() int64 { 18 | orderID++ 19 | return orderID 20 | } 21 | 22 | func main() { 23 | // We set logger for pretty logs to console 24 | log := ibapi.Logger() 25 | //ibapi.SetLogLevel(int(zerolog.DebugLevel)) 26 | ibapi.SetConsoleWriter() 27 | // ibapi.SetConnectionTimeout(1 * time.Second) 28 | 29 | // IB CLient 30 | ib := ibapi.NewEClient(nil) 31 | 32 | if err := ib.Connect(host, port, 5); err != nil { //rand.Int63n(999999) 33 | log.Error().Err(err).Msg("Connect") 34 | return 35 | } 36 | 37 | // Add a short delay to allow the connection to stabilize 38 | time.Sleep(100 * time.Millisecond) 39 | log.Info().Msg("Waited for connection to stabilize") 40 | 41 | // ib.SetConnectionOptions("+PACEAPI") 42 | 43 | // Logger test 44 | // log.Trace().Interface("Log level", log.GetLevel()).Msg("Logger Trace") 45 | // log.Debug().Interface("Log level", log.GetLevel()).Msg("Logger Debug") 46 | // log.Info().Interface("Log level", log.GetLevel()).Msg("Logger Info") 47 | // log.Warn().Interface("Log level", log.GetLevel()).Msg("Logger Warn") 48 | // log.Error().Interface("Log level", log.GetLevel()).Msg("Logger Error") 49 | 50 | time.Sleep(1 * time.Second) 51 | log.Info().Bool("Is connected", ib.IsConnected()).Int("Server Version", ib.ServerVersion()).Str("TWS Connection time", ib.TWSConnectionTime()).Msg("Connection details") 52 | 53 | time.Sleep(1 * time.Second) 54 | ib.ReqCurrentTime() 55 | 56 | // ########## account ########## 57 | // ib.ReqManagedAccts() 58 | 59 | // ib.ReqAutoOpenOrders(false) // Only from clientID = 0 60 | // ib.ReqAutoOpenOrders(false) 61 | // ib.ReqAccountUpdates(true, "") 62 | // ib.ReqAllOpenOrders() 63 | // ib.ReqPositions() 64 | // ib.ReqCompletedOrders(false) 65 | // ib.ReqExecutions(690, ibapi.NewExecutionFilter()) 66 | 67 | tags := []string{"AccountType", "NetLiquidation", "TotalCashValue", "SettledCash", 68 | "sAccruedCash", "BuyingPower", "EquityWithLoanValue", 69 | "PreviousEquityWithLoanValue", "GrossPositionValue", "ReqTEquity", 70 | "ReqTMargin", "SMA", "InitMarginReq", "MaintMarginReq", "AvailableFunds", 71 | "ExcessLiquidity", "Cushion", "FullInitMarginReq", "FullMaintMarginReq", 72 | "FullAvailableFunds", "FullExcessLiquidity", "LookAheadNextChange", 73 | "LookAheadInitMarginReq", "LookAheadMaintMarginReq", 74 | "LookAheadAvailableFunds", "LookAheadExcessLiquidity", 75 | "HighestSeverity", "DayTradesRemaining", "Leverage", "$LEDGER:ALL"} 76 | id := nextID() 77 | ib.ReqAccountSummary(id, "All", strings.Join(tags, ",")) 78 | time.Sleep(10 * time.Second) 79 | ib.CancelAccountSummary(id) 80 | 81 | // time.Sleep(1 * time.Second) 82 | // ib.ReqFamilyCodes() 83 | // time.Sleep(1 * time.Second) 84 | // ib.ReqScannerParameters() 85 | // ########## market data ########## 86 | //eurusd := &ibapi.Contract{Symbol: "EUR", SecType: "CASH", Currency: "USD", Exchange: "IDEALPRO"} 87 | //id := nextID() 88 | // ib.ReqMktData(id, eurusd, "", false, false, nil) 89 | // time.Sleep(4 * time.Second) 90 | // ib.CancelMktData(id) 91 | 92 | // ########## real time bars ########## 93 | // aapl := &ibapi.Contract{ConID: 265598, Symbol: "AAPL", SecType: "STK", Exchange: "SMART"} 94 | // id := nextID() 95 | // ib.ReqRealTimeBars(id, aapl, 5, "TRADES", false, nil) 96 | // time.Sleep(10 * time.Second) 97 | // ib.CancelRealTimeBars(id) 98 | 99 | // ########## contract ########## 100 | // ib.ReqContractDetails(nextID(), aapl) 101 | // ib.ReqMatchingSymbols(nextID(), "ibm") 102 | 103 | // ########## orders ########## 104 | // id := nextID() 105 | // eurusd := &ibapi.Contract{Symbol: "EUR", SecType: "CASH", Currency: "USD", Exchange: "IDEALPRO"} 106 | // limitOrder := ibapi.LimitOrder("BUY", ibapi.StringToDecimal("20000"), 1.08) 107 | // ib.PlaceOrder(id+102, eurusd, limitOrder) 108 | 109 | // time.Sleep(4 * time.Second) 110 | // ib.CancelOrder(id, ibapi.NewOrderCancel()) 111 | // time.Sleep(4 * time.Second) 112 | // ib.ReqGlobalCancel(ibapi.NewOrderCancel()) 113 | // Real time bars 114 | // duration := "60 S" 115 | // barSize := "5 secs" 116 | // whatToShow := "MIDPOINT" // "TRADES", "MIDPOINT", "BID" or "ASK" 117 | // ib.ReqHistoricalData(id, eurusd, "", duration, barSize, whatToShow, true, 1, true, nil) 118 | 119 | // ########## orders ########## 120 | // id := nextID() 121 | // opt := ibapi.NewContract() 122 | // opt.Symbol = "GOOG" 123 | // opt.SecType = "OPT" 124 | // opt.Exchange = "SMART" 125 | // opt.Currency = "USD" 126 | // opt.LastTradeDateOrContractMonth = "202512" 127 | // opt.Strike = 150 128 | // opt.Right = "C" 129 | // opt.Multiplier = "100" 130 | // ib.CalculateOptionPrice(id, opt, 0.25, 150, nil) 131 | // time.Sleep(3 * time.Second) 132 | // ib.CalculateImpliedVolatility(nextID(), opt, 14.35, 150, nil) 133 | // time.Sleep(10 * time.Second) 134 | //ib.CancelHistoricalData(id) 135 | 136 | time.Sleep(5 * time.Second) 137 | err := ib.Disconnect() 138 | if err != nil { 139 | log.Error().Err(err).Msg("Disconnect") 140 | } 141 | log.Info().Msg("Bye!!!!") 142 | } 143 | -------------------------------------------------------------------------------- /examples/blocking/blocking.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "math/rand" 5 | "time" 6 | 7 | "github.com/scmhub/ibapi" 8 | ) 9 | 10 | const ( 11 | host = "localhost" 12 | port = 7497 13 | ) 14 | 15 | var log = ibapi.Logger() 16 | 17 | var tChan chan int64 18 | 19 | func init() { 20 | tChan = make(chan int64) 21 | } 22 | 23 | // Wrapper 24 | type Wrapper struct { 25 | ibapi.Wrapper 26 | } 27 | 28 | func (w Wrapper) CurrentTime(t int64) { 29 | log.Debug().Time("Server Time", time.Unix(t, 0)).Msg("") 30 | tChan <- t 31 | } 32 | 33 | // IB 34 | type IB struct { 35 | ibapi.EClient 36 | } 37 | 38 | func NewIB() *IB { 39 | return &IB{ 40 | EClient: *ibapi.NewEClient(&Wrapper{}), 41 | } 42 | } 43 | 44 | func (ib *IB) ReqCurrentTime() int64 { 45 | ib.EClient.ReqCurrentTime() 46 | return <-tChan 47 | } 48 | 49 | func main() { 50 | // Set the console writter 51 | ibapi.SetConsoleWriter() 52 | // Set log level 53 | //ibapi.SetLogLevel(int(zerolog.DebugLevel)) 54 | 55 | // Creates IB CLient 56 | ib := NewIB() 57 | 58 | // Client connection 59 | err := ib.Connect(host, port, int64(rand.Intn(1e9))) 60 | if err != nil { 61 | log.Error().Err(err).Msg("Connect") 62 | return 63 | } 64 | defer ib.Disconnect() 65 | // Add a short delay to allow the connection to stabilize 66 | time.Sleep(100 * time.Millisecond) 67 | log.Info().Msg("Waited for connection to stabilize") 68 | 69 | // Request servert current time 70 | t := ib.ReqCurrentTime() 71 | log.Info().Time("current time", time.Unix(t, 0)).Msg("Requested Server Current time") 72 | } 73 | -------------------------------------------------------------------------------- /execution.go: -------------------------------------------------------------------------------- 1 | package ibapi 2 | 3 | import ( 4 | "fmt" 5 | "strconv" 6 | ) 7 | 8 | // Execution is the information of an order`s execution. 9 | type Execution struct { 10 | ExecID string 11 | Time string 12 | AcctNumber string 13 | Exchange string 14 | Side string 15 | Shares Decimal //UNSET_DECIMAL 16 | Price float64 17 | PermID int64 18 | ClientID int64 19 | OrderID int64 20 | Liquidation int64 21 | CumQty Decimal // UNSET_DECIMAL 22 | AvgPrice float64 23 | OrderRef string 24 | EVRule string 25 | EVMultiplier float64 26 | ModelCode string 27 | LastLiquidity int64 28 | PendingPriceRevision bool 29 | Submitter string 30 | OptExerciseOrLapseType OptionExerciseType 31 | } 32 | 33 | func (e Execution) String() string { 34 | return fmt.Sprintf("ExecId: %s, Time: %s, Account: %s, Exchange: %s, Side: %s, Shares: %s, Price: %s, PermId: %s, ClientId: %s, OrderId: %s, Liquidation: %s, CumQty: %s, AvgPrice: %s, OrderRef: %s, EvRule: %s, EvMultiplier: %s, ModelCode: %s, LastLiquidity: %s, PendingPriceRevision: %s, Submitter: %s, OptionExerciseType: %s", 35 | e.ExecID, e.Time, e.AcctNumber, e.Exchange, e.Side, DecimalMaxString(e.Shares), FloatMaxString(e.Price), LongMaxString(e.PermID), IntMaxString(e.ClientID), IntMaxString(e.OrderID), IntMaxString(e.Liquidation), DecimalMaxString(e.CumQty), FloatMaxString(e.AvgPrice), 36 | e.OrderRef, e.EVRule, FloatMaxString(e.EVMultiplier), e.ModelCode, IntMaxString(e.LastLiquidity), strconv.FormatBool(e.PendingPriceRevision), e.Submitter, e.OptExerciseOrLapseType.String()) 37 | } 38 | 39 | func NewExecution() *Execution { 40 | e := &Execution{} 41 | e.Shares = UNSET_DECIMAL 42 | e.CumQty = UNSET_DECIMAL 43 | e.OptExerciseOrLapseType = OptionExerciseTypeNone 44 | return e 45 | } 46 | 47 | // ExecutionFilter . 48 | type ExecutionFilter struct { 49 | ClientID int64 50 | AcctCode string 51 | Time string 52 | Symbol string 53 | SecType string 54 | Exchange string 55 | Side string 56 | LastNDays int64 57 | SpecificDates []int64 58 | } 59 | 60 | func NewExecutionFilter() *ExecutionFilter { 61 | ef := &ExecutionFilter{} 62 | ef.LastNDays = UNSET_INT 63 | return ef 64 | } 65 | -------------------------------------------------------------------------------- /execution_condition.go: -------------------------------------------------------------------------------- 1 | package ibapi 2 | 3 | import "fmt" 4 | 5 | var _ OrderCondition = (*ExecutionCondition)(nil) 6 | 7 | type ExecutionCondition struct { 8 | *orderCondition 9 | SecType string 10 | Exchange string 11 | Symbol string 12 | } 13 | 14 | func newExecutionCondition() *ExecutionCondition { 15 | return &ExecutionCondition{orderCondition: newOrderCondition(ExecutionOrderCondition)} 16 | } 17 | 18 | func (ec *ExecutionCondition) decode(msgBuf *MsgBuffer) { 19 | ec.orderCondition.decode(msgBuf) 20 | ec.SecType = msgBuf.decodeString() 21 | ec.Exchange = msgBuf.decodeString() 22 | ec.Symbol = msgBuf.decodeString() 23 | } 24 | 25 | func (ec ExecutionCondition) makeFields() []any { 26 | return append(ec.orderCondition.makeFields(), ec.SecType, ec.Exchange, ec.Symbol) 27 | } 28 | 29 | func (ec ExecutionCondition) String() string { 30 | return fmt.Sprintf("trade occurs for %v symbol on %v exchange for %v security type", ec.Symbol, ec.Exchange, ec.SecType) 31 | } 32 | -------------------------------------------------------------------------------- /fa_allocation_sample.go: -------------------------------------------------------------------------------- 1 | package ibapi 2 | 3 | import ( 4 | "encoding/xml" 5 | ) 6 | 7 | // ListOf Groups . 8 | type ListOfGroups struct { 9 | XMLName xml.Name `xml:"ListOfGroups"` 10 | Groups []Group 11 | } 12 | 13 | // Group . 14 | // DefaultMethod is either one of the IB-computed allocation methods (AvailableEquity, Equal, NetLiq) 15 | // or a user-specified allocation methods (MonetaryAmount, Percent, Ratio, ContractsOrShares). 16 | // AvailableEquity method requires you to specify an order size. This method distributes shares based on the amount of available equity in each account. 17 | // The system calculates ratios based on the Available Equity in each account and allocates shares based on these ratios. 18 | // Equal method requires you to specify an order size. This method distributes shares equally between all accounts in the group. 19 | // NetLiq method requires you to specify an order size. This method distributes shares based on the net liquidation value of each account. 20 | // The system calculates ratios based on the Net Liquidation value in each account and allocates shares based on these ratios. 21 | // MonetaryAmount method calculates the number of units to be allocated based on the monetary value assigned to each account. 22 | // Ratio method calculates the allocation of shares based on the ratios you enter. 23 | // ContractsOrShares method allocates the absolute number of shares you enter to each account listed. 24 | // If you use this method, the order size is calculated by adding together the number of shares allocated to each account in the profile. 25 | type Group struct { 26 | XMLName xml.Name `xml:"Group"` 27 | Name string `xml:"name"` 28 | DefaultMethod string `xml:"defaultMethod"` 29 | ListOfAccounts ListOfAccounts 30 | } 31 | 32 | // ListOfAccounts . 33 | type ListOfAccounts struct { 34 | XMLName xml.Name `xml:"ListOfAccts"` 35 | VarName string `xml:"varName,attr"` 36 | Accounts []Account 37 | } 38 | 39 | // Account . 40 | type Account struct { 41 | XMLName xml.Name `xml:"Account"` 42 | ID string `xml:"acct"` 43 | Amount string `xml:"amount,omitempty"` 44 | } 45 | 46 | // FAUpdatedGroup returns a list of groups xml sample 47 | func FAUpdatedGroup() string { 48 | log := ListOfGroups{ 49 | Groups: []Group{ 50 | { 51 | Name: "MyTestProfile1", 52 | DefaultMethod: "ContractsOrShares", 53 | ListOfAccounts: ListOfAccounts{ 54 | VarName: "list", 55 | Accounts: []Account{ 56 | {ID: "DU6202167", Amount: "100.0"}, 57 | {ID: "DU6202168", Amount: "200.0"}, 58 | }, 59 | }, 60 | }, 61 | { 62 | Name: "MyTestProfile2", 63 | DefaultMethod: "Ratio", 64 | ListOfAccounts: ListOfAccounts{ 65 | VarName: "list", 66 | Accounts: []Account{ 67 | {ID: "DU6202167", Amount: "1.0"}, 68 | {ID: "DU6202168", Amount: "2.0"}, 69 | }, 70 | }, 71 | }, 72 | { 73 | Name: "MyTestProfile3", 74 | DefaultMethod: "Percent", 75 | ListOfAccounts: ListOfAccounts{ 76 | VarName: "list", 77 | Accounts: []Account{ 78 | {ID: "DU6202167", Amount: "60.0"}, 79 | {ID: "DU6202168", Amount: "40.0"}, 80 | }, 81 | }, 82 | }, 83 | { 84 | Name: "MyTestProfile4", 85 | DefaultMethod: "MonetaryAmount", 86 | ListOfAccounts: ListOfAccounts{ 87 | VarName: "list", 88 | Accounts: []Account{ 89 | {ID: "DU6202167", Amount: "1000.0"}, 90 | {ID: "DU6202168", Amount: "2000.0"}, 91 | }, 92 | }, 93 | }, 94 | { 95 | Name: "Group_1", 96 | DefaultMethod: "NetLiq", 97 | ListOfAccounts: ListOfAccounts{ 98 | VarName: "list", 99 | Accounts: []Account{ 100 | {ID: "DU6202167"}, 101 | {ID: "DU6202168"}, 102 | }, 103 | }, 104 | }, 105 | { 106 | Name: "MyTestGroup1", 107 | DefaultMethod: "AvailableEquity", 108 | ListOfAccounts: ListOfAccounts{ 109 | VarName: "list", 110 | Accounts: []Account{ 111 | {ID: "DU6202167"}, 112 | {ID: "DU6202168"}, 113 | }, 114 | }, 115 | }, 116 | { 117 | Name: "MyTestGroup2", 118 | DefaultMethod: "NetLiq", 119 | ListOfAccounts: ListOfAccounts{ 120 | VarName: "list", 121 | Accounts: []Account{ 122 | {ID: "DU6202167"}, 123 | {ID: "DU6202168"}, 124 | }, 125 | }, 126 | }, 127 | { 128 | Name: "MyTestGroup3", 129 | DefaultMethod: "Equal", 130 | ListOfAccounts: ListOfAccounts{ 131 | VarName: "list", 132 | Accounts: []Account{ 133 | {ID: "DU6202167"}, 134 | {ID: "DU6202168"}, 135 | }, 136 | }, 137 | }, 138 | { 139 | Name: "Group_2", 140 | DefaultMethod: "AvailableEquity", 141 | ListOfAccounts: ListOfAccounts{ 142 | VarName: "list", 143 | Accounts: []Account{ 144 | {ID: "DU6202167"}, 145 | {ID: "DU6202168"}, 146 | }, 147 | }, 148 | }, 149 | }, 150 | } 151 | 152 | groupXml, _ := xml.MarshalIndent(log, " ", " ") 153 | return xml.Header + string(groupXml) 154 | } 155 | 156 | /* 157 | 158 | 159 | 160 | MyTestProfile1 161 | ContractsOrShares 162 | 163 | 164 | DU6202167 165 | 100.0 166 | 167 | 168 | DU6202168 169 | 200.0 170 | 171 | 172 | 173 | 174 | MyTestProfile2 175 | Ratio 176 | 177 | 178 | DU6202167 179 | 1.0 180 | 181 | 182 | DU6202168 183 | 2.0 184 | 185 | 186 | 187 | 188 | MyTestProfile3 189 | Percent 190 | 191 | 192 | DU6202167 193 | 60.0 194 | 195 | 196 | DU6202168 197 | 40.0 198 | 199 | 200 | 201 | 202 | MyTestProfile4 203 | MonetaryAmount 204 | 205 | 206 | DU6202167 207 | 1000.0 208 | 209 | 210 | DU6202168 211 | 2000.0 212 | 213 | 214 | 215 | 216 | Group_1 217 | NetLiq 218 | 219 | 220 | DU6202167 221 | 222 | 223 | DU6202168 224 | 225 | 226 | 227 | 228 | MyTestGroup1 229 | AvailableEquity 230 | 231 | 232 | DU6202167 233 | 234 | 235 | DU6202168 236 | 237 | 238 | 239 | 240 | MyTestGroup2 241 | NetLiq 242 | 243 | 244 | DU6202167 245 | 246 | 247 | DU6202168 248 | 249 | 250 | 251 | 252 | MyTestGroup3 253 | Equal 254 | 255 | 256 | DU6202167 257 | 258 | 259 | DU6202168 260 | 261 | 262 | 263 | 264 | Group_2 265 | AvailableEquity 266 | 267 | 268 | DU6202167 269 | 270 | 271 | DU6202168 272 | 273 | 274 | 275 | 276 | */ 277 | -------------------------------------------------------------------------------- /family_code.go: -------------------------------------------------------------------------------- 1 | package ibapi 2 | 3 | import "fmt" 4 | 5 | // FamilyCode . 6 | type FamilyCode struct { 7 | AccountID string 8 | FamilyCodeStr string 9 | } 10 | 11 | func NewFamilyCode() FamilyCode { 12 | return FamilyCode{} 13 | } 14 | 15 | func (f FamilyCode) String() string { 16 | return fmt.Sprintf("AccountId: %s, FamilyCodeStr: %s", f.AccountID, f.FamilyCodeStr) 17 | } 18 | -------------------------------------------------------------------------------- /go.mod: -------------------------------------------------------------------------------- 1 | module github.com/scmhub/ibapi 2 | 3 | go 1.23 4 | 5 | require ( 6 | github.com/robaho/fixed v0.0.0-20240822193421-08ddb66c3dd0 7 | github.com/rs/zerolog v1.33.0 8 | google.golang.org/protobuf v1.36.6 9 | ) 10 | 11 | require ( 12 | github.com/mattn/go-colorable v0.1.13 // indirect 13 | github.com/mattn/go-isatty v0.0.20 // indirect 14 | golang.org/x/sys v0.25.0 // indirect 15 | ) 16 | -------------------------------------------------------------------------------- /go.sum: -------------------------------------------------------------------------------- 1 | github.com/coreos/go-systemd/v22 v22.5.0/go.mod h1:Y58oyj3AT4RCenI/lSvhwexgC+NSVTIJ3seZv2GcEnc= 2 | github.com/godbus/dbus/v5 v5.0.4/go.mod h1:xhWf0FNVPg57R7Z0UbKHbJfkEywrmjJnf7w5xrFpKfA= 3 | github.com/google/go-cmp v0.5.5 h1:Khx7svrCpmxxtHBq5j2mp/xVjsi8hQMfNLvJFAlrGgU= 4 | github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= 5 | github.com/mattn/go-colorable v0.1.13 h1:fFA4WZxdEF4tXPZVKMLwD8oUnCTTo08duU7wxecdEvA= 6 | github.com/mattn/go-colorable v0.1.13/go.mod h1:7S9/ev0klgBDR4GtXTXX8a3vIGJpMovkB8vQcUbaXHg= 7 | github.com/mattn/go-isatty v0.0.16/go.mod h1:kYGgaQfpe5nmfYZH+SKPsOc2e4SrIfOl2e/yFXSvRLM= 8 | github.com/mattn/go-isatty v0.0.19/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y= 9 | github.com/mattn/go-isatty v0.0.20 h1:xfD0iDuEKnDkl03q4limB+vH+GxLEtL/jb4xVJSWWEY= 10 | github.com/mattn/go-isatty v0.0.20/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y= 11 | github.com/mattn/go-sqlite3 v1.14.22 h1:2gZY6PC6kBnID23Tichd1K+Z0oS6nE/XwU+Vz/5o4kU= 12 | github.com/mattn/go-sqlite3 v1.14.22/go.mod h1:Uh1q+B4BYcTPb+yiD3kU8Ct7aC0hY9fxUwlHK0RXw+Y= 13 | github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= 14 | github.com/robaho/fixed v0.0.0-20240822193421-08ddb66c3dd0 h1:5eL+YsnnLxrGVsBT9FYtA+bdtJ2Yfow7EXYHjWGN6zY= 15 | github.com/robaho/fixed v0.0.0-20240822193421-08ddb66c3dd0/go.mod h1:gOuZr6norIEHlPghhACq3f8PL6ZFF5uJVMOgh2/M7xQ= 16 | github.com/rs/xid v1.5.0/go.mod h1:trrq9SKmegXys3aeAKXMUTdJsYXVwGY3RLcfgqegfbg= 17 | github.com/rs/zerolog v1.33.0 h1:1cU2KZkvPxNyfgEmhHAz/1A9Bz+llsdYzklWFzgp0r8= 18 | github.com/rs/zerolog v1.33.0/go.mod h1:/7mN4D5sKwJLZQ2b/znpjC3/GQWY/xaDXUM0kKWRHss= 19 | github.com/shopspring/decimal v1.4.0 h1:bxl37RwXBklmTi0C79JfXCEBD1cqqHt0bbgBAGFp81k= 20 | github.com/shopspring/decimal v1.4.0/go.mod h1:gawqmDU56v4yIKSwfBSFip1HdCCXN8/+DMd9qYNcwME= 21 | golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= 22 | golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= 23 | golang.org/x/sys v0.12.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= 24 | golang.org/x/sys v0.25.0 h1:r+8e+loiHxRqhXVl6ML1nO3l1+oFoWbnlu2Ehimmi34= 25 | golang.org/x/sys v0.25.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= 26 | golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543 h1:E7g+9GITq07hpfrRu66IVDexMakfv52eLZ2CXBWiKr4= 27 | golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= 28 | google.golang.org/protobuf v1.36.6 h1:z1NpPI8ku2WgiWnf+t9wTPsn6eP1L7ksHUlkfLvd9xY= 29 | google.golang.org/protobuf v1.36.6/go.mod h1:jduwjTPXsFjZGTmRluh+L6NjiWu7pchiJ2/5YcXBHnY= 30 | -------------------------------------------------------------------------------- /histogram_data.go: -------------------------------------------------------------------------------- 1 | package ibapi 2 | 3 | import "fmt" 4 | 5 | // HistogramData . 6 | type HistogramData struct { 7 | Price float64 8 | Size Decimal 9 | } 10 | 11 | func NewHistogramData() HistogramData { 12 | hd := HistogramData{} 13 | hd.Size = UNSET_DECIMAL 14 | return hd 15 | } 16 | 17 | func (hd HistogramData) String() string { 18 | return fmt.Sprintf("Price: %v, Size: %v", hd.Price, hd.Size) 19 | } 20 | -------------------------------------------------------------------------------- /historical_session.go: -------------------------------------------------------------------------------- 1 | package ibapi 2 | 3 | import "fmt" 4 | 5 | // HistoricalSession . 6 | type HistoricalSession struct { 7 | StartDateTime string 8 | EndDateTime string 9 | RefDate string 10 | } 11 | 12 | func NewHistoricalSession() HistoricalSession { 13 | return HistoricalSession{} 14 | } 15 | 16 | func (h HistoricalSession) String() string { 17 | return fmt.Sprintf("Start: %s, End: %s, Ref Date: %s", h.StartDateTime, h.EndDateTime, h.RefDate) 18 | } 19 | -------------------------------------------------------------------------------- /historical_tick.go: -------------------------------------------------------------------------------- 1 | package ibapi 2 | 3 | import "fmt" 4 | 5 | // HistoricalTick is the historical tick's description. 6 | // Used when requesting historical tick data with whatToShow = MIDPOINT. 7 | type HistoricalTick struct { 8 | Time int64 9 | Price float64 10 | Size Decimal 11 | } 12 | 13 | func NewHistoricalTick() HistoricalTick { 14 | ht := HistoricalTick{} 15 | ht.Size = UNSET_DECIMAL 16 | return ht 17 | } 18 | 19 | func (h HistoricalTick) String() string { 20 | return fmt.Sprintf("Time: %d, Price: %f, Size: %s", h.Time, h.Price, DecimalMaxString(h.Size)) 21 | } 22 | -------------------------------------------------------------------------------- /historical_tick_bid_ask.go: -------------------------------------------------------------------------------- 1 | package ibapi 2 | 3 | import "fmt" 4 | 5 | // HistoricalTickBidAsk is the historical tick's description. 6 | // Used when requesting historical tick data with whatToShow = BID_ASK. 7 | type HistoricalTickBidAsk struct { 8 | Time int64 9 | TickAttirbBidAsk TickAttribBidAsk 10 | PriceBid float64 11 | PriceAsk float64 12 | SizeBid Decimal 13 | SizeAsk Decimal 14 | } 15 | 16 | func NewHistoricalTickBidAsk() HistoricalTickBidAsk { 17 | htba := HistoricalTickBidAsk{} 18 | htba.SizeBid = UNSET_DECIMAL 19 | htba.SizeAsk = UNSET_DECIMAL 20 | return htba 21 | } 22 | 23 | func (h HistoricalTickBidAsk) String() string { 24 | return fmt.Sprintf("Time: %d, TickAttriBidAsk: %s, PriceBid: %f, PriceAsk: %f, SizeBid: %s, SizeAsk: %s", 25 | h.Time, h.TickAttirbBidAsk, h.PriceBid, h.PriceAsk, DecimalMaxString(h.SizeBid), DecimalMaxString(h.SizeAsk)) 26 | } 27 | -------------------------------------------------------------------------------- /historical_tick_last.go: -------------------------------------------------------------------------------- 1 | package ibapi 2 | 3 | import ( 4 | "fmt" 5 | "time" 6 | ) 7 | 8 | // HistoricalTickLast is the historical last tick's description. 9 | // Used when requesting historical tick data with whatToShow = TRADES. 10 | type HistoricalTickLast struct { 11 | Time int64 12 | TickAttribLast TickAttribLast 13 | Price float64 14 | Size Decimal 15 | Exchange string 16 | SpecialConditions string 17 | } 18 | 19 | func NewHistoricalTickLast() HistoricalTickLast { 20 | htl := HistoricalTickLast{} 21 | htl.Size = UNSET_DECIMAL 22 | return htl 23 | } 24 | 25 | func (h HistoricalTickLast) String() string { 26 | return fmt.Sprintf("Time: %d, TickAttribLast: %s, Price: %f, Size: %s, Exchange: %s, SpecialConditions: %s", 27 | h.Time, h.TickAttribLast, h.Price, DecimalMaxString(h.Size), h.Exchange, h.SpecialConditions) 28 | } 29 | 30 | func (h HistoricalTickLast) Timestamp() time.Time { 31 | return time.Unix(h.Time, 0) 32 | } 33 | -------------------------------------------------------------------------------- /ineligibility_reason.go: -------------------------------------------------------------------------------- 1 | package ibapi 2 | 3 | // IneligibilityReason is a simple struct for ineligibility reason 4 | type IneligibilityReason struct { 5 | ID string 6 | Description string 7 | } 8 | -------------------------------------------------------------------------------- /logger.go: -------------------------------------------------------------------------------- 1 | package ibapi 2 | 3 | import ( 4 | "fmt" 5 | "os" 6 | 7 | "github.com/rs/zerolog" 8 | ) 9 | 10 | var log zerolog.Logger 11 | 12 | const DEFAULT_LEVEL = zerolog.InfoLevel 13 | 14 | func init() { 15 | zerolog.SetGlobalLevel(DEFAULT_LEVEL) 16 | log = zerolog.New(os.Stderr).With().Timestamp().Logger() 17 | } 18 | 19 | // Logger returns the logger. 20 | func Logger() *zerolog.Logger { 21 | return &log 22 | } 23 | 24 | // SetLogLevel sets the loggging level. 25 | func SetLogLevel(logLevel int) { 26 | zerolog.SetGlobalLevel(zerolog.Level(int8(logLevel))) 27 | } 28 | 29 | // SetConsoleWriter will send pretty log to the console. 30 | func SetConsoleWriter() { 31 | output := zerolog.ConsoleWriter{Out: os.Stdout} 32 | output.FormatMessage = func(i any) string { 33 | return fmt.Sprintf("| IB | %s", i) 34 | } 35 | log = log.Output(output) 36 | } 37 | -------------------------------------------------------------------------------- /margin_condition.go: -------------------------------------------------------------------------------- 1 | package ibapi 2 | 3 | import "fmt" 4 | 5 | // var _ OrderCondition = (*MarginCondition)(nil) 6 | // var _ ContractCondition = (*MarginCondition)(nil) 7 | var _ OperatorCondition = (*MarginCondition)(nil) 8 | 9 | type MarginCondition struct { 10 | *operatorCondition 11 | Percent int64 12 | } 13 | 14 | func newMarginCondition() *MarginCondition { 15 | return &MarginCondition{operatorCondition: newOperatorCondition(MarginOrderCondition)} 16 | } 17 | 18 | func (mc *MarginCondition) decode(msgBuf *MsgBuffer) { 19 | mc.operatorCondition.decode(msgBuf) 20 | mc.Percent = msgBuf.decodeInt64() 21 | } 22 | 23 | func (mc MarginCondition) makeFields() []any { 24 | return append(mc.operatorCondition.makeFields(), mc.Percent) 25 | } 26 | 27 | func (mc MarginCondition) String() string { 28 | percent := fmt.Sprintf("%d", mc.Percent) 29 | return fmt.Sprintf("the margin cushion persent %s", mc.operatorCondition.stringWithOperator(percent)) 30 | } 31 | -------------------------------------------------------------------------------- /message.go: -------------------------------------------------------------------------------- 1 | package ibapi 2 | 3 | /* 4 | High level IB message info. 5 | */ 6 | 7 | // IN is the incoming msg id's 8 | type IN = int64 9 | 10 | const ( 11 | TICK_PRICE IN = 1 12 | TICK_SIZE IN = 2 13 | ORDER_STATUS IN = 3 14 | ERR_MSG IN = 4 15 | OPEN_ORDER IN = 5 16 | ACCT_VALUE IN = 6 17 | PORTFOLIO_VALUE IN = 7 18 | ACCT_UPDATE_TIME IN = 8 19 | NEXT_VALID_ID IN = 9 20 | CONTRACT_DATA IN = 10 21 | EXECUTION_DATA IN = 11 22 | MARKET_DEPTH IN = 12 23 | MARKET_DEPTH_L2 IN = 13 24 | NEWS_BULLETINS IN = 14 25 | MANAGED_ACCTS IN = 15 26 | RECEIVE_FA IN = 16 27 | HISTORICAL_DATA IN = 17 28 | BOND_CONTRACT_DATA IN = 18 29 | SCANNER_PARAMETERS IN = 19 30 | SCANNER_DATA IN = 20 31 | TICK_OPTION_COMPUTATION IN = 21 32 | TICK_GENERIC IN = 45 33 | TICK_STRING IN = 46 34 | TICK_EFP IN = 47 35 | CURRENT_TIME IN = 49 36 | REAL_TIME_BARS IN = 50 37 | FUNDAMENTAL_DATA IN = 51 38 | CONTRACT_DATA_END IN = 52 39 | OPEN_ORDER_END IN = 53 40 | ACCT_DOWNLOAD_END IN = 54 41 | EXECUTION_DATA_END IN = 55 42 | DELTA_NEUTRAL_VALIDATION IN = 56 43 | TICK_SNAPSHOT_END IN = 57 44 | MARKET_DATA_TYPE IN = 58 45 | COMMISSION_AND_FEES_REPORT IN = 59 46 | POSITION_DATA IN = 61 47 | POSITION_END IN = 62 48 | ACCOUNT_SUMMARY IN = 63 49 | ACCOUNT_SUMMARY_END IN = 64 50 | VERIFY_MESSAGE_API IN = 65 51 | VERIFY_COMPLETED IN = 66 52 | DISPLAY_GROUP_LIST IN = 67 53 | DISPLAY_GROUP_UPDATED IN = 68 54 | VERIFY_AND_AUTH_MESSAGE_API IN = 69 55 | VERIFY_AND_AUTH_COMPLETED IN = 70 56 | POSITION_MULTI IN = 71 57 | POSITION_MULTI_END IN = 72 58 | ACCOUNT_UPDATE_MULTI IN = 73 59 | ACCOUNT_UPDATE_MULTI_END IN = 74 60 | SECURITY_DEFINITION_OPTION_PARAMETER IN = 75 61 | SECURITY_DEFINITION_OPTION_PARAMETER_END IN = 76 62 | SOFT_DOLLAR_TIERS IN = 77 63 | FAMILY_CODES IN = 78 64 | SYMBOL_SAMPLES IN = 79 65 | MKT_DEPTH_EXCHANGES IN = 80 66 | TICK_REQ_PARAMS IN = 81 67 | SMART_COMPONENTS IN = 82 68 | NEWS_ARTICLE IN = 83 69 | TICK_NEWS IN = 84 70 | NEWS_PROVIDERS IN = 85 71 | HISTORICAL_NEWS IN = 86 72 | HISTORICAL_NEWS_END IN = 87 73 | HEAD_TIMESTAMP IN = 88 74 | HISTOGRAM_DATA IN = 89 75 | HISTORICAL_DATA_UPDATE IN = 90 76 | REROUTE_MKT_DATA_REQ IN = 91 77 | REROUTE_MKT_DEPTH_REQ IN = 92 78 | MARKET_RULE IN = 93 79 | PNL IN = 94 80 | PNL_SINGLE IN = 95 81 | HISTORICAL_TICKS IN = 96 82 | HISTORICAL_TICKS_BID_ASK IN = 97 83 | HISTORICAL_TICKS_LAST IN = 98 84 | TICK_BY_TICK IN = 99 85 | ORDER_BOUND IN = 100 86 | COMPLETED_ORDER IN = 101 87 | COMPLETED_ORDERS_END IN = 102 88 | REPLACE_FA_END IN = 103 89 | WSH_META_DATA IN = 104 90 | WSH_EVENT_DATA IN = 105 91 | HISTORICAL_SCHEDULE IN = 106 92 | USER_INFO IN = 107 93 | HISTORICAL_DATA_END IN = 108 94 | CURRENT_TIME_IN_MILLIS IN = 109 95 | ) 96 | 97 | // OUT is the outgoing msg id's. 98 | type OUT = int64 99 | 100 | const ( 101 | REQ_MKT_DATA OUT = 1 102 | CANCEL_MKT_DATA OUT = 2 103 | PLACE_ORDER OUT = 3 104 | CANCEL_ORDER OUT = 4 105 | REQ_OPEN_ORDERS OUT = 5 106 | REQ_ACCT_DATA OUT = 6 107 | REQ_EXECUTIONS OUT = 7 108 | REQ_IDS OUT = 8 109 | REQ_CONTRACT_DATA OUT = 9 110 | REQ_MKT_DEPTH OUT = 10 111 | CANCEL_MKT_DEPTH OUT = 11 112 | REQ_NEWS_BULLETINS OUT = 12 113 | CANCEL_NEWS_BULLETINS OUT = 13 114 | SET_SERVER_LOGLEVEL OUT = 14 115 | REQ_AUTO_OPEN_ORDERS OUT = 15 116 | REQ_ALL_OPEN_ORDERS OUT = 16 117 | REQ_MANAGED_ACCTS OUT = 17 118 | REQ_FA OUT = 18 119 | REPLACE_FA OUT = 19 120 | REQ_HISTORICAL_DATA OUT = 20 121 | EXERCISE_OPTIONS OUT = 21 122 | REQ_SCANNER_SUBSCRIPTION OUT = 22 123 | CANCEL_SCANNER_SUBSCRIPTION OUT = 23 124 | REQ_SCANNER_PARAMETERS OUT = 24 125 | CANCEL_HISTORICAL_DATA OUT = 25 126 | REQ_CURRENT_TIME OUT = 49 127 | REQ_REAL_TIME_BARS OUT = 50 128 | CANCEL_REAL_TIME_BARS OUT = 51 129 | REQ_FUNDAMENTAL_DATA OUT = 52 130 | CANCEL_FUNDAMENTAL_DATA OUT = 53 131 | REQ_CALC_IMPLIED_VOLAT OUT = 54 132 | REQ_CALC_OPTION_PRICE OUT = 55 133 | CANCEL_CALC_IMPLIED_VOLAT OUT = 56 134 | CANCEL_CALC_OPTION_PRICE OUT = 57 135 | REQ_GLOBAL_CANCEL OUT = 58 136 | REQ_MARKET_DATA_TYPE OUT = 59 137 | REQ_POSITIONS OUT = 61 138 | REQ_ACCOUNT_SUMMARY OUT = 62 139 | CANCEL_ACCOUNT_SUMMARY OUT = 63 140 | CANCEL_POSITIONS OUT = 64 141 | VERIFY_REQUEST OUT = 65 142 | VERIFY_MESSAGE OUT = 66 143 | QUERY_DISPLAY_GROUPS OUT = 67 144 | SUBSCRIBE_TO_GROUP_EVENTS OUT = 68 145 | UPDATE_DISPLAY_GROUP OUT = 69 146 | UNSUBSCRIBE_FROM_GROUP_EVENTS OUT = 70 147 | START_API OUT = 71 148 | VERIFY_AND_AUTH_REQUEST OUT = 72 149 | VERIFY_AND_AUTH_MESSAGE OUT = 73 150 | REQ_POSITIONS_MULTI OUT = 74 151 | CANCEL_POSITIONS_MULTI OUT = 75 152 | REQ_ACCOUNT_UPDATES_MULTI OUT = 76 153 | CANCEL_ACCOUNT_UPDATES_MULTI OUT = 77 154 | REQ_SEC_DEF_OPT_PARAMS OUT = 78 155 | REQ_SOFT_DOLLAR_TIERS OUT = 79 156 | REQ_FAMILY_CODES OUT = 80 157 | REQ_MATCHING_SYMBOLS OUT = 81 158 | REQ_MKT_DEPTH_EXCHANGES OUT = 82 159 | REQ_SMART_COMPONENTS OUT = 83 160 | REQ_NEWS_ARTICLE OUT = 84 161 | REQ_NEWS_PROVIDERS OUT = 85 162 | REQ_HISTORICAL_NEWS OUT = 86 163 | REQ_HEAD_TIMESTAMP OUT = 87 164 | REQ_HISTOGRAM_DATA OUT = 88 165 | CANCEL_HISTOGRAM_DATA OUT = 89 166 | CANCEL_HEAD_TIMESTAMP OUT = 90 167 | REQ_MARKET_RULE OUT = 91 168 | REQ_PNL OUT = 92 169 | CANCEL_PNL OUT = 93 170 | REQ_PNL_SINGLE OUT = 94 171 | CANCEL_PNL_SINGLE OUT = 95 172 | REQ_HISTORICAL_TICKS OUT = 96 173 | REQ_TICK_BY_TICK_DATA OUT = 97 174 | CANCEL_TICK_BY_TICK_DATA OUT = 98 175 | REQ_COMPLETED_ORDERS OUT = 99 176 | REQ_WSH_META_DATA OUT = 100 177 | CANCEL_WSH_META_DATA OUT = 101 178 | REQ_WSH_EVENT_DATA OUT = 102 179 | CANCEL_WSH_EVENT_DATA OUT = 103 180 | REQ_USER_INFO OUT = 104 181 | REQ_CURRENT_TIME_IN_MILLIS OUT = 105 182 | ) 183 | 184 | // TWS New Bulletins constants 185 | const NEWS_MSG int64 = 1 // standard IB news bulleting message 186 | const EXCHANGE_AVAIL_MSG int64 = 2 // control message specifying that an exchange is available for trading 187 | const EXCHANGE_UNAVAIL_MSG int64 = 3 // control message specifying that an exchange is unavailable for trading 188 | 189 | const PROTOBUF_MSG_ID int64 = 200 190 | 191 | var PROTOBUF_MSG_IDS = map[OUT]Version{ 192 | REQ_EXECUTIONS: MIN_SERVER_VER_PROTOBUF, 193 | PLACE_ORDER: MIN_SERVER_VER_PROTOBUF_PLACE_ORDER, 194 | CANCEL_ORDER: MIN_SERVER_VER_PROTOBUF_PLACE_ORDER, 195 | REQ_GLOBAL_CANCEL: MIN_SERVER_VER_PROTOBUF_PLACE_ORDER, 196 | } 197 | -------------------------------------------------------------------------------- /news_provider.go: -------------------------------------------------------------------------------- 1 | package ibapi 2 | 3 | import "fmt" 4 | 5 | // NewsProvider . 6 | type NewsProvider struct { 7 | Code string 8 | Name string 9 | } 10 | 11 | func NewNewsProvider() NewsProvider { 12 | return NewsProvider{} 13 | } 14 | 15 | func (np NewsProvider) String() string { 16 | return fmt.Sprintf("Code: %s, Name: %s", np.Code, np.Name) 17 | } 18 | -------------------------------------------------------------------------------- /operator_condition.go: -------------------------------------------------------------------------------- 1 | package ibapi 2 | 3 | import "fmt" 4 | 5 | // OperatorCondition embeds OrderCondition and requires valueConverter 6 | type OperatorCondition interface { 7 | OrderCondition 8 | } 9 | 10 | var _ OrderCondition = (*operatorCondition)(nil) 11 | 12 | type operatorCondition struct { 13 | *orderCondition 14 | IsMore bool 15 | } 16 | 17 | func newOperatorCondition(orderConditionType OrderConditionType) *operatorCondition { 18 | return &operatorCondition{orderCondition: newOrderCondition(orderConditionType)} 19 | } 20 | 21 | func (oc *operatorCondition) decode(msgBuf *MsgBuffer) { // 2 fields 22 | oc.orderCondition.decode(msgBuf) 23 | oc.IsMore = msgBuf.decodeBool() 24 | } 25 | 26 | func (oc operatorCondition) makeFields() []any { 27 | return append(oc.orderCondition.makeFields(), oc.IsMore) 28 | } 29 | 30 | func (oc operatorCondition) stringWithOperator(value string) string { 31 | if oc.IsMore { 32 | return fmt.Sprintf("is >= %s", value) 33 | } 34 | return fmt.Sprintf("is <= %s", value) 35 | } 36 | -------------------------------------------------------------------------------- /order_cancel.go: -------------------------------------------------------------------------------- 1 | package ibapi 2 | 3 | import "fmt" 4 | 5 | // OrderCancel . 6 | type OrderCancel struct { 7 | ManualOrderCancelTime string 8 | ExtOperator string 9 | ManualOrderIndicator int64 10 | } 11 | 12 | func NewOrderCancel() OrderCancel { 13 | return OrderCancel{ 14 | ManualOrderIndicator: UNSET_INT, 15 | } 16 | } 17 | 18 | func (o OrderCancel) String() string { 19 | return fmt.Sprintf("ManualOrderCancelTime: %s, ManualOrderIndicator: %s", o.ManualOrderCancelTime, IntMaxString(o.ManualOrderIndicator)) 20 | } 21 | -------------------------------------------------------------------------------- /order_condition.go: -------------------------------------------------------------------------------- 1 | package ibapi 2 | 3 | /* 4 | ------------------------------------------------ 5 | ------------------------------------------------ 6 | OrderCondition 7 | ------------------------------------------------ 8 | OperatorCondition 9 | OrderCondition 10 | ------------------------------------------------ 11 | ContractCondition 12 | OperatorCondition 13 | ------------------------------------------------ 14 | ------------------------------------------------ 15 | PriceOrderCondition 16 | ContractCondition 17 | ------------------------------------------------ 18 | TimeOrderCondition 19 | OperatorCondition 20 | ------------------------------------------------ 21 | MarginOrderCondition 22 | OperatorCondition 23 | ------------------------------------------------ 24 | ExecutionOrderCondition 25 | OrderCondition 26 | ------------------------------------------------ 27 | VolumeOrderCondition 28 | ContractCondition 29 | ------------------------------------------------ 30 | PercentChangeOrderCondition 31 | ContractCondition 32 | ------------------------------------------------ 33 | ------------------------------------------------ 34 | */ 35 | 36 | type OrderConditionType = int64 37 | 38 | const ( 39 | PriceOrderCondition OrderConditionType = 1 40 | TimeOrderCondition OrderConditionType = 3 41 | MarginOrderCondition OrderConditionType = 4 42 | ExecutionOrderCondition OrderConditionType = 5 43 | VolumeOrderCondition OrderConditionType = 6 44 | PercentChangeOrderCondition OrderConditionType = 7 45 | ) 46 | 47 | type OrderCondition interface { 48 | Type() OrderConditionType 49 | TypeName() string 50 | IsConjunctionConnection() bool 51 | SetIsConjunctionConnection(bool) 52 | decode(*MsgBuffer) 53 | makeFields() []any 54 | } 55 | 56 | var _ OrderCondition = (*orderCondition)(nil) 57 | 58 | type orderCondition struct { 59 | condType OrderConditionType 60 | isConjunctionConnection bool 61 | } 62 | 63 | func newOrderCondition(condType OrderConditionType) *orderCondition { 64 | return &orderCondition{ 65 | condType: condType, 66 | isConjunctionConnection: true, 67 | } 68 | } 69 | 70 | func (oc orderCondition) Type() OrderConditionType { 71 | return oc.condType 72 | } 73 | 74 | func (oc orderCondition) TypeName() string { 75 | switch oc.condType { 76 | case PriceOrderCondition: 77 | return "Price" 78 | case TimeOrderCondition: 79 | return "Time" 80 | case MarginOrderCondition: 81 | return "Margin" 82 | case ExecutionOrderCondition: 83 | return "Execution" 84 | case VolumeOrderCondition: 85 | return "Volume" 86 | case PercentChangeOrderCondition: 87 | return "PercentChange" 88 | default: 89 | return "Unknown" 90 | } 91 | } 92 | 93 | func (oc *orderCondition) IsConjunctionConnection() bool { 94 | return oc.isConjunctionConnection 95 | } 96 | 97 | func (oc *orderCondition) SetIsConjunctionConnection(isConjunctionConnection bool) { 98 | oc.isConjunctionConnection = isConjunctionConnection 99 | } 100 | 101 | func (oc *orderCondition) decode(msgBuf *MsgBuffer) { 102 | connector := msgBuf.decodeString() 103 | oc.isConjunctionConnection = connector == "a" 104 | } 105 | 106 | func (oc orderCondition) makeFields() []any { 107 | if oc.isConjunctionConnection { 108 | return []any{"a"} 109 | } 110 | return []any{"o"} 111 | } 112 | 113 | func (oc orderCondition) String() string { 114 | if oc.isConjunctionConnection { 115 | return "" 116 | } 117 | return "" 118 | } 119 | 120 | func CreateOrderCondition(condType OrderConditionType) OrderCondition { 121 | var cond OrderCondition 122 | switch condType { 123 | case PriceOrderCondition: 124 | cond = newPriceCondition() 125 | case TimeOrderCondition: 126 | cond = newTimeCondition() 127 | case MarginOrderCondition: 128 | cond = newMarginCondition() 129 | case ExecutionOrderCondition: 130 | cond = newExecutionCondition() 131 | case VolumeOrderCondition: 132 | cond = newVolumeCondition() 133 | case PercentChangeOrderCondition: 134 | cond = newPercentChangeCondition() 135 | default: 136 | log.Panic().Msg("unknown OrderConditionType") 137 | } 138 | return cond 139 | } 140 | -------------------------------------------------------------------------------- /order_state.go: -------------------------------------------------------------------------------- 1 | package ibapi 2 | 3 | import ( 4 | "fmt" 5 | ) 6 | 7 | // OrderAllocation . 8 | type OrderAllocation struct { 9 | Account string 10 | Position Decimal // UNSET_DECIMAL 11 | PositionDesired Decimal // UNSET_DECIMAL 12 | PositionAfter Decimal // UNSET_DECIMAL 13 | DesiredAllocQty Decimal // UNSET_DECIMAL 14 | AllowedAllocQty Decimal // UNSET_DECIMAL 15 | IsMonetary bool 16 | } 17 | 18 | func NewOrderAllocation() *OrderAllocation { 19 | oa := &OrderAllocation{} 20 | oa.Position = UNSET_DECIMAL 21 | oa.PositionDesired = UNSET_DECIMAL 22 | oa.PositionAfter = UNSET_DECIMAL 23 | oa.DesiredAllocQty = UNSET_DECIMAL 24 | oa.AllowedAllocQty = UNSET_DECIMAL 25 | return oa 26 | } 27 | 28 | func (oa OrderAllocation) String() string { 29 | return fmt.Sprint( 30 | "Account: ", oa.Account, 31 | ", Position: ", DecimalMaxString(oa.Position), 32 | ", PositionDesired: ", DecimalMaxString(oa.PositionDesired), 33 | ", PositionAfter: ", DecimalMaxString(oa.PositionAfter), 34 | ", DesiredAllocQty: ", DecimalMaxString(oa.DesiredAllocQty), 35 | ", AllowedAllocQty: ", DecimalMaxString(oa.AllowedAllocQty), 36 | ", IsMonetary: ", oa.IsMonetary, 37 | ) 38 | } 39 | 40 | // OrderState . 41 | type OrderState struct { 42 | Status string 43 | 44 | InitMarginBefore string 45 | MaintMarginBefore string 46 | EquityWithLoanBefore string 47 | InitMarginChange string 48 | MaintMarginChange string 49 | EquityWithLoanChange string 50 | InitMarginAfter string 51 | MaintMarginAfter string 52 | EquityWithLoanAfter string 53 | 54 | CommissionAndFees float64 // UNSET_FLOAT 55 | MinCommissionAndFees float64 // UNSET_FLOAT 56 | MaxCommissionAndFees float64 // UNSET_FLOAT 57 | CommissionAndFeesCurrency string 58 | MarginCurrency string 59 | InitMarginBeforeOutsideRTH float64 // UNSET_FLOAT 60 | MaintMarginBeforeOutsideRTH float64 // UNSET_FLOAT 61 | EquityWithLoanBeforeOutsideRTH float64 // UNSET_FLOAT 62 | InitMarginChangeOutsideRTH float64 // UNSET_FLOAT 63 | MaintMarginChangeOutsideRTH float64 // UNSET_FLOAT 64 | EquityWithLoanChangeOutsideRTH float64 // UNSET_FLOAT 65 | InitMarginAfterOutsideRTH float64 // UNSET_FLOAT 66 | MaintMarginAfterOutsideRTH float64 // UNSET_FLOAT 67 | EquityWithLoanAfterOutsideRTH float64 // UNSET_FLOAT 68 | SuggestedSize Decimal // UNSET_DECIMAL 69 | RejectReason string 70 | OrderAllocations []*OrderAllocation 71 | WarningText string 72 | 73 | CompletedTime string 74 | CompletedStatus string 75 | } 76 | 77 | func NewOrderState() *OrderState { 78 | os := &OrderState{} 79 | os.CommissionAndFees = UNSET_FLOAT 80 | os.MinCommissionAndFees = UNSET_FLOAT 81 | os.MaxCommissionAndFees = UNSET_FLOAT 82 | os.InitMarginBeforeOutsideRTH = UNSET_FLOAT 83 | os.MaintMarginBeforeOutsideRTH = UNSET_FLOAT 84 | os.EquityWithLoanBeforeOutsideRTH = UNSET_FLOAT 85 | os.InitMarginChangeOutsideRTH = UNSET_FLOAT 86 | os.MaintMarginChangeOutsideRTH = UNSET_FLOAT 87 | os.EquityWithLoanChangeOutsideRTH = UNSET_FLOAT 88 | os.InitMarginAfterOutsideRTH = UNSET_FLOAT 89 | os.MaintMarginAfterOutsideRTH = UNSET_FLOAT 90 | os.EquityWithLoanAfterOutsideRTH = UNSET_FLOAT 91 | os.SuggestedSize = UNSET_DECIMAL 92 | 93 | return os 94 | } 95 | 96 | func (os OrderState) String() string { 97 | s := fmt.Sprint( 98 | "Status: ", os.Status, 99 | ", InitMarginBefore: ", os.InitMarginBefore, 100 | ", MaintMarginBefore: ", os.MaintMarginBefore, 101 | ", EquityWithLoanBefore: ", os.EquityWithLoanBefore, 102 | ", InitMarginChange: ", os.InitMarginChange, 103 | ", MaintMarginChange: ", os.MaintMarginChange, 104 | ", EquityWithLoanChange: ", os.EquityWithLoanChange, 105 | ", InitMarginAfter: ", os.InitMarginAfter, 106 | ", MaintMarginAfter: ", os.MaintMarginAfter, 107 | ", EquityWithLoanAfter: ", os.EquityWithLoanAfter, 108 | ", CommissionAndFees: ", FloatMaxString(os.CommissionAndFees), 109 | ", MinCommissionAndFees: ", FloatMaxString(os.MinCommissionAndFees), 110 | ", MaxCommissionAndFees: ", FloatMaxString(os.MaxCommissionAndFees), 111 | ", CommissionAndFeesCurrency: ", os.CommissionAndFeesCurrency, 112 | ", MarginCurrency: ", os.MarginCurrency, 113 | ", InitMarginBeforeOutsideRTH: ", FloatMaxString(os.InitMarginBeforeOutsideRTH), 114 | ", MaintMarginBeforeOutsideRTH: ", FloatMaxString(os.MaintMarginBeforeOutsideRTH), 115 | ", EquityWithLoanBeforeOutsideRTH: ", FloatMaxString(os.EquityWithLoanBeforeOutsideRTH), 116 | ", InitMarginChangeOutsideRTH: ", FloatMaxString(os.InitMarginChangeOutsideRTH), 117 | ", MaintMarginChangeOutsideRTH: ", FloatMaxString(os.MaintMarginChangeOutsideRTH), 118 | ", EquityWithLoanChangeOutsideRTH: ", FloatMaxString(os.EquityWithLoanChangeOutsideRTH), 119 | ", InitMarginAfterOutsideRTH: ", FloatMaxString(os.InitMarginAfterOutsideRTH), 120 | ", MaintMarginAfterOutsideRTH: ", FloatMaxString(os.MaintMarginAfterOutsideRTH), 121 | ", EquityWithLoanAfterOutsideRTH: ", FloatMaxString(os.EquityWithLoanAfterOutsideRTH), 122 | ", SuggestedSize: ", DecimalMaxString(os.SuggestedSize), 123 | ", RejectReason: ", os.RejectReason, 124 | ", WarningText: ", os.WarningText, 125 | ", CompletedTime: ", os.CompletedTime, 126 | ", CompletedStatus: ", os.CompletedStatus, 127 | ) 128 | 129 | if os.OrderAllocations != nil { 130 | s += ", OrderAllocations: " 131 | for _, oa := range os.OrderAllocations { 132 | s += "[" + oa.String() + "]" 133 | } 134 | } 135 | 136 | return s 137 | } 138 | -------------------------------------------------------------------------------- /percent_change_condition.go: -------------------------------------------------------------------------------- 1 | package ibapi 2 | 3 | import ( 4 | "fmt" 5 | ) 6 | 7 | // var _ OrderCondition = (*PercentChangeCondition)(nil) 8 | var _ ContractCondition = (*PercentChangeCondition)(nil) 9 | 10 | type PercentChangeCondition struct { 11 | *contractCondition 12 | ChangePercent float64 13 | } 14 | 15 | func newPercentChangeCondition() *PercentChangeCondition { 16 | return &PercentChangeCondition{contractCondition: newContractCondition(PercentChangeOrderCondition)} 17 | } 18 | 19 | func (pcc *PercentChangeCondition) decode(msgBuf *MsgBuffer) { 20 | pcc.ChangePercent = msgBuf.decodeFloat64() 21 | } 22 | 23 | func (pcc PercentChangeCondition) makeFields() []any { 24 | return append(pcc.contractCondition.makeFields(), pcc.ChangePercent) 25 | } 26 | 27 | func (pcc PercentChangeCondition) String() string { 28 | volume := fmt.Sprintf("%f", pcc.ChangePercent) 29 | return fmt.Sprintf("%s %s", pcc.contractCondition, pcc.operatorCondition.stringWithOperator(volume)) 30 | } 31 | -------------------------------------------------------------------------------- /price_condition.go: -------------------------------------------------------------------------------- 1 | package ibapi 2 | 3 | import ( 4 | "fmt" 5 | ) 6 | 7 | // Trigger Methods. 8 | type TriggerMethod int64 9 | 10 | const ( 11 | DefaultTriggerMethod TriggerMethod = 0 12 | DoubleBidAskTriggerMethod TriggerMethod = 1 13 | LastTriggerMethod TriggerMethod = 2 14 | DoubleLastTriggerMethod TriggerMethod = 3 15 | BidAskTriggerMethod TriggerMethod = 4 16 | LastBidAskTriggerMethod TriggerMethod = 7 17 | MidPointTriggerMethod TriggerMethod = 8 18 | ) 19 | 20 | func (tm TriggerMethod) String() string { 21 | switch tm { 22 | case DefaultTriggerMethod: 23 | return "default" 24 | case DoubleBidAskTriggerMethod: 25 | return "Double BidAsk" 26 | case LastTriggerMethod: 27 | return "last" 28 | case DoubleLastTriggerMethod: 29 | return "double Last" 30 | case BidAskTriggerMethod: 31 | return "Bid/ssk" 32 | case LastBidAskTriggerMethod: 33 | return "last of Bid/Ask" 34 | case MidPointTriggerMethod: 35 | return "mid-point" 36 | default: 37 | return fmt.Sprintf("Unknown Trigger Method %d", tm) 38 | } 39 | } 40 | 41 | // var _ OrderCondition = (*PriceCondition)(nil) 42 | var _ ContractCondition = (*PriceCondition)(nil) 43 | 44 | type PriceCondition struct { 45 | *contractCondition 46 | Price float64 47 | TriggerMethod TriggerMethod 48 | } 49 | 50 | func newPriceCondition() *PriceCondition { 51 | return &PriceCondition{contractCondition: newContractCondition(PriceOrderCondition)} 52 | } 53 | 54 | func (pc *PriceCondition) decode(msgBuf *MsgBuffer) { 55 | pc.contractCondition.decode(msgBuf) 56 | pc.Price = msgBuf.decodeFloat64() 57 | pc.TriggerMethod = TriggerMethod(msgBuf.decodeInt64()) 58 | } 59 | 60 | func (pc PriceCondition) makeFields() []any { 61 | return append(pc.contractCondition.makeFields(), pc.Price, pc.TriggerMethod) 62 | } 63 | 64 | func (pc PriceCondition) String() string { 65 | return fmt.Sprintf("%v %v", pc.TriggerMethod, pc.contractCondition) 66 | } 67 | -------------------------------------------------------------------------------- /price_increment.go: -------------------------------------------------------------------------------- 1 | package ibapi 2 | 3 | import "fmt" 4 | 5 | // PriceIncrement . 6 | type PriceIncrement struct { 7 | LowEdge float64 8 | Increment float64 9 | } 10 | 11 | func NewPriceIncrement() PriceIncrement { 12 | return PriceIncrement{} 13 | } 14 | 15 | func (p PriceIncrement) String() string { 16 | return fmt.Sprintf("LowEdge: %f, Increment: %f", p.LowEdge, p.Increment) 17 | } 18 | -------------------------------------------------------------------------------- /proto/CancelOrderRequest.proto: -------------------------------------------------------------------------------- 1 | syntax = "proto3"; 2 | 3 | package protobuf; 4 | 5 | import "OrderCancel.proto"; 6 | 7 | option go_package = ".;protobuf"; 8 | 9 | message CancelOrderRequest { 10 | optional int32 orderId = 1; 11 | optional OrderCancel orderCancel = 2; 12 | } -------------------------------------------------------------------------------- /proto/ComboLeg.proto: -------------------------------------------------------------------------------- 1 | syntax = "proto3"; 2 | 3 | package protobuf; 4 | 5 | option go_package = ".;protobuf"; 6 | 7 | message ComboLeg { 8 | optional int32 conId = 1; 9 | optional int32 ratio = 2; 10 | optional string action = 3; 11 | optional string exchange = 4; 12 | optional int32 openClose = 5; 13 | optional int32 shortSalesSlot = 6; 14 | optional string designatedLocation = 7; 15 | optional int32 exemptCode = 8; 16 | optional double perLegPrice = 9; 17 | } 18 | -------------------------------------------------------------------------------- /proto/Contract.proto: -------------------------------------------------------------------------------- 1 | syntax = "proto3"; 2 | 3 | package protobuf; 4 | 5 | import "ComboLeg.proto"; 6 | import "DeltaNeutralContract.proto"; 7 | 8 | option go_package = ".;protobuf"; 9 | 10 | message Contract { 11 | optional int32 conId = 1; 12 | optional string symbol = 2; 13 | optional string secType = 3; 14 | optional string lastTradeDateOrContractMonth = 4; 15 | optional double strike = 5; 16 | optional string right = 6; 17 | optional double multiplier = 7; 18 | optional string exchange = 8; 19 | optional string primaryExch = 9; 20 | optional string currency = 10; 21 | optional string localSymbol = 11; 22 | optional string tradingClass = 12; 23 | optional string secIdType = 13; 24 | optional string secId = 14; 25 | optional string description = 15; 26 | optional string issuerId = 16; 27 | optional DeltaNeutralContract deltaNeutralContract = 17; 28 | optional bool includeExpired = 18; 29 | optional string comboLegsDescrip = 19; 30 | repeated ComboLeg comboLegs = 20; 31 | } 32 | -------------------------------------------------------------------------------- /proto/DeltaNeutralContract.proto: -------------------------------------------------------------------------------- 1 | syntax = "proto3"; 2 | 3 | package protobuf; 4 | 5 | option go_package = ".;protobuf"; 6 | 7 | message DeltaNeutralContract { 8 | optional int32 conId = 1; 9 | optional double delta = 2; 10 | optional double price = 3; 11 | } 12 | -------------------------------------------------------------------------------- /proto/ErrorMessage.proto: -------------------------------------------------------------------------------- 1 | syntax = "proto3"; 2 | 3 | package protobuf; 4 | 5 | option go_package = ".;protobuf"; 6 | 7 | message ErrorMessage { 8 | optional int32 id = 1; 9 | optional int64 errorTime = 2; 10 | optional int32 errorCode = 3; 11 | optional string errorMsg = 4; 12 | optional string advancedOrderRejectJson = 5; 13 | } -------------------------------------------------------------------------------- /proto/Execution.proto: -------------------------------------------------------------------------------- 1 | syntax = "proto3"; 2 | 3 | package protobuf; 4 | 5 | option go_package = ".;protobuf"; 6 | 7 | message Execution { 8 | optional int32 orderId = 1; 9 | optional string execId = 2; 10 | optional string time = 3; 11 | optional string acctNumber = 4; 12 | optional string exchange = 5; 13 | optional string side = 6; 14 | optional string shares = 7; 15 | optional double price = 8; 16 | optional int64 permId = 9; 17 | optional int32 clientId = 10; 18 | optional bool isLiquidation = 11; 19 | optional string cumQty = 12; 20 | optional double avgPrice = 13; 21 | optional string orderRef = 14; 22 | optional string evRule = 15; 23 | optional double evMultiplier = 16; 24 | optional string modelCode = 17; 25 | optional int32 lastLiquidity = 18; 26 | optional bool isPriceRevisionPending = 19; 27 | optional string submitter = 20; 28 | optional int32 optExerciseOrLapseType = 21; 29 | } 30 | -------------------------------------------------------------------------------- /proto/ExecutionDetails.proto: -------------------------------------------------------------------------------- 1 | syntax = "proto3"; 2 | 3 | package protobuf; 4 | 5 | import "Contract.proto"; 6 | import "Execution.proto"; 7 | 8 | option go_package = ".;protobuf"; 9 | 10 | message ExecutionDetails { 11 | optional int32 reqId = 1; 12 | optional Contract contract = 2; 13 | optional Execution execution = 3; 14 | } 15 | -------------------------------------------------------------------------------- /proto/ExecutionDetailsEnd.proto: -------------------------------------------------------------------------------- 1 | syntax = "proto3"; 2 | 3 | package protobuf; 4 | 5 | option go_package = ".;protobuf"; 6 | 7 | message ExecutionDetailsEnd { 8 | optional int32 reqId = 1; 9 | } 10 | -------------------------------------------------------------------------------- /proto/ExecutionFilter.proto: -------------------------------------------------------------------------------- 1 | syntax = "proto3"; 2 | 3 | package protobuf; 4 | 5 | option go_package = ".;protobuf"; 6 | 7 | message ExecutionFilter { 8 | optional int32 clientId = 1; 9 | optional string acctCode = 2; 10 | optional string time = 3; 11 | optional string symbol = 4; 12 | optional string secType = 5; 13 | optional string exchange = 6; 14 | optional string side = 7; 15 | optional int32 lastNDays = 8; 16 | repeated int32 specificDates = 9; 17 | } 18 | -------------------------------------------------------------------------------- /proto/ExecutionRequest.proto: -------------------------------------------------------------------------------- 1 | syntax = "proto3"; 2 | 3 | package protobuf; 4 | 5 | import "ExecutionFilter.proto"; 6 | 7 | option go_package = ".;protobuf"; 8 | 9 | message ExecutionRequest { 10 | optional int32 reqId = 1; 11 | optional ExecutionFilter executionFilter = 2; 12 | } 13 | -------------------------------------------------------------------------------- /proto/GlobalCancelRequest.proto: -------------------------------------------------------------------------------- 1 | syntax = "proto3"; 2 | 3 | package protobuf; 4 | 5 | import "OrderCancel.proto"; 6 | 7 | option go_package = ".;protobuf"; 8 | 9 | message GlobalCancelRequest { 10 | optional OrderCancel orderCancel = 1; 11 | } -------------------------------------------------------------------------------- /proto/OpenOrder.proto: -------------------------------------------------------------------------------- 1 | syntax = "proto3"; 2 | 3 | package protobuf; 4 | 5 | import "Contract.proto"; 6 | import "Order.proto"; 7 | import "OrderState.proto"; 8 | 9 | option go_package = ".;protobuf"; 10 | 11 | message OpenOrder { 12 | optional int32 orderId = 1; 13 | optional Contract contract = 2; 14 | optional Order order = 3; 15 | optional OrderState orderState = 4; 16 | } -------------------------------------------------------------------------------- /proto/OpenOrdersEnd.proto: -------------------------------------------------------------------------------- 1 | syntax = "proto3"; 2 | 3 | package protobuf; 4 | 5 | option go_package = ".;protobuf"; 6 | 7 | message OpenOrdersEnd { 8 | // empty 9 | } -------------------------------------------------------------------------------- /proto/Order.proto: -------------------------------------------------------------------------------- 1 | syntax = "proto3"; 2 | 3 | package protobuf; 4 | 5 | import "OrderCondition.proto"; 6 | import "SoftDollarTier.proto"; 7 | 8 | option go_package = ".;protobuf"; 9 | 10 | message Order { 11 | 12 | // order ids 13 | optional int32 clientId = 1; 14 | optional int32 orderId = 2; 15 | optional int64 permId = 3; 16 | optional int32 parentId = 4; 17 | 18 | // primary attributes 19 | optional string action = 5; 20 | optional string totalQuantity = 6; 21 | optional int32 displaySize = 7; 22 | optional string orderType = 8; 23 | optional double lmtPrice = 9; 24 | optional double auxPrice = 10; 25 | optional string tif = 11; 26 | 27 | // clearing info 28 | optional string account = 12; 29 | optional string settlingFirm = 13; 30 | optional string clearingAccount = 14; 31 | optional string clearingIntent = 15; 32 | 33 | // secondary attributes 34 | optional bool allOrNone = 16; 35 | optional bool blockOrder = 17; 36 | optional bool hidden = 18; 37 | optional bool outsideRth = 19; 38 | optional bool sweepToFill = 20; 39 | optional double percentOffset = 21; 40 | optional double trailingPercent = 22; 41 | optional double trailStopPrice = 23; 42 | optional int32 minQty = 24; 43 | optional string goodAfterTime = 25; 44 | optional string goodTillDate = 26; 45 | optional string ocaGroup = 27; 46 | optional string orderRef = 28; 47 | optional string rule80A = 29; 48 | optional int32 ocaType = 30; 49 | optional int32 triggerMethod = 31; 50 | 51 | // extended order fields 52 | optional string activeStartTime = 32; 53 | optional string activeStopTime = 33; 54 | 55 | // advisor allocation orders 56 | optional string faGroup = 34; 57 | optional string faMethod = 35; 58 | optional string faPercentage = 36; 59 | 60 | // volatility orders 61 | optional double volatility = 37; 62 | optional int32 volatilityType = 38; 63 | optional bool continuousUpdate = 39; 64 | optional int32 referencePriceType = 40; 65 | optional string deltaNeutralOrderType = 41; 66 | optional double deltaNeutralAuxPrice = 42; 67 | optional int32 deltaNeutralConId = 43; 68 | optional string deltaNeutralOpenClose = 44; 69 | optional bool deltaNeutralShortSale = 45; 70 | optional int32 deltaNeutralShortSaleSlot = 46; 71 | optional string deltaNeutralDesignatedLocation = 47; 72 | 73 | // scale orders 74 | optional int32 scaleInitLevelSize = 48; 75 | optional int32 scaleSubsLevelSize = 49; 76 | optional double scalePriceIncrement = 50; 77 | optional double scalePriceAdjustValue = 51; 78 | optional int32 scalePriceAdjustInterval = 52; 79 | optional double scaleProfitOffset = 53; 80 | optional bool scaleAutoReset = 54; 81 | optional int32 scaleInitPosition = 55; 82 | optional int32 scaleInitFillQty = 56; 83 | optional bool scaleRandomPercent = 57; 84 | optional string scaleTable = 58; 85 | 86 | // hedge orders 87 | optional string hedgeType = 59; 88 | optional string hedgeParam = 60; 89 | 90 | // algo orders 91 | optional string algoStrategy = 61; 92 | map algoParams = 62; 93 | optional string algoId = 63; 94 | 95 | // combo orders 96 | map smartComboRoutingParams = 64; 97 | 98 | // processing control 99 | optional bool whatIf = 65; 100 | optional bool transmit = 66; 101 | optional bool overridePercentageConstraints = 67; 102 | 103 | // Institutional orders only 104 | optional string openClose = 68; 105 | optional int32 origin = 69; 106 | optional int32 shortSaleSlot = 70; 107 | optional string designatedLocation = 71; 108 | optional int32 exemptCode = 72; 109 | optional string deltaNeutralSettlingFirm = 73; 110 | optional string deltaNeutralClearingAccount = 74; 111 | optional string deltaNeutralClearingIntent = 75; 112 | 113 | // SMART routing only 114 | optional double discretionaryAmt = 76; 115 | optional bool optOutSmartRouting = 77; 116 | 117 | // BOX ORDERS ONLY 118 | optional double startingPrice = 78; 119 | optional double stockRefPrice = 79; 120 | optional double delta = 80; 121 | 122 | // pegged to stock or VOL orders 123 | optional double stockRangeLower = 81; 124 | optional double stockRangeUpper = 82; 125 | 126 | // Not Held 127 | optional bool notHeld = 83; 128 | 129 | // order misc options 130 | map orderMiscOptions = 84; 131 | 132 | //order algo id 133 | optional bool solicited = 85; 134 | 135 | optional bool randomizeSize = 86; 136 | optional bool randomizePrice = 87; 137 | 138 | // PEG2BENCH fields 139 | optional int32 referenceContractId = 88; 140 | optional double peggedChangeAmount = 89; 141 | optional bool isPeggedChangeAmountDecrease = 90; 142 | optional double referenceChangeAmount = 91; 143 | optional string referenceExchangeId = 92; 144 | optional string adjustedOrderType = 93; 145 | optional double triggerPrice = 94; 146 | optional double adjustedStopPrice = 95; 147 | optional double adjustedStopLimitPrice = 96; 148 | optional double adjustedTrailingAmount = 97; 149 | optional int32 adjustableTrailingUnit = 98; 150 | optional double lmtPriceOffset = 99; 151 | 152 | repeated OrderCondition conditions = 100; 153 | optional bool conditionsCancelOrder = 101; 154 | optional bool conditionsIgnoreRth = 102; 155 | 156 | // models 157 | optional string modelCode = 103; 158 | 159 | optional string extOperator = 104; 160 | 161 | optional SoftDollarTier softDollarTier = 105; 162 | 163 | // native cash quantity 164 | optional double cashQty = 106; 165 | 166 | optional string mifid2DecisionMaker = 107; 167 | optional string mifid2DecisionAlgo = 108; 168 | optional string mifid2ExecutionTrader = 109; 169 | optional string mifid2ExecutionAlgo = 110; 170 | 171 | // don't use auto price for hedge 172 | optional bool dontUseAutoPriceForHedge = 111; 173 | 174 | optional bool isOmsContainer = 112; 175 | optional bool discretionaryUpToLimitPrice = 113; 176 | 177 | optional string autoCancelDate = 114; 178 | optional string filledQuantity = 115; 179 | optional int32 refFuturesConId = 116; 180 | optional bool autoCancelParent = 117; 181 | optional string shareholder = 118; 182 | optional bool imbalanceOnly = 119; 183 | optional bool routeMarketableToBbo = 120; 184 | optional int64 parentPermId = 121; 185 | 186 | optional int32 usePriceMgmtAlgo = 122; 187 | optional int32 duration = 123; 188 | optional int32 postToAts = 124; 189 | optional string advancedErrorOverride = 125; 190 | optional string manualOrderTime = 126; 191 | optional int32 minTradeQty = 127; 192 | optional int32 minCompeteSize = 128; 193 | optional double competeAgainstBestOffset = 129; 194 | optional double midOffsetAtWhole = 130; 195 | optional double midOffsetAtHalf = 131; 196 | optional string customerAccount = 132; 197 | optional bool professionalCustomer = 133; 198 | optional string bondAccruedInterest = 134; 199 | optional bool includeOvernight = 135; 200 | optional int32 manualOrderIndicator = 136; 201 | optional string submitter = 137; 202 | } -------------------------------------------------------------------------------- /proto/OrderAllocation.proto: -------------------------------------------------------------------------------- 1 | syntax = "proto3"; 2 | 3 | package protobuf; 4 | 5 | option go_package = ".;protobuf"; 6 | 7 | message OrderAllocation { 8 | optional string account = 1; 9 | optional string position = 2; 10 | optional string positionDesired = 3; 11 | optional string positionAfter = 4; 12 | optional string desiredAllocQty = 5; 13 | optional string allowedAllocQty = 6; 14 | optional bool isMonetary = 7; 15 | } -------------------------------------------------------------------------------- /proto/OrderCancel.proto: -------------------------------------------------------------------------------- 1 | syntax = "proto3"; 2 | 3 | package protobuf; 4 | 5 | option go_package = ".;protobuf"; 6 | 7 | message OrderCancel { 8 | optional string manualOrderCancelTime = 1; 9 | optional string extOperator = 2; 10 | optional int32 manualOrderIndicator = 3; 11 | } -------------------------------------------------------------------------------- /proto/OrderCondition.proto: -------------------------------------------------------------------------------- 1 | syntax = "proto3"; 2 | 3 | package protobuf; 4 | 5 | option go_package = ".;protobuf"; 6 | 7 | message OrderCondition { 8 | optional int32 type = 1; 9 | optional bool isConjunctionConnection = 2; 10 | optional bool isMore = 3; 11 | optional int32 conId = 4; 12 | optional string exchange = 5; 13 | optional string symbol = 6; 14 | optional string secType = 7; 15 | optional int32 percent = 8; 16 | optional double changePercent = 9; 17 | optional double price = 10; 18 | optional int32 triggerMethod = 11; 19 | optional string time = 12; 20 | optional int32 volume = 13; 21 | } -------------------------------------------------------------------------------- /proto/OrderState.proto: -------------------------------------------------------------------------------- 1 | syntax = "proto3"; 2 | 3 | package protobuf; 4 | 5 | import "OrderAllocation.proto"; 6 | 7 | option go_package = ".;protobuf"; 8 | 9 | message OrderState { 10 | optional string status = 1; 11 | optional double initMarginBefore = 2; 12 | optional double maintMarginBefore = 3; 13 | optional double equityWithLoanBefore = 4; 14 | optional double initMarginChange = 5; 15 | optional double maintMarginChange = 6; 16 | optional double equityWithLoanChange = 7; 17 | optional double initMarginAfter = 8; 18 | optional double maintMarginAfter = 9; 19 | optional double equityWithLoanAfter = 10; 20 | 21 | optional double commissionAndFees = 11; 22 | optional double minCommissionAndFees = 12; 23 | optional double maxCommissionAndFees = 13; 24 | optional string commissionAndFeesCurrency = 14; 25 | optional string marginCurrency = 15; 26 | 27 | optional double initMarginBeforeOutsideRTH = 16; 28 | optional double maintMarginBeforeOutsideRTH = 17; 29 | optional double equityWithLoanBeforeOutsideRTH = 18; 30 | optional double initMarginChangeOutsideRTH = 19; 31 | optional double maintMarginChangeOutsideRTH = 20; 32 | optional double equityWithLoanChangeOutsideRTH = 21; 33 | optional double initMarginAfterOutsideRTH = 22; 34 | optional double maintMarginAfterOutsideRTH = 23; 35 | optional double equityWithLoanAfterOutsideRTH = 24; 36 | 37 | optional string suggestedSize = 25; 38 | optional string rejectReason = 26; 39 | repeated OrderAllocation orderAllocations = 27; 40 | optional string warningText = 28; 41 | optional string completedTime = 29; 42 | optional string completedStatus = 30; 43 | } -------------------------------------------------------------------------------- /proto/OrderStatus.proto: -------------------------------------------------------------------------------- 1 | syntax = "proto3"; 2 | 3 | package protobuf; 4 | 5 | option go_package = ".;protobuf"; 6 | 7 | message OrderStatus { 8 | optional int32 orderId = 1; 9 | optional string status = 2; 10 | optional string filled = 3; 11 | optional string remaining = 4; 12 | optional double avgFillPrice = 5; 13 | optional int64 permId = 6; 14 | optional int32 parentId = 7; 15 | optional double lastFillPrice = 8; 16 | optional int32 clientId = 9; 17 | optional string whyHeld = 10; 18 | optional double mktCapPrice = 11; 19 | } -------------------------------------------------------------------------------- /proto/PlaceOrderRequest.proto: -------------------------------------------------------------------------------- 1 | 2 | syntax = "proto3"; 3 | 4 | package protobuf; 5 | 6 | import "Contract.proto"; 7 | import "Order.proto"; 8 | 9 | option go_package = ".;protobuf"; 10 | 11 | message PlaceOrderRequest { 12 | optional int32 orderId = 1; 13 | optional Contract contract = 2; 14 | optional Order order = 3; 15 | } -------------------------------------------------------------------------------- /proto/SoftDollarTier.proto: -------------------------------------------------------------------------------- 1 | syntax = "proto3"; 2 | 3 | package protobuf; 4 | 5 | option go_package = ".;protobuf"; 6 | 7 | message SoftDollarTier { 8 | optional string name = 1; 9 | optional string value = 2; 10 | optional string displayName = 3; 11 | } -------------------------------------------------------------------------------- /proto/proto.md: -------------------------------------------------------------------------------- 1 | To generate protobuf files run from "ibapi" directory: 2 | 3 | ``` 4 | protoc --proto_path=proto --go_out=protobuf proto/*.proto --experimental_allow_proto3_optional 5 | ``` 6 | -------------------------------------------------------------------------------- /protobuf/CancelOrderRequest.pb.go: -------------------------------------------------------------------------------- 1 | // Code generated by protoc-gen-go. DO NOT EDIT. 2 | // versions: 3 | // protoc-gen-go v1.36.5 4 | // protoc v3.12.4 5 | // source: CancelOrderRequest.proto 6 | 7 | package protobuf 8 | 9 | import ( 10 | protoreflect "google.golang.org/protobuf/reflect/protoreflect" 11 | protoimpl "google.golang.org/protobuf/runtime/protoimpl" 12 | reflect "reflect" 13 | sync "sync" 14 | unsafe "unsafe" 15 | ) 16 | 17 | const ( 18 | // Verify that this generated code is sufficiently up-to-date. 19 | _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) 20 | // Verify that runtime/protoimpl is sufficiently up-to-date. 21 | _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) 22 | ) 23 | 24 | type CancelOrderRequest struct { 25 | state protoimpl.MessageState `protogen:"open.v1"` 26 | OrderId *int32 `protobuf:"varint,1,opt,name=orderId,proto3,oneof" json:"orderId,omitempty"` 27 | OrderCancel *OrderCancel `protobuf:"bytes,2,opt,name=orderCancel,proto3,oneof" json:"orderCancel,omitempty"` 28 | unknownFields protoimpl.UnknownFields 29 | sizeCache protoimpl.SizeCache 30 | } 31 | 32 | func (x *CancelOrderRequest) Reset() { 33 | *x = CancelOrderRequest{} 34 | mi := &file_CancelOrderRequest_proto_msgTypes[0] 35 | ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) 36 | ms.StoreMessageInfo(mi) 37 | } 38 | 39 | func (x *CancelOrderRequest) String() string { 40 | return protoimpl.X.MessageStringOf(x) 41 | } 42 | 43 | func (*CancelOrderRequest) ProtoMessage() {} 44 | 45 | func (x *CancelOrderRequest) ProtoReflect() protoreflect.Message { 46 | mi := &file_CancelOrderRequest_proto_msgTypes[0] 47 | if x != nil { 48 | ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) 49 | if ms.LoadMessageInfo() == nil { 50 | ms.StoreMessageInfo(mi) 51 | } 52 | return ms 53 | } 54 | return mi.MessageOf(x) 55 | } 56 | 57 | // Deprecated: Use CancelOrderRequest.ProtoReflect.Descriptor instead. 58 | func (*CancelOrderRequest) Descriptor() ([]byte, []int) { 59 | return file_CancelOrderRequest_proto_rawDescGZIP(), []int{0} 60 | } 61 | 62 | func (x *CancelOrderRequest) GetOrderId() int32 { 63 | if x != nil && x.OrderId != nil { 64 | return *x.OrderId 65 | } 66 | return 0 67 | } 68 | 69 | func (x *CancelOrderRequest) GetOrderCancel() *OrderCancel { 70 | if x != nil { 71 | return x.OrderCancel 72 | } 73 | return nil 74 | } 75 | 76 | var File_CancelOrderRequest_proto protoreflect.FileDescriptor 77 | 78 | var file_CancelOrderRequest_proto_rawDesc = string([]byte{ 79 | 0x0a, 0x18, 0x43, 0x61, 0x6e, 0x63, 0x65, 0x6c, 0x4f, 0x72, 0x64, 0x65, 0x72, 0x52, 0x65, 0x71, 80 | 0x75, 0x65, 0x73, 0x74, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x08, 0x70, 0x72, 0x6f, 0x74, 81 | 0x6f, 0x62, 0x75, 0x66, 0x1a, 0x11, 0x4f, 0x72, 0x64, 0x65, 0x72, 0x43, 0x61, 0x6e, 0x63, 0x65, 82 | 0x6c, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x8d, 0x01, 0x0a, 0x12, 0x43, 0x61, 0x6e, 0x63, 83 | 0x65, 0x6c, 0x4f, 0x72, 0x64, 0x65, 0x72, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x1d, 84 | 0x0a, 0x07, 0x6f, 0x72, 0x64, 0x65, 0x72, 0x49, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x48, 85 | 0x00, 0x52, 0x07, 0x6f, 0x72, 0x64, 0x65, 0x72, 0x49, 0x64, 0x88, 0x01, 0x01, 0x12, 0x3c, 0x0a, 86 | 0x0b, 0x6f, 0x72, 0x64, 0x65, 0x72, 0x43, 0x61, 0x6e, 0x63, 0x65, 0x6c, 0x18, 0x02, 0x20, 0x01, 87 | 0x28, 0x0b, 0x32, 0x15, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x4f, 0x72, 88 | 0x64, 0x65, 0x72, 0x43, 0x61, 0x6e, 0x63, 0x65, 0x6c, 0x48, 0x01, 0x52, 0x0b, 0x6f, 0x72, 0x64, 89 | 0x65, 0x72, 0x43, 0x61, 0x6e, 0x63, 0x65, 0x6c, 0x88, 0x01, 0x01, 0x42, 0x0a, 0x0a, 0x08, 0x5f, 90 | 0x6f, 0x72, 0x64, 0x65, 0x72, 0x49, 0x64, 0x42, 0x0e, 0x0a, 0x0c, 0x5f, 0x6f, 0x72, 0x64, 0x65, 91 | 0x72, 0x43, 0x61, 0x6e, 0x63, 0x65, 0x6c, 0x42, 0x0c, 0x5a, 0x0a, 0x2e, 0x3b, 0x70, 0x72, 0x6f, 92 | 0x74, 0x6f, 0x62, 0x75, 0x66, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, 93 | }) 94 | 95 | var ( 96 | file_CancelOrderRequest_proto_rawDescOnce sync.Once 97 | file_CancelOrderRequest_proto_rawDescData []byte 98 | ) 99 | 100 | func file_CancelOrderRequest_proto_rawDescGZIP() []byte { 101 | file_CancelOrderRequest_proto_rawDescOnce.Do(func() { 102 | file_CancelOrderRequest_proto_rawDescData = protoimpl.X.CompressGZIP(unsafe.Slice(unsafe.StringData(file_CancelOrderRequest_proto_rawDesc), len(file_CancelOrderRequest_proto_rawDesc))) 103 | }) 104 | return file_CancelOrderRequest_proto_rawDescData 105 | } 106 | 107 | var file_CancelOrderRequest_proto_msgTypes = make([]protoimpl.MessageInfo, 1) 108 | var file_CancelOrderRequest_proto_goTypes = []any{ 109 | (*CancelOrderRequest)(nil), // 0: protobuf.CancelOrderRequest 110 | (*OrderCancel)(nil), // 1: protobuf.OrderCancel 111 | } 112 | var file_CancelOrderRequest_proto_depIdxs = []int32{ 113 | 1, // 0: protobuf.CancelOrderRequest.orderCancel:type_name -> protobuf.OrderCancel 114 | 1, // [1:1] is the sub-list for method output_type 115 | 1, // [1:1] is the sub-list for method input_type 116 | 1, // [1:1] is the sub-list for extension type_name 117 | 1, // [1:1] is the sub-list for extension extendee 118 | 0, // [0:1] is the sub-list for field type_name 119 | } 120 | 121 | func init() { file_CancelOrderRequest_proto_init() } 122 | func file_CancelOrderRequest_proto_init() { 123 | if File_CancelOrderRequest_proto != nil { 124 | return 125 | } 126 | file_OrderCancel_proto_init() 127 | file_CancelOrderRequest_proto_msgTypes[0].OneofWrappers = []any{} 128 | type x struct{} 129 | out := protoimpl.TypeBuilder{ 130 | File: protoimpl.DescBuilder{ 131 | GoPackagePath: reflect.TypeOf(x{}).PkgPath(), 132 | RawDescriptor: unsafe.Slice(unsafe.StringData(file_CancelOrderRequest_proto_rawDesc), len(file_CancelOrderRequest_proto_rawDesc)), 133 | NumEnums: 0, 134 | NumMessages: 1, 135 | NumExtensions: 0, 136 | NumServices: 0, 137 | }, 138 | GoTypes: file_CancelOrderRequest_proto_goTypes, 139 | DependencyIndexes: file_CancelOrderRequest_proto_depIdxs, 140 | MessageInfos: file_CancelOrderRequest_proto_msgTypes, 141 | }.Build() 142 | File_CancelOrderRequest_proto = out.File 143 | file_CancelOrderRequest_proto_goTypes = nil 144 | file_CancelOrderRequest_proto_depIdxs = nil 145 | } 146 | -------------------------------------------------------------------------------- /protobuf/DeltaNeutralContract.pb.go: -------------------------------------------------------------------------------- 1 | // Code generated by protoc-gen-go. DO NOT EDIT. 2 | // versions: 3 | // protoc-gen-go v1.36.5 4 | // protoc v3.12.4 5 | // source: DeltaNeutralContract.proto 6 | 7 | package protobuf 8 | 9 | import ( 10 | protoreflect "google.golang.org/protobuf/reflect/protoreflect" 11 | protoimpl "google.golang.org/protobuf/runtime/protoimpl" 12 | reflect "reflect" 13 | sync "sync" 14 | unsafe "unsafe" 15 | ) 16 | 17 | const ( 18 | // Verify that this generated code is sufficiently up-to-date. 19 | _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) 20 | // Verify that runtime/protoimpl is sufficiently up-to-date. 21 | _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) 22 | ) 23 | 24 | type DeltaNeutralContract struct { 25 | state protoimpl.MessageState `protogen:"open.v1"` 26 | ConId *int32 `protobuf:"varint,1,opt,name=conId,proto3,oneof" json:"conId,omitempty"` 27 | Delta *float64 `protobuf:"fixed64,2,opt,name=delta,proto3,oneof" json:"delta,omitempty"` 28 | Price *float64 `protobuf:"fixed64,3,opt,name=price,proto3,oneof" json:"price,omitempty"` 29 | unknownFields protoimpl.UnknownFields 30 | sizeCache protoimpl.SizeCache 31 | } 32 | 33 | func (x *DeltaNeutralContract) Reset() { 34 | *x = DeltaNeutralContract{} 35 | mi := &file_DeltaNeutralContract_proto_msgTypes[0] 36 | ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) 37 | ms.StoreMessageInfo(mi) 38 | } 39 | 40 | func (x *DeltaNeutralContract) String() string { 41 | return protoimpl.X.MessageStringOf(x) 42 | } 43 | 44 | func (*DeltaNeutralContract) ProtoMessage() {} 45 | 46 | func (x *DeltaNeutralContract) ProtoReflect() protoreflect.Message { 47 | mi := &file_DeltaNeutralContract_proto_msgTypes[0] 48 | if x != nil { 49 | ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) 50 | if ms.LoadMessageInfo() == nil { 51 | ms.StoreMessageInfo(mi) 52 | } 53 | return ms 54 | } 55 | return mi.MessageOf(x) 56 | } 57 | 58 | // Deprecated: Use DeltaNeutralContract.ProtoReflect.Descriptor instead. 59 | func (*DeltaNeutralContract) Descriptor() ([]byte, []int) { 60 | return file_DeltaNeutralContract_proto_rawDescGZIP(), []int{0} 61 | } 62 | 63 | func (x *DeltaNeutralContract) GetConId() int32 { 64 | if x != nil && x.ConId != nil { 65 | return *x.ConId 66 | } 67 | return 0 68 | } 69 | 70 | func (x *DeltaNeutralContract) GetDelta() float64 { 71 | if x != nil && x.Delta != nil { 72 | return *x.Delta 73 | } 74 | return 0 75 | } 76 | 77 | func (x *DeltaNeutralContract) GetPrice() float64 { 78 | if x != nil && x.Price != nil { 79 | return *x.Price 80 | } 81 | return 0 82 | } 83 | 84 | var File_DeltaNeutralContract_proto protoreflect.FileDescriptor 85 | 86 | var file_DeltaNeutralContract_proto_rawDesc = string([]byte{ 87 | 0x0a, 0x1a, 0x44, 0x65, 0x6c, 0x74, 0x61, 0x4e, 0x65, 0x75, 0x74, 0x72, 0x61, 0x6c, 0x43, 0x6f, 88 | 0x6e, 0x74, 0x72, 0x61, 0x63, 0x74, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x08, 0x70, 0x72, 89 | 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x22, 0x85, 0x01, 0x0a, 0x14, 0x44, 0x65, 0x6c, 0x74, 0x61, 90 | 0x4e, 0x65, 0x75, 0x74, 0x72, 0x61, 0x6c, 0x43, 0x6f, 0x6e, 0x74, 0x72, 0x61, 0x63, 0x74, 0x12, 91 | 0x19, 0x0a, 0x05, 0x63, 0x6f, 0x6e, 0x49, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x48, 0x00, 92 | 0x52, 0x05, 0x63, 0x6f, 0x6e, 0x49, 0x64, 0x88, 0x01, 0x01, 0x12, 0x19, 0x0a, 0x05, 0x64, 0x65, 93 | 0x6c, 0x74, 0x61, 0x18, 0x02, 0x20, 0x01, 0x28, 0x01, 0x48, 0x01, 0x52, 0x05, 0x64, 0x65, 0x6c, 94 | 0x74, 0x61, 0x88, 0x01, 0x01, 0x12, 0x19, 0x0a, 0x05, 0x70, 0x72, 0x69, 0x63, 0x65, 0x18, 0x03, 95 | 0x20, 0x01, 0x28, 0x01, 0x48, 0x02, 0x52, 0x05, 0x70, 0x72, 0x69, 0x63, 0x65, 0x88, 0x01, 0x01, 96 | 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x63, 0x6f, 0x6e, 0x49, 0x64, 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x64, 97 | 0x65, 0x6c, 0x74, 0x61, 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x70, 0x72, 0x69, 0x63, 0x65, 0x42, 0x0c, 98 | 0x5a, 0x0a, 0x2e, 0x3b, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x62, 0x06, 0x70, 0x72, 99 | 0x6f, 0x74, 0x6f, 0x33, 100 | }) 101 | 102 | var ( 103 | file_DeltaNeutralContract_proto_rawDescOnce sync.Once 104 | file_DeltaNeutralContract_proto_rawDescData []byte 105 | ) 106 | 107 | func file_DeltaNeutralContract_proto_rawDescGZIP() []byte { 108 | file_DeltaNeutralContract_proto_rawDescOnce.Do(func() { 109 | file_DeltaNeutralContract_proto_rawDescData = protoimpl.X.CompressGZIP(unsafe.Slice(unsafe.StringData(file_DeltaNeutralContract_proto_rawDesc), len(file_DeltaNeutralContract_proto_rawDesc))) 110 | }) 111 | return file_DeltaNeutralContract_proto_rawDescData 112 | } 113 | 114 | var file_DeltaNeutralContract_proto_msgTypes = make([]protoimpl.MessageInfo, 1) 115 | var file_DeltaNeutralContract_proto_goTypes = []any{ 116 | (*DeltaNeutralContract)(nil), // 0: protobuf.DeltaNeutralContract 117 | } 118 | var file_DeltaNeutralContract_proto_depIdxs = []int32{ 119 | 0, // [0:0] is the sub-list for method output_type 120 | 0, // [0:0] is the sub-list for method input_type 121 | 0, // [0:0] is the sub-list for extension type_name 122 | 0, // [0:0] is the sub-list for extension extendee 123 | 0, // [0:0] is the sub-list for field type_name 124 | } 125 | 126 | func init() { file_DeltaNeutralContract_proto_init() } 127 | func file_DeltaNeutralContract_proto_init() { 128 | if File_DeltaNeutralContract_proto != nil { 129 | return 130 | } 131 | file_DeltaNeutralContract_proto_msgTypes[0].OneofWrappers = []any{} 132 | type x struct{} 133 | out := protoimpl.TypeBuilder{ 134 | File: protoimpl.DescBuilder{ 135 | GoPackagePath: reflect.TypeOf(x{}).PkgPath(), 136 | RawDescriptor: unsafe.Slice(unsafe.StringData(file_DeltaNeutralContract_proto_rawDesc), len(file_DeltaNeutralContract_proto_rawDesc)), 137 | NumEnums: 0, 138 | NumMessages: 1, 139 | NumExtensions: 0, 140 | NumServices: 0, 141 | }, 142 | GoTypes: file_DeltaNeutralContract_proto_goTypes, 143 | DependencyIndexes: file_DeltaNeutralContract_proto_depIdxs, 144 | MessageInfos: file_DeltaNeutralContract_proto_msgTypes, 145 | }.Build() 146 | File_DeltaNeutralContract_proto = out.File 147 | file_DeltaNeutralContract_proto_goTypes = nil 148 | file_DeltaNeutralContract_proto_depIdxs = nil 149 | } 150 | -------------------------------------------------------------------------------- /protobuf/ErrorMessage.pb.go: -------------------------------------------------------------------------------- 1 | // Code generated by protoc-gen-go. DO NOT EDIT. 2 | // versions: 3 | // protoc-gen-go v1.36.5 4 | // protoc v3.12.4 5 | // source: ErrorMessage.proto 6 | 7 | package protobuf 8 | 9 | import ( 10 | protoreflect "google.golang.org/protobuf/reflect/protoreflect" 11 | protoimpl "google.golang.org/protobuf/runtime/protoimpl" 12 | reflect "reflect" 13 | sync "sync" 14 | unsafe "unsafe" 15 | ) 16 | 17 | const ( 18 | // Verify that this generated code is sufficiently up-to-date. 19 | _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) 20 | // Verify that runtime/protoimpl is sufficiently up-to-date. 21 | _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) 22 | ) 23 | 24 | type ErrorMessage struct { 25 | state protoimpl.MessageState `protogen:"open.v1"` 26 | Id *int32 `protobuf:"varint,1,opt,name=id,proto3,oneof" json:"id,omitempty"` 27 | ErrorTime *int64 `protobuf:"varint,2,opt,name=errorTime,proto3,oneof" json:"errorTime,omitempty"` 28 | ErrorCode *int32 `protobuf:"varint,3,opt,name=errorCode,proto3,oneof" json:"errorCode,omitempty"` 29 | ErrorMsg *string `protobuf:"bytes,4,opt,name=errorMsg,proto3,oneof" json:"errorMsg,omitempty"` 30 | AdvancedOrderRejectJson *string `protobuf:"bytes,5,opt,name=advancedOrderRejectJson,proto3,oneof" json:"advancedOrderRejectJson,omitempty"` 31 | unknownFields protoimpl.UnknownFields 32 | sizeCache protoimpl.SizeCache 33 | } 34 | 35 | func (x *ErrorMessage) Reset() { 36 | *x = ErrorMessage{} 37 | mi := &file_ErrorMessage_proto_msgTypes[0] 38 | ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) 39 | ms.StoreMessageInfo(mi) 40 | } 41 | 42 | func (x *ErrorMessage) String() string { 43 | return protoimpl.X.MessageStringOf(x) 44 | } 45 | 46 | func (*ErrorMessage) ProtoMessage() {} 47 | 48 | func (x *ErrorMessage) ProtoReflect() protoreflect.Message { 49 | mi := &file_ErrorMessage_proto_msgTypes[0] 50 | if x != nil { 51 | ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) 52 | if ms.LoadMessageInfo() == nil { 53 | ms.StoreMessageInfo(mi) 54 | } 55 | return ms 56 | } 57 | return mi.MessageOf(x) 58 | } 59 | 60 | // Deprecated: Use ErrorMessage.ProtoReflect.Descriptor instead. 61 | func (*ErrorMessage) Descriptor() ([]byte, []int) { 62 | return file_ErrorMessage_proto_rawDescGZIP(), []int{0} 63 | } 64 | 65 | func (x *ErrorMessage) GetId() int32 { 66 | if x != nil && x.Id != nil { 67 | return *x.Id 68 | } 69 | return 0 70 | } 71 | 72 | func (x *ErrorMessage) GetErrorTime() int64 { 73 | if x != nil && x.ErrorTime != nil { 74 | return *x.ErrorTime 75 | } 76 | return 0 77 | } 78 | 79 | func (x *ErrorMessage) GetErrorCode() int32 { 80 | if x != nil && x.ErrorCode != nil { 81 | return *x.ErrorCode 82 | } 83 | return 0 84 | } 85 | 86 | func (x *ErrorMessage) GetErrorMsg() string { 87 | if x != nil && x.ErrorMsg != nil { 88 | return *x.ErrorMsg 89 | } 90 | return "" 91 | } 92 | 93 | func (x *ErrorMessage) GetAdvancedOrderRejectJson() string { 94 | if x != nil && x.AdvancedOrderRejectJson != nil { 95 | return *x.AdvancedOrderRejectJson 96 | } 97 | return "" 98 | } 99 | 100 | var File_ErrorMessage_proto protoreflect.FileDescriptor 101 | 102 | var file_ErrorMessage_proto_rawDesc = string([]byte{ 103 | 0x0a, 0x12, 0x45, 0x72, 0x72, 0x6f, 0x72, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x2e, 0x70, 104 | 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x08, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x22, 0x95, 105 | 0x02, 0x0a, 0x0c, 0x45, 0x72, 0x72, 0x6f, 0x72, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x12, 106 | 0x13, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x48, 0x00, 0x52, 0x02, 0x69, 107 | 0x64, 0x88, 0x01, 0x01, 0x12, 0x21, 0x0a, 0x09, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x54, 0x69, 0x6d, 108 | 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x03, 0x48, 0x01, 0x52, 0x09, 0x65, 0x72, 0x72, 0x6f, 0x72, 109 | 0x54, 0x69, 0x6d, 0x65, 0x88, 0x01, 0x01, 0x12, 0x21, 0x0a, 0x09, 0x65, 0x72, 0x72, 0x6f, 0x72, 110 | 0x43, 0x6f, 0x64, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x05, 0x48, 0x02, 0x52, 0x09, 0x65, 0x72, 111 | 0x72, 0x6f, 0x72, 0x43, 0x6f, 0x64, 0x65, 0x88, 0x01, 0x01, 0x12, 0x1f, 0x0a, 0x08, 0x65, 0x72, 112 | 0x72, 0x6f, 0x72, 0x4d, 0x73, 0x67, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x48, 0x03, 0x52, 0x08, 113 | 0x65, 0x72, 0x72, 0x6f, 0x72, 0x4d, 0x73, 0x67, 0x88, 0x01, 0x01, 0x12, 0x3d, 0x0a, 0x17, 0x61, 114 | 0x64, 0x76, 0x61, 0x6e, 0x63, 0x65, 0x64, 0x4f, 0x72, 0x64, 0x65, 0x72, 0x52, 0x65, 0x6a, 0x65, 115 | 0x63, 0x74, 0x4a, 0x73, 0x6f, 0x6e, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x48, 0x04, 0x52, 0x17, 116 | 0x61, 0x64, 0x76, 0x61, 0x6e, 0x63, 0x65, 0x64, 0x4f, 0x72, 0x64, 0x65, 0x72, 0x52, 0x65, 0x6a, 117 | 0x65, 0x63, 0x74, 0x4a, 0x73, 0x6f, 0x6e, 0x88, 0x01, 0x01, 0x42, 0x05, 0x0a, 0x03, 0x5f, 0x69, 118 | 0x64, 0x42, 0x0c, 0x0a, 0x0a, 0x5f, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x54, 0x69, 0x6d, 0x65, 0x42, 119 | 0x0c, 0x0a, 0x0a, 0x5f, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x43, 0x6f, 0x64, 0x65, 0x42, 0x0b, 0x0a, 120 | 0x09, 0x5f, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x4d, 0x73, 0x67, 0x42, 0x1a, 0x0a, 0x18, 0x5f, 0x61, 121 | 0x64, 0x76, 0x61, 0x6e, 0x63, 0x65, 0x64, 0x4f, 0x72, 0x64, 0x65, 0x72, 0x52, 0x65, 0x6a, 0x65, 122 | 0x63, 0x74, 0x4a, 0x73, 0x6f, 0x6e, 0x42, 0x0c, 0x5a, 0x0a, 0x2e, 0x3b, 0x70, 0x72, 0x6f, 0x74, 123 | 0x6f, 0x62, 0x75, 0x66, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, 124 | }) 125 | 126 | var ( 127 | file_ErrorMessage_proto_rawDescOnce sync.Once 128 | file_ErrorMessage_proto_rawDescData []byte 129 | ) 130 | 131 | func file_ErrorMessage_proto_rawDescGZIP() []byte { 132 | file_ErrorMessage_proto_rawDescOnce.Do(func() { 133 | file_ErrorMessage_proto_rawDescData = protoimpl.X.CompressGZIP(unsafe.Slice(unsafe.StringData(file_ErrorMessage_proto_rawDesc), len(file_ErrorMessage_proto_rawDesc))) 134 | }) 135 | return file_ErrorMessage_proto_rawDescData 136 | } 137 | 138 | var file_ErrorMessage_proto_msgTypes = make([]protoimpl.MessageInfo, 1) 139 | var file_ErrorMessage_proto_goTypes = []any{ 140 | (*ErrorMessage)(nil), // 0: protobuf.ErrorMessage 141 | } 142 | var file_ErrorMessage_proto_depIdxs = []int32{ 143 | 0, // [0:0] is the sub-list for method output_type 144 | 0, // [0:0] is the sub-list for method input_type 145 | 0, // [0:0] is the sub-list for extension type_name 146 | 0, // [0:0] is the sub-list for extension extendee 147 | 0, // [0:0] is the sub-list for field type_name 148 | } 149 | 150 | func init() { file_ErrorMessage_proto_init() } 151 | func file_ErrorMessage_proto_init() { 152 | if File_ErrorMessage_proto != nil { 153 | return 154 | } 155 | file_ErrorMessage_proto_msgTypes[0].OneofWrappers = []any{} 156 | type x struct{} 157 | out := protoimpl.TypeBuilder{ 158 | File: protoimpl.DescBuilder{ 159 | GoPackagePath: reflect.TypeOf(x{}).PkgPath(), 160 | RawDescriptor: unsafe.Slice(unsafe.StringData(file_ErrorMessage_proto_rawDesc), len(file_ErrorMessage_proto_rawDesc)), 161 | NumEnums: 0, 162 | NumMessages: 1, 163 | NumExtensions: 0, 164 | NumServices: 0, 165 | }, 166 | GoTypes: file_ErrorMessage_proto_goTypes, 167 | DependencyIndexes: file_ErrorMessage_proto_depIdxs, 168 | MessageInfos: file_ErrorMessage_proto_msgTypes, 169 | }.Build() 170 | File_ErrorMessage_proto = out.File 171 | file_ErrorMessage_proto_goTypes = nil 172 | file_ErrorMessage_proto_depIdxs = nil 173 | } 174 | -------------------------------------------------------------------------------- /protobuf/ExecutionDetails.pb.go: -------------------------------------------------------------------------------- 1 | // Code generated by protoc-gen-go. DO NOT EDIT. 2 | // versions: 3 | // protoc-gen-go v1.36.5 4 | // protoc v3.12.4 5 | // source: ExecutionDetails.proto 6 | 7 | package protobuf 8 | 9 | import ( 10 | protoreflect "google.golang.org/protobuf/reflect/protoreflect" 11 | protoimpl "google.golang.org/protobuf/runtime/protoimpl" 12 | reflect "reflect" 13 | sync "sync" 14 | unsafe "unsafe" 15 | ) 16 | 17 | const ( 18 | // Verify that this generated code is sufficiently up-to-date. 19 | _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) 20 | // Verify that runtime/protoimpl is sufficiently up-to-date. 21 | _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) 22 | ) 23 | 24 | type ExecutionDetails struct { 25 | state protoimpl.MessageState `protogen:"open.v1"` 26 | ReqId *int32 `protobuf:"varint,1,opt,name=reqId,proto3,oneof" json:"reqId,omitempty"` 27 | Contract *Contract `protobuf:"bytes,2,opt,name=contract,proto3,oneof" json:"contract,omitempty"` 28 | Execution *Execution `protobuf:"bytes,3,opt,name=execution,proto3,oneof" json:"execution,omitempty"` 29 | unknownFields protoimpl.UnknownFields 30 | sizeCache protoimpl.SizeCache 31 | } 32 | 33 | func (x *ExecutionDetails) Reset() { 34 | *x = ExecutionDetails{} 35 | mi := &file_ExecutionDetails_proto_msgTypes[0] 36 | ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) 37 | ms.StoreMessageInfo(mi) 38 | } 39 | 40 | func (x *ExecutionDetails) String() string { 41 | return protoimpl.X.MessageStringOf(x) 42 | } 43 | 44 | func (*ExecutionDetails) ProtoMessage() {} 45 | 46 | func (x *ExecutionDetails) ProtoReflect() protoreflect.Message { 47 | mi := &file_ExecutionDetails_proto_msgTypes[0] 48 | if x != nil { 49 | ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) 50 | if ms.LoadMessageInfo() == nil { 51 | ms.StoreMessageInfo(mi) 52 | } 53 | return ms 54 | } 55 | return mi.MessageOf(x) 56 | } 57 | 58 | // Deprecated: Use ExecutionDetails.ProtoReflect.Descriptor instead. 59 | func (*ExecutionDetails) Descriptor() ([]byte, []int) { 60 | return file_ExecutionDetails_proto_rawDescGZIP(), []int{0} 61 | } 62 | 63 | func (x *ExecutionDetails) GetReqId() int32 { 64 | if x != nil && x.ReqId != nil { 65 | return *x.ReqId 66 | } 67 | return 0 68 | } 69 | 70 | func (x *ExecutionDetails) GetContract() *Contract { 71 | if x != nil { 72 | return x.Contract 73 | } 74 | return nil 75 | } 76 | 77 | func (x *ExecutionDetails) GetExecution() *Execution { 78 | if x != nil { 79 | return x.Execution 80 | } 81 | return nil 82 | } 83 | 84 | var File_ExecutionDetails_proto protoreflect.FileDescriptor 85 | 86 | var file_ExecutionDetails_proto_rawDesc = string([]byte{ 87 | 0x0a, 0x16, 0x45, 0x78, 0x65, 0x63, 0x75, 0x74, 0x69, 0x6f, 0x6e, 0x44, 0x65, 0x74, 0x61, 0x69, 88 | 0x6c, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x08, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 89 | 0x75, 0x66, 0x1a, 0x0e, 0x43, 0x6f, 0x6e, 0x74, 0x72, 0x61, 0x63, 0x74, 0x2e, 0x70, 0x72, 0x6f, 90 | 0x74, 0x6f, 0x1a, 0x0f, 0x45, 0x78, 0x65, 0x63, 0x75, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x70, 0x72, 91 | 0x6f, 0x74, 0x6f, 0x22, 0xbf, 0x01, 0x0a, 0x10, 0x45, 0x78, 0x65, 0x63, 0x75, 0x74, 0x69, 0x6f, 92 | 0x6e, 0x44, 0x65, 0x74, 0x61, 0x69, 0x6c, 0x73, 0x12, 0x19, 0x0a, 0x05, 0x72, 0x65, 0x71, 0x49, 93 | 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x48, 0x00, 0x52, 0x05, 0x72, 0x65, 0x71, 0x49, 0x64, 94 | 0x88, 0x01, 0x01, 0x12, 0x33, 0x0a, 0x08, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x61, 0x63, 0x74, 0x18, 95 | 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x12, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 96 | 0x2e, 0x43, 0x6f, 0x6e, 0x74, 0x72, 0x61, 0x63, 0x74, 0x48, 0x01, 0x52, 0x08, 0x63, 0x6f, 0x6e, 97 | 0x74, 0x72, 0x61, 0x63, 0x74, 0x88, 0x01, 0x01, 0x12, 0x36, 0x0a, 0x09, 0x65, 0x78, 0x65, 0x63, 98 | 0x75, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x13, 0x2e, 0x70, 0x72, 99 | 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45, 0x78, 0x65, 0x63, 0x75, 0x74, 0x69, 0x6f, 0x6e, 100 | 0x48, 0x02, 0x52, 0x09, 0x65, 0x78, 0x65, 0x63, 0x75, 0x74, 0x69, 0x6f, 0x6e, 0x88, 0x01, 0x01, 101 | 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x72, 0x65, 0x71, 0x49, 0x64, 0x42, 0x0b, 0x0a, 0x09, 0x5f, 0x63, 102 | 0x6f, 0x6e, 0x74, 0x72, 0x61, 0x63, 0x74, 0x42, 0x0c, 0x0a, 0x0a, 0x5f, 0x65, 0x78, 0x65, 0x63, 103 | 0x75, 0x74, 0x69, 0x6f, 0x6e, 0x42, 0x0c, 0x5a, 0x0a, 0x2e, 0x3b, 0x70, 0x72, 0x6f, 0x74, 0x6f, 104 | 0x62, 0x75, 0x66, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, 105 | }) 106 | 107 | var ( 108 | file_ExecutionDetails_proto_rawDescOnce sync.Once 109 | file_ExecutionDetails_proto_rawDescData []byte 110 | ) 111 | 112 | func file_ExecutionDetails_proto_rawDescGZIP() []byte { 113 | file_ExecutionDetails_proto_rawDescOnce.Do(func() { 114 | file_ExecutionDetails_proto_rawDescData = protoimpl.X.CompressGZIP(unsafe.Slice(unsafe.StringData(file_ExecutionDetails_proto_rawDesc), len(file_ExecutionDetails_proto_rawDesc))) 115 | }) 116 | return file_ExecutionDetails_proto_rawDescData 117 | } 118 | 119 | var file_ExecutionDetails_proto_msgTypes = make([]protoimpl.MessageInfo, 1) 120 | var file_ExecutionDetails_proto_goTypes = []any{ 121 | (*ExecutionDetails)(nil), // 0: protobuf.ExecutionDetails 122 | (*Contract)(nil), // 1: protobuf.Contract 123 | (*Execution)(nil), // 2: protobuf.Execution 124 | } 125 | var file_ExecutionDetails_proto_depIdxs = []int32{ 126 | 1, // 0: protobuf.ExecutionDetails.contract:type_name -> protobuf.Contract 127 | 2, // 1: protobuf.ExecutionDetails.execution:type_name -> protobuf.Execution 128 | 2, // [2:2] is the sub-list for method output_type 129 | 2, // [2:2] is the sub-list for method input_type 130 | 2, // [2:2] is the sub-list for extension type_name 131 | 2, // [2:2] is the sub-list for extension extendee 132 | 0, // [0:2] is the sub-list for field type_name 133 | } 134 | 135 | func init() { file_ExecutionDetails_proto_init() } 136 | func file_ExecutionDetails_proto_init() { 137 | if File_ExecutionDetails_proto != nil { 138 | return 139 | } 140 | file_Contract_proto_init() 141 | file_Execution_proto_init() 142 | file_ExecutionDetails_proto_msgTypes[0].OneofWrappers = []any{} 143 | type x struct{} 144 | out := protoimpl.TypeBuilder{ 145 | File: protoimpl.DescBuilder{ 146 | GoPackagePath: reflect.TypeOf(x{}).PkgPath(), 147 | RawDescriptor: unsafe.Slice(unsafe.StringData(file_ExecutionDetails_proto_rawDesc), len(file_ExecutionDetails_proto_rawDesc)), 148 | NumEnums: 0, 149 | NumMessages: 1, 150 | NumExtensions: 0, 151 | NumServices: 0, 152 | }, 153 | GoTypes: file_ExecutionDetails_proto_goTypes, 154 | DependencyIndexes: file_ExecutionDetails_proto_depIdxs, 155 | MessageInfos: file_ExecutionDetails_proto_msgTypes, 156 | }.Build() 157 | File_ExecutionDetails_proto = out.File 158 | file_ExecutionDetails_proto_goTypes = nil 159 | file_ExecutionDetails_proto_depIdxs = nil 160 | } 161 | -------------------------------------------------------------------------------- /protobuf/ExecutionDetailsEnd.pb.go: -------------------------------------------------------------------------------- 1 | // Code generated by protoc-gen-go. DO NOT EDIT. 2 | // versions: 3 | // protoc-gen-go v1.36.5 4 | // protoc v3.12.4 5 | // source: ExecutionDetailsEnd.proto 6 | 7 | package protobuf 8 | 9 | import ( 10 | protoreflect "google.golang.org/protobuf/reflect/protoreflect" 11 | protoimpl "google.golang.org/protobuf/runtime/protoimpl" 12 | reflect "reflect" 13 | sync "sync" 14 | unsafe "unsafe" 15 | ) 16 | 17 | const ( 18 | // Verify that this generated code is sufficiently up-to-date. 19 | _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) 20 | // Verify that runtime/protoimpl is sufficiently up-to-date. 21 | _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) 22 | ) 23 | 24 | type ExecutionDetailsEnd struct { 25 | state protoimpl.MessageState `protogen:"open.v1"` 26 | ReqId *int32 `protobuf:"varint,1,opt,name=reqId,proto3,oneof" json:"reqId,omitempty"` 27 | unknownFields protoimpl.UnknownFields 28 | sizeCache protoimpl.SizeCache 29 | } 30 | 31 | func (x *ExecutionDetailsEnd) Reset() { 32 | *x = ExecutionDetailsEnd{} 33 | mi := &file_ExecutionDetailsEnd_proto_msgTypes[0] 34 | ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) 35 | ms.StoreMessageInfo(mi) 36 | } 37 | 38 | func (x *ExecutionDetailsEnd) String() string { 39 | return protoimpl.X.MessageStringOf(x) 40 | } 41 | 42 | func (*ExecutionDetailsEnd) ProtoMessage() {} 43 | 44 | func (x *ExecutionDetailsEnd) ProtoReflect() protoreflect.Message { 45 | mi := &file_ExecutionDetailsEnd_proto_msgTypes[0] 46 | if x != nil { 47 | ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) 48 | if ms.LoadMessageInfo() == nil { 49 | ms.StoreMessageInfo(mi) 50 | } 51 | return ms 52 | } 53 | return mi.MessageOf(x) 54 | } 55 | 56 | // Deprecated: Use ExecutionDetailsEnd.ProtoReflect.Descriptor instead. 57 | func (*ExecutionDetailsEnd) Descriptor() ([]byte, []int) { 58 | return file_ExecutionDetailsEnd_proto_rawDescGZIP(), []int{0} 59 | } 60 | 61 | func (x *ExecutionDetailsEnd) GetReqId() int32 { 62 | if x != nil && x.ReqId != nil { 63 | return *x.ReqId 64 | } 65 | return 0 66 | } 67 | 68 | var File_ExecutionDetailsEnd_proto protoreflect.FileDescriptor 69 | 70 | var file_ExecutionDetailsEnd_proto_rawDesc = string([]byte{ 71 | 0x0a, 0x19, 0x45, 0x78, 0x65, 0x63, 0x75, 0x74, 0x69, 0x6f, 0x6e, 0x44, 0x65, 0x74, 0x61, 0x69, 72 | 0x6c, 0x73, 0x45, 0x6e, 0x64, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x08, 0x70, 0x72, 0x6f, 73 | 0x74, 0x6f, 0x62, 0x75, 0x66, 0x22, 0x3a, 0x0a, 0x13, 0x45, 0x78, 0x65, 0x63, 0x75, 0x74, 0x69, 74 | 0x6f, 0x6e, 0x44, 0x65, 0x74, 0x61, 0x69, 0x6c, 0x73, 0x45, 0x6e, 0x64, 0x12, 0x19, 0x0a, 0x05, 75 | 0x72, 0x65, 0x71, 0x49, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x48, 0x00, 0x52, 0x05, 0x72, 76 | 0x65, 0x71, 0x49, 0x64, 0x88, 0x01, 0x01, 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x72, 0x65, 0x71, 0x49, 77 | 0x64, 0x42, 0x0c, 0x5a, 0x0a, 0x2e, 0x3b, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x62, 78 | 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, 79 | }) 80 | 81 | var ( 82 | file_ExecutionDetailsEnd_proto_rawDescOnce sync.Once 83 | file_ExecutionDetailsEnd_proto_rawDescData []byte 84 | ) 85 | 86 | func file_ExecutionDetailsEnd_proto_rawDescGZIP() []byte { 87 | file_ExecutionDetailsEnd_proto_rawDescOnce.Do(func() { 88 | file_ExecutionDetailsEnd_proto_rawDescData = protoimpl.X.CompressGZIP(unsafe.Slice(unsafe.StringData(file_ExecutionDetailsEnd_proto_rawDesc), len(file_ExecutionDetailsEnd_proto_rawDesc))) 89 | }) 90 | return file_ExecutionDetailsEnd_proto_rawDescData 91 | } 92 | 93 | var file_ExecutionDetailsEnd_proto_msgTypes = make([]protoimpl.MessageInfo, 1) 94 | var file_ExecutionDetailsEnd_proto_goTypes = []any{ 95 | (*ExecutionDetailsEnd)(nil), // 0: protobuf.ExecutionDetailsEnd 96 | } 97 | var file_ExecutionDetailsEnd_proto_depIdxs = []int32{ 98 | 0, // [0:0] is the sub-list for method output_type 99 | 0, // [0:0] is the sub-list for method input_type 100 | 0, // [0:0] is the sub-list for extension type_name 101 | 0, // [0:0] is the sub-list for extension extendee 102 | 0, // [0:0] is the sub-list for field type_name 103 | } 104 | 105 | func init() { file_ExecutionDetailsEnd_proto_init() } 106 | func file_ExecutionDetailsEnd_proto_init() { 107 | if File_ExecutionDetailsEnd_proto != nil { 108 | return 109 | } 110 | file_ExecutionDetailsEnd_proto_msgTypes[0].OneofWrappers = []any{} 111 | type x struct{} 112 | out := protoimpl.TypeBuilder{ 113 | File: protoimpl.DescBuilder{ 114 | GoPackagePath: reflect.TypeOf(x{}).PkgPath(), 115 | RawDescriptor: unsafe.Slice(unsafe.StringData(file_ExecutionDetailsEnd_proto_rawDesc), len(file_ExecutionDetailsEnd_proto_rawDesc)), 116 | NumEnums: 0, 117 | NumMessages: 1, 118 | NumExtensions: 0, 119 | NumServices: 0, 120 | }, 121 | GoTypes: file_ExecutionDetailsEnd_proto_goTypes, 122 | DependencyIndexes: file_ExecutionDetailsEnd_proto_depIdxs, 123 | MessageInfos: file_ExecutionDetailsEnd_proto_msgTypes, 124 | }.Build() 125 | File_ExecutionDetailsEnd_proto = out.File 126 | file_ExecutionDetailsEnd_proto_goTypes = nil 127 | file_ExecutionDetailsEnd_proto_depIdxs = nil 128 | } 129 | -------------------------------------------------------------------------------- /protobuf/ExecutionFilter.pb.go: -------------------------------------------------------------------------------- 1 | // Code generated by protoc-gen-go. DO NOT EDIT. 2 | // versions: 3 | // protoc-gen-go v1.36.5 4 | // protoc v3.12.4 5 | // source: ExecutionFilter.proto 6 | 7 | package protobuf 8 | 9 | import ( 10 | protoreflect "google.golang.org/protobuf/reflect/protoreflect" 11 | protoimpl "google.golang.org/protobuf/runtime/protoimpl" 12 | reflect "reflect" 13 | sync "sync" 14 | unsafe "unsafe" 15 | ) 16 | 17 | const ( 18 | // Verify that this generated code is sufficiently up-to-date. 19 | _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) 20 | // Verify that runtime/protoimpl is sufficiently up-to-date. 21 | _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) 22 | ) 23 | 24 | type ExecutionFilter struct { 25 | state protoimpl.MessageState `protogen:"open.v1"` 26 | ClientId *int32 `protobuf:"varint,1,opt,name=clientId,proto3,oneof" json:"clientId,omitempty"` 27 | AcctCode *string `protobuf:"bytes,2,opt,name=acctCode,proto3,oneof" json:"acctCode,omitempty"` 28 | Time *string `protobuf:"bytes,3,opt,name=time,proto3,oneof" json:"time,omitempty"` 29 | Symbol *string `protobuf:"bytes,4,opt,name=symbol,proto3,oneof" json:"symbol,omitempty"` 30 | SecType *string `protobuf:"bytes,5,opt,name=secType,proto3,oneof" json:"secType,omitempty"` 31 | Exchange *string `protobuf:"bytes,6,opt,name=exchange,proto3,oneof" json:"exchange,omitempty"` 32 | Side *string `protobuf:"bytes,7,opt,name=side,proto3,oneof" json:"side,omitempty"` 33 | LastNDays *int32 `protobuf:"varint,8,opt,name=lastNDays,proto3,oneof" json:"lastNDays,omitempty"` 34 | SpecificDates []int32 `protobuf:"varint,9,rep,packed,name=specificDates,proto3" json:"specificDates,omitempty"` 35 | unknownFields protoimpl.UnknownFields 36 | sizeCache protoimpl.SizeCache 37 | } 38 | 39 | func (x *ExecutionFilter) Reset() { 40 | *x = ExecutionFilter{} 41 | mi := &file_ExecutionFilter_proto_msgTypes[0] 42 | ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) 43 | ms.StoreMessageInfo(mi) 44 | } 45 | 46 | func (x *ExecutionFilter) String() string { 47 | return protoimpl.X.MessageStringOf(x) 48 | } 49 | 50 | func (*ExecutionFilter) ProtoMessage() {} 51 | 52 | func (x *ExecutionFilter) ProtoReflect() protoreflect.Message { 53 | mi := &file_ExecutionFilter_proto_msgTypes[0] 54 | if x != nil { 55 | ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) 56 | if ms.LoadMessageInfo() == nil { 57 | ms.StoreMessageInfo(mi) 58 | } 59 | return ms 60 | } 61 | return mi.MessageOf(x) 62 | } 63 | 64 | // Deprecated: Use ExecutionFilter.ProtoReflect.Descriptor instead. 65 | func (*ExecutionFilter) Descriptor() ([]byte, []int) { 66 | return file_ExecutionFilter_proto_rawDescGZIP(), []int{0} 67 | } 68 | 69 | func (x *ExecutionFilter) GetClientId() int32 { 70 | if x != nil && x.ClientId != nil { 71 | return *x.ClientId 72 | } 73 | return 0 74 | } 75 | 76 | func (x *ExecutionFilter) GetAcctCode() string { 77 | if x != nil && x.AcctCode != nil { 78 | return *x.AcctCode 79 | } 80 | return "" 81 | } 82 | 83 | func (x *ExecutionFilter) GetTime() string { 84 | if x != nil && x.Time != nil { 85 | return *x.Time 86 | } 87 | return "" 88 | } 89 | 90 | func (x *ExecutionFilter) GetSymbol() string { 91 | if x != nil && x.Symbol != nil { 92 | return *x.Symbol 93 | } 94 | return "" 95 | } 96 | 97 | func (x *ExecutionFilter) GetSecType() string { 98 | if x != nil && x.SecType != nil { 99 | return *x.SecType 100 | } 101 | return "" 102 | } 103 | 104 | func (x *ExecutionFilter) GetExchange() string { 105 | if x != nil && x.Exchange != nil { 106 | return *x.Exchange 107 | } 108 | return "" 109 | } 110 | 111 | func (x *ExecutionFilter) GetSide() string { 112 | if x != nil && x.Side != nil { 113 | return *x.Side 114 | } 115 | return "" 116 | } 117 | 118 | func (x *ExecutionFilter) GetLastNDays() int32 { 119 | if x != nil && x.LastNDays != nil { 120 | return *x.LastNDays 121 | } 122 | return 0 123 | } 124 | 125 | func (x *ExecutionFilter) GetSpecificDates() []int32 { 126 | if x != nil { 127 | return x.SpecificDates 128 | } 129 | return nil 130 | } 131 | 132 | var File_ExecutionFilter_proto protoreflect.FileDescriptor 133 | 134 | var file_ExecutionFilter_proto_rawDesc = string([]byte{ 135 | 0x0a, 0x15, 0x45, 0x78, 0x65, 0x63, 0x75, 0x74, 0x69, 0x6f, 0x6e, 0x46, 0x69, 0x6c, 0x74, 0x65, 136 | 0x72, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x08, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 137 | 0x66, 0x22, 0x89, 0x03, 0x0a, 0x0f, 0x45, 0x78, 0x65, 0x63, 0x75, 0x74, 0x69, 0x6f, 0x6e, 0x46, 138 | 0x69, 0x6c, 0x74, 0x65, 0x72, 0x12, 0x1f, 0x0a, 0x08, 0x63, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x49, 139 | 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x48, 0x00, 0x52, 0x08, 0x63, 0x6c, 0x69, 0x65, 0x6e, 140 | 0x74, 0x49, 0x64, 0x88, 0x01, 0x01, 0x12, 0x1f, 0x0a, 0x08, 0x61, 0x63, 0x63, 0x74, 0x43, 0x6f, 141 | 0x64, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x48, 0x01, 0x52, 0x08, 0x61, 0x63, 0x63, 0x74, 142 | 0x43, 0x6f, 0x64, 0x65, 0x88, 0x01, 0x01, 0x12, 0x17, 0x0a, 0x04, 0x74, 0x69, 0x6d, 0x65, 0x18, 143 | 0x03, 0x20, 0x01, 0x28, 0x09, 0x48, 0x02, 0x52, 0x04, 0x74, 0x69, 0x6d, 0x65, 0x88, 0x01, 0x01, 144 | 0x12, 0x1b, 0x0a, 0x06, 0x73, 0x79, 0x6d, 0x62, 0x6f, 0x6c, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 145 | 0x48, 0x03, 0x52, 0x06, 0x73, 0x79, 0x6d, 0x62, 0x6f, 0x6c, 0x88, 0x01, 0x01, 0x12, 0x1d, 0x0a, 146 | 0x07, 0x73, 0x65, 0x63, 0x54, 0x79, 0x70, 0x65, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x48, 0x04, 147 | 0x52, 0x07, 0x73, 0x65, 0x63, 0x54, 0x79, 0x70, 0x65, 0x88, 0x01, 0x01, 0x12, 0x1f, 0x0a, 0x08, 148 | 0x65, 0x78, 0x63, 0x68, 0x61, 0x6e, 0x67, 0x65, 0x18, 0x06, 0x20, 0x01, 0x28, 0x09, 0x48, 0x05, 149 | 0x52, 0x08, 0x65, 0x78, 0x63, 0x68, 0x61, 0x6e, 0x67, 0x65, 0x88, 0x01, 0x01, 0x12, 0x17, 0x0a, 150 | 0x04, 0x73, 0x69, 0x64, 0x65, 0x18, 0x07, 0x20, 0x01, 0x28, 0x09, 0x48, 0x06, 0x52, 0x04, 0x73, 151 | 0x69, 0x64, 0x65, 0x88, 0x01, 0x01, 0x12, 0x21, 0x0a, 0x09, 0x6c, 0x61, 0x73, 0x74, 0x4e, 0x44, 152 | 0x61, 0x79, 0x73, 0x18, 0x08, 0x20, 0x01, 0x28, 0x05, 0x48, 0x07, 0x52, 0x09, 0x6c, 0x61, 0x73, 153 | 0x74, 0x4e, 0x44, 0x61, 0x79, 0x73, 0x88, 0x01, 0x01, 0x12, 0x24, 0x0a, 0x0d, 0x73, 0x70, 0x65, 154 | 0x63, 0x69, 0x66, 0x69, 0x63, 0x44, 0x61, 0x74, 0x65, 0x73, 0x18, 0x09, 0x20, 0x03, 0x28, 0x05, 155 | 0x52, 0x0d, 0x73, 0x70, 0x65, 0x63, 0x69, 0x66, 0x69, 0x63, 0x44, 0x61, 0x74, 0x65, 0x73, 0x42, 156 | 0x0b, 0x0a, 0x09, 0x5f, 0x63, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x49, 0x64, 0x42, 0x0b, 0x0a, 0x09, 157 | 0x5f, 0x61, 0x63, 0x63, 0x74, 0x43, 0x6f, 0x64, 0x65, 0x42, 0x07, 0x0a, 0x05, 0x5f, 0x74, 0x69, 158 | 0x6d, 0x65, 0x42, 0x09, 0x0a, 0x07, 0x5f, 0x73, 0x79, 0x6d, 0x62, 0x6f, 0x6c, 0x42, 0x0a, 0x0a, 159 | 0x08, 0x5f, 0x73, 0x65, 0x63, 0x54, 0x79, 0x70, 0x65, 0x42, 0x0b, 0x0a, 0x09, 0x5f, 0x65, 0x78, 160 | 0x63, 0x68, 0x61, 0x6e, 0x67, 0x65, 0x42, 0x07, 0x0a, 0x05, 0x5f, 0x73, 0x69, 0x64, 0x65, 0x42, 161 | 0x0c, 0x0a, 0x0a, 0x5f, 0x6c, 0x61, 0x73, 0x74, 0x4e, 0x44, 0x61, 0x79, 0x73, 0x42, 0x0c, 0x5a, 162 | 0x0a, 0x2e, 0x3b, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x62, 0x06, 0x70, 0x72, 0x6f, 163 | 0x74, 0x6f, 0x33, 164 | }) 165 | 166 | var ( 167 | file_ExecutionFilter_proto_rawDescOnce sync.Once 168 | file_ExecutionFilter_proto_rawDescData []byte 169 | ) 170 | 171 | func file_ExecutionFilter_proto_rawDescGZIP() []byte { 172 | file_ExecutionFilter_proto_rawDescOnce.Do(func() { 173 | file_ExecutionFilter_proto_rawDescData = protoimpl.X.CompressGZIP(unsafe.Slice(unsafe.StringData(file_ExecutionFilter_proto_rawDesc), len(file_ExecutionFilter_proto_rawDesc))) 174 | }) 175 | return file_ExecutionFilter_proto_rawDescData 176 | } 177 | 178 | var file_ExecutionFilter_proto_msgTypes = make([]protoimpl.MessageInfo, 1) 179 | var file_ExecutionFilter_proto_goTypes = []any{ 180 | (*ExecutionFilter)(nil), // 0: protobuf.ExecutionFilter 181 | } 182 | var file_ExecutionFilter_proto_depIdxs = []int32{ 183 | 0, // [0:0] is the sub-list for method output_type 184 | 0, // [0:0] is the sub-list for method input_type 185 | 0, // [0:0] is the sub-list for extension type_name 186 | 0, // [0:0] is the sub-list for extension extendee 187 | 0, // [0:0] is the sub-list for field type_name 188 | } 189 | 190 | func init() { file_ExecutionFilter_proto_init() } 191 | func file_ExecutionFilter_proto_init() { 192 | if File_ExecutionFilter_proto != nil { 193 | return 194 | } 195 | file_ExecutionFilter_proto_msgTypes[0].OneofWrappers = []any{} 196 | type x struct{} 197 | out := protoimpl.TypeBuilder{ 198 | File: protoimpl.DescBuilder{ 199 | GoPackagePath: reflect.TypeOf(x{}).PkgPath(), 200 | RawDescriptor: unsafe.Slice(unsafe.StringData(file_ExecutionFilter_proto_rawDesc), len(file_ExecutionFilter_proto_rawDesc)), 201 | NumEnums: 0, 202 | NumMessages: 1, 203 | NumExtensions: 0, 204 | NumServices: 0, 205 | }, 206 | GoTypes: file_ExecutionFilter_proto_goTypes, 207 | DependencyIndexes: file_ExecutionFilter_proto_depIdxs, 208 | MessageInfos: file_ExecutionFilter_proto_msgTypes, 209 | }.Build() 210 | File_ExecutionFilter_proto = out.File 211 | file_ExecutionFilter_proto_goTypes = nil 212 | file_ExecutionFilter_proto_depIdxs = nil 213 | } 214 | -------------------------------------------------------------------------------- /protobuf/ExecutionRequest.pb.go: -------------------------------------------------------------------------------- 1 | // Code generated by protoc-gen-go. DO NOT EDIT. 2 | // versions: 3 | // protoc-gen-go v1.36.5 4 | // protoc v3.12.4 5 | // source: ExecutionRequest.proto 6 | 7 | package protobuf 8 | 9 | import ( 10 | protoreflect "google.golang.org/protobuf/reflect/protoreflect" 11 | protoimpl "google.golang.org/protobuf/runtime/protoimpl" 12 | reflect "reflect" 13 | sync "sync" 14 | unsafe "unsafe" 15 | ) 16 | 17 | const ( 18 | // Verify that this generated code is sufficiently up-to-date. 19 | _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) 20 | // Verify that runtime/protoimpl is sufficiently up-to-date. 21 | _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) 22 | ) 23 | 24 | type ExecutionRequest struct { 25 | state protoimpl.MessageState `protogen:"open.v1"` 26 | ReqId *int32 `protobuf:"varint,1,opt,name=reqId,proto3,oneof" json:"reqId,omitempty"` 27 | ExecutionFilter *ExecutionFilter `protobuf:"bytes,2,opt,name=executionFilter,proto3,oneof" json:"executionFilter,omitempty"` 28 | unknownFields protoimpl.UnknownFields 29 | sizeCache protoimpl.SizeCache 30 | } 31 | 32 | func (x *ExecutionRequest) Reset() { 33 | *x = ExecutionRequest{} 34 | mi := &file_ExecutionRequest_proto_msgTypes[0] 35 | ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) 36 | ms.StoreMessageInfo(mi) 37 | } 38 | 39 | func (x *ExecutionRequest) String() string { 40 | return protoimpl.X.MessageStringOf(x) 41 | } 42 | 43 | func (*ExecutionRequest) ProtoMessage() {} 44 | 45 | func (x *ExecutionRequest) ProtoReflect() protoreflect.Message { 46 | mi := &file_ExecutionRequest_proto_msgTypes[0] 47 | if x != nil { 48 | ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) 49 | if ms.LoadMessageInfo() == nil { 50 | ms.StoreMessageInfo(mi) 51 | } 52 | return ms 53 | } 54 | return mi.MessageOf(x) 55 | } 56 | 57 | // Deprecated: Use ExecutionRequest.ProtoReflect.Descriptor instead. 58 | func (*ExecutionRequest) Descriptor() ([]byte, []int) { 59 | return file_ExecutionRequest_proto_rawDescGZIP(), []int{0} 60 | } 61 | 62 | func (x *ExecutionRequest) GetReqId() int32 { 63 | if x != nil && x.ReqId != nil { 64 | return *x.ReqId 65 | } 66 | return 0 67 | } 68 | 69 | func (x *ExecutionRequest) GetExecutionFilter() *ExecutionFilter { 70 | if x != nil { 71 | return x.ExecutionFilter 72 | } 73 | return nil 74 | } 75 | 76 | var File_ExecutionRequest_proto protoreflect.FileDescriptor 77 | 78 | var file_ExecutionRequest_proto_rawDesc = string([]byte{ 79 | 0x0a, 0x16, 0x45, 0x78, 0x65, 0x63, 0x75, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 80 | 0x73, 0x74, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x08, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 81 | 0x75, 0x66, 0x1a, 0x15, 0x45, 0x78, 0x65, 0x63, 0x75, 0x74, 0x69, 0x6f, 0x6e, 0x46, 0x69, 0x6c, 82 | 0x74, 0x65, 0x72, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x95, 0x01, 0x0a, 0x10, 0x45, 0x78, 83 | 0x65, 0x63, 0x75, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x19, 84 | 0x0a, 0x05, 0x72, 0x65, 0x71, 0x49, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x48, 0x00, 0x52, 85 | 0x05, 0x72, 0x65, 0x71, 0x49, 0x64, 0x88, 0x01, 0x01, 0x12, 0x48, 0x0a, 0x0f, 0x65, 0x78, 0x65, 86 | 0x63, 0x75, 0x74, 0x69, 0x6f, 0x6e, 0x46, 0x69, 0x6c, 0x74, 0x65, 0x72, 0x18, 0x02, 0x20, 0x01, 87 | 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45, 0x78, 88 | 0x65, 0x63, 0x75, 0x74, 0x69, 0x6f, 0x6e, 0x46, 0x69, 0x6c, 0x74, 0x65, 0x72, 0x48, 0x01, 0x52, 89 | 0x0f, 0x65, 0x78, 0x65, 0x63, 0x75, 0x74, 0x69, 0x6f, 0x6e, 0x46, 0x69, 0x6c, 0x74, 0x65, 0x72, 90 | 0x88, 0x01, 0x01, 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x72, 0x65, 0x71, 0x49, 0x64, 0x42, 0x12, 0x0a, 91 | 0x10, 0x5f, 0x65, 0x78, 0x65, 0x63, 0x75, 0x74, 0x69, 0x6f, 0x6e, 0x46, 0x69, 0x6c, 0x74, 0x65, 92 | 0x72, 0x42, 0x0c, 0x5a, 0x0a, 0x2e, 0x3b, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x62, 93 | 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, 94 | }) 95 | 96 | var ( 97 | file_ExecutionRequest_proto_rawDescOnce sync.Once 98 | file_ExecutionRequest_proto_rawDescData []byte 99 | ) 100 | 101 | func file_ExecutionRequest_proto_rawDescGZIP() []byte { 102 | file_ExecutionRequest_proto_rawDescOnce.Do(func() { 103 | file_ExecutionRequest_proto_rawDescData = protoimpl.X.CompressGZIP(unsafe.Slice(unsafe.StringData(file_ExecutionRequest_proto_rawDesc), len(file_ExecutionRequest_proto_rawDesc))) 104 | }) 105 | return file_ExecutionRequest_proto_rawDescData 106 | } 107 | 108 | var file_ExecutionRequest_proto_msgTypes = make([]protoimpl.MessageInfo, 1) 109 | var file_ExecutionRequest_proto_goTypes = []any{ 110 | (*ExecutionRequest)(nil), // 0: protobuf.ExecutionRequest 111 | (*ExecutionFilter)(nil), // 1: protobuf.ExecutionFilter 112 | } 113 | var file_ExecutionRequest_proto_depIdxs = []int32{ 114 | 1, // 0: protobuf.ExecutionRequest.executionFilter:type_name -> protobuf.ExecutionFilter 115 | 1, // [1:1] is the sub-list for method output_type 116 | 1, // [1:1] is the sub-list for method input_type 117 | 1, // [1:1] is the sub-list for extension type_name 118 | 1, // [1:1] is the sub-list for extension extendee 119 | 0, // [0:1] is the sub-list for field type_name 120 | } 121 | 122 | func init() { file_ExecutionRequest_proto_init() } 123 | func file_ExecutionRequest_proto_init() { 124 | if File_ExecutionRequest_proto != nil { 125 | return 126 | } 127 | file_ExecutionFilter_proto_init() 128 | file_ExecutionRequest_proto_msgTypes[0].OneofWrappers = []any{} 129 | type x struct{} 130 | out := protoimpl.TypeBuilder{ 131 | File: protoimpl.DescBuilder{ 132 | GoPackagePath: reflect.TypeOf(x{}).PkgPath(), 133 | RawDescriptor: unsafe.Slice(unsafe.StringData(file_ExecutionRequest_proto_rawDesc), len(file_ExecutionRequest_proto_rawDesc)), 134 | NumEnums: 0, 135 | NumMessages: 1, 136 | NumExtensions: 0, 137 | NumServices: 0, 138 | }, 139 | GoTypes: file_ExecutionRequest_proto_goTypes, 140 | DependencyIndexes: file_ExecutionRequest_proto_depIdxs, 141 | MessageInfos: file_ExecutionRequest_proto_msgTypes, 142 | }.Build() 143 | File_ExecutionRequest_proto = out.File 144 | file_ExecutionRequest_proto_goTypes = nil 145 | file_ExecutionRequest_proto_depIdxs = nil 146 | } 147 | -------------------------------------------------------------------------------- /protobuf/GlobalCancelRequest.pb.go: -------------------------------------------------------------------------------- 1 | // Code generated by protoc-gen-go. DO NOT EDIT. 2 | // versions: 3 | // protoc-gen-go v1.36.5 4 | // protoc v3.12.4 5 | // source: GlobalCancelRequest.proto 6 | 7 | package protobuf 8 | 9 | import ( 10 | protoreflect "google.golang.org/protobuf/reflect/protoreflect" 11 | protoimpl "google.golang.org/protobuf/runtime/protoimpl" 12 | reflect "reflect" 13 | sync "sync" 14 | unsafe "unsafe" 15 | ) 16 | 17 | const ( 18 | // Verify that this generated code is sufficiently up-to-date. 19 | _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) 20 | // Verify that runtime/protoimpl is sufficiently up-to-date. 21 | _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) 22 | ) 23 | 24 | type GlobalCancelRequest struct { 25 | state protoimpl.MessageState `protogen:"open.v1"` 26 | OrderCancel *OrderCancel `protobuf:"bytes,1,opt,name=orderCancel,proto3,oneof" json:"orderCancel,omitempty"` 27 | unknownFields protoimpl.UnknownFields 28 | sizeCache protoimpl.SizeCache 29 | } 30 | 31 | func (x *GlobalCancelRequest) Reset() { 32 | *x = GlobalCancelRequest{} 33 | mi := &file_GlobalCancelRequest_proto_msgTypes[0] 34 | ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) 35 | ms.StoreMessageInfo(mi) 36 | } 37 | 38 | func (x *GlobalCancelRequest) String() string { 39 | return protoimpl.X.MessageStringOf(x) 40 | } 41 | 42 | func (*GlobalCancelRequest) ProtoMessage() {} 43 | 44 | func (x *GlobalCancelRequest) ProtoReflect() protoreflect.Message { 45 | mi := &file_GlobalCancelRequest_proto_msgTypes[0] 46 | if x != nil { 47 | ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) 48 | if ms.LoadMessageInfo() == nil { 49 | ms.StoreMessageInfo(mi) 50 | } 51 | return ms 52 | } 53 | return mi.MessageOf(x) 54 | } 55 | 56 | // Deprecated: Use GlobalCancelRequest.ProtoReflect.Descriptor instead. 57 | func (*GlobalCancelRequest) Descriptor() ([]byte, []int) { 58 | return file_GlobalCancelRequest_proto_rawDescGZIP(), []int{0} 59 | } 60 | 61 | func (x *GlobalCancelRequest) GetOrderCancel() *OrderCancel { 62 | if x != nil { 63 | return x.OrderCancel 64 | } 65 | return nil 66 | } 67 | 68 | var File_GlobalCancelRequest_proto protoreflect.FileDescriptor 69 | 70 | var file_GlobalCancelRequest_proto_rawDesc = string([]byte{ 71 | 0x0a, 0x19, 0x47, 0x6c, 0x6f, 0x62, 0x61, 0x6c, 0x43, 0x61, 0x6e, 0x63, 0x65, 0x6c, 0x52, 0x65, 72 | 0x71, 0x75, 0x65, 0x73, 0x74, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x08, 0x70, 0x72, 0x6f, 73 | 0x74, 0x6f, 0x62, 0x75, 0x66, 0x1a, 0x11, 0x4f, 0x72, 0x64, 0x65, 0x72, 0x43, 0x61, 0x6e, 0x63, 74 | 0x65, 0x6c, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x63, 0x0a, 0x13, 0x47, 0x6c, 0x6f, 0x62, 75 | 0x61, 0x6c, 0x43, 0x61, 0x6e, 0x63, 0x65, 0x6c, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 76 | 0x3c, 0x0a, 0x0b, 0x6f, 0x72, 0x64, 0x65, 0x72, 0x43, 0x61, 0x6e, 0x63, 0x65, 0x6c, 0x18, 0x01, 77 | 0x20, 0x01, 0x28, 0x0b, 0x32, 0x15, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 78 | 0x4f, 0x72, 0x64, 0x65, 0x72, 0x43, 0x61, 0x6e, 0x63, 0x65, 0x6c, 0x48, 0x00, 0x52, 0x0b, 0x6f, 79 | 0x72, 0x64, 0x65, 0x72, 0x43, 0x61, 0x6e, 0x63, 0x65, 0x6c, 0x88, 0x01, 0x01, 0x42, 0x0e, 0x0a, 80 | 0x0c, 0x5f, 0x6f, 0x72, 0x64, 0x65, 0x72, 0x43, 0x61, 0x6e, 0x63, 0x65, 0x6c, 0x42, 0x0c, 0x5a, 81 | 0x0a, 0x2e, 0x3b, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x62, 0x06, 0x70, 0x72, 0x6f, 82 | 0x74, 0x6f, 0x33, 83 | }) 84 | 85 | var ( 86 | file_GlobalCancelRequest_proto_rawDescOnce sync.Once 87 | file_GlobalCancelRequest_proto_rawDescData []byte 88 | ) 89 | 90 | func file_GlobalCancelRequest_proto_rawDescGZIP() []byte { 91 | file_GlobalCancelRequest_proto_rawDescOnce.Do(func() { 92 | file_GlobalCancelRequest_proto_rawDescData = protoimpl.X.CompressGZIP(unsafe.Slice(unsafe.StringData(file_GlobalCancelRequest_proto_rawDesc), len(file_GlobalCancelRequest_proto_rawDesc))) 93 | }) 94 | return file_GlobalCancelRequest_proto_rawDescData 95 | } 96 | 97 | var file_GlobalCancelRequest_proto_msgTypes = make([]protoimpl.MessageInfo, 1) 98 | var file_GlobalCancelRequest_proto_goTypes = []any{ 99 | (*GlobalCancelRequest)(nil), // 0: protobuf.GlobalCancelRequest 100 | (*OrderCancel)(nil), // 1: protobuf.OrderCancel 101 | } 102 | var file_GlobalCancelRequest_proto_depIdxs = []int32{ 103 | 1, // 0: protobuf.GlobalCancelRequest.orderCancel:type_name -> protobuf.OrderCancel 104 | 1, // [1:1] is the sub-list for method output_type 105 | 1, // [1:1] is the sub-list for method input_type 106 | 1, // [1:1] is the sub-list for extension type_name 107 | 1, // [1:1] is the sub-list for extension extendee 108 | 0, // [0:1] is the sub-list for field type_name 109 | } 110 | 111 | func init() { file_GlobalCancelRequest_proto_init() } 112 | func file_GlobalCancelRequest_proto_init() { 113 | if File_GlobalCancelRequest_proto != nil { 114 | return 115 | } 116 | file_OrderCancel_proto_init() 117 | file_GlobalCancelRequest_proto_msgTypes[0].OneofWrappers = []any{} 118 | type x struct{} 119 | out := protoimpl.TypeBuilder{ 120 | File: protoimpl.DescBuilder{ 121 | GoPackagePath: reflect.TypeOf(x{}).PkgPath(), 122 | RawDescriptor: unsafe.Slice(unsafe.StringData(file_GlobalCancelRequest_proto_rawDesc), len(file_GlobalCancelRequest_proto_rawDesc)), 123 | NumEnums: 0, 124 | NumMessages: 1, 125 | NumExtensions: 0, 126 | NumServices: 0, 127 | }, 128 | GoTypes: file_GlobalCancelRequest_proto_goTypes, 129 | DependencyIndexes: file_GlobalCancelRequest_proto_depIdxs, 130 | MessageInfos: file_GlobalCancelRequest_proto_msgTypes, 131 | }.Build() 132 | File_GlobalCancelRequest_proto = out.File 133 | file_GlobalCancelRequest_proto_goTypes = nil 134 | file_GlobalCancelRequest_proto_depIdxs = nil 135 | } 136 | -------------------------------------------------------------------------------- /protobuf/OpenOrder.pb.go: -------------------------------------------------------------------------------- 1 | // Code generated by protoc-gen-go. DO NOT EDIT. 2 | // versions: 3 | // protoc-gen-go v1.36.5 4 | // protoc v3.12.4 5 | // source: OpenOrder.proto 6 | 7 | package protobuf 8 | 9 | import ( 10 | protoreflect "google.golang.org/protobuf/reflect/protoreflect" 11 | protoimpl "google.golang.org/protobuf/runtime/protoimpl" 12 | reflect "reflect" 13 | sync "sync" 14 | unsafe "unsafe" 15 | ) 16 | 17 | const ( 18 | // Verify that this generated code is sufficiently up-to-date. 19 | _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) 20 | // Verify that runtime/protoimpl is sufficiently up-to-date. 21 | _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) 22 | ) 23 | 24 | type OpenOrder struct { 25 | state protoimpl.MessageState `protogen:"open.v1"` 26 | OrderId *int32 `protobuf:"varint,1,opt,name=orderId,proto3,oneof" json:"orderId,omitempty"` 27 | Contract *Contract `protobuf:"bytes,2,opt,name=contract,proto3,oneof" json:"contract,omitempty"` 28 | Order *Order `protobuf:"bytes,3,opt,name=order,proto3,oneof" json:"order,omitempty"` 29 | OrderState *OrderState `protobuf:"bytes,4,opt,name=orderState,proto3,oneof" json:"orderState,omitempty"` 30 | unknownFields protoimpl.UnknownFields 31 | sizeCache protoimpl.SizeCache 32 | } 33 | 34 | func (x *OpenOrder) Reset() { 35 | *x = OpenOrder{} 36 | mi := &file_OpenOrder_proto_msgTypes[0] 37 | ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) 38 | ms.StoreMessageInfo(mi) 39 | } 40 | 41 | func (x *OpenOrder) String() string { 42 | return protoimpl.X.MessageStringOf(x) 43 | } 44 | 45 | func (*OpenOrder) ProtoMessage() {} 46 | 47 | func (x *OpenOrder) ProtoReflect() protoreflect.Message { 48 | mi := &file_OpenOrder_proto_msgTypes[0] 49 | if x != nil { 50 | ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) 51 | if ms.LoadMessageInfo() == nil { 52 | ms.StoreMessageInfo(mi) 53 | } 54 | return ms 55 | } 56 | return mi.MessageOf(x) 57 | } 58 | 59 | // Deprecated: Use OpenOrder.ProtoReflect.Descriptor instead. 60 | func (*OpenOrder) Descriptor() ([]byte, []int) { 61 | return file_OpenOrder_proto_rawDescGZIP(), []int{0} 62 | } 63 | 64 | func (x *OpenOrder) GetOrderId() int32 { 65 | if x != nil && x.OrderId != nil { 66 | return *x.OrderId 67 | } 68 | return 0 69 | } 70 | 71 | func (x *OpenOrder) GetContract() *Contract { 72 | if x != nil { 73 | return x.Contract 74 | } 75 | return nil 76 | } 77 | 78 | func (x *OpenOrder) GetOrder() *Order { 79 | if x != nil { 80 | return x.Order 81 | } 82 | return nil 83 | } 84 | 85 | func (x *OpenOrder) GetOrderState() *OrderState { 86 | if x != nil { 87 | return x.OrderState 88 | } 89 | return nil 90 | } 91 | 92 | var File_OpenOrder_proto protoreflect.FileDescriptor 93 | 94 | var file_OpenOrder_proto_rawDesc = string([]byte{ 95 | 0x0a, 0x0f, 0x4f, 0x70, 0x65, 0x6e, 0x4f, 0x72, 0x64, 0x65, 0x72, 0x2e, 0x70, 0x72, 0x6f, 0x74, 96 | 0x6f, 0x12, 0x08, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x1a, 0x0e, 0x43, 0x6f, 0x6e, 97 | 0x74, 0x72, 0x61, 0x63, 0x74, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x0b, 0x4f, 0x72, 0x64, 98 | 0x65, 0x72, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x10, 0x4f, 0x72, 0x64, 0x65, 0x72, 0x53, 99 | 0x74, 0x61, 0x74, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0xf8, 0x01, 0x0a, 0x09, 0x4f, 100 | 0x70, 0x65, 0x6e, 0x4f, 0x72, 0x64, 0x65, 0x72, 0x12, 0x1d, 0x0a, 0x07, 0x6f, 0x72, 0x64, 0x65, 101 | 0x72, 0x49, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x48, 0x00, 0x52, 0x07, 0x6f, 0x72, 0x64, 102 | 0x65, 0x72, 0x49, 0x64, 0x88, 0x01, 0x01, 0x12, 0x33, 0x0a, 0x08, 0x63, 0x6f, 0x6e, 0x74, 0x72, 103 | 0x61, 0x63, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x12, 0x2e, 0x70, 0x72, 0x6f, 0x74, 104 | 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x43, 0x6f, 0x6e, 0x74, 0x72, 0x61, 0x63, 0x74, 0x48, 0x01, 0x52, 105 | 0x08, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x61, 0x63, 0x74, 0x88, 0x01, 0x01, 0x12, 0x2a, 0x0a, 0x05, 106 | 0x6f, 0x72, 0x64, 0x65, 0x72, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0f, 0x2e, 0x70, 0x72, 107 | 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x4f, 0x72, 0x64, 0x65, 0x72, 0x48, 0x02, 0x52, 0x05, 108 | 0x6f, 0x72, 0x64, 0x65, 0x72, 0x88, 0x01, 0x01, 0x12, 0x39, 0x0a, 0x0a, 0x6f, 0x72, 0x64, 0x65, 109 | 0x72, 0x53, 0x74, 0x61, 0x74, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x70, 110 | 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x4f, 0x72, 0x64, 0x65, 0x72, 0x53, 0x74, 0x61, 111 | 0x74, 0x65, 0x48, 0x03, 0x52, 0x0a, 0x6f, 0x72, 0x64, 0x65, 0x72, 0x53, 0x74, 0x61, 0x74, 0x65, 112 | 0x88, 0x01, 0x01, 0x42, 0x0a, 0x0a, 0x08, 0x5f, 0x6f, 0x72, 0x64, 0x65, 0x72, 0x49, 0x64, 0x42, 113 | 0x0b, 0x0a, 0x09, 0x5f, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x61, 0x63, 0x74, 0x42, 0x08, 0x0a, 0x06, 114 | 0x5f, 0x6f, 0x72, 0x64, 0x65, 0x72, 0x42, 0x0d, 0x0a, 0x0b, 0x5f, 0x6f, 0x72, 0x64, 0x65, 0x72, 115 | 0x53, 0x74, 0x61, 0x74, 0x65, 0x42, 0x0c, 0x5a, 0x0a, 0x2e, 0x3b, 0x70, 0x72, 0x6f, 0x74, 0x6f, 116 | 0x62, 0x75, 0x66, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, 117 | }) 118 | 119 | var ( 120 | file_OpenOrder_proto_rawDescOnce sync.Once 121 | file_OpenOrder_proto_rawDescData []byte 122 | ) 123 | 124 | func file_OpenOrder_proto_rawDescGZIP() []byte { 125 | file_OpenOrder_proto_rawDescOnce.Do(func() { 126 | file_OpenOrder_proto_rawDescData = protoimpl.X.CompressGZIP(unsafe.Slice(unsafe.StringData(file_OpenOrder_proto_rawDesc), len(file_OpenOrder_proto_rawDesc))) 127 | }) 128 | return file_OpenOrder_proto_rawDescData 129 | } 130 | 131 | var file_OpenOrder_proto_msgTypes = make([]protoimpl.MessageInfo, 1) 132 | var file_OpenOrder_proto_goTypes = []any{ 133 | (*OpenOrder)(nil), // 0: protobuf.OpenOrder 134 | (*Contract)(nil), // 1: protobuf.Contract 135 | (*Order)(nil), // 2: protobuf.Order 136 | (*OrderState)(nil), // 3: protobuf.OrderState 137 | } 138 | var file_OpenOrder_proto_depIdxs = []int32{ 139 | 1, // 0: protobuf.OpenOrder.contract:type_name -> protobuf.Contract 140 | 2, // 1: protobuf.OpenOrder.order:type_name -> protobuf.Order 141 | 3, // 2: protobuf.OpenOrder.orderState:type_name -> protobuf.OrderState 142 | 3, // [3:3] is the sub-list for method output_type 143 | 3, // [3:3] is the sub-list for method input_type 144 | 3, // [3:3] is the sub-list for extension type_name 145 | 3, // [3:3] is the sub-list for extension extendee 146 | 0, // [0:3] is the sub-list for field type_name 147 | } 148 | 149 | func init() { file_OpenOrder_proto_init() } 150 | func file_OpenOrder_proto_init() { 151 | if File_OpenOrder_proto != nil { 152 | return 153 | } 154 | file_Contract_proto_init() 155 | file_Order_proto_init() 156 | file_OrderState_proto_init() 157 | file_OpenOrder_proto_msgTypes[0].OneofWrappers = []any{} 158 | type x struct{} 159 | out := protoimpl.TypeBuilder{ 160 | File: protoimpl.DescBuilder{ 161 | GoPackagePath: reflect.TypeOf(x{}).PkgPath(), 162 | RawDescriptor: unsafe.Slice(unsafe.StringData(file_OpenOrder_proto_rawDesc), len(file_OpenOrder_proto_rawDesc)), 163 | NumEnums: 0, 164 | NumMessages: 1, 165 | NumExtensions: 0, 166 | NumServices: 0, 167 | }, 168 | GoTypes: file_OpenOrder_proto_goTypes, 169 | DependencyIndexes: file_OpenOrder_proto_depIdxs, 170 | MessageInfos: file_OpenOrder_proto_msgTypes, 171 | }.Build() 172 | File_OpenOrder_proto = out.File 173 | file_OpenOrder_proto_goTypes = nil 174 | file_OpenOrder_proto_depIdxs = nil 175 | } 176 | -------------------------------------------------------------------------------- /protobuf/OpenOrdersEnd.pb.go: -------------------------------------------------------------------------------- 1 | // Code generated by protoc-gen-go. DO NOT EDIT. 2 | // versions: 3 | // protoc-gen-go v1.36.5 4 | // protoc v3.12.4 5 | // source: OpenOrdersEnd.proto 6 | 7 | package protobuf 8 | 9 | import ( 10 | protoreflect "google.golang.org/protobuf/reflect/protoreflect" 11 | protoimpl "google.golang.org/protobuf/runtime/protoimpl" 12 | reflect "reflect" 13 | sync "sync" 14 | unsafe "unsafe" 15 | ) 16 | 17 | const ( 18 | // Verify that this generated code is sufficiently up-to-date. 19 | _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) 20 | // Verify that runtime/protoimpl is sufficiently up-to-date. 21 | _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) 22 | ) 23 | 24 | type OpenOrdersEnd struct { 25 | state protoimpl.MessageState `protogen:"open.v1"` 26 | unknownFields protoimpl.UnknownFields 27 | sizeCache protoimpl.SizeCache 28 | } 29 | 30 | func (x *OpenOrdersEnd) Reset() { 31 | *x = OpenOrdersEnd{} 32 | mi := &file_OpenOrdersEnd_proto_msgTypes[0] 33 | ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) 34 | ms.StoreMessageInfo(mi) 35 | } 36 | 37 | func (x *OpenOrdersEnd) String() string { 38 | return protoimpl.X.MessageStringOf(x) 39 | } 40 | 41 | func (*OpenOrdersEnd) ProtoMessage() {} 42 | 43 | func (x *OpenOrdersEnd) ProtoReflect() protoreflect.Message { 44 | mi := &file_OpenOrdersEnd_proto_msgTypes[0] 45 | if x != nil { 46 | ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) 47 | if ms.LoadMessageInfo() == nil { 48 | ms.StoreMessageInfo(mi) 49 | } 50 | return ms 51 | } 52 | return mi.MessageOf(x) 53 | } 54 | 55 | // Deprecated: Use OpenOrdersEnd.ProtoReflect.Descriptor instead. 56 | func (*OpenOrdersEnd) Descriptor() ([]byte, []int) { 57 | return file_OpenOrdersEnd_proto_rawDescGZIP(), []int{0} 58 | } 59 | 60 | var File_OpenOrdersEnd_proto protoreflect.FileDescriptor 61 | 62 | var file_OpenOrdersEnd_proto_rawDesc = string([]byte{ 63 | 0x0a, 0x13, 0x4f, 0x70, 0x65, 0x6e, 0x4f, 0x72, 0x64, 0x65, 0x72, 0x73, 0x45, 0x6e, 0x64, 0x2e, 64 | 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x08, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x22, 65 | 0x0f, 0x0a, 0x0d, 0x4f, 0x70, 0x65, 0x6e, 0x4f, 0x72, 0x64, 0x65, 0x72, 0x73, 0x45, 0x6e, 0x64, 66 | 0x42, 0x0c, 0x5a, 0x0a, 0x2e, 0x3b, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x62, 0x06, 67 | 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, 68 | }) 69 | 70 | var ( 71 | file_OpenOrdersEnd_proto_rawDescOnce sync.Once 72 | file_OpenOrdersEnd_proto_rawDescData []byte 73 | ) 74 | 75 | func file_OpenOrdersEnd_proto_rawDescGZIP() []byte { 76 | file_OpenOrdersEnd_proto_rawDescOnce.Do(func() { 77 | file_OpenOrdersEnd_proto_rawDescData = protoimpl.X.CompressGZIP(unsafe.Slice(unsafe.StringData(file_OpenOrdersEnd_proto_rawDesc), len(file_OpenOrdersEnd_proto_rawDesc))) 78 | }) 79 | return file_OpenOrdersEnd_proto_rawDescData 80 | } 81 | 82 | var file_OpenOrdersEnd_proto_msgTypes = make([]protoimpl.MessageInfo, 1) 83 | var file_OpenOrdersEnd_proto_goTypes = []any{ 84 | (*OpenOrdersEnd)(nil), // 0: protobuf.OpenOrdersEnd 85 | } 86 | var file_OpenOrdersEnd_proto_depIdxs = []int32{ 87 | 0, // [0:0] is the sub-list for method output_type 88 | 0, // [0:0] is the sub-list for method input_type 89 | 0, // [0:0] is the sub-list for extension type_name 90 | 0, // [0:0] is the sub-list for extension extendee 91 | 0, // [0:0] is the sub-list for field type_name 92 | } 93 | 94 | func init() { file_OpenOrdersEnd_proto_init() } 95 | func file_OpenOrdersEnd_proto_init() { 96 | if File_OpenOrdersEnd_proto != nil { 97 | return 98 | } 99 | type x struct{} 100 | out := protoimpl.TypeBuilder{ 101 | File: protoimpl.DescBuilder{ 102 | GoPackagePath: reflect.TypeOf(x{}).PkgPath(), 103 | RawDescriptor: unsafe.Slice(unsafe.StringData(file_OpenOrdersEnd_proto_rawDesc), len(file_OpenOrdersEnd_proto_rawDesc)), 104 | NumEnums: 0, 105 | NumMessages: 1, 106 | NumExtensions: 0, 107 | NumServices: 0, 108 | }, 109 | GoTypes: file_OpenOrdersEnd_proto_goTypes, 110 | DependencyIndexes: file_OpenOrdersEnd_proto_depIdxs, 111 | MessageInfos: file_OpenOrdersEnd_proto_msgTypes, 112 | }.Build() 113 | File_OpenOrdersEnd_proto = out.File 114 | file_OpenOrdersEnd_proto_goTypes = nil 115 | file_OpenOrdersEnd_proto_depIdxs = nil 116 | } 117 | -------------------------------------------------------------------------------- /protobuf/OrderAllocation.pb.go: -------------------------------------------------------------------------------- 1 | // Code generated by protoc-gen-go. DO NOT EDIT. 2 | // versions: 3 | // protoc-gen-go v1.36.5 4 | // protoc v3.12.4 5 | // source: OrderAllocation.proto 6 | 7 | package protobuf 8 | 9 | import ( 10 | protoreflect "google.golang.org/protobuf/reflect/protoreflect" 11 | protoimpl "google.golang.org/protobuf/runtime/protoimpl" 12 | reflect "reflect" 13 | sync "sync" 14 | unsafe "unsafe" 15 | ) 16 | 17 | const ( 18 | // Verify that this generated code is sufficiently up-to-date. 19 | _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) 20 | // Verify that runtime/protoimpl is sufficiently up-to-date. 21 | _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) 22 | ) 23 | 24 | type OrderAllocation struct { 25 | state protoimpl.MessageState `protogen:"open.v1"` 26 | Account *string `protobuf:"bytes,1,opt,name=account,proto3,oneof" json:"account,omitempty"` 27 | Position *string `protobuf:"bytes,2,opt,name=position,proto3,oneof" json:"position,omitempty"` 28 | PositionDesired *string `protobuf:"bytes,3,opt,name=positionDesired,proto3,oneof" json:"positionDesired,omitempty"` 29 | PositionAfter *string `protobuf:"bytes,4,opt,name=positionAfter,proto3,oneof" json:"positionAfter,omitempty"` 30 | DesiredAllocQty *string `protobuf:"bytes,5,opt,name=desiredAllocQty,proto3,oneof" json:"desiredAllocQty,omitempty"` 31 | AllowedAllocQty *string `protobuf:"bytes,6,opt,name=allowedAllocQty,proto3,oneof" json:"allowedAllocQty,omitempty"` 32 | IsMonetary *bool `protobuf:"varint,7,opt,name=isMonetary,proto3,oneof" json:"isMonetary,omitempty"` 33 | unknownFields protoimpl.UnknownFields 34 | sizeCache protoimpl.SizeCache 35 | } 36 | 37 | func (x *OrderAllocation) Reset() { 38 | *x = OrderAllocation{} 39 | mi := &file_OrderAllocation_proto_msgTypes[0] 40 | ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) 41 | ms.StoreMessageInfo(mi) 42 | } 43 | 44 | func (x *OrderAllocation) String() string { 45 | return protoimpl.X.MessageStringOf(x) 46 | } 47 | 48 | func (*OrderAllocation) ProtoMessage() {} 49 | 50 | func (x *OrderAllocation) ProtoReflect() protoreflect.Message { 51 | mi := &file_OrderAllocation_proto_msgTypes[0] 52 | if x != nil { 53 | ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) 54 | if ms.LoadMessageInfo() == nil { 55 | ms.StoreMessageInfo(mi) 56 | } 57 | return ms 58 | } 59 | return mi.MessageOf(x) 60 | } 61 | 62 | // Deprecated: Use OrderAllocation.ProtoReflect.Descriptor instead. 63 | func (*OrderAllocation) Descriptor() ([]byte, []int) { 64 | return file_OrderAllocation_proto_rawDescGZIP(), []int{0} 65 | } 66 | 67 | func (x *OrderAllocation) GetAccount() string { 68 | if x != nil && x.Account != nil { 69 | return *x.Account 70 | } 71 | return "" 72 | } 73 | 74 | func (x *OrderAllocation) GetPosition() string { 75 | if x != nil && x.Position != nil { 76 | return *x.Position 77 | } 78 | return "" 79 | } 80 | 81 | func (x *OrderAllocation) GetPositionDesired() string { 82 | if x != nil && x.PositionDesired != nil { 83 | return *x.PositionDesired 84 | } 85 | return "" 86 | } 87 | 88 | func (x *OrderAllocation) GetPositionAfter() string { 89 | if x != nil && x.PositionAfter != nil { 90 | return *x.PositionAfter 91 | } 92 | return "" 93 | } 94 | 95 | func (x *OrderAllocation) GetDesiredAllocQty() string { 96 | if x != nil && x.DesiredAllocQty != nil { 97 | return *x.DesiredAllocQty 98 | } 99 | return "" 100 | } 101 | 102 | func (x *OrderAllocation) GetAllowedAllocQty() string { 103 | if x != nil && x.AllowedAllocQty != nil { 104 | return *x.AllowedAllocQty 105 | } 106 | return "" 107 | } 108 | 109 | func (x *OrderAllocation) GetIsMonetary() bool { 110 | if x != nil && x.IsMonetary != nil { 111 | return *x.IsMonetary 112 | } 113 | return false 114 | } 115 | 116 | var File_OrderAllocation_proto protoreflect.FileDescriptor 117 | 118 | var file_OrderAllocation_proto_rawDesc = string([]byte{ 119 | 0x0a, 0x15, 0x4f, 0x72, 0x64, 0x65, 0x72, 0x41, 0x6c, 0x6c, 0x6f, 0x63, 0x61, 0x74, 0x69, 0x6f, 120 | 0x6e, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x08, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 121 | 0x66, 0x22, 0xa4, 0x03, 0x0a, 0x0f, 0x4f, 0x72, 0x64, 0x65, 0x72, 0x41, 0x6c, 0x6c, 0x6f, 0x63, 122 | 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x1d, 0x0a, 0x07, 0x61, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 123 | 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x48, 0x00, 0x52, 0x07, 0x61, 0x63, 0x63, 0x6f, 0x75, 0x6e, 124 | 0x74, 0x88, 0x01, 0x01, 0x12, 0x1f, 0x0a, 0x08, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x69, 0x6f, 0x6e, 125 | 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x48, 0x01, 0x52, 0x08, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x69, 126 | 0x6f, 0x6e, 0x88, 0x01, 0x01, 0x12, 0x2d, 0x0a, 0x0f, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x69, 0x6f, 127 | 0x6e, 0x44, 0x65, 0x73, 0x69, 0x72, 0x65, 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x48, 0x02, 128 | 0x52, 0x0f, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x44, 0x65, 0x73, 0x69, 0x72, 0x65, 129 | 0x64, 0x88, 0x01, 0x01, 0x12, 0x29, 0x0a, 0x0d, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x69, 0x6f, 0x6e, 130 | 0x41, 0x66, 0x74, 0x65, 0x72, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x48, 0x03, 0x52, 0x0d, 0x70, 131 | 0x6f, 0x73, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x41, 0x66, 0x74, 0x65, 0x72, 0x88, 0x01, 0x01, 0x12, 132 | 0x2d, 0x0a, 0x0f, 0x64, 0x65, 0x73, 0x69, 0x72, 0x65, 0x64, 0x41, 0x6c, 0x6c, 0x6f, 0x63, 0x51, 133 | 0x74, 0x79, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x48, 0x04, 0x52, 0x0f, 0x64, 0x65, 0x73, 0x69, 134 | 0x72, 0x65, 0x64, 0x41, 0x6c, 0x6c, 0x6f, 0x63, 0x51, 0x74, 0x79, 0x88, 0x01, 0x01, 0x12, 0x2d, 135 | 0x0a, 0x0f, 0x61, 0x6c, 0x6c, 0x6f, 0x77, 0x65, 0x64, 0x41, 0x6c, 0x6c, 0x6f, 0x63, 0x51, 0x74, 136 | 0x79, 0x18, 0x06, 0x20, 0x01, 0x28, 0x09, 0x48, 0x05, 0x52, 0x0f, 0x61, 0x6c, 0x6c, 0x6f, 0x77, 137 | 0x65, 0x64, 0x41, 0x6c, 0x6c, 0x6f, 0x63, 0x51, 0x74, 0x79, 0x88, 0x01, 0x01, 0x12, 0x23, 0x0a, 138 | 0x0a, 0x69, 0x73, 0x4d, 0x6f, 0x6e, 0x65, 0x74, 0x61, 0x72, 0x79, 0x18, 0x07, 0x20, 0x01, 0x28, 139 | 0x08, 0x48, 0x06, 0x52, 0x0a, 0x69, 0x73, 0x4d, 0x6f, 0x6e, 0x65, 0x74, 0x61, 0x72, 0x79, 0x88, 140 | 0x01, 0x01, 0x42, 0x0a, 0x0a, 0x08, 0x5f, 0x61, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x42, 0x0b, 141 | 0x0a, 0x09, 0x5f, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x42, 0x12, 0x0a, 0x10, 0x5f, 142 | 0x70, 0x6f, 0x73, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x44, 0x65, 0x73, 0x69, 0x72, 0x65, 0x64, 0x42, 143 | 0x10, 0x0a, 0x0e, 0x5f, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x41, 0x66, 0x74, 0x65, 144 | 0x72, 0x42, 0x12, 0x0a, 0x10, 0x5f, 0x64, 0x65, 0x73, 0x69, 0x72, 0x65, 0x64, 0x41, 0x6c, 0x6c, 145 | 0x6f, 0x63, 0x51, 0x74, 0x79, 0x42, 0x12, 0x0a, 0x10, 0x5f, 0x61, 0x6c, 0x6c, 0x6f, 0x77, 0x65, 146 | 0x64, 0x41, 0x6c, 0x6c, 0x6f, 0x63, 0x51, 0x74, 0x79, 0x42, 0x0d, 0x0a, 0x0b, 0x5f, 0x69, 0x73, 147 | 0x4d, 0x6f, 0x6e, 0x65, 0x74, 0x61, 0x72, 0x79, 0x42, 0x0c, 0x5a, 0x0a, 0x2e, 0x3b, 0x70, 0x72, 148 | 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, 149 | }) 150 | 151 | var ( 152 | file_OrderAllocation_proto_rawDescOnce sync.Once 153 | file_OrderAllocation_proto_rawDescData []byte 154 | ) 155 | 156 | func file_OrderAllocation_proto_rawDescGZIP() []byte { 157 | file_OrderAllocation_proto_rawDescOnce.Do(func() { 158 | file_OrderAllocation_proto_rawDescData = protoimpl.X.CompressGZIP(unsafe.Slice(unsafe.StringData(file_OrderAllocation_proto_rawDesc), len(file_OrderAllocation_proto_rawDesc))) 159 | }) 160 | return file_OrderAllocation_proto_rawDescData 161 | } 162 | 163 | var file_OrderAllocation_proto_msgTypes = make([]protoimpl.MessageInfo, 1) 164 | var file_OrderAllocation_proto_goTypes = []any{ 165 | (*OrderAllocation)(nil), // 0: protobuf.OrderAllocation 166 | } 167 | var file_OrderAllocation_proto_depIdxs = []int32{ 168 | 0, // [0:0] is the sub-list for method output_type 169 | 0, // [0:0] is the sub-list for method input_type 170 | 0, // [0:0] is the sub-list for extension type_name 171 | 0, // [0:0] is the sub-list for extension extendee 172 | 0, // [0:0] is the sub-list for field type_name 173 | } 174 | 175 | func init() { file_OrderAllocation_proto_init() } 176 | func file_OrderAllocation_proto_init() { 177 | if File_OrderAllocation_proto != nil { 178 | return 179 | } 180 | file_OrderAllocation_proto_msgTypes[0].OneofWrappers = []any{} 181 | type x struct{} 182 | out := protoimpl.TypeBuilder{ 183 | File: protoimpl.DescBuilder{ 184 | GoPackagePath: reflect.TypeOf(x{}).PkgPath(), 185 | RawDescriptor: unsafe.Slice(unsafe.StringData(file_OrderAllocation_proto_rawDesc), len(file_OrderAllocation_proto_rawDesc)), 186 | NumEnums: 0, 187 | NumMessages: 1, 188 | NumExtensions: 0, 189 | NumServices: 0, 190 | }, 191 | GoTypes: file_OrderAllocation_proto_goTypes, 192 | DependencyIndexes: file_OrderAllocation_proto_depIdxs, 193 | MessageInfos: file_OrderAllocation_proto_msgTypes, 194 | }.Build() 195 | File_OrderAllocation_proto = out.File 196 | file_OrderAllocation_proto_goTypes = nil 197 | file_OrderAllocation_proto_depIdxs = nil 198 | } 199 | -------------------------------------------------------------------------------- /protobuf/OrderCancel.pb.go: -------------------------------------------------------------------------------- 1 | // Code generated by protoc-gen-go. DO NOT EDIT. 2 | // versions: 3 | // protoc-gen-go v1.36.5 4 | // protoc v3.12.4 5 | // source: OrderCancel.proto 6 | 7 | package protobuf 8 | 9 | import ( 10 | protoreflect "google.golang.org/protobuf/reflect/protoreflect" 11 | protoimpl "google.golang.org/protobuf/runtime/protoimpl" 12 | reflect "reflect" 13 | sync "sync" 14 | unsafe "unsafe" 15 | ) 16 | 17 | const ( 18 | // Verify that this generated code is sufficiently up-to-date. 19 | _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) 20 | // Verify that runtime/protoimpl is sufficiently up-to-date. 21 | _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) 22 | ) 23 | 24 | type OrderCancel struct { 25 | state protoimpl.MessageState `protogen:"open.v1"` 26 | ManualOrderCancelTime *string `protobuf:"bytes,1,opt,name=manualOrderCancelTime,proto3,oneof" json:"manualOrderCancelTime,omitempty"` 27 | ExtOperator *string `protobuf:"bytes,2,opt,name=extOperator,proto3,oneof" json:"extOperator,omitempty"` 28 | ManualOrderIndicator *int32 `protobuf:"varint,3,opt,name=manualOrderIndicator,proto3,oneof" json:"manualOrderIndicator,omitempty"` 29 | unknownFields protoimpl.UnknownFields 30 | sizeCache protoimpl.SizeCache 31 | } 32 | 33 | func (x *OrderCancel) Reset() { 34 | *x = OrderCancel{} 35 | mi := &file_OrderCancel_proto_msgTypes[0] 36 | ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) 37 | ms.StoreMessageInfo(mi) 38 | } 39 | 40 | func (x *OrderCancel) String() string { 41 | return protoimpl.X.MessageStringOf(x) 42 | } 43 | 44 | func (*OrderCancel) ProtoMessage() {} 45 | 46 | func (x *OrderCancel) ProtoReflect() protoreflect.Message { 47 | mi := &file_OrderCancel_proto_msgTypes[0] 48 | if x != nil { 49 | ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) 50 | if ms.LoadMessageInfo() == nil { 51 | ms.StoreMessageInfo(mi) 52 | } 53 | return ms 54 | } 55 | return mi.MessageOf(x) 56 | } 57 | 58 | // Deprecated: Use OrderCancel.ProtoReflect.Descriptor instead. 59 | func (*OrderCancel) Descriptor() ([]byte, []int) { 60 | return file_OrderCancel_proto_rawDescGZIP(), []int{0} 61 | } 62 | 63 | func (x *OrderCancel) GetManualOrderCancelTime() string { 64 | if x != nil && x.ManualOrderCancelTime != nil { 65 | return *x.ManualOrderCancelTime 66 | } 67 | return "" 68 | } 69 | 70 | func (x *OrderCancel) GetExtOperator() string { 71 | if x != nil && x.ExtOperator != nil { 72 | return *x.ExtOperator 73 | } 74 | return "" 75 | } 76 | 77 | func (x *OrderCancel) GetManualOrderIndicator() int32 { 78 | if x != nil && x.ManualOrderIndicator != nil { 79 | return *x.ManualOrderIndicator 80 | } 81 | return 0 82 | } 83 | 84 | var File_OrderCancel_proto protoreflect.FileDescriptor 85 | 86 | var file_OrderCancel_proto_rawDesc = string([]byte{ 87 | 0x0a, 0x11, 0x4f, 0x72, 0x64, 0x65, 0x72, 0x43, 0x61, 0x6e, 0x63, 0x65, 0x6c, 0x2e, 0x70, 0x72, 88 | 0x6f, 0x74, 0x6f, 0x12, 0x08, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x22, 0xeb, 0x01, 89 | 0x0a, 0x0b, 0x4f, 0x72, 0x64, 0x65, 0x72, 0x43, 0x61, 0x6e, 0x63, 0x65, 0x6c, 0x12, 0x39, 0x0a, 90 | 0x15, 0x6d, 0x61, 0x6e, 0x75, 0x61, 0x6c, 0x4f, 0x72, 0x64, 0x65, 0x72, 0x43, 0x61, 0x6e, 0x63, 91 | 0x65, 0x6c, 0x54, 0x69, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x48, 0x00, 0x52, 0x15, 92 | 0x6d, 0x61, 0x6e, 0x75, 0x61, 0x6c, 0x4f, 0x72, 0x64, 0x65, 0x72, 0x43, 0x61, 0x6e, 0x63, 0x65, 93 | 0x6c, 0x54, 0x69, 0x6d, 0x65, 0x88, 0x01, 0x01, 0x12, 0x25, 0x0a, 0x0b, 0x65, 0x78, 0x74, 0x4f, 94 | 0x70, 0x65, 0x72, 0x61, 0x74, 0x6f, 0x72, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x48, 0x01, 0x52, 95 | 0x0b, 0x65, 0x78, 0x74, 0x4f, 0x70, 0x65, 0x72, 0x61, 0x74, 0x6f, 0x72, 0x88, 0x01, 0x01, 0x12, 96 | 0x37, 0x0a, 0x14, 0x6d, 0x61, 0x6e, 0x75, 0x61, 0x6c, 0x4f, 0x72, 0x64, 0x65, 0x72, 0x49, 0x6e, 97 | 0x64, 0x69, 0x63, 0x61, 0x74, 0x6f, 0x72, 0x18, 0x03, 0x20, 0x01, 0x28, 0x05, 0x48, 0x02, 0x52, 98 | 0x14, 0x6d, 0x61, 0x6e, 0x75, 0x61, 0x6c, 0x4f, 0x72, 0x64, 0x65, 0x72, 0x49, 0x6e, 0x64, 0x69, 99 | 0x63, 0x61, 0x74, 0x6f, 0x72, 0x88, 0x01, 0x01, 0x42, 0x18, 0x0a, 0x16, 0x5f, 0x6d, 0x61, 0x6e, 100 | 0x75, 0x61, 0x6c, 0x4f, 0x72, 0x64, 0x65, 0x72, 0x43, 0x61, 0x6e, 0x63, 0x65, 0x6c, 0x54, 0x69, 101 | 0x6d, 0x65, 0x42, 0x0e, 0x0a, 0x0c, 0x5f, 0x65, 0x78, 0x74, 0x4f, 0x70, 0x65, 0x72, 0x61, 0x74, 102 | 0x6f, 0x72, 0x42, 0x17, 0x0a, 0x15, 0x5f, 0x6d, 0x61, 0x6e, 0x75, 0x61, 0x6c, 0x4f, 0x72, 0x64, 103 | 0x65, 0x72, 0x49, 0x6e, 0x64, 0x69, 0x63, 0x61, 0x74, 0x6f, 0x72, 0x42, 0x0c, 0x5a, 0x0a, 0x2e, 104 | 0x3b, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 105 | 0x33, 106 | }) 107 | 108 | var ( 109 | file_OrderCancel_proto_rawDescOnce sync.Once 110 | file_OrderCancel_proto_rawDescData []byte 111 | ) 112 | 113 | func file_OrderCancel_proto_rawDescGZIP() []byte { 114 | file_OrderCancel_proto_rawDescOnce.Do(func() { 115 | file_OrderCancel_proto_rawDescData = protoimpl.X.CompressGZIP(unsafe.Slice(unsafe.StringData(file_OrderCancel_proto_rawDesc), len(file_OrderCancel_proto_rawDesc))) 116 | }) 117 | return file_OrderCancel_proto_rawDescData 118 | } 119 | 120 | var file_OrderCancel_proto_msgTypes = make([]protoimpl.MessageInfo, 1) 121 | var file_OrderCancel_proto_goTypes = []any{ 122 | (*OrderCancel)(nil), // 0: protobuf.OrderCancel 123 | } 124 | var file_OrderCancel_proto_depIdxs = []int32{ 125 | 0, // [0:0] is the sub-list for method output_type 126 | 0, // [0:0] is the sub-list for method input_type 127 | 0, // [0:0] is the sub-list for extension type_name 128 | 0, // [0:0] is the sub-list for extension extendee 129 | 0, // [0:0] is the sub-list for field type_name 130 | } 131 | 132 | func init() { file_OrderCancel_proto_init() } 133 | func file_OrderCancel_proto_init() { 134 | if File_OrderCancel_proto != nil { 135 | return 136 | } 137 | file_OrderCancel_proto_msgTypes[0].OneofWrappers = []any{} 138 | type x struct{} 139 | out := protoimpl.TypeBuilder{ 140 | File: protoimpl.DescBuilder{ 141 | GoPackagePath: reflect.TypeOf(x{}).PkgPath(), 142 | RawDescriptor: unsafe.Slice(unsafe.StringData(file_OrderCancel_proto_rawDesc), len(file_OrderCancel_proto_rawDesc)), 143 | NumEnums: 0, 144 | NumMessages: 1, 145 | NumExtensions: 0, 146 | NumServices: 0, 147 | }, 148 | GoTypes: file_OrderCancel_proto_goTypes, 149 | DependencyIndexes: file_OrderCancel_proto_depIdxs, 150 | MessageInfos: file_OrderCancel_proto_msgTypes, 151 | }.Build() 152 | File_OrderCancel_proto = out.File 153 | file_OrderCancel_proto_goTypes = nil 154 | file_OrderCancel_proto_depIdxs = nil 155 | } 156 | -------------------------------------------------------------------------------- /protobuf/PlaceOrderRequest.pb.go: -------------------------------------------------------------------------------- 1 | // Code generated by protoc-gen-go. DO NOT EDIT. 2 | // versions: 3 | // protoc-gen-go v1.36.5 4 | // protoc v3.12.4 5 | // source: PlaceOrderRequest.proto 6 | 7 | package protobuf 8 | 9 | import ( 10 | protoreflect "google.golang.org/protobuf/reflect/protoreflect" 11 | protoimpl "google.golang.org/protobuf/runtime/protoimpl" 12 | reflect "reflect" 13 | sync "sync" 14 | unsafe "unsafe" 15 | ) 16 | 17 | const ( 18 | // Verify that this generated code is sufficiently up-to-date. 19 | _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) 20 | // Verify that runtime/protoimpl is sufficiently up-to-date. 21 | _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) 22 | ) 23 | 24 | type PlaceOrderRequest struct { 25 | state protoimpl.MessageState `protogen:"open.v1"` 26 | OrderId *int32 `protobuf:"varint,1,opt,name=orderId,proto3,oneof" json:"orderId,omitempty"` 27 | Contract *Contract `protobuf:"bytes,2,opt,name=contract,proto3,oneof" json:"contract,omitempty"` 28 | Order *Order `protobuf:"bytes,3,opt,name=order,proto3,oneof" json:"order,omitempty"` 29 | unknownFields protoimpl.UnknownFields 30 | sizeCache protoimpl.SizeCache 31 | } 32 | 33 | func (x *PlaceOrderRequest) Reset() { 34 | *x = PlaceOrderRequest{} 35 | mi := &file_PlaceOrderRequest_proto_msgTypes[0] 36 | ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) 37 | ms.StoreMessageInfo(mi) 38 | } 39 | 40 | func (x *PlaceOrderRequest) String() string { 41 | return protoimpl.X.MessageStringOf(x) 42 | } 43 | 44 | func (*PlaceOrderRequest) ProtoMessage() {} 45 | 46 | func (x *PlaceOrderRequest) ProtoReflect() protoreflect.Message { 47 | mi := &file_PlaceOrderRequest_proto_msgTypes[0] 48 | if x != nil { 49 | ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) 50 | if ms.LoadMessageInfo() == nil { 51 | ms.StoreMessageInfo(mi) 52 | } 53 | return ms 54 | } 55 | return mi.MessageOf(x) 56 | } 57 | 58 | // Deprecated: Use PlaceOrderRequest.ProtoReflect.Descriptor instead. 59 | func (*PlaceOrderRequest) Descriptor() ([]byte, []int) { 60 | return file_PlaceOrderRequest_proto_rawDescGZIP(), []int{0} 61 | } 62 | 63 | func (x *PlaceOrderRequest) GetOrderId() int32 { 64 | if x != nil && x.OrderId != nil { 65 | return *x.OrderId 66 | } 67 | return 0 68 | } 69 | 70 | func (x *PlaceOrderRequest) GetContract() *Contract { 71 | if x != nil { 72 | return x.Contract 73 | } 74 | return nil 75 | } 76 | 77 | func (x *PlaceOrderRequest) GetOrder() *Order { 78 | if x != nil { 79 | return x.Order 80 | } 81 | return nil 82 | } 83 | 84 | var File_PlaceOrderRequest_proto protoreflect.FileDescriptor 85 | 86 | var file_PlaceOrderRequest_proto_rawDesc = string([]byte{ 87 | 0x0a, 0x17, 0x50, 0x6c, 0x61, 0x63, 0x65, 0x4f, 0x72, 0x64, 0x65, 0x72, 0x52, 0x65, 0x71, 0x75, 88 | 0x65, 0x73, 0x74, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x08, 0x70, 0x72, 0x6f, 0x74, 0x6f, 89 | 0x62, 0x75, 0x66, 0x1a, 0x0e, 0x43, 0x6f, 0x6e, 0x74, 0x72, 0x61, 0x63, 0x74, 0x2e, 0x70, 0x72, 90 | 0x6f, 0x74, 0x6f, 0x1a, 0x0b, 0x4f, 0x72, 0x64, 0x65, 0x72, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 91 | 0x22, 0xb6, 0x01, 0x0a, 0x11, 0x50, 0x6c, 0x61, 0x63, 0x65, 0x4f, 0x72, 0x64, 0x65, 0x72, 0x52, 92 | 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x1d, 0x0a, 0x07, 0x6f, 0x72, 0x64, 0x65, 0x72, 0x49, 93 | 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x48, 0x00, 0x52, 0x07, 0x6f, 0x72, 0x64, 0x65, 0x72, 94 | 0x49, 0x64, 0x88, 0x01, 0x01, 0x12, 0x33, 0x0a, 0x08, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x61, 0x63, 95 | 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x12, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 96 | 0x75, 0x66, 0x2e, 0x43, 0x6f, 0x6e, 0x74, 0x72, 0x61, 0x63, 0x74, 0x48, 0x01, 0x52, 0x08, 0x63, 97 | 0x6f, 0x6e, 0x74, 0x72, 0x61, 0x63, 0x74, 0x88, 0x01, 0x01, 0x12, 0x2a, 0x0a, 0x05, 0x6f, 0x72, 98 | 0x64, 0x65, 0x72, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0f, 0x2e, 0x70, 0x72, 0x6f, 0x74, 99 | 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x4f, 0x72, 0x64, 0x65, 0x72, 0x48, 0x02, 0x52, 0x05, 0x6f, 0x72, 100 | 0x64, 0x65, 0x72, 0x88, 0x01, 0x01, 0x42, 0x0a, 0x0a, 0x08, 0x5f, 0x6f, 0x72, 0x64, 0x65, 0x72, 101 | 0x49, 0x64, 0x42, 0x0b, 0x0a, 0x09, 0x5f, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x61, 0x63, 0x74, 0x42, 102 | 0x08, 0x0a, 0x06, 0x5f, 0x6f, 0x72, 0x64, 0x65, 0x72, 0x42, 0x0c, 0x5a, 0x0a, 0x2e, 0x3b, 0x70, 103 | 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, 104 | }) 105 | 106 | var ( 107 | file_PlaceOrderRequest_proto_rawDescOnce sync.Once 108 | file_PlaceOrderRequest_proto_rawDescData []byte 109 | ) 110 | 111 | func file_PlaceOrderRequest_proto_rawDescGZIP() []byte { 112 | file_PlaceOrderRequest_proto_rawDescOnce.Do(func() { 113 | file_PlaceOrderRequest_proto_rawDescData = protoimpl.X.CompressGZIP(unsafe.Slice(unsafe.StringData(file_PlaceOrderRequest_proto_rawDesc), len(file_PlaceOrderRequest_proto_rawDesc))) 114 | }) 115 | return file_PlaceOrderRequest_proto_rawDescData 116 | } 117 | 118 | var file_PlaceOrderRequest_proto_msgTypes = make([]protoimpl.MessageInfo, 1) 119 | var file_PlaceOrderRequest_proto_goTypes = []any{ 120 | (*PlaceOrderRequest)(nil), // 0: protobuf.PlaceOrderRequest 121 | (*Contract)(nil), // 1: protobuf.Contract 122 | (*Order)(nil), // 2: protobuf.Order 123 | } 124 | var file_PlaceOrderRequest_proto_depIdxs = []int32{ 125 | 1, // 0: protobuf.PlaceOrderRequest.contract:type_name -> protobuf.Contract 126 | 2, // 1: protobuf.PlaceOrderRequest.order:type_name -> protobuf.Order 127 | 2, // [2:2] is the sub-list for method output_type 128 | 2, // [2:2] is the sub-list for method input_type 129 | 2, // [2:2] is the sub-list for extension type_name 130 | 2, // [2:2] is the sub-list for extension extendee 131 | 0, // [0:2] is the sub-list for field type_name 132 | } 133 | 134 | func init() { file_PlaceOrderRequest_proto_init() } 135 | func file_PlaceOrderRequest_proto_init() { 136 | if File_PlaceOrderRequest_proto != nil { 137 | return 138 | } 139 | file_Contract_proto_init() 140 | file_Order_proto_init() 141 | file_PlaceOrderRequest_proto_msgTypes[0].OneofWrappers = []any{} 142 | type x struct{} 143 | out := protoimpl.TypeBuilder{ 144 | File: protoimpl.DescBuilder{ 145 | GoPackagePath: reflect.TypeOf(x{}).PkgPath(), 146 | RawDescriptor: unsafe.Slice(unsafe.StringData(file_PlaceOrderRequest_proto_rawDesc), len(file_PlaceOrderRequest_proto_rawDesc)), 147 | NumEnums: 0, 148 | NumMessages: 1, 149 | NumExtensions: 0, 150 | NumServices: 0, 151 | }, 152 | GoTypes: file_PlaceOrderRequest_proto_goTypes, 153 | DependencyIndexes: file_PlaceOrderRequest_proto_depIdxs, 154 | MessageInfos: file_PlaceOrderRequest_proto_msgTypes, 155 | }.Build() 156 | File_PlaceOrderRequest_proto = out.File 157 | file_PlaceOrderRequest_proto_goTypes = nil 158 | file_PlaceOrderRequest_proto_depIdxs = nil 159 | } 160 | -------------------------------------------------------------------------------- /protobuf/SoftDollarTier.pb.go: -------------------------------------------------------------------------------- 1 | // Code generated by protoc-gen-go. DO NOT EDIT. 2 | // versions: 3 | // protoc-gen-go v1.36.5 4 | // protoc v3.12.4 5 | // source: SoftDollarTier.proto 6 | 7 | package protobuf 8 | 9 | import ( 10 | protoreflect "google.golang.org/protobuf/reflect/protoreflect" 11 | protoimpl "google.golang.org/protobuf/runtime/protoimpl" 12 | reflect "reflect" 13 | sync "sync" 14 | unsafe "unsafe" 15 | ) 16 | 17 | const ( 18 | // Verify that this generated code is sufficiently up-to-date. 19 | _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) 20 | // Verify that runtime/protoimpl is sufficiently up-to-date. 21 | _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) 22 | ) 23 | 24 | type SoftDollarTier struct { 25 | state protoimpl.MessageState `protogen:"open.v1"` 26 | Name *string `protobuf:"bytes,1,opt,name=name,proto3,oneof" json:"name,omitempty"` 27 | Value *string `protobuf:"bytes,2,opt,name=value,proto3,oneof" json:"value,omitempty"` 28 | DisplayName *string `protobuf:"bytes,3,opt,name=displayName,proto3,oneof" json:"displayName,omitempty"` 29 | unknownFields protoimpl.UnknownFields 30 | sizeCache protoimpl.SizeCache 31 | } 32 | 33 | func (x *SoftDollarTier) Reset() { 34 | *x = SoftDollarTier{} 35 | mi := &file_SoftDollarTier_proto_msgTypes[0] 36 | ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) 37 | ms.StoreMessageInfo(mi) 38 | } 39 | 40 | func (x *SoftDollarTier) String() string { 41 | return protoimpl.X.MessageStringOf(x) 42 | } 43 | 44 | func (*SoftDollarTier) ProtoMessage() {} 45 | 46 | func (x *SoftDollarTier) ProtoReflect() protoreflect.Message { 47 | mi := &file_SoftDollarTier_proto_msgTypes[0] 48 | if x != nil { 49 | ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) 50 | if ms.LoadMessageInfo() == nil { 51 | ms.StoreMessageInfo(mi) 52 | } 53 | return ms 54 | } 55 | return mi.MessageOf(x) 56 | } 57 | 58 | // Deprecated: Use SoftDollarTier.ProtoReflect.Descriptor instead. 59 | func (*SoftDollarTier) Descriptor() ([]byte, []int) { 60 | return file_SoftDollarTier_proto_rawDescGZIP(), []int{0} 61 | } 62 | 63 | func (x *SoftDollarTier) GetName() string { 64 | if x != nil && x.Name != nil { 65 | return *x.Name 66 | } 67 | return "" 68 | } 69 | 70 | func (x *SoftDollarTier) GetValue() string { 71 | if x != nil && x.Value != nil { 72 | return *x.Value 73 | } 74 | return "" 75 | } 76 | 77 | func (x *SoftDollarTier) GetDisplayName() string { 78 | if x != nil && x.DisplayName != nil { 79 | return *x.DisplayName 80 | } 81 | return "" 82 | } 83 | 84 | var File_SoftDollarTier_proto protoreflect.FileDescriptor 85 | 86 | var file_SoftDollarTier_proto_rawDesc = string([]byte{ 87 | 0x0a, 0x14, 0x53, 0x6f, 0x66, 0x74, 0x44, 0x6f, 0x6c, 0x6c, 0x61, 0x72, 0x54, 0x69, 0x65, 0x72, 88 | 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x08, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 89 | 0x22, 0x8e, 0x01, 0x0a, 0x0e, 0x53, 0x6f, 0x66, 0x74, 0x44, 0x6f, 0x6c, 0x6c, 0x61, 0x72, 0x54, 90 | 0x69, 0x65, 0x72, 0x12, 0x17, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 91 | 0x09, 0x48, 0x00, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x88, 0x01, 0x01, 0x12, 0x19, 0x0a, 0x05, 92 | 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x48, 0x01, 0x52, 0x05, 0x76, 93 | 0x61, 0x6c, 0x75, 0x65, 0x88, 0x01, 0x01, 0x12, 0x25, 0x0a, 0x0b, 0x64, 0x69, 0x73, 0x70, 0x6c, 94 | 0x61, 0x79, 0x4e, 0x61, 0x6d, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x48, 0x02, 0x52, 0x0b, 95 | 0x64, 0x69, 0x73, 0x70, 0x6c, 0x61, 0x79, 0x4e, 0x61, 0x6d, 0x65, 0x88, 0x01, 0x01, 0x42, 0x07, 96 | 0x0a, 0x05, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x76, 0x61, 0x6c, 0x75, 97 | 0x65, 0x42, 0x0e, 0x0a, 0x0c, 0x5f, 0x64, 0x69, 0x73, 0x70, 0x6c, 0x61, 0x79, 0x4e, 0x61, 0x6d, 98 | 0x65, 0x42, 0x0c, 0x5a, 0x0a, 0x2e, 0x3b, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x62, 99 | 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, 100 | }) 101 | 102 | var ( 103 | file_SoftDollarTier_proto_rawDescOnce sync.Once 104 | file_SoftDollarTier_proto_rawDescData []byte 105 | ) 106 | 107 | func file_SoftDollarTier_proto_rawDescGZIP() []byte { 108 | file_SoftDollarTier_proto_rawDescOnce.Do(func() { 109 | file_SoftDollarTier_proto_rawDescData = protoimpl.X.CompressGZIP(unsafe.Slice(unsafe.StringData(file_SoftDollarTier_proto_rawDesc), len(file_SoftDollarTier_proto_rawDesc))) 110 | }) 111 | return file_SoftDollarTier_proto_rawDescData 112 | } 113 | 114 | var file_SoftDollarTier_proto_msgTypes = make([]protoimpl.MessageInfo, 1) 115 | var file_SoftDollarTier_proto_goTypes = []any{ 116 | (*SoftDollarTier)(nil), // 0: protobuf.SoftDollarTier 117 | } 118 | var file_SoftDollarTier_proto_depIdxs = []int32{ 119 | 0, // [0:0] is the sub-list for method output_type 120 | 0, // [0:0] is the sub-list for method input_type 121 | 0, // [0:0] is the sub-list for extension type_name 122 | 0, // [0:0] is the sub-list for extension extendee 123 | 0, // [0:0] is the sub-list for field type_name 124 | } 125 | 126 | func init() { file_SoftDollarTier_proto_init() } 127 | func file_SoftDollarTier_proto_init() { 128 | if File_SoftDollarTier_proto != nil { 129 | return 130 | } 131 | file_SoftDollarTier_proto_msgTypes[0].OneofWrappers = []any{} 132 | type x struct{} 133 | out := protoimpl.TypeBuilder{ 134 | File: protoimpl.DescBuilder{ 135 | GoPackagePath: reflect.TypeOf(x{}).PkgPath(), 136 | RawDescriptor: unsafe.Slice(unsafe.StringData(file_SoftDollarTier_proto_rawDesc), len(file_SoftDollarTier_proto_rawDesc)), 137 | NumEnums: 0, 138 | NumMessages: 1, 139 | NumExtensions: 0, 140 | NumServices: 0, 141 | }, 142 | GoTypes: file_SoftDollarTier_proto_goTypes, 143 | DependencyIndexes: file_SoftDollarTier_proto_depIdxs, 144 | MessageInfos: file_SoftDollarTier_proto_msgTypes, 145 | }.Build() 146 | File_SoftDollarTier_proto = out.File 147 | file_SoftDollarTier_proto_goTypes = nil 148 | file_SoftDollarTier_proto_depIdxs = nil 149 | } 150 | -------------------------------------------------------------------------------- /reader.go: -------------------------------------------------------------------------------- 1 | package ibapi 2 | 3 | import ( 4 | "bufio" 5 | "context" 6 | "sync" 7 | ) 8 | 9 | // EReader starts the scan and decode goroutines 10 | func EReader(ctx context.Context, scanner *bufio.Scanner, decoder *EDecoder, wg *sync.WaitGroup) { 11 | 12 | msgChan := make(chan []byte, 300) 13 | 14 | // Decode 15 | wg.Add(1) 16 | go func() { 17 | log.Debug().Msg("decoder started") 18 | defer log.Debug().Msg("decoder ended") 19 | defer wg.Done() 20 | for { 21 | select { 22 | case <-ctx.Done(): 23 | return 24 | case msg, ok := <-msgChan: 25 | if !ok { 26 | return 27 | } 28 | decoder.interpret(msg) // single worker and no go here!! 29 | } 30 | } 31 | }() 32 | 33 | // Scan 34 | wg.Add(1) 35 | go func() { 36 | log.Debug().Msg("scanner started") 37 | defer log.Debug().Msg("scanner ended") 38 | defer wg.Done() 39 | for scanner.Scan() { 40 | msgBytes := make([]byte, len(scanner.Bytes())) 41 | copy(msgBytes, scanner.Bytes()) 42 | msgChan <- msgBytes 43 | if err := scanner.Err(); err != nil { 44 | log.Error().Err(err).Msg("scanner error") 45 | break 46 | } 47 | } 48 | close(msgChan) 49 | }() 50 | } 51 | -------------------------------------------------------------------------------- /scanner.go: -------------------------------------------------------------------------------- 1 | package ibapi 2 | 3 | import "fmt" 4 | 5 | const NO_ROW_NUMBER_SPECIFIED int64 = -1 6 | 7 | // ScanData . 8 | type ScanData struct { 9 | Rank int64 10 | ContractDetails *ContractDetails 11 | Distance string 12 | Benchmark string 13 | Projection string 14 | LegsStr string 15 | } 16 | 17 | func (s ScanData) String() string { 18 | return fmt.Sprintf("Rank: %d, Symbol: %s, SecType: %s, Currency: %s, Distance: %s, Benchmark: %s, Projection: %s, Legs String: %s", 19 | s.Rank, s.ContractDetails.Contract.Symbol, s.ContractDetails.Contract.SecType, s.ContractDetails.Contract.Currency, 20 | s.Distance, s.Benchmark, s.Projection, s.LegsStr) 21 | } 22 | 23 | // ScannerSubscription . 24 | type ScannerSubscription struct { 25 | NumberOfRows int64 `default:"NO_ROW_NUMBER_SPECIFIED"` 26 | Instrument string 27 | LocationCode string 28 | ScanCode string 29 | AbovePrice float64 `default:"UNSET_FLOAT"` 30 | BelowPrice float64 `default:"UNSET_FLOAT"` 31 | AboveVolume int64 `default:"UNSET_INT"` 32 | MarketCapAbove float64 `default:"UNSET_FLOAT"` 33 | MarketCapBelow float64 `default:"UNSET_FLOAT"` 34 | MoodyRatingAbove string 35 | MoodyRatingBelow string 36 | SpRatingAbove string 37 | SpRatingBelow string 38 | MaturityDateAbove string 39 | MaturityDateBelow string 40 | CouponRateAbove float64 `default:"UNSET_FLOAT"` 41 | CouponRateBelow float64 `default:"UNSET_FLOAT"` 42 | ExcludeConvertible bool 43 | AverageOptionVolumeAbove int64 `default:"UNSET_INT"` 44 | ScannerSettingPairs string 45 | StockTypeFilter string 46 | } 47 | 48 | func (s ScannerSubscription) String() string { 49 | return fmt.Sprintf("Instrument: %s, LocationCode: %s, ScanCode: %s", s.Instrument, s.LocationCode, s.ScanCode) 50 | } 51 | 52 | // NewScannerSubscription creates a default ScannerSubscription. 53 | func NewScannerSubscription() *ScannerSubscription { 54 | scannerSubscription := &ScannerSubscription{} 55 | 56 | scannerSubscription.NumberOfRows = NO_ROW_NUMBER_SPECIFIED 57 | 58 | scannerSubscription.AbovePrice = UNSET_FLOAT 59 | scannerSubscription.BelowPrice = UNSET_FLOAT 60 | scannerSubscription.AboveVolume = UNSET_INT 61 | scannerSubscription.MarketCapAbove = UNSET_FLOAT 62 | scannerSubscription.MarketCapBelow = UNSET_FLOAT 63 | 64 | scannerSubscription.CouponRateAbove = UNSET_FLOAT 65 | scannerSubscription.CouponRateBelow = UNSET_FLOAT 66 | 67 | scannerSubscription.AverageOptionVolumeAbove = UNSET_INT 68 | 69 | return scannerSubscription 70 | } 71 | -------------------------------------------------------------------------------- /scanner_subscription_samples.go: -------------------------------------------------------------------------------- 1 | package ibapi 2 | 3 | // HotUSStkByVolume . 4 | // Hot US stocks by volume 5 | func HotUSStkByVolume() *ScannerSubscription { 6 | 7 | scanSub := NewScannerSubscription() 8 | scanSub.Instrument = "STK" 9 | scanSub.LocationCode = "STK.US.MAJOR" 10 | scanSub.ScanCode = "HOT_BY_VOLUME" 11 | 12 | return scanSub 13 | } 14 | 15 | // TopPercentGainersIbis . 16 | // Top % gainers at IBIS 17 | func TopPercentGainersIbis() *ScannerSubscription { 18 | 19 | scanSub := NewScannerSubscription() 20 | scanSub.Instrument = "STOCK.EU" 21 | scanSub.LocationCode = "STK.EU.IBIS" 22 | scanSub.ScanCode = "TOP_PERC_GAIN" 23 | 24 | return scanSub 25 | } 26 | 27 | // MostActiveFutEurex . 28 | // Most active futures at EUREX 29 | func MostActiveFutEurex() *ScannerSubscription { 30 | 31 | scanSub := NewScannerSubscription() 32 | scanSub.Instrument = "FUT.EU" 33 | scanSub.LocationCode = "FUT.EU.EUREX" 34 | scanSub.ScanCode = "MOST_ACTIVE" 35 | 36 | return scanSub 37 | } 38 | 39 | // HighOptVolumePCRatioUSIndexes . 40 | // High option volume P/C ratio US indexes 41 | func HighOptVolumePCRatioUSIndexes() *ScannerSubscription { 42 | 43 | scanSub := NewScannerSubscription() 44 | scanSub.Instrument = "IND.US" 45 | scanSub.LocationCode = "IND.US" 46 | scanSub.ScanCode = "HIGH_OPT_VOLUME_PUT_CALL_RATIO" 47 | 48 | return scanSub 49 | } 50 | 51 | // ComplexOrdersAndTrades . 52 | // Complex orders and trades scan, latest trades 53 | func ComplexOrdersAndTrades() *ScannerSubscription { 54 | 55 | scanSub := NewScannerSubscription() 56 | scanSub.Instrument = "NATCOMB" 57 | scanSub.LocationCode = "NATCOMB.OPT.US" 58 | scanSub.ScanCode = "COMBO_LATEST_TRADE" 59 | 60 | return scanSub 61 | } 62 | -------------------------------------------------------------------------------- /soft_dollar_tier.go: -------------------------------------------------------------------------------- 1 | package ibapi 2 | 3 | import "fmt" 4 | 5 | // SoftDollarTier stores the Soft Dollar Tier information. 6 | type SoftDollarTier struct { 7 | Name string 8 | Value string 9 | DisplayName string 10 | } 11 | 12 | func NewSoftDollarTier() SoftDollarTier { 13 | return SoftDollarTier{} 14 | } 15 | 16 | func (s SoftDollarTier) String() string { 17 | return fmt.Sprintf("Name: %s, Value: %s, DisplayName: %s", 18 | s.Name, 19 | s.Value, 20 | s.DisplayName) 21 | } 22 | -------------------------------------------------------------------------------- /tag_value.go: -------------------------------------------------------------------------------- 1 | package ibapi 2 | 3 | import "fmt" 4 | 5 | // TagValue maps a tag to a value. Both of them are strings. 6 | // They are used in a slice to convey extra info with the requests. 7 | type TagValue struct { 8 | Tag string 9 | Value string 10 | } 11 | 12 | func NewTagValue() TagValue { 13 | return TagValue{} 14 | } 15 | 16 | func (tv TagValue) String() string { 17 | return fmt.Sprintf("%s=%s;", tv.Tag, tv.Value) 18 | } 19 | -------------------------------------------------------------------------------- /tick_attrib.go: -------------------------------------------------------------------------------- 1 | package ibapi 2 | 3 | import "fmt" 4 | 5 | // TickAttrib . 6 | type TickAttrib struct { 7 | CanAutoExecute bool 8 | PastLimit bool 9 | PreOpen bool 10 | } 11 | 12 | func NewTickAttrib() TickAttrib { 13 | return TickAttrib{} 14 | } 15 | 16 | func (t TickAttrib) String() string { 17 | return fmt.Sprintf("CanAutoExecute: %t, PastLimit: %t, PreOpen: %t", t.CanAutoExecute, t.PastLimit, t.PreOpen) 18 | } 19 | -------------------------------------------------------------------------------- /tick_attrib_bid_ask.go: -------------------------------------------------------------------------------- 1 | package ibapi 2 | 3 | import "fmt" 4 | 5 | // TickAttribBidAsk . 6 | type TickAttribBidAsk struct { 7 | BidPastLow bool 8 | AskPastHigh bool 9 | } 10 | 11 | func NewTickAttribBidAsk() TickAttribBidAsk { 12 | return TickAttribBidAsk{} 13 | } 14 | 15 | func (t TickAttribBidAsk) String() string { 16 | return fmt.Sprintf("BidPastLow: %t, AskPastHigh: %t", t.BidPastLow, t.AskPastHigh) 17 | } 18 | -------------------------------------------------------------------------------- /tick_attrib_last.go: -------------------------------------------------------------------------------- 1 | package ibapi 2 | 3 | import "fmt" 4 | 5 | // TickAttribLast . 6 | type TickAttribLast struct { 7 | PastLimit bool 8 | Unreported bool 9 | } 10 | 11 | func NewTickAttribLast() TickAttribLast { 12 | return TickAttribLast{} 13 | } 14 | 15 | func (t TickAttribLast) String() string { 16 | return fmt.Sprintf("PastLimit: %t, Unreported: %t", t.PastLimit, t.Unreported) 17 | } 18 | -------------------------------------------------------------------------------- /tick_type.go: -------------------------------------------------------------------------------- 1 | package ibapi 2 | 3 | // TickType is the type of ticks. 4 | type TickType = int64 5 | 6 | const ( 7 | BID_SIZE TickType = iota 8 | BID 9 | ASK 10 | ASK_SIZE 11 | LAST 12 | LAST_SIZE 13 | HIGH 14 | LOW 15 | VOLUME 16 | CLOSE 17 | BID_OPTION_COMPUTATION 18 | ASK_OPTION_COMPUTATION 19 | LAST_OPTION_COMPUTATION 20 | MODEL_OPTION 21 | OPEN 22 | LOW_13_WEEK 23 | HIGH_13_WEEK 24 | LOW_26_WEEK 25 | HIGH_26_WEEK 26 | LOW_52_WEEK 27 | HIGH_52_WEEK 28 | AVG_VOLUME 29 | OPEN_INTEREST 30 | OPTION_HISTORICAL_VOL 31 | OPTION_IMPLIED_VOL 32 | OPTION_BID_EXCH 33 | OPTION_ASK_EXCH 34 | OPTION_CALL_OPEN_INTEREST 35 | OPTION_PUT_OPEN_INTEREST 36 | OPTION_CALL_VOLUME 37 | OPTION_PUT_VOLUME 38 | INDEX_FUTURE_PREMIUM 39 | BID_EXCH 40 | ASK_EXCH 41 | AUCTION_VOLUME 42 | AUCTION_PRICE 43 | AUCTION_IMBALANCE 44 | MARK_PRICE 45 | BID_EFP_COMPUTATION 46 | ASK_EFP_COMPUTATION 47 | LAST_EFP_COMPUTATION 48 | OPEN_EFP_COMPUTATION 49 | HIGH_EFP_COMPUTATION 50 | LOW_EFP_COMPUTATION 51 | CLOSE_EFP_COMPUTATION 52 | LAST_TIMESTAMP 53 | SHORTABLE 54 | FUNDAMENTAL_RATIOS 55 | RT_VOLUME 56 | HALTED 57 | BID_YIELD 58 | ASK_YIELD 59 | LAST_YIELD 60 | CUST_OPTION_COMPUTATION 61 | TRADE_COUNT 62 | TRADE_RATE 63 | VOLUME_RATE 64 | LAST_RTH_TRADE 65 | RT_HISTORICAL_VOL 66 | IB_DIVIDENDS 67 | BOND_FACTOR_MULTIPLIER 68 | REGULATORY_IMBALANCE 69 | NEWS_TICK 70 | SHORT_TERM_VOLUME_3_MIN 71 | SHORT_TERM_VOLUME_5_MIN 72 | SHORT_TERM_VOLUME_10_MIN 73 | DELAYED_BID 74 | DELAYED_ASK 75 | DELAYED_LAST 76 | DELAYED_BID_SIZE 77 | DELAYED_ASK_SIZE 78 | DELAYED_LAST_SIZE 79 | DELAYED_HIGH 80 | DELAYED_LOW 81 | DELAYED_VOLUME 82 | DELAYED_CLOSE 83 | DELAYED_OPEN 84 | RT_TRD_VOLUME 85 | CREDITMAN_MARK_PRICE 86 | CREDITMAN_SLOW_MARK_PRICE 87 | DELAYED_BID_OPTION 88 | DELAYED_ASK_OPTION 89 | DELAYED_LAST_OPTION 90 | DELAYED_MODEL_OPTION 91 | LAST_EXCH 92 | LAST_REG_TIME 93 | FUTURES_OPEN_INTEREST 94 | AVG_OPT_VOLUME 95 | DELAYED_LAST_TIMESTAMP 96 | SHORTABLE_SHARES 97 | DELAYED_HALTED 98 | REUTERS_2_MUTUAL_FUNDS 99 | ETF_NAV_CLOSE 100 | ETF_NAV_PRIOR_CLOSE 101 | ETF_NAV_BID 102 | ETF_NAV_ASK 103 | ETF_NAV_LAST 104 | ETF_FROZEN_NAV_LAST 105 | ETF_NAV_HIGH 106 | ETF_NAV_LOW 107 | SOCIAL_MARKET_ANALYTICS 108 | ESTIMATED_IPO_MIDPOINT 109 | FINAL_IPO_LAST 110 | DELAYED_YIELD_BID 111 | DELAYED_YIELD_ASK 112 | NOT_SET 113 | ) 114 | 115 | func TickName(t TickType) string { 116 | return tickTypeMap[t] 117 | } 118 | 119 | var tickTypeMap = map[TickType]string{ 120 | BID_SIZE: "BID_SIZE", 121 | BID: "BID", 122 | ASK: "ASK", 123 | ASK_SIZE: "ASK_SIZE", 124 | LAST: "LAST", 125 | LAST_SIZE: "LAST_SIZE", 126 | HIGH: "HIGH", 127 | LOW: "LOW", 128 | VOLUME: "VOLUME", 129 | CLOSE: "CLOSE", 130 | BID_OPTION_COMPUTATION: "BID_OPTION_COMPUTATION", 131 | ASK_OPTION_COMPUTATION: "ASK_OPTION_COMPUTATION", 132 | LAST_OPTION_COMPUTATION: "LAST_OPTION_COMPUTATION", 133 | MODEL_OPTION: "MODEL_OPTION", 134 | OPEN: "OPEN", 135 | LOW_13_WEEK: "LOW_13_WEEK", 136 | HIGH_13_WEEK: "HIGH_13_WEEK", 137 | LOW_26_WEEK: "LOW_26_WEEK", 138 | HIGH_26_WEEK: "HIGH_26_WEEK", 139 | LOW_52_WEEK: "LOW_52_WEEK", 140 | HIGH_52_WEEK: "HIGH_52_WEEK", 141 | AVG_VOLUME: "AVG_VOLUME", 142 | OPEN_INTEREST: "OPEN_INTEREST", 143 | OPTION_HISTORICAL_VOL: "OPTION_HISTORICAL_VOL", 144 | OPTION_IMPLIED_VOL: "OPTION_IMPLIED_VOL", 145 | OPTION_BID_EXCH: "OPTION_BID_EXCH", 146 | OPTION_ASK_EXCH: "OPTION_ASK_EXCH", 147 | OPTION_CALL_OPEN_INTEREST: "OPTION_CALL_OPEN_INTEREST", 148 | OPTION_PUT_OPEN_INTEREST: "OPTION_PUT_OPEN_INTEREST", 149 | OPTION_CALL_VOLUME: "OPTION_CALL_VOLUME", 150 | OPTION_PUT_VOLUME: "OPTION_PUT_VOLUME", 151 | INDEX_FUTURE_PREMIUM: "INDEX_FUTURE_PREMIUM", 152 | BID_EXCH: "BID_EXCH", 153 | ASK_EXCH: "ASK_EXCH", 154 | AUCTION_VOLUME: "AUCTION_VOLUME", 155 | AUCTION_PRICE: "AUCTION_PRICE", 156 | AUCTION_IMBALANCE: "AUCTION_IMBALANCE", 157 | MARK_PRICE: "MARK_PRICE", 158 | BID_EFP_COMPUTATION: "BID_EFP_COMPUTATION", 159 | ASK_EFP_COMPUTATION: "ASK_EFP_COMPUTATION", 160 | LAST_EFP_COMPUTATION: "LAST_EFP_COMPUTATION", 161 | OPEN_EFP_COMPUTATION: "OPEN_EFP_COMPUTATION", 162 | HIGH_EFP_COMPUTATION: "HIGH_EFP_COMPUTATION", 163 | LOW_EFP_COMPUTATION: "LOW_EFP_COMPUTATION", 164 | CLOSE_EFP_COMPUTATION: "CLOSE_EFP_COMPUTATION", 165 | LAST_TIMESTAMP: "LAST_TIMESTAMP", 166 | SHORTABLE: "SHORTABLE", 167 | FUNDAMENTAL_RATIOS: "FUNDAMENTAL_RATIOS", 168 | RT_VOLUME: "RT_VOLUME", 169 | HALTED: "HALTED", 170 | BID_YIELD: "BID_YIELD", 171 | ASK_YIELD: "ASK_YIELD", 172 | LAST_YIELD: "LAST_YIELD", 173 | CUST_OPTION_COMPUTATION: "CUST_OPTION_COMPUTATION", 174 | TRADE_COUNT: "TRADE_COUNT", 175 | TRADE_RATE: "TRADE_RATE", 176 | VOLUME_RATE: "VOLUME_RATE", 177 | LAST_RTH_TRADE: "LAST_RTH_TRADE", 178 | RT_HISTORICAL_VOL: "RT_HISTORICAL_VOL", 179 | IB_DIVIDENDS: "IB_DIVIDENDS", 180 | BOND_FACTOR_MULTIPLIER: "BOND_FACTOR_MULTIPLIER", 181 | REGULATORY_IMBALANCE: "REGULATORY_IMBALANCE", 182 | NEWS_TICK: "NEWS_TICK", 183 | SHORT_TERM_VOLUME_3_MIN: "SHORT_TERM_VOLUME_3_MIN", 184 | SHORT_TERM_VOLUME_5_MIN: "SHORT_TERM_VOLUME_5_MIN", 185 | SHORT_TERM_VOLUME_10_MIN: "SHORT_TERM_VOLUME_10_MIN", 186 | DELAYED_BID: "DELAYED_BID", 187 | DELAYED_ASK: "DELAYED_ASK", 188 | DELAYED_LAST: "DELAYED_LAST", 189 | DELAYED_BID_SIZE: "DELAYED_BID_SIZE", 190 | DELAYED_ASK_SIZE: "DELAYED_ASK_SIZE", 191 | DELAYED_LAST_SIZE: "DELAYED_LAST_SIZE", 192 | DELAYED_HIGH: "DELAYED_HIGH", 193 | DELAYED_LOW: "DELAYED_LOW", 194 | DELAYED_VOLUME: "DELAYED_VOLUME", 195 | DELAYED_CLOSE: "DELAYED_CLOSE", 196 | DELAYED_OPEN: "DELAYED_OPEN", 197 | RT_TRD_VOLUME: "RT_TRD_VOLUME", 198 | CREDITMAN_MARK_PRICE: "CREDITMAN_MARK_PRICE", 199 | CREDITMAN_SLOW_MARK_PRICE: "CREDITMAN_SLOW_MARK_PRICE", 200 | DELAYED_BID_OPTION: "DELAYED_BID_OPTION", 201 | DELAYED_ASK_OPTION: "DELAYED_ASK_OPTION", 202 | DELAYED_LAST_OPTION: "DELAYED_LAST_OPTION", 203 | DELAYED_MODEL_OPTION: "DELAYED_MODEL_OPTION", 204 | LAST_EXCH: "LAST_EXCH", 205 | LAST_REG_TIME: "LAST_REG_TIME", 206 | FUTURES_OPEN_INTEREST: "FUTURES_OPEN_INTEREST", 207 | AVG_OPT_VOLUME: "AVG_OPT_VOLUME", 208 | DELAYED_LAST_TIMESTAMP: "DELAYED_LAST_TIMESTAMP", 209 | SHORTABLE_SHARES: "SHORTABLE_SHARES", 210 | DELAYED_HALTED: "DELAYED_HALTED", 211 | REUTERS_2_MUTUAL_FUNDS: "REUTERS_2_MUTUAL_FUNDS", 212 | ETF_NAV_CLOSE: "ETF_NAV_CLOSE", 213 | ETF_NAV_PRIOR_CLOSE: "ETF_NAV_PRIOR_CLOSE", 214 | ETF_NAV_BID: "ETF_NAV_BID", 215 | ETF_NAV_ASK: "ETF_NAV_ASK", 216 | ETF_NAV_LAST: "ETF_NAV_LAST", 217 | ETF_FROZEN_NAV_LAST: "ETF_FROZEN_NAV_LAST", 218 | ETF_NAV_HIGH: "ETF_NAV_HIGH", 219 | ETF_NAV_LOW: "ETF_NAV_LOW", 220 | SOCIAL_MARKET_ANALYTICS: "SOCIAL_MARKET_ANALYTICS", 221 | ESTIMATED_IPO_MIDPOINT: "ESTIMATED_IPO_MIDPOINT", 222 | FINAL_IPO_LAST: "FINAL_IPO_LAST", 223 | DELAYED_YIELD_BID: "DELAYED_YIELD_BID", 224 | DELAYED_YIELD_ASK: "DELAYED_YIELD_ASK", 225 | NOT_SET: "NOT_SET", 226 | } 227 | 228 | func IsPrice(tickType TickType) bool { 229 | return tickType == BID || tickType == ASK || tickType == LAST || tickType == DELAYED_BID || tickType == DELAYED_ASK || tickType == DELAYED_LAST 230 | } 231 | -------------------------------------------------------------------------------- /time_condition.go: -------------------------------------------------------------------------------- 1 | package ibapi 2 | 3 | import "fmt" 4 | 5 | // var _ OrderCondition = (*TimeCondition)(nil) 6 | // var _ ContractCondition = (*TimeCondition)(nil) 7 | var _ OperatorCondition = (*TimeCondition)(nil) 8 | 9 | type TimeCondition struct { 10 | *operatorCondition 11 | Time string 12 | } 13 | 14 | func newTimeCondition() *TimeCondition { 15 | return &TimeCondition{operatorCondition: newOperatorCondition(TimeOrderCondition)} 16 | } 17 | 18 | func (tc *TimeCondition) decode(msgBuf *MsgBuffer) { 19 | tc.operatorCondition.decode(msgBuf) 20 | tc.Time = msgBuf.decodeString() 21 | } 22 | 23 | func (tc TimeCondition) makeFields() []any { 24 | return append(tc.operatorCondition.makeFields(), tc.Time) 25 | } 26 | 27 | func (tc TimeCondition) String() string { 28 | return fmt.Sprintf("time is %s", tc.operatorCondition.stringWithOperator(tc.Time)) 29 | } 30 | -------------------------------------------------------------------------------- /utils.go: -------------------------------------------------------------------------------- 1 | package ibapi 2 | 3 | import ( 4 | "bytes" 5 | "encoding/binary" 6 | "fmt" 7 | "io" 8 | "strconv" 9 | "time" 10 | ) 11 | 12 | const ( 13 | delim byte = '\x00' 14 | // MAX_MSG_LEN is the max length that receiver could take. 15 | MAX_MSG_LEN int = 0xFFFFFF // 16Mb - 1byte 16 | RAW_INT_LEN int = 4 17 | ) 18 | 19 | // scanFields defines how to unpack the buf 20 | func scanFields(data []byte, atEOF bool) (advance int, token []byte, err error) { 21 | if atEOF { 22 | return 0, nil, io.EOF 23 | } 24 | 25 | if len(data) < 4 { 26 | return 0, nil, nil // will try to read more data 27 | } 28 | 29 | totalSize := int(binary.BigEndian.Uint32(data[:4])) + 4 30 | 31 | if totalSize > len(data) { 32 | return 0, nil, nil 33 | } 34 | 35 | // msgBytes := make([]byte, totalSize-4, totalSize-4) 36 | // copy(msgBytes, data[4:totalSize]) 37 | // not copy here, copied by callee more reasonable 38 | return totalSize, data[4:totalSize], nil 39 | } 40 | 41 | // MsgBuffer is the buffer that contains a whole msg. 42 | type MsgBuffer struct { 43 | bytes.Buffer 44 | bs []byte 45 | err error 46 | } 47 | 48 | // NewMsgBuffer create a new MsgBuffer. 49 | func NewMsgBuffer(bs []byte) *MsgBuffer { 50 | return &MsgBuffer{*bytes.NewBuffer(bs), nil, nil} 51 | } 52 | 53 | func (m *MsgBuffer) decode() { 54 | _, m.err = m.ReadBytes(delim) 55 | if m.err != nil { 56 | log.Panic().Err(m.err).Msg("decode read error") 57 | } 58 | } 59 | 60 | func (m *MsgBuffer) decodeInt64() int64 { 61 | var i int64 62 | m.bs, m.err = m.ReadBytes(delim) 63 | if m.err != nil { 64 | log.Panic().Err(m.err).Msg("decode int64 read error") 65 | } 66 | 67 | m.bs = m.bs[:len(m.bs)-1] 68 | if bytes.Equal(m.bs, nil) { 69 | return 0 70 | } 71 | 72 | i, m.err = strconv.ParseInt(string(m.bs), 10, 64) 73 | if m.err != nil { 74 | fmt.Println(string(m.bs)) 75 | log.Panic().Err(m.err).Msg("decode int64 parse error") 76 | } 77 | 78 | return i 79 | } 80 | 81 | func (m *MsgBuffer) decodeRawInt64() int64 { 82 | // Ensure there's enough data in the buffer 83 | if m.Len() < RAW_INT_LEN { 84 | log.Panic().Err(m.err).Msg("decode raw int64 read error") 85 | } 86 | 87 | // Read 4 bytes 88 | buf := make([]byte, RAW_INT_LEN) 89 | n, err := m.Read(buf) 90 | if err != nil || n != RAW_INT_LEN { 91 | log.Panic().Err(err).Msg("decode raw int64 read error") 92 | } 93 | 94 | // Update m.bs to contain the remaining buffer 95 | m.bs = m.Bytes() 96 | 97 | // Convert directly to int64 using LittleEndian 98 | return int64(binary.BigEndian.Uint32(buf)) 99 | } 100 | 101 | func (m *MsgBuffer) decodeDecimal() Decimal { 102 | m.bs, m.err = m.ReadBytes(delim) 103 | if m.err != nil { 104 | log.Panic().Err(m.err).Msg("decode decimal read error") 105 | } 106 | 107 | d := StringToDecimal(string(m.bs[:len(m.bs)-1])) 108 | return d 109 | } 110 | 111 | func (m *MsgBuffer) decodeInt64ShowUnset() int64 { 112 | var i int64 113 | m.bs, m.err = m.ReadBytes(delim) 114 | if m.err != nil { 115 | log.Panic().Err(m.err).Msg("decode int64ShowUnset read error") 116 | } 117 | 118 | m.bs = m.bs[:len(m.bs)-1] 119 | if bytes.Equal(m.bs, nil) { 120 | return UNSET_INT 121 | } 122 | 123 | i, m.err = strconv.ParseInt(string(m.bs), 10, 64) 124 | if m.err != nil { 125 | log.Panic().Err(m.err).Msg("decode int64ShowUnset parse error") 126 | } 127 | 128 | return i 129 | } 130 | 131 | func (m *MsgBuffer) decodeFloat64() float64 { 132 | var f float64 133 | m.bs, m.err = m.ReadBytes(delim) 134 | if m.err != nil { 135 | log.Panic().Err(m.err).Msg("decode float64 read error") 136 | } 137 | 138 | m.bs = m.bs[:len(m.bs)-1] 139 | if bytes.Equal(m.bs, nil) { 140 | return 0.0 141 | } 142 | 143 | f, m.err = strconv.ParseFloat(string(m.bs), 64) 144 | if m.err != nil { 145 | log.Panic().Err(m.err).Msg("decode float64 parse error") 146 | } 147 | 148 | return f 149 | } 150 | 151 | func (m *MsgBuffer) decodeFloat64ShowUnset() float64 { 152 | var f float64 153 | m.bs, m.err = m.ReadBytes(delim) 154 | if m.err != nil { 155 | log.Panic().Err(m.err).Msg("decode float64ShowUnset read error") 156 | } 157 | 158 | m.bs = m.bs[:len(m.bs)-1] 159 | if bytes.Equal(m.bs, nil) || bytes.Equal(m.bs, []byte("None")) { 160 | return UNSET_FLOAT 161 | } 162 | 163 | f, m.err = strconv.ParseFloat(string(m.bs), 64) 164 | if m.err != nil { 165 | log.Panic().Err(m.err).Msg("decode float64ShowUnset parse error") 166 | } 167 | 168 | return f 169 | } 170 | 171 | func (m *MsgBuffer) decodeBool() bool { 172 | m.bs, m.err = m.ReadBytes(delim) 173 | if m.err != nil { 174 | log.Panic().Err(m.err).Msg("decode bool read error") 175 | } 176 | 177 | m.bs = m.bs[:len(m.bs)-1] 178 | 179 | if bytes.Equal(m.bs, []byte{'0'}) || bytes.Equal(m.bs, nil) { 180 | return false 181 | } 182 | return true 183 | } 184 | 185 | func (m *MsgBuffer) decodeString() string { 186 | m.bs, m.err = m.ReadBytes(delim) 187 | if m.err != nil { 188 | log.Panic().Err(m.err).Msg("decode string read error") 189 | } 190 | 191 | return string(m.bs[:len(m.bs)-1]) 192 | } 193 | 194 | func (m *MsgBuffer) decodeStringUnescaped() string { 195 | m.bs, m.err = m.ReadBytes(delim) 196 | if m.err != nil { 197 | log.Panic().Err(m.err).Msg("decode string read error") 198 | } 199 | var s string 200 | s, m.err = strconv.Unquote(fmt.Sprint("\"", m.bs[:len(m.bs)-1], "\"")) 201 | if m.err != nil { 202 | log.Panic().Err(m.err).Msg("decode string unmarshal error") 203 | } 204 | return s 205 | } 206 | 207 | // Reset reset buffer, []byte, err. 208 | func (m *MsgBuffer) Reset() { 209 | m.Buffer.Reset() 210 | m.bs = m.bs[:0] 211 | m.err = nil 212 | } 213 | 214 | func makeField(val any) string { 215 | return fmt.Sprintf("%v\x00", val) 216 | } 217 | 218 | func splitMsgBytes(data []byte) [][]byte { 219 | fields := bytes.Split(data, []byte{delim}) 220 | return fields[:len(fields)-1] 221 | } 222 | 223 | func stringIsEmpty(s string) bool { 224 | return s == "" 225 | } 226 | 227 | func isValidFloat64Value(val float64) bool { 228 | return val != UNSET_FLOAT 229 | } 230 | 231 | func isValidInt64Value(val int64) bool { 232 | return val != UNSET_INT && val != UNSET_LONG 233 | } 234 | 235 | func isValidDecimalValue(val Decimal) bool { 236 | return val != UNSET_DECIMAL 237 | } 238 | 239 | func FloatMaxString(val float64) string { 240 | if val == UNSET_FLOAT { 241 | return "" 242 | } 243 | return strconv.FormatFloat(val, 'g', 10, 64) 244 | } 245 | 246 | func LongMaxString(val int64) string { 247 | if val == UNSET_LONG { 248 | return "" 249 | } 250 | return strconv.FormatInt(val, 10) 251 | } 252 | 253 | func IntMaxString(val int64) string { 254 | if val == UNSET_INT { 255 | return "" 256 | } 257 | return strconv.FormatInt(val, 10) 258 | } 259 | 260 | func DecimalMaxString(val Decimal) string { 261 | if val == UNSET_DECIMAL { 262 | return "" 263 | } 264 | return DecimalToString(val) 265 | } 266 | 267 | // CurrentTimeMillis returns the current time in milliseconds. 268 | func currentTimeMillis() int64 { 269 | return time.Now().UnixNano() / int64(time.Millisecond) 270 | } 271 | 272 | // GetTimeStrFromMillis converts a timestamp in milliseconds to a formatted string. 273 | // Returns an empty string if the input time is less than or equal to zero. 274 | func GetTimeStrFromMillis(timestamp int64) string { 275 | if timestamp > 0 { 276 | return time.Unix(0, timestamp*int64(time.Millisecond)).Format("20060102-15:04:05") 277 | } 278 | return "" 279 | } 280 | 281 | // isASCIIPrintable checks if all characters in the given string are ASCII printable characters. 282 | func isASCIIPrintable(s string) bool { 283 | for _, r := range s { 284 | if r == '\t' || r == '\n' || r == '\r' || r < 32 || r > 126 { 285 | return false 286 | } 287 | } 288 | return true 289 | } 290 | 291 | func BoolToInt64(b bool) int64 { 292 | if b { 293 | return 1 294 | } 295 | return 0 296 | } 297 | -------------------------------------------------------------------------------- /volume_condition.go: -------------------------------------------------------------------------------- 1 | package ibapi 2 | 3 | import ( 4 | "fmt" 5 | "strconv" 6 | ) 7 | 8 | // var _ OrderCondition = (*VolumeCondition)(nil) 9 | var _ ContractCondition = (*VolumeCondition)(nil) 10 | 11 | type VolumeCondition struct { 12 | *contractCondition 13 | Volume int64 14 | } 15 | 16 | func newVolumeCondition() *VolumeCondition { 17 | return &VolumeCondition{contractCondition: newContractCondition(VolumeOrderCondition)} 18 | } 19 | 20 | func (vc *VolumeCondition) decode(msgBuf *MsgBuffer) { 21 | vc.contractCondition.decode(msgBuf) 22 | vc.Volume = msgBuf.decodeInt64() 23 | } 24 | 25 | func (vc VolumeCondition) makeFields() []any { 26 | return append(vc.contractCondition.makeFields(), vc.Volume) 27 | } 28 | 29 | func (vc VolumeCondition) String() string { 30 | volume := strconv.FormatInt(vc.Volume, 10) 31 | return fmt.Sprintf("%s %s", vc.contractCondition, vc.operatorCondition.stringWithOperator(volume)) 32 | } 33 | -------------------------------------------------------------------------------- /wsh_event_data.go: -------------------------------------------------------------------------------- 1 | package ibapi 2 | 3 | import "fmt" 4 | 5 | // WshEventData . 6 | type WshEventData struct { 7 | ConID int64 // UNSET_INT 8 | Filter string 9 | FillWatchList bool 10 | FillPortfolio bool 11 | FillCompetitors bool 12 | StartDate string 13 | EndDate string 14 | TotalLimit int64 // UNSET_INT 15 | } 16 | 17 | func NewWshEventData() WshEventData { 18 | wed := WshEventData{} 19 | wed.ConID = UNSET_INT 20 | wed.TotalLimit = UNSET_INT 21 | return wed 22 | } 23 | 24 | func (w WshEventData) String() string { 25 | return fmt.Sprintf("WshEventData. ConId: %s, Filter: %s, Fill Watchlist: %t, Fill Portfolio: %t, Fill Competitors: %t", 26 | IntMaxString(w.ConID), w.Filter, w.FillWatchList, w.FillPortfolio, w.FillCompetitors) 27 | } 28 | --------------------------------------------------------------------------------