-
Notifications
You must be signed in to change notification settings - Fork 689
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
how to separate the pairs from the stream? #597
Comments
what do you want to do in the wsKlineHandler ? @Sexy-Commando |
the stream arrives in variable event in wsKlineHandler,but the pairs come as a whole.i want to separate the pairs as separate strings. ETHBTC 0.05150000 |
why the pairs come as a whole? it's just a single object pointer in wsKlineHandler, you know, you just handle the single object pointer and then add it to database. @Sexy-Commando |
but how do i do that? i have no idea. could you provide an example? |
i want to process the stream as it arrives and i have no idea how to do that. the stream arrives in this variable event,and i need to separate the pairs so that i can process them.so i can't loop through it,i can't use string separator,i can't add it to a map.how to do this?
func main() {
pairs := map[string]string{"ETHBTC":"1s","BTCUSDT":"1s","LTCBTC":"1s"}
wsKlineHandler := func(event *binance.WsKlineEvent) {
fmt.Println(event.Symbol,event.Kline.Open)
}
errHandler := func(err error) {
fmt.Println(err)
}
doneC, _, err := binance.WsCombinedKlineServe(pairs, wsKlineHandler, errHandler)
if err != nil {
fmt.Println(err)
return
}
<-doneC
}
this is the stream i get
ETHBTC 0.05150000
LTCBTC 0.00110300
BTCUSDT 66311.48000000
The text was updated successfully, but these errors were encountered: