Skip to content

Commit

Permalink
Merge pull request #9 from hadrianl/debug
Browse files Browse the repository at this point in the history
Debug
  • Loading branch information
hadrianl authored May 2, 2020
2 parents 6552a6a + ebbb80f commit cc40cc0
Show file tree
Hide file tree
Showing 16 changed files with 799 additions and 454 deletions.
45 changes: 43 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
# Interactive Brokers API - GoLang Version
# Interactive Brokers API - GoLang Implement
Interactive Brokers API 9.79
pure golang, Unofficial version, smilar to the official python version
pure golang, Unofficial, smilar to the official python Implement


## INSTALL
`go get -u github.com/hadrianl/ibapi`

## USAGE
### demo1
```golang
import (
. "github.com/hadrianl/ibapi"
Expand Down Expand Up @@ -42,5 +43,45 @@ func main(){

```

### demo2 with context
```golang
import (
. "github.com/hadrianl/ibapi"
"time"
"context"
log "github.com/sirupsen/logrus"
)

func main(){
var err error
ibwrapper := &Wrapper{}
ctx, _ := context.WithTimeout(context.Background(), time.Second*30)
ic := NewIbClient(ibwrapper)
ic.SetContext(ctx)
err = ic.Connect("172.0.0.1", 4002, 0)
if err != nil {
log.Panic("Connect failed:", err)
return
}

err = ic.HandShake()
if err != nil {
log.Println("HandShake failed:", err)
return
}

ic.ReqCurrentTime()
ic.ReqAutoOpenOrders(true)
ic.ReqAccountUpdates(true, "")
ic.ReqExecutions(ic.GetReqID(), ExecutionFilter{})

ic.Run()

err = ic.LoopUntilDone() // block until ctx or ic is done, also,
fmt.Println(err)
}

```

## Reference
1.[Offical Document](https://interactivebrokers.github.io/tws-api/)
Loading

0 comments on commit cc40cc0

Please sign in to comment.