init
This commit is contained in:
35
demo/tmp.go
Normal file
35
demo/tmp.go
Normal file
@@ -0,0 +1,35 @@
|
||||
package demo
|
||||
|
||||
import (
|
||||
"github.com/banbox/banbot/config"
|
||||
"github.com/banbox/banbot/core"
|
||||
"github.com/banbox/banbot/orm/ormo"
|
||||
"github.com/banbox/banbot/strat"
|
||||
"github.com/banbox/banexg/log"
|
||||
"go.uber.org/zap"
|
||||
)
|
||||
|
||||
func tmp(p *config.RunPolicyConfig) *strat.TradeStrat {
|
||||
price := 2.236
|
||||
return &strat.TradeStrat{
|
||||
OnBar: func(s *strat.StratJob) {
|
||||
s.OpenOrder(&strat.EnterReq{
|
||||
Tag: "BUY",
|
||||
OrderType: core.OrderTypeLimit,
|
||||
Limit: price,
|
||||
Amount: 4.65000,
|
||||
TakeProfit: price * 1.01,
|
||||
TakeProfitLimit: price * 1.012,
|
||||
StopLoss: price * 0.99,
|
||||
Log: true,
|
||||
})
|
||||
s.CloseOrders(&strat.ExitReq{
|
||||
Tag: "all",
|
||||
})
|
||||
ods, err := strat.GetHistOrders(ormo.GetHistOrdersArgs{
|
||||
Limit: 3,
|
||||
})
|
||||
log.Info("get hist", zap.Int("num", len(ods)), zap.Error(err))
|
||||
},
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user