mirror of
https://github.com/c9s/bbgo.git
synced 2024-09-20 08:11:08 +00:00
types: Add TradeWith helper
This commit is contained in:
parent
b90564be90
commit
9f5ef21dda
|
@ -627,6 +627,16 @@ func (k *KLineSeries) Length() int {
|
|||
|
||||
var _ Series = &KLineSeries{}
|
||||
|
||||
func TradeWith(symbol string, f func(trade Trade)) func(trade Trade) {
|
||||
return func(trade Trade) {
|
||||
if symbol != "" && trade.Symbol != symbol {
|
||||
return
|
||||
}
|
||||
|
||||
f(trade)
|
||||
}
|
||||
}
|
||||
|
||||
func KLineWith(symbol string, interval Interval, callback KLineCallback) KLineCallback {
|
||||
return func(k KLine) {
|
||||
if k.Symbol != symbol || (k.Interval != "" && k.Interval != interval) {
|
||||
|
|
Loading…
Reference in New Issue
Block a user