func ExampleObserver() {
logrus.SetLevel(logrus.DebugLevel)
wsObserver := NewWebsocketObserver()
wsClient := NewWSClient(wsObserver, "btcusdc", "btcusdt", "btcusd")
go func() {
if err := wsClient.Run(time.Second * 10); err != nil {
logrus.WithError(err).Error("got an error on WebSocket-client")
}
}()
go func() {
for trade := range wsClient.Fills() {
logrus.WithField("trade", trade).Info("got trade report")
}
}()
time.Sleep(time.Second * 4)
bsSvc := NewPrivateClient("_", "_", wsObserver)
report, err := bsSvc.BuyMarketOrder("btcusdc", "0.0009")
if err != nil {
logrus.WithError(err).Error("could not place order")
} else {
logrus.Info("order has been placed: ", report)
}
time.Sleep(time.Second * 1)
report2, err := bsSvc.SellMarketOrder("btcusdc", "0.0009")
if err != nil {
logrus.WithError(err).Error("could not place order")
} else {
logrus.Info("order has been placed: ", report2)
}
select {}
}
forked from b2broker/bitstamp
-
Notifications
You must be signed in to change notification settings - Fork 0
stalin-777/bitstamp
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
About
Bitstamp V2 API
Topics
Resources
Stars
Watchers
Forks
Packages 0
No packages published
Languages
- Go 100.0%