sheep

package module
v0.0.0-...-d95647c Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 4, 2019 License: MIT Imports: 5 Imported by: 0

README

sheep

火币,OKEX,币安 API工具集

币安 API 基于 https://github.com/pdepip/go-binance 实现

example

import (
	"log"

	"time"

	"github.com/leek-box/sheep/huobi"
)

func main() {
	h, err := huobi.NewHuobi("your-access-key", "your-secret-key")
	if err != nil {
		log.Println(err.Error())
		return
	}

	// 打开websocket通信
	err = h.OpenWebsocket()
	if err != nil {
		log.Fatal(err)
	}
	defer h.CloseWebsocket()

	//获取账户余额
	balances, err := h.GetAccountBalance()
	if err != nil {
		log.Fatal(err)
	}

	log.Println(balances)

	//webcosket监听函数
	listen := func(symbol string, depth *huobi.MarketDepth) {
		log.Println(depth)
	}

	//设置监听
	h.SetDepthlListener(listen)

	//订阅
	h.SubscribeDepth("btcusdt")
	h.SubscribeDepth("ethusdt")

	time.Sleep(time.Hour)
}

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ExchageI

type ExchageI interface {
	GetExchangeType() string
	//获取账户余额
	GetAccountBalance() ([]proto.AccountBalance, error)
	//下单
	OrderPlace(params *proto.OrderPlaceParams) (*proto.OrderPlaceReturn, error)
	//取消订单
	OrderCancel(params *proto.OrderCancelParams) error
	//获取订单详情
	GetOrderInfo(params *proto.OrderInfoParams) (*proto.Order, error)
	//获取历史订单列表
	GetOrders(params *proto.OrdersParams) ([]proto.Order, error)
}

func NewExchange

func NewExchange(typ, accessKey, secretKey string) (ExchageI, error)

Directories

Path Synopsis
account.go Account (Signed) Endpoints for Binance Exchange API binance.go Wrapper for the Binance Exchange API Authors: Pat DePippo <patrick.depippo@dcrypt.io> Matthew Woop <matthew.woop@dcrypt.io> To Do: client.go Wrapper for the Binance Exchange API market.go Market Data Endpoints for the Binance Exchange API Util Functions for Binance Api Wrapper
account.go Account (Signed) Endpoints for Binance Exchange API binance.go Wrapper for the Binance Exchange API Authors: Pat DePippo <patrick.depippo@dcrypt.io> Matthew Woop <matthew.woop@dcrypt.io> To Do: client.go Wrapper for the Binance Exchange API market.go Market Data Endpoints for the Binance Exchange API Util Functions for Binance Api Wrapper

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL