Files
tessera/services/data_service/internal/provider/providers/binance/ws/subjects.go

22 lines
676 B
Go

package ws
import "regexp"
var (
reAggTrade = regexp.MustCompile(`^[a-z0-9]+@aggTrade$`)
reTrade = regexp.MustCompile(`^[a-z0-9]+@trade$`)
reMarkPrice = regexp.MustCompile(`^[a-z0-9]+@markPrice(@1s)?$`)
reKline = regexp.MustCompile(`^[a-z0-9]+@kline_(1s|1m|3m|5m|15m|30m|1h|2h|4h|6h|8h|12h|1d|3d|1w|1M)$`)
reBookTicker = regexp.MustCompile(`^[a-z0-9]+@bookTicker$`)
reDepth = regexp.MustCompile(`^[a-z0-9]+@depth(@100ms)?$`)
)
func IsValidSubject(s string) bool {
return reAggTrade.MatchString(s) ||
reTrade.MatchString(s) ||
reMarkPrice.MatchString(s) ||
reKline.MatchString(s) ||
reBookTicker.MatchString(s) ||
reDepth.MatchString(s)
}