Comments (3)
Can you post what you have implement? Make sure you subscribe to get a response for request ID or all responses.
I have example code available here for other types of requests:
https://github.com/dsouzae/ibstockcli
I do not have an example for RequestRealtimeBars, but I will see if I can get a working example ready for tomorrow.
from ib.
Thank you @dsouzae, your repo really helped me out. I would suggest anyone looking for examples to check out the code for the same.
from ib.
I have pushed some changes in the ibstockcli. Here are some details.
Make sure you either call SubscribeAll(...)
or Subscribe(...,id)
with the request id to get the responses on your reply change.
Make the request:
func doRequestRealTimeBars(mgr *IBManager, symbol string) {
request := ib.RequestRealTimeBars{
Contract: NewContract(symbol),
BarSize: 5,
WhatToShow: ib.RealTimeTrades,
UseRTH: true,
}
id := mgr.NextOrderID()
request.SetID(id)
mgr.realtimeMap[id] = symbol
mgr.engine.Send(&request)
log.Printf("%s: Sending RealTime Bars For %s", mgr.label, symbol)
}
I added a map to save the request id to get the symbol string.
In your engineLoop
add support to output realtime bars. Also using the map to get the symbol name:
case (*ib.RealtimeBars):
r := r.(*ib.RealtimeBars)
symbol, ok := ibmanager.realtimeMap[r.ID()]
if !ok {
symbol = "???"
}
log.Printf("%10s: %v - Open: %10.2f Close: %10.2f Low %10.2f High %10.2f Volume %10.2f Count %10v WAP %10.2f\n",
symbol,
time.Unix(r.Time, 0).Format("15:04:05"),
r.Open,
r.Close,
r.Low,
r.High,
r.Volume,
r.Count,
r.WAP)
from ib.
Related Issues (16)
- NewInstrumentManager does not seem to work. HOT 2
- Can not connect to TWS on Win32 HOT 14
- 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
- Large file issue in git repo
- 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
- Noob question: No streaming data for instrument manager HOT 4
- can this also work with CP web gateway ? HOT 1
- G
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.