Documentation ¶
Index ¶
- Constants
- Variables
- func Copy(dst, src string) (err error)
- func CopyWithMainPkg(dst, src string) (err error)
- func FloatAdd(a, b float64) float64
- func FloatDiv(a, b float64) float64
- func FloatMul(a, b float64) float64
- func FloatSub(a, b float64) float64
- func FormatFloat(n float64, precision int) float64
- func GetBinSizeDuration(str string) (duration time.Duration, err error)
- func GetExecDir() string
- func MergeKlineChan(klines chan []interface{}, srcDuration, dstDuration time.Duration) (rets chan []interface{})
- func OpenURL(strURL string) error
- func ParseBinSizes(str string) (durations []time.Duration, err error)
- func ParseBinStrs(str string) (strs []string)
- type CandleFn
- type Entry
- type KlineMerge
- func (km *KlineMerge) GetDst() int64
- func (km *KlineMerge) GetDstDuration() time.Duration
- func (km *KlineMerge) GetSrc() int64
- func (km *KlineMerge) GetSrcDuration() time.Duration
- func (km *KlineMerge) GetUnFinished() (ret interface{})
- func (km *KlineMerge) IsFirst() bool
- func (km *KlineMerge) NeedMerge() bool
- func (km *KlineMerge) Update(data interface{}) (ret interface{})
- type LeverBalance
- func (b *LeverBalance) AddTrade(tr Trade) (profit, onceFee float64, err error)
- func (b *LeverBalance) CheckLiquidation(price float64) (liqPrice float64, isLiq bool)
- func (b *LeverBalance) Get() (total float64)
- func (b *LeverBalance) GetFeeTotal() float64
- func (b *LeverBalance) Pos() (pos float64)
- func (b *LeverBalance) Set(total float64)
- func (b *LeverBalance) SetFee(fee float64)
- func (b *LeverBalance) SetLever(lever float64)
- type Param
- func BoolParam(name, label, info string, defValue bool, ptr *bool, enums ...Entry) Param
- func FloatParam(name, label, info string, defValue float64, ptr *float64, enums ...Entry) Param
- func IntParam(name, label, info string, defValue int, ptr *int, enums ...Entry) Param
- func StringParam(name, label, info, defValue string, ptr *string, enums ...Entry) Param
- type ParamData
- type VBalance
- func (b *VBalance) AddTrade(tr Trade) (profit, onceFee float64, err error)
- func (b *VBalance) AvgOpenPrice() (price float64)
- func (b *VBalance) Get() (total float64)
- func (b *VBalance) GetFeeTotal() (fee float64)
- func (b *VBalance) Pos() (pos float64)
- func (b *VBalance) Set(total float64)
- func (b *VBalance) SetFee(fee float64)
Constants ¶
View Source
const (
DefaultBinSizes = "1m, 5m, 15m, 30m, 1h, 4h, 1d"
)
Variables ¶
View Source
var ( ErrNoBalance = errors.New("no balance") Zero = decimal.NewFromInt(0) )
View Source
var ( Day = time.Hour * 24 Week = time.Hour * 24 * 7 )
Functions ¶
func CopyWithMainPkg ¶
func FormatFloat ¶
FormatFloat format float with precision
func GetBinSizeDuration ¶
GetBinSizeDuration get duration of the binsize
func MergeKlineChan ¶
func MergeKlineChan(klines chan []interface{}, srcDuration, dstDuration time.Duration) (rets chan []interface{})
MergeKlineChan merge kline data
func ParseBinSizes ¶
ParseBinSizes parse binsizes
func ParseBinStrs ¶
ParseBinStrs parse binsizes to strs
Types ¶
type CandleFn ¶
type CandleFn func(candle *trademodel.Candle)
type KlineMerge ¶
type KlineMerge struct {
// contains filtered or unexported fields
}
KlineMerge merge kline to new duration
func NewKlineMerge ¶
func NewKlineMerge(src, dst time.Duration) *KlineMerge
NewKlineMerge merge kline constructor
func NewKlineMergeStr ¶
func NewKlineMergeStr(src, dst string) *KlineMerge
NewKlineMergeStr new KlineMerge with string duration
func (*KlineMerge) GetDst ¶
func (km *KlineMerge) GetDst() int64
GetDst return kline dst duration secs
func (*KlineMerge) GetDstDuration ¶
func (km *KlineMerge) GetDstDuration() time.Duration
GetDstDuration get kline dst duration
func (*KlineMerge) GetSrc ¶
func (km *KlineMerge) GetSrc() int64
GetSrc return kline source duration secs
func (*KlineMerge) GetSrcDuration ¶
func (km *KlineMerge) GetSrcDuration() time.Duration
GetSrcDuration get kline source duration
func (*KlineMerge) GetUnFinished ¶ added in v0.1.7
func (km *KlineMerge) GetUnFinished() (ret interface{})
func (*KlineMerge) Update ¶
func (km *KlineMerge) Update(data interface{}) (ret interface{})
Update update candle, and return new kline candle return nil if no new kline candle
type LeverBalance ¶ added in v0.1.7
type LeverBalance struct {
// contains filtered or unexported fields
}
func NewLeverBalance ¶ added in v0.1.7
func NewLeverBalance() *LeverBalance
func (*LeverBalance) AddTrade ¶ added in v0.1.7
func (b *LeverBalance) AddTrade(tr Trade) (profit, onceFee float64, err error)
func (*LeverBalance) CheckLiquidation ¶ added in v0.1.7
func (b *LeverBalance) CheckLiquidation(price float64) (liqPrice float64, isLiq bool)
func (*LeverBalance) Get ¶ added in v0.1.7
func (b *LeverBalance) Get() (total float64)
func (*LeverBalance) GetFeeTotal ¶ added in v0.1.7
func (b *LeverBalance) GetFeeTotal() float64
func (*LeverBalance) Pos ¶ added in v0.1.7
func (b *LeverBalance) Pos() (pos float64)
func (*LeverBalance) Set ¶ added in v0.1.7
func (b *LeverBalance) Set(total float64)
func (*LeverBalance) SetFee ¶ added in v0.1.7
func (b *LeverBalance) SetFee(fee float64)
func (*LeverBalance) SetLever ¶ added in v0.1.7
func (b *LeverBalance) SetLever(lever float64)
type Param ¶
type Param struct { Name string Type string Label string Info string DefValue interface{} Enums []Entry // contains filtered or unexported fields }
func FloatParam ¶ added in v0.0.8
type VBalance ¶
type VBalance struct {
// contains filtered or unexported fields
}
func NewVBalance ¶
func NewVBalance() *VBalance
func (*VBalance) AvgOpenPrice ¶ added in v0.1.7
func (*VBalance) GetFeeTotal ¶
Click to show internal directories.
Click to hide internal directories.