mirror of
https://github.com/c9s/bbgo.git
synced 2024-11-26 08:45:16 +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) {
|
func (e *TwapExecution) newBestPriceOrder() (orderForm types.SubmitOrder, err error) {
|
||||||
book := e.orderBook.Copy()
|
book := e.orderBook.Copy()
|
||||||
|
sideBook := book.SideBook(e.Side)
|
||||||
sideBook, err := e.getSideBook()
|
|
||||||
if err != nil {
|
|
||||||
return orderForm, err
|
|
||||||
}
|
|
||||||
|
|
||||||
first, ok := sideBook.First()
|
first, ok := sideBook.First()
|
||||||
if !ok {
|
if !ok {
|
||||||
|
@ -212,11 +202,8 @@ func (e *TwapExecution) newBestPriceOrder() (orderForm types.SubmitOrder, err er
|
||||||
}
|
}
|
||||||
|
|
||||||
func (e *TwapExecution) updateOrder(ctx context.Context) error {
|
func (e *TwapExecution) updateOrder(ctx context.Context) error {
|
||||||
|
book := e.orderBook.Copy()
|
||||||
sideBook, err := e.getSideBook()
|
sideBook := book.SideBook(e.Side)
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
first, ok := sideBook.First()
|
first, ok := sideBook.First()
|
||||||
if !ok {
|
if !ok {
|
||||||
|
|
Loading…
Reference in New Issue
Block a user