mirror of
https://github.com/c9s/bbgo.git
synced 2024-11-26 00:35:15 +00:00
reduce side book copy
This commit is contained in:
parent
9fa10ee1fd
commit
9efb45b133
|
@ -63,19 +63,9 @@ func (e *TwapExecution) connectUserData(ctx context.Context) {
|
|||
}
|
||||
}
|
||||
|
||||
func (e *TwapExecution) getSideBook() (pvs types.PriceVolumeSlice, err error) {
|
||||
book := e.orderBook.Copy()
|
||||
pvs = book.SideBook(e.Side)
|
||||
return pvs, err
|
||||
}
|
||||
|
||||
func (e *TwapExecution) newBestPriceOrder() (orderForm types.SubmitOrder, err error) {
|
||||
book := e.orderBook.Copy()
|
||||
|
||||
sideBook, err := e.getSideBook()
|
||||
if err != nil {
|
||||
return orderForm, err
|
||||
}
|
||||
sideBook := book.SideBook(e.Side)
|
||||
|
||||
first, ok := sideBook.First()
|
||||
if !ok {
|
||||
|
@ -212,11 +202,8 @@ func (e *TwapExecution) newBestPriceOrder() (orderForm types.SubmitOrder, err er
|
|||
}
|
||||
|
||||
func (e *TwapExecution) updateOrder(ctx context.Context) error {
|
||||
|
||||
sideBook, err := e.getSideBook()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
book := e.orderBook.Copy()
|
||||
sideBook := book.SideBook(e.Side)
|
||||
|
||||
first, ok := sideBook.First()
|
||||
if !ok {
|
||||
|
|
Loading…
Reference in New Issue
Block a user