mirror of
https://github.com/c9s/bbgo.git
synced 2024-11-24 15:55:14 +00:00
move bbo monitor to bbgo package
This commit is contained in:
parent
c8823e977f
commit
79b636fa02
|
@ -1,4 +1,4 @@
|
||||||
package twap
|
package bbgo
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"time"
|
"time"
|
|
@ -1,6 +1,6 @@
|
||||||
// Code generated by "callbackgen -type BboMonitor"; DO NOT EDIT.
|
// Code generated by "callbackgen -type BboMonitor"; DO NOT EDIT.
|
||||||
|
|
||||||
package twap
|
package bbgo
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/c9s/bbgo/pkg/types"
|
"github.com/c9s/bbgo/pkg/types"
|
|
@ -207,6 +207,7 @@ type Strategy struct {
|
||||||
HedgeExchange string `json:"hedgeExchange"`
|
HedgeExchange string `json:"hedgeExchange"`
|
||||||
|
|
||||||
UpdateInterval types.Duration `json:"updateInterval"`
|
UpdateInterval types.Duration `json:"updateInterval"`
|
||||||
|
UpdateLayers int `json:"updateLayers"`
|
||||||
|
|
||||||
HedgeInterval types.Duration `json:"hedgeInterval"`
|
HedgeInterval types.Duration `json:"hedgeInterval"`
|
||||||
|
|
||||||
|
@ -346,6 +347,10 @@ func (s *Strategy) Defaults() error {
|
||||||
s.UpdateInterval = types.Duration(5 * time.Second)
|
s.UpdateInterval = types.Duration(5 * time.Second)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if s.UpdateLayers == 0 {
|
||||||
|
s.UpdateLayers = 5
|
||||||
|
}
|
||||||
|
|
||||||
if s.FullReplenishInterval == 0 {
|
if s.FullReplenishInterval == 0 {
|
||||||
s.FullReplenishInterval = types.Duration(10 * time.Minute)
|
s.FullReplenishInterval = types.Duration(10 * time.Minute)
|
||||||
}
|
}
|
||||||
|
@ -426,7 +431,7 @@ func (s *Strategy) quoteWorker(ctx context.Context) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
if time.Since(lastOrderReplenishTime) < 10*time.Second {
|
if time.Since(lastOrderReplenishTime) < 15*time.Second {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -435,7 +440,7 @@ func (s *Strategy) quoteWorker(ctx context.Context) {
|
||||||
s.updateQuote(ctx, 0)
|
s.updateQuote(ctx, 0)
|
||||||
|
|
||||||
case types.BookSignalUpdate:
|
case types.BookSignalUpdate:
|
||||||
s.updateQuote(ctx, 5)
|
s.updateQuote(ctx, s.UpdateLayers)
|
||||||
}
|
}
|
||||||
|
|
||||||
lastOrderReplenishTime = time.Now()
|
lastOrderReplenishTime = time.Now()
|
||||||
|
|
|
@ -231,7 +231,7 @@ func (e *FixedQuantityExecutor) orderUpdater(ctx context.Context) {
|
||||||
ticker := time.NewTimer(e.updateInterval)
|
ticker := time.NewTimer(e.updateInterval)
|
||||||
defer ticker.Stop()
|
defer ticker.Stop()
|
||||||
|
|
||||||
monitor := NewBboMonitor()
|
monitor := bbgo.NewBboMonitor()
|
||||||
|
|
||||||
for {
|
for {
|
||||||
select {
|
select {
|
||||||
|
|
Loading…
Reference in New Issue
Block a user