mirror of
https://github.com/c9s/bbgo.git
synced 2024-11-10 09:11:55 +00:00
19 lines
377 B
Go
19 lines
377 B
Go
package testhelper
|
|
|
|
import "github.com/c9s/bbgo/pkg/fixedpoint"
|
|
|
|
func Number(a interface{}) fixedpoint.Value {
|
|
switch v := a.(type) {
|
|
case string:
|
|
return fixedpoint.MustNewFromString(v)
|
|
case int:
|
|
return fixedpoint.NewFromInt(int64(v))
|
|
case int64:
|
|
return fixedpoint.NewFromInt(int64(v))
|
|
case float64:
|
|
return fixedpoint.NewFromFloat(v)
|
|
}
|
|
|
|
return fixedpoint.Zero
|
|
}
|