1234567891011121314151617181920212223242526272829303132 |
- package sentio
- import "cmp"
- type Strategy interface {
- Name() string
- Model() string
- MarketId() string
- PositionSymbols() map[Side]string
- Interval() uint8
- Handle(market Market, proba float64) ([]StrategyOrder, error)
- }
- type StrategyOrder struct {
- Symbol string `yaml:"symbol"`
- Action OrderAction `yaml:"action"`
- Ratio float64 `yaml:"ratio"`
- }
- func CompareStrategyOrders(a, b StrategyOrder) int {
- if a.Action == b.Action {
- return cmp.Compare(b.Ratio, a.Ratio)
- }
- if OrderSell == a.Action {
- return -1
- }
- return 1
- }
|