forked from stellar-deprecated/kelp
-
Notifications
You must be signed in to change notification settings - Fork 0
/
strategy.go
25 lines (22 loc) · 1.1 KB
/
strategy.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
package api
import (
"github.com/stellar/go/build"
hProtocol "github.com/stellar/go/protocols/horizon"
"github.com/stellar/kelp/model"
)
// Strategy represents some logic for a bot to follow while doing market making
type Strategy interface {
PruneExistingOffers(buyingAOffers []hProtocol.Offer, sellingAOffers []hProtocol.Offer) ([]build.TransactionMutator, []hProtocol.Offer, []hProtocol.Offer)
PreUpdate(maxAssetA float64, maxAssetB float64, trustA float64, trustB float64) error
UpdateWithOps(buyingAOffers []hProtocol.Offer, sellingAOffers []hProtocol.Offer) ([]build.TransactionMutator, error)
PostUpdate() error
GetFillHandlers() ([]FillHandler, error)
}
// SideStrategy represents a strategy on a single side of the orderbook
type SideStrategy interface {
PruneExistingOffers(offers []hProtocol.Offer) ([]build.TransactionMutator, []hProtocol.Offer)
PreUpdate(maxAssetA float64, maxAssetB float64, trustA float64, trustB float64) error
UpdateWithOps(offers []hProtocol.Offer) (ops []build.TransactionMutator, newTopOffer *model.Number, e error)
PostUpdate() error
GetFillHandlers() ([]FillHandler, error)
}