123456789101112131415161718192021222324252627282930313233343536 |
- package sentio
- import (
- "cmp"
- "time"
- )
- type Strategy interface {
- Name() string
- Model() string
- MarketId() string
- PositionSymbols() map[Side]string
- Interval() uint8
- Cooldown(periods uint8) time.Duration
- Handle(market Market, ts time.Time, 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
- }
|