-
Notifications
You must be signed in to change notification settings - Fork 8
/
mod.go
55 lines (47 loc) · 956 Bytes
/
mod.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
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
package stackfuncs
import (
"github.com/liderman/traderstack/internal/engine"
"time"
)
type Mod struct {
}
func NewMod() *Mod {
return &Mod{}
}
func (l *Mod) Name() string {
return "mod"
}
func (l *Mod) BaseType() string {
return engine.BaseTypeDecimal
}
func (l *Mod) Run(options *engine.Options, now time.Time, accountId string, isTest bool) (interface{}, error) {
a, err := options.GetNumericDecimal("a")
if err != nil {
return nil, err
}
b, err := options.GetNumericDecimal("b")
if err != nil {
return nil, err
}
return a.Mod(b), nil
}
func (l *Mod) Arguments() []*engine.Argument {
return []*engine.Argument{
{
Id: "a",
Name: "Слева",
Desc: "",
BaseType: "numeric",
ExtendedType: "",
Required: true,
},
{
Id: "b",
Name: "Справа",
Desc: "",
BaseType: "numeric",
ExtendedType: "",
Required: true,
},
}
}