Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for delayed/frozen market data #33

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions eclientsocket.go
Original file line number Diff line number Diff line change
Expand Up @@ -1340,6 +1340,13 @@ func (r *RequestGlobalCancel) code() OutgoingMessageID { return mRequestGlob
func (r *RequestGlobalCancel) version() int64 { return 1 }
func (r *RequestGlobalCancel) write(b *bytes.Buffer) error { return nil }

const (
MarketDataTypeLive = 1
MarketDataTypeFrozen = 2
MarketDataTypeDelayed = 3
MarketDataTypeDelayedFrozen = 4
)

// RequestMarketDataType is equivalent of IB API EClientSocket.reqMarketDataType()
type RequestMarketDataType struct {
MarketDataType int64
Expand Down
8 changes: 4 additions & 4 deletions instrument_manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,18 +45,18 @@ func (i *InstrumentManager) receive(r Reply) (UpdateStatus, error) {
switch r.(type) {
case *ErrorMessage:
r := r.(*ErrorMessage)
if r.SeverityWarning() {
if r.SeverityWarning() || r.Code == 10167 /*displaying delayed market data*/ {
return UpdateFalse, nil
}
return UpdateFalse, r.Error()
case *TickPrice:
r := r.(*TickPrice)
switch r.Type {
case TickLast:
case TickLast, TickDelayedLast:
i.last = r.Price
case TickBid:
case TickBid, TickDelayedBid:
i.bid = r.Price
case TickAsk:
case TickAsk, TickDelayedAsk:
i.ask = r.Price
}
}
Expand Down
7 changes: 7 additions & 0 deletions tick_type.go
Original file line number Diff line number Diff line change
Expand Up @@ -67,4 +67,11 @@ const (
TickLastRTHTrade = 57
TickNotSet = 58
TickRegulatoryImbalance = 61
TickNews = 62
TickShortTermVolume3Min = 63
TickShortTermVolume5Min = 64
TickShortTermVolume10Min = 65
TickDelayedBid = 66
TickDelayedAsk = 67
TickDelayedLast = 68
)