Skip to content
This repository has been archived by the owner on Apr 11, 2020. It is now read-only.

miguelmota/go-etherdelta

Repository files navigation

go-etherdelta

The unofficial EtherDelta (and ForkDelta) client for Golang.

License Go Report Card GoDoc

Documentation

https://godoc.org/github.com/miguelmota/go-etherdelta

Getting started

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)
}

ForkDelta

A ForkDelta client is avaiable:

service := ed.NewForkDelta(&ed.Options{
  ProviderURI: "wss://mainnet.infura.io/ws",
})

Examples

Take a look at the tests.

Config

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.

Test

go test -v ./...

FAQ

  • 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.

Resources

License

MIT