add 1m subscribe to RoiTakeProfit

This commit is contained in:
c9s 2022-07-19 11:00:45 +08:00
parent 1ca7e0d032
commit 9302474d51
No known key found for this signature in database
GPG Key ID: 7385E7E464CB0A54

View File

@ -9,12 +9,18 @@ import (
// RoiTakeProfit force takes the profit by the given ROI percentage.
type RoiTakeProfit struct {
Symbol string `json:"symbol"`
Percentage fixedpoint.Value `json:"percentage"`
session *ExchangeSession
orderExecutor *GeneralOrderExecutor
}
func (s *RoiTakeProfit) Subscribe(session *ExchangeSession) {
// use 1m kline to handle roi stop
session.Subscribe(types.KLineChannel, s.Symbol, types.SubscribeOptions{Interval: types.Interval1m})
}
func (s *RoiTakeProfit) Bind(session *ExchangeSession, orderExecutor *GeneralOrderExecutor) {
s.session = session
s.orderExecutor = orderExecutor