Skip to content

Commit

Permalink
rename trade callbacks to trade update callbacks
Browse files Browse the repository at this point in the history
  • Loading branch information
c9s committed Oct 31, 2020
1 parent 224acd0 commit 74a9cae
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 9 deletions.
7 changes: 7 additions & 0 deletions pkg/types/orderbook.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,13 @@ func (slice PriceVolumeSlice) Copy() PriceVolumeSlice {
return append(slice[:0:0], slice...)
}

func (slice PriceVolumeSlice) First() (PriceVolume, bool) {
if len(slice) > 0 {
return slice[0], true
}
return PriceVolume{}, false
}

func (slice PriceVolumeSlice) IndexByVolumeDepth(requiredVolume fixedpoint.Value) int {
var tv int64 = 0
for x, el := range slice {
Expand Down
24 changes: 17 additions & 7 deletions pkg/types/standardstream_callbacks.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 5 additions & 2 deletions pkg/types/stream.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,11 @@ var KLineChannel = Channel("kline")
type StandardStream struct {
Subscriptions []Subscription

// private trade callbacks
tradeCallbacks []func(trade Trade)
// private trade update callbacks
tradeUpdateCallbacks []func(trade Trade)

// private order update callbacks
orderUpdateCallbacks []func(order Order)

// balance snapshot callbacks
balanceSnapshotCallbacks []func(balances map[string]Balance)
Expand Down

0 comments on commit 74a9cae

Please sign in to comment.