Skip to content

Commit a116cdc

Browse files
committed
Go 1.26 - Added hedgeMaxSize parameter to Order
1 parent f3ff722 commit a116cdc

3 files changed

Lines changed: 36 additions & 63 deletions

File tree

README.md

Lines changed: 30 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
[![Go Reference](https://pkg.go.dev/badge/github.com/scmhub/ibsync.svg)](https://pkg.go.dev/github.com/scmhub/ibsync)
33
[![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](https://opensource.org/licenses/MIT)
44

5-
# Interactive Brokers Synchronous Golang Client
5+
# Interactive Brokers Synchronous Golang Client
66

77
`ibsync` is a Go package designed to simplify interaction with the [Interactive Brokers](https://www.interactivebrokers.com/en/home.php) API. It is inspired by the great [ib_insync](https://github.com/erdewit/ib_insync) Python library and based on [ibapi](https://github.com/scmhub/ibapi). It provides a synchronous, easy-to-use interface for account management, trade execution, real-time and historical market data within the IB ecosystem.
88

@@ -12,18 +12,22 @@
1212
## Getting Started
1313

1414
### Prerequisites
15-
- **Go** version 1.23 or higher (recommended)
15+
16+
- **Go** version 1.26 or higher (recommended)
1617
- An **Interactive Brokers** account with TWS or IB Gateway installed and running
1718

1819
### Installation
20+
1921
Install the package via `go get`:
2022

2123
```bash
2224
go get -u github.com/scmhub/ibsync
2325
```
2426

2527
## Quick start
28+
2629
Here’s a basic example to connect and get the managed accounts list:
30+
2731
```go
2832
package main
2933

@@ -52,7 +56,9 @@ func main() {
5256
## Usage guide
5357

5458
### Configuration
59+
5560
Connect with a different configuration.
61+
5662
```go
5763
// New IB client & Connect
5864
ib := ibsync.NewIB()
@@ -73,7 +79,9 @@ defer ib.Disconnect()
7379
```
7480

7581
### Account
82+
7683
Account value, summary, positions, trades...
84+
7785
```go
7886
// Account Values
7987
accountValues := ib.AccountValues()
@@ -97,7 +105,9 @@ openTrades := ib.OpenTrades()
97105
```
98106

99107
### Contract details
108+
100109
Request contract details from symbol, exchange
110+
101111
```go
102112
// NewStock("AMD", "", "")
103113
amd := ibsync.NewStock("AMD", "", "")
@@ -110,7 +120,9 @@ fmt.Println("number of contract found for request NewStock(\"AMD\", \"\", \"\")
110120
```
111121

112122
### Pnl
123+
113124
Subscribe to the pnl stream
125+
114126
```go
115127
// Request PnL subscription for the account.
116128
ib.ReqPnL(account, modelCode)
@@ -130,7 +142,9 @@ fmt.Println("Current PnL:", pnl)
130142
```
131143

132144
### Orders
145+
133146
Place an order and create a new trade. Modify or cancel the trade. Cancel all trades
147+
134148
```go
135149
// Create the contract
136150
eurusd := ibsync.NewForex("EUR", "IDEALPRO", "USD")
@@ -154,7 +168,9 @@ ib.ReqGlobalCancel()
154168
```
155169

156170
### Bar data
171+
157172
Real time and historical bar data.
173+
158174
```go
159175
// Historical data
160176
barChan, _ := ib.ReqHistoricalData(eurusd, endDateTime, duration, barSize, whatToShow, useRTH, formatDate)
@@ -180,7 +196,9 @@ cancel()
180196
```
181197

182198
### Tick data
199+
183200
Real time and historical tick data.
201+
184202
```go
185203
// Snapshot - Market price
186204
snapshot, err := ib.Snapshot(eurusd)
@@ -199,7 +217,9 @@ historicalTicks, err, done := ib.ReqHistoricalTicks(aapl, startDateTime, time.Ti
199217
```
200218

201219
### Scanner
220+
202221
Request scanner parameters and scanner subscritpion
222+
203223
```go
204224
// Scanner Parameters
205225
xml, err := ib.ReqScannerParameters()
@@ -225,24 +245,29 @@ filterScanData, err := ib.ReqScannerSubscription(scanSubscription, opts)
225245
```
226246

227247
## Documentation
248+
228249
For more information on how to use this package, please refer to the [GoDoc](https://pkg.go.dev/github.com/scmhub/ibsync) documentation and check the [examples](https://github.com/scmhub/ibsync/tree/main/examples) directory. You can also have a look at the `ib_test.go` file
229250

230251
## Acknowledgments
252+
231253
- [ibapi](https://github.com/scmhub/ibapi) for core API functionality.
232254
- [ib_insync](https://github.com/erdewit/ib_insync) for API inspiration. (ib_insync is now [ib_async](https://github.com/ib-api-reloaded/ib_async))
233255

234256
## Notice of Non-Affiliation and Disclaimer
257+
235258
> [!CAUTION]
236259
> 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.
237260
238261
> [!IMPORTANT]
239-
>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.
262+
> 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.
240263
241264
> [!IMPORTANT]
242-
>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.
265+
> 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.
243266
244267
## License
268+
245269
Distributed under the MIT License. See [LICENSE](./LICENSE) for more information.
246270

247271
## Author
248-
**Philippe Chavanne** - [contact](https://scm.cx/contact)
272+
273+
**Philippe Chavanne** - [contact](https://scm.cx/contact)

go.mod

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
module github.com/scmhub/ibsync
22

3-
go 1.25
3+
go 1.26
44

55
require (
66
github.com/rs/zerolog v1.34.0
7-
github.com/scmhub/ibapi v0.10.44
7+
github.com/scmhub/ibapi v0.10.45-0.20260304215041-33f7d11f8b2b
88
)
99

1010
require (

go.sum

Lines changed: 4 additions & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
github.com/coreos/go-systemd/v22 v22.5.0/go.mod h1:Y58oyj3AT4RCenI/lSvhwexgC+NSVTIJ3seZv2GcEnc=
22
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=
3+
github.com/google/go-cmp v0.7.0 h1:wk8382ETsv4JYUZwIsn6YpYiWiBsYLSJiTsyBybVuN8=
4+
github.com/google/go-cmp v0.7.0/go.mod h1:pXiqmnSA92OHEEa9HXL2W4E7lf9JzCmGVUdgjX3N/iU=
55
github.com/mattn/go-colorable v0.1.13/go.mod h1:7S9/ev0klgBDR4GtXTXX8a3vIGJpMovkB8vQcUbaXHg=
66
github.com/mattn/go-colorable v0.1.14 h1:9A9LHSqF/7dyVVX6g0U9cwm9pG3kP9gSzcuIPHPsaIE=
77
github.com/mattn/go-colorable v0.1.14/go.mod h1:6LmQG8QLFO4G5z1gPvYEzlUgJ2wF+stgPZH1UqBm1s8=
@@ -12,71 +12,19 @@ github.com/mattn/go-isatty v0.0.20/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D
1212
github.com/mattn/go-sqlite3 v1.14.22 h1:2gZY6PC6kBnID23Tichd1K+Z0oS6nE/XwU+Vz/5o4kU=
1313
github.com/mattn/go-sqlite3 v1.14.22/go.mod h1:Uh1q+B4BYcTPb+yiD3kU8Ct7aC0hY9fxUwlHK0RXw+Y=
1414
github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
15-
github.com/robaho/fixed v0.0.0-20250130054609-fd0e46fcd988 h1:aHw3VW2Oe8Q2Icq1eUradihZqn/zBVlNQonXw+swAgM=
16-
github.com/robaho/fixed v0.0.0-20250130054609-fd0e46fcd988/go.mod h1:gOuZr6norIEHlPghhACq3f8PL6ZFF5uJVMOgh2/M7xQ=
1715
github.com/robaho/fixed v0.0.0-20251201003256-beee5759f86a h1:aeGponfnGZvVKhjkKOUv3uW/UcpmgLCp77IaDOvqoFM=
1816
github.com/robaho/fixed v0.0.0-20251201003256-beee5759f86a/go.mod h1:gOuZr6norIEHlPghhACq3f8PL6ZFF5uJVMOgh2/M7xQ=
1917
github.com/rs/xid v1.6.0/go.mod h1:7XoLgs4eV+QndskICGsho+ADou8ySMSjJKDIan90Nz0=
2018
github.com/rs/zerolog v1.34.0 h1:k43nTLIwcTVQAncfCw4KZ2VY6ukYoZaBPNOE8txlOeY=
2119
github.com/rs/zerolog v1.34.0/go.mod h1:bJsvje4Z08ROH4Nhs5iH600c3IkWhwp44iRc54W6wYQ=
22-
github.com/scmhub/ibapi v0.10.40-0.20250901153504-b1b6b69dd307 h1:wimPwlWZGvLfGBKj4ZrRumU6NIMSdxtHFIA178Iuvls=
23-
github.com/scmhub/ibapi v0.10.40-0.20250901153504-b1b6b69dd307/go.mod h1:agnBUsviLLjmglbUZVwZSvBkT07aG+H5941hklh8+Hs=
24-
github.com/scmhub/ibapi v0.10.40 h1:CoDan37xEvRJR+nLxGWOEBK3q2M/v7QIgfYzEqTGvRs=
25-
github.com/scmhub/ibapi v0.10.40/go.mod h1:agnBUsviLLjmglbUZVwZSvBkT07aG+H5941hklh8+Hs=
26-
github.com/scmhub/ibapi v0.10.41-0.20251001145137-48f7a91a8c76 h1:nzGVbfCAR/9G9lXVkvood6xB3IyjvdUoWotWIntkCwY=
27-
github.com/scmhub/ibapi v0.10.41-0.20251001145137-48f7a91a8c76/go.mod h1:agnBUsviLLjmglbUZVwZSvBkT07aG+H5941hklh8+Hs=
28-
github.com/scmhub/ibapi v0.10.41-0.20251004053232-e3a3c2561eac h1:OBAmkdzub1LNbhY6Hmh0yEwNmt2quNwClO2A6EM6ftU=
29-
github.com/scmhub/ibapi v0.10.41-0.20251004053232-e3a3c2561eac/go.mod h1:agnBUsviLLjmglbUZVwZSvBkT07aG+H5941hklh8+Hs=
30-
github.com/scmhub/ibapi v0.10.41-0.20251017163017-49f8dc9fac23 h1:IZYlYyIG1NE/jlJtxFCJlo5ZrE7mRaAVFq8b1xRnh20=
31-
github.com/scmhub/ibapi v0.10.41-0.20251017163017-49f8dc9fac23/go.mod h1:p3JXDMmQNWYhaZTTPaJOSkBmwSzUYeHOwevJYiJqcgc=
32-
github.com/scmhub/ibapi v0.10.41-0.20251103134903-19012e505448 h1:BOrfHssqkcbuF2fJYjMINnubBKOMAnZ/3wXuKc3d6MQ=
33-
github.com/scmhub/ibapi v0.10.41-0.20251103134903-19012e505448/go.mod h1:p3JXDMmQNWYhaZTTPaJOSkBmwSzUYeHOwevJYiJqcgc=
34-
github.com/scmhub/ibapi v0.10.41-0.20251105093634-8b1715fb616c h1:HU9jHRcbbIwJy+yGw3DgYL4Ph+lvDdsa74QYznoBHsc=
35-
github.com/scmhub/ibapi v0.10.41-0.20251105093634-8b1715fb616c/go.mod h1:p3JXDMmQNWYhaZTTPaJOSkBmwSzUYeHOwevJYiJqcgc=
36-
github.com/scmhub/ibapi v0.10.41-0.20251106152323-b971e06d9a8e h1:ZWMw2kn6vyKkDjfgRfnwRmn1KShWMjJ7x42JtzmhwpE=
37-
github.com/scmhub/ibapi v0.10.41-0.20251106152323-b971e06d9a8e/go.mod h1:p3JXDMmQNWYhaZTTPaJOSkBmwSzUYeHOwevJYiJqcgc=
38-
github.com/scmhub/ibapi v0.10.41-0.20251206071903-e17274c71b27 h1:IcG0NiiyWO9YccX65z35K5Mf21CY8Vi1WdmblMbCGzM=
39-
github.com/scmhub/ibapi v0.10.41-0.20251206071903-e17274c71b27/go.mod h1:p3JXDMmQNWYhaZTTPaJOSkBmwSzUYeHOwevJYiJqcgc=
40-
github.com/scmhub/ibapi v0.10.41 h1:vdjBysM94O7+fi4WZyjzkAt0SeLfYRvBJuhozrAblNA=
41-
github.com/scmhub/ibapi v0.10.41/go.mod h1:Q1BAnuGhSUb5YgS4Zvkf+UzdrnpYD57+t+nrPbA+5AU=
42-
github.com/scmhub/ibapi v0.10.42-0.20251209150719-e9dd2fc9c37f h1:fOUfwoXgq49b33MQLSLTMWOfNKyTaduRHX6vLvE10BA=
43-
github.com/scmhub/ibapi v0.10.42-0.20251209150719-e9dd2fc9c37f/go.mod h1:Q1BAnuGhSUb5YgS4Zvkf+UzdrnpYD57+t+nrPbA+5AU=
44-
github.com/scmhub/ibapi v0.10.42-0.20260103094808-e041120a5bab h1:6+IPVQyf9aIh6pVFIVc9Llw+6LKjTtA/IIG72M+iUYc=
45-
github.com/scmhub/ibapi v0.10.42-0.20260103094808-e041120a5bab/go.mod h1:Q1BAnuGhSUb5YgS4Zvkf+UzdrnpYD57+t+nrPbA+5AU=
46-
github.com/scmhub/ibapi v0.10.42 h1:OmRmwJXkNMM4m4bf+RFnkS3xNPtrqg3gYq7wFOXrtdw=
47-
github.com/scmhub/ibapi v0.10.42/go.mod h1:Q1BAnuGhSUb5YgS4Zvkf+UzdrnpYD57+t+nrPbA+5AU=
48-
github.com/scmhub/ibapi v0.10.43 h1:dswG2K6f00zcx3WZ+MnhVcMvnrUZrNl4XbNRAwKRpJw=
49-
github.com/scmhub/ibapi v0.10.43/go.mod h1:Q1BAnuGhSUb5YgS4Zvkf+UzdrnpYD57+t+nrPbA+5AU=
50-
github.com/scmhub/ibapi v0.10.44-0.20260223170735-35f92e30ed44 h1:e1/QzmNt0QqTJRc3E83ANUFQj52YvGhV+cEaXGzSVLU=
51-
github.com/scmhub/ibapi v0.10.44-0.20260223170735-35f92e30ed44/go.mod h1:Q1BAnuGhSUb5YgS4Zvkf+UzdrnpYD57+t+nrPbA+5AU=
52-
github.com/scmhub/ibapi v0.10.44-0.20260223173056-204509b1a2a8 h1:EZxnpr1DbxVPxNMpswv6nT8zR8+LJ/2uHBq8N2HRxZ0=
53-
github.com/scmhub/ibapi v0.10.44-0.20260223173056-204509b1a2a8/go.mod h1:Q1BAnuGhSUb5YgS4Zvkf+UzdrnpYD57+t+nrPbA+5AU=
54-
github.com/scmhub/ibapi v0.10.44 h1:gLor5W+a/prY6djomjS6Jbcoi/8p4NfephfAcPYtCnQ=
55-
github.com/scmhub/ibapi v0.10.44/go.mod h1:Q1BAnuGhSUb5YgS4Zvkf+UzdrnpYD57+t+nrPbA+5AU=
20+
github.com/scmhub/ibapi v0.10.45-0.20260304215041-33f7d11f8b2b h1:99nognIXvGObbCaG/YeY4C5mNw84Vm8ErgRFaNHLeUg=
21+
github.com/scmhub/ibapi v0.10.45-0.20260304215041-33f7d11f8b2b/go.mod h1:codoOOEwT48pn9R4pBQny41OLqqgwqLRC5Mm+OEEIhQ=
5622
github.com/shopspring/decimal v1.4.0 h1:bxl37RwXBklmTi0C79JfXCEBD1cqqHt0bbgBAGFp81k=
5723
github.com/shopspring/decimal v1.4.0/go.mod h1:gawqmDU56v4yIKSwfBSFip1HdCCXN8/+DMd9qYNcwME=
5824
golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
5925
golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
6026
golang.org/x/sys v0.12.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
61-
golang.org/x/sys v0.35.0 h1:vz1N37gP5bs89s7He8XuIYXpyY0+QlsKmzipCbUtyxI=
62-
golang.org/x/sys v0.35.0/go.mod h1:BJP2sWEmIv4KK5OTEluFJCKSidICx8ciO85XgH3Ak8k=
63-
golang.org/x/sys v0.36.0 h1:KVRy2GtZBrk1cBYA7MKu5bEZFxQk4NIDV6RLVcC8o0k=
64-
golang.org/x/sys v0.36.0/go.mod h1:OgkHotnGiDImocRcuBABYBEXf8A9a87e/uXjp9XT3ks=
65-
golang.org/x/sys v0.37.0 h1:fdNQudmxPjkdUTPnLn5mdQv7Zwvbvpaxqs831goi9kQ=
66-
golang.org/x/sys v0.37.0/go.mod h1:OgkHotnGiDImocRcuBABYBEXf8A9a87e/uXjp9XT3ks=
67-
golang.org/x/sys v0.38.0 h1:3yZWxaJjBmCWXqhN1qh02AkOnCQ1poK6oF+a7xWL6Gc=
68-
golang.org/x/sys v0.38.0/go.mod h1:OgkHotnGiDImocRcuBABYBEXf8A9a87e/uXjp9XT3ks=
69-
golang.org/x/sys v0.39.0 h1:CvCKL8MeisomCi6qNZ+wbb0DN9E5AATixKsvNtMoMFk=
70-
golang.org/x/sys v0.39.0/go.mod h1:OgkHotnGiDImocRcuBABYBEXf8A9a87e/uXjp9XT3ks=
7127
golang.org/x/sys v0.41.0 h1:Ivj+2Cp/ylzLiEU89QhWblYnOE9zerudt9Ftecq2C6k=
7228
golang.org/x/sys v0.41.0/go.mod h1:OgkHotnGiDImocRcuBABYBEXf8A9a87e/uXjp9XT3ks=
73-
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543 h1:E7g+9GITq07hpfrRu66IVDexMakfv52eLZ2CXBWiKr4=
74-
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
75-
google.golang.org/protobuf v1.36.8 h1:xHScyCOEuuwZEc6UtSOvPbAT4zRh0xcNRYekJwfqyMc=
76-
google.golang.org/protobuf v1.36.8/go.mod h1:fuxRtAxBytpl4zzqUh6/eyUujkJdNiuEkXntxiD/uRU=
77-
google.golang.org/protobuf v1.36.9 h1:w2gp2mA27hUeUzj9Ex9FBjsBm40zfaDtEWow293U7Iw=
78-
google.golang.org/protobuf v1.36.9/go.mod h1:fuxRtAxBytpl4zzqUh6/eyUujkJdNiuEkXntxiD/uRU=
79-
google.golang.org/protobuf v1.36.10 h1:AYd7cD/uASjIL6Q9LiTjz8JLcrh/88q5UObnmY3aOOE=
80-
google.golang.org/protobuf v1.36.10/go.mod h1:HTf+CrKn2C3g5S8VImy6tdcUvCska2kB7j23XfzDpco=
8129
google.golang.org/protobuf v1.36.11 h1:fV6ZwhNocDyBLK0dj+fg8ektcVegBBuEolpbTQyBNVE=
8230
google.golang.org/protobuf v1.36.11/go.mod h1:HTf+CrKn2C3g5S8VImy6tdcUvCska2kB7j23XfzDpco=

0 commit comments

Comments
 (0)