Documentation
¶
Index ¶
Examples ¶
Constants ¶
View Source
const ( // WebsocketAddress - Poloniex Websocket address. WebsocketAddress = "wss://api.poloniex.com" // WebsocketRealm - Poloniex Websocket realm name. WebsocketRealm = "realm1" )
Variables ¶
This section is empty.
Functions ¶
func History ¶
History - Reads trades history from start to end. Results channel will be closed by this function.
Example ¶
ctx, cancel := context.WithTimeout(context.Background(), time.Hour)
defer cancel()
req := HistoryRequest{
Pair: currency.NewPair("BTC", "XRP"),
Start: time.Now().Add(-time.Hour * 24),
End: time.Now(),
}
// Create results channel
results := make(chan []*order.Trade, 10)
// Get all trades in goroutine
go func() {
if err := History(ctx, req, results); err != nil {
glog.Fatal(err)
}
}()
for {
select {
case <-ctx.Done():
if err := ctx.Err(); err != nil {
glog.Fatal(err)
}
break
case trades := <-results:
pp.Println(trades[:10])
return
}
}
Types ¶
type HistoryRequest ¶
HistoryRequest - Trades history request.
Click to show internal directories.
Click to hide internal directories.