mirror of
https://github.com/c9s/bbgo.git
synced 2024-11-24 15:55:14 +00:00
kucoin: implement getEndpoint method
This commit is contained in:
parent
a4c9aea6c6
commit
b0d4688528
|
@ -57,7 +57,6 @@ var websocketCmd = &cobra.Command{
|
|||
|
||||
}
|
||||
|
||||
|
||||
u, err := bullet.URL()
|
||||
if err != nil {
|
||||
return err
|
||||
|
|
|
@ -144,19 +144,33 @@ func (s *Stream) Reconnector(ctx context.Context) {
|
|||
}
|
||||
}
|
||||
|
||||
func (s *Stream) getEndpoint() string {
|
||||
var url string
|
||||
// getEndpoint use the publicOnly flag to check whether we should allocate a public bullet or private bullet
|
||||
func (s *Stream) getEndpoint() (string, error) {
|
||||
var bullet *kucoinapi.Bullet
|
||||
var err error
|
||||
if s.publicOnly {
|
||||
url = "XXX"
|
||||
bullet, err = s.Client.BulletService.NewGetPublicBulletRequest().Do(nil)
|
||||
} else {
|
||||
url = "XXX"
|
||||
bullet, err = s.Client.BulletService.NewGetPrivateBulletRequest().Do(nil)
|
||||
}
|
||||
return url
|
||||
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
|
||||
url, err := bullet.URL()
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
|
||||
return url.String(), nil
|
||||
}
|
||||
|
||||
func (s *Stream) connect(ctx context.Context) error {
|
||||
// when in public mode, the listen key is an empty string
|
||||
var url = s.getEndpoint()
|
||||
url, err := s.getEndpoint()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
conn, err := s.StandardStream.Dial(url)
|
||||
if err != nil {
|
||||
|
|
Loading…
Reference in New Issue
Block a user