The unofficial EtherDelta (and ForkDelta) client for Golang.
https://godoc.org/github.com/miguelmota/go-etherdelta
package main
import (
"log"
ed "github.com/miguelmota/go-etherdelta"
)
func main() {
service := ed.New(&ed.Options{
ProviderURI: "wss://mainnet.infura.io/ws",
})
orders, err := service.GetOrderBook(&ed.GetOrderBookOpts{
TokenAddress: "0x0d8775f648430679a709e98d2b0cb6250d2887ef",
})
if err != nil {
panic(err)
}
log.Println(orders)
}
A ForkDelta client is avaiable:
service := ed.NewForkDelta(&ed.Options{
ProviderURI: "wss://mainnet.infura.io/ws",
})
Take a look at the tests.
You can pass the ProviderURI
property to the EtherDelta constructor options. If this is not set, then the service will read the ETH_PROVIDER_URI
environment variable, otherwise the Ethereum provider is set to wss://mainnet.infura.io/ws
by default.
go test -v ./...
-
Q: Why do I get empty results sometimes?
- A: Sometimes the EtherDelta websocket connection randomly disconnects. It can be unreliable at times.
-
Q: It's completely not working anymore!
- A: EtherDelta may have changed their API or websocket endpoint.
MIT