Skip to content

Latest commit

 

History

History
80 lines (50 loc) · 2.06 KB

README.md

File metadata and controls

80 lines (50 loc) · 2.06 KB

go-etherdelta

EtherDelta client for Golang.

License Go Report Card GoDoc

Documentation

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

Getting started

package main

import (
	"log"

	ed "github.com/coincircle/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