Skip to content
bestmixer is a Go client library for the BestMixer.io API https://bestmixer.io/en/api
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.travis.yml
LICENSE
README.md
bestmixer.go
bestmixer_test.go
code.go
code_test.go
fee.go
fee_test.go
go.mod
order.go
order_test.go

README.md

BestMixer.io API

Build Status Go Report Card GoDoc License MIT

bestmixer is a Go client library for the BestMixer.io API.

Start using it

  1. Download and install it:

    $ go get github.com/MarinX/bestmixer
  2. Import it in your code:

    import "github.com/MarinX/bestmixer"
  3. (Optional) Run test

    $ go test -v

API

creating a client

	// Create a new BestMixer.io client with http.DefaultClient
	// replace api_key with your own key
	client := bestmixer.New("api_key", nil)

	// if you have your own http.Client you can supply it
	// as a second param
	client := bestmixer.New("api_key", myHttpClient)

Code

Info

	codeInfo, err := client.Code.Info("bm_code")
	if err != nil {
		fmt.Println(err)
		return
	}
	fmt.Println("BTC:", codeInfo.BTC)
	fmt.Println("BCH:", codeInfo.BCH)
	fmt.Println("LTC:", codeInfo.LTC)

Fee

Info

	feeInfo, err := client.Fee.Info()
	if err != nil {
		fmt.Println(err)
		return
	}
	fmt.Println("fee btc:", feeInfo.BTC)
	fmt.Println("fee bch:", feeInfo.BCH)
	fmt.Println("fee ltc:", feeInfo.LTC)

Order

creating order

	order, err := client.Order.Create(
		"bm_code",
		bestmixer.CoinBTC,
		1.001,
		[]bestmixer.Output{
			bestmixer.Output{
				Address: "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
				Percent: 5.5,
				Delay:   33,
			},
		})
	if err != nil {
		fmt.Println(err)
		return
	}
	fmt.Println("Order created:", order.OrderID)

creating fixed order

	orderFixed, err := client.Order.CreateFixed(
		"bm_code",
		bestmixer.CoinBTC,
		1.001,
		[]bestmixer.Output{
			bestmixer.Output{
				Address: "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
				Percent: 0.1,
				Delay:   33,
			},
		})
	if err != nil {
		fmt.Println(err)
		return
	}
	fmt.Println("Order fixed created:", orderFixed.OrderID)

get order info

	orderStatus, err := client.Order.Info("my_order_id")
	if err != nil {
		fmt.Println(err)
		return
	}
	fmt.Println("Order status:", orderStatus.Status)

License

This library is under the MIT License

You can’t perform that action at this time.