Comments (4)
See if nothize#1 is related.
from ib.
Hello Gareth,
Not sure if you have resolved this issue yet, hopefully the following is helpful.
The InstrumentManager
is not documented how it works. I am not sure of the history of it, but it looks to be used for testing the code. It is used to get one result based on test code.
My guess is the channel inside mgr
is no longer reading the reply channel.
manager.go
has a full documentation about how managers are supposed to work. Depending on your goal, you might need to implement your own manager.
Or you can start will the following code (hopefully it works, my environment is not setup market data):
func main() {
options := ib.EngineOptions{}
engine, err := ib.NewEngine(options)
if err != nil {
log.Fatal(err)
}
rc := make(chan ib.Reply)
req := &ib.RequestMarketData{}
req.Contract = ib.Contract{
Symbol: "USD",
SecurityType: "CASH",
Exchange: "IDEALPRO",
Currency: "ZAR"}
req.SetID(engine.NextRequestID())
engine.Send(req)
for {
select {
case r := <-rc:
fmt.Println(r)
switch r.(type) {
case *ib.TickPrice:
tick := r.(*ib.TickPrice)
switch tick.Type {
case ib.TickLast:
fmt.Printf("%v: Last %v", tick.ID(), tick.Price)
case ib.TickBid:
fmt.Printf("%v: Bid %v", tick.ID(), tick.Price)
case ib.TickAsk:
fmt.Printf("%v: Ask %v", tick.ID(), tick.Price)
}
}
}
}
}
from ib.
Thank you so much for getting back to me. I ended up solving the issue.
the code opens up 2 responses from the IB workstation. 1 when on the engine. and then another when i created the instrument manager (which i thought would have gone to the engine one). then in my select case statement i was only doing the drain for the engine channel that is created and never drained the instrument manager channel <- if that makes sense :)
so in my code above if i add notify:=mgr.Refresh() and then just listen for notify:
engine,_:=ib.NewEngine(ib.EngineOptions{})
rc := make(chan ib.Reply)
mgr,_:=ib.NewInstrumentManager(engine, ib.Contract{
Symbol: "USD",
SecurityType: "CASH",
Exchange: "IDEALPRO",
Currency: "ZAR",
})
s:=ib.RequestMarketDataType{
MarketDataType: 1,
}
notify:=mgr.Refresh()
engine.Send(&s)
engine.SubscribeAll(rc)
for {
select {
case <-notify:
fmt.Println(mgr.Ask())
case r := <-rc:
//whatever you want to do with engine responses
}
}
from ib.
Your code with Refresh
looks to be the correct solution over mine.
from ib.
Related Issues (16)
- Gitter chat room HOT 2
- Placing A Basic Order HOT 5
- Sell in FA Group HOT 2
- missing request types?
- Manager returned an error after 0 updates: SinkManager: no new update in 15s
- NewInstrumentManager does not seem to work. HOT 2
- Large file issue in git repo
- RequestRealTimeBars Example HOT 3
- Go test not working HOT 4
- `go test` not working HOT 1
- TWS API v9.72+? HOT 5
- noob question: how can I access to my portfolio? HOT 1
- can this also work with CP web gateway ? HOT 1
- G
- Can not connect to TWS on Win32 HOT 14
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from ib.