util

package
v1.0.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 19, 2022 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Abs

func Abs(i float32) float32

绝对值

func AddSecond

func AddSecond(t time.Time, second int64) time.Time

添加秒

func BuySize

func BuySize(price float32, buyunit float32, value float32) float32

token - > 张数 保证金*币的价格*杠杆倍数/合约面值=可开张数

func Float32

func Float32(str string) float32

func FloatDeceimal

func FloatDeceimal(f float32) float32

func FloatString

func FloatString(f float32) string

func Floor

func Floor(value float32) float32

向下取整

func Int32

func Int32(str string) int32

func Int32ToFloat

func Int32ToFloat(i int32) float32

func Int64

func Int64(str string) int64

func IsoTime

func IsoTime(t time.Time) string

func IsoToTime

func IsoToTime(iso string) (time.Time, error)

func Log

func Log()

func Lower

func Lower(s string) string

小写

func Max

func Max(values ...float32) float32

最大值

func MaxInt

func MaxInt(values ...int) int

最大值

func Min

func Min(values ...float32) float32

最小值

func MkDir

func MkDir(dir string) (bool, error)

func PayFee

func PayFee(price float32, size, value float32) float32

支付手续费

func PriceEqual

func PriceEqual(dest float32, price float32) bool

价格相等 合理偏差 0.001 dest 目标价格

func PriceTend

func PriceTend(prices []float32) int32

价格趋势 1 上升 2 下降 3 波动

func Profit

func Profit(op conset.OPERATION, price float32, lastprice float32, size, value float32) float32

币本位收益 反向合约 多仓收益=面值*开仓张数(1/开仓价格-1/平仓价格) 空仓收益=面值*开仓张数(1/平仓价格-1/开仓价格)

func ProfitRate

func ProfitRate(profit float32, total float32) float32

收益率 op 3 平多 4 平空

func QQMail

func QQMail(from string, to []string, title string, body string, password string) error

func SecondsTime

func SecondsTime(second int64) time.Time

func SqrtN

func SqrtN(m float32, n float32) float32

func SqrtN64

func SqrtN64(m float64, n float64) float64

开N次方

func StringToTime

func StringToTime(str string) time.Time

func SubHours

func SubHours(t1 time.Time, t2 time.Time) float32

func TimeFormatDay

func TimeFormatDay(t time.Time) string

func TimeFormatString

func TimeFormatString(t time.Time) string

func TimeMillis

func TimeMillis(t time.Time) int64

func Unit

func Unit(total float32, price float32) float32

*

  • 买入单位,回撤 ATR 亏损比例
  • rate*Total = atr/price * Unit
  • rate: 总账户最大亏损(总账户 满足连续最大亏损40次)
  • atr/price 回撤(高位最大回撤 0.04)

func UnixMillis

func UnixMillis(t time.Time) string

func Upper

func Upper(s string) string

大写

func UsdtProfit

func UsdtProfit(op conset.OPERATION, closePrice, openPrice float32, size, value float32) float32

USDT收益 正向合约 做多:收益=(平仓价-开仓价)*面值*张数=(平仓价-开仓价)*数量 做空:收益=(开仓价-平仓价)*面值*张数=(开仓价-平仓价)*数量

func ZDollar

func ZDollar(symbol conset.SYMBOL) float32

一张 代表的面纸

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL