Refactor Binance Futures Websocket: enhance configuration management, implement shard handling, and improve subscription logic
This commit is contained in:
@@ -0,0 +1,21 @@
|
||||
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)
|
||||
}
|
||||
Reference in New Issue
Block a user