api

package
v0.0.0-...-d060b71 Latest Latest
Warning

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

Go to latest
Published: Nov 3, 2018 License: MIT Imports: 25 Imported by: 3

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BigOne

type BigOne struct {
	// contains filtered or unexported fields
}

BigOne the exchange struct of big.one

func (*BigOne) AutoSleep

func (e *BigOne) AutoSleep()

AutoSleep auto sleep to achieve the limit calls amount per second of this exchange

func (*BigOne) CancelOrder

func (e *BigOne) CancelOrder(order Order) bool

CancelOrder cancel an order

func (*BigOne) GetAccount

func (e *BigOne) GetAccount() interface{}

GetAccount get the account detail of this exchange

func (*BigOne) GetMinAmount

func (e *BigOne) GetMinAmount(stock string) float64

GetMinAmount get the min trade amonut of this exchange

func (*BigOne) GetName

func (e *BigOne) GetName() string

GetName get the name of this exchange

func (*BigOne) GetOrder

func (e *BigOne) GetOrder(stockType, id string) interface{}

GetOrder get details of an order

func (*BigOne) GetOrders

func (e *BigOne) GetOrders(stockType string) interface{}

GetOrders get all unfilled orders

func (*BigOne) GetRecords

func (e *BigOne) GetRecords(stockType, period string, sizes ...interface{}) interface{}

GetRecords get candlestick data

func (*BigOne) GetTicker

func (e *BigOne) GetTicker(stockType string, sizes ...interface{}) interface{}

GetTicker get market ticker & depth

func (*BigOne) GetTrades

func (e *BigOne) GetTrades(stockType string) interface{}

GetTrades get all filled orders recently

func (*BigOne) GetType

func (e *BigOne) GetType() string

GetType get the type of this exchange

func (*BigOne) Log

func (e *BigOne) Log(msgs ...interface{})

Log print something to console

func (*BigOne) SetLimit

func (e *BigOne) SetLimit(times interface{}) float64

SetLimit set the limit calls amount per second of this exchange

func (*BigOne) Trade

func (e *BigOne) Trade(tradeType string, stockType string, _price, _amount interface{}, msgs ...interface{}) interface{}

Trade place an order

type Binance

type Binance struct {
	// contains filtered or unexported fields
}

Binance the exchange struct of binance.com

func (*Binance) AutoSleep

func (e *Binance) AutoSleep()

AutoSleep auto sleep to achieve the limit calls amount per second of this exchange

func (*Binance) CancelOrder

func (e *Binance) CancelOrder(order Order) bool

CancelOrder cancel an order

func (*Binance) GetAccount

func (e *Binance) GetAccount() interface{}

GetAccount get the account detail of this exchange

func (*Binance) GetMinAmount

func (e *Binance) GetMinAmount(stock string) float64

GetMinAmount get the min trade amonut of this exchange

func (*Binance) GetName

func (e *Binance) GetName() string

GetName get the name of this exchange

func (*Binance) GetOrder

func (e *Binance) GetOrder(stockType, id string) interface{}

GetOrder get details of an order

func (*Binance) GetOrders

func (e *Binance) GetOrders(stockType string) interface{}

GetOrders get all unfilled orders

func (*Binance) GetRecords

func (e *Binance) GetRecords(stockType, period string, sizes ...interface{}) interface{}

GetRecords get candlestick data

func (*Binance) GetTicker

func (e *Binance) GetTicker(stockType string, sizes ...interface{}) interface{}

GetTicker get market ticker & depth

func (*Binance) GetTrades

func (e *Binance) GetTrades(stockType string) interface{}

GetTrades get all filled orders recently

func (*Binance) GetType

func (e *Binance) GetType() string

GetType get the type of this exchange

func (*Binance) Log

func (e *Binance) Log(msgs ...interface{})

Log print something to console

func (*Binance) SetLimit

func (e *Binance) SetLimit(times interface{}) float64

SetLimit set the limit calls amount per second of this exchange

func (*Binance) Trade

func (e *Binance) Trade(tradeType string, stockType string, _price, _amount interface{}, msgs ...interface{}) interface{}

Trade place an order

type Exchange

type Exchange interface {
	Log(...interface{})                                                                                   //向管理台发送这个交易所的打印信息
	GetType() string                                                                                      //获取交易所类型,是火币还是OKEY等。。。
	GetName() string                                                                                      //获取交易所名称,自定义的
	SetLimit(times interface{}) float64                                                                   //设置交易所的API访问频率,和 E.AutoSleep() 配合使用
	AutoSleep()                                                                                           //自动休眠以满足设置的交易所的API访问频率
	GetMinAmount(stock string) float64                                                                    //获取交易所的最小交易数量
	GetAccount() interface{}                                                                              //获取交易所的账户资金信息
	Trade(tradeType string, stockType string, price, amount interface{}, msgs ...interface{}) interface{} //如果 Price <= 0 自动设置为市价单,数量参数也有所不同,如果成功返回订单的 ID,如果失败返回 false
	GetOrder(stockType, id string) interface{}                                                            //返回订单信息
	GetOrders(stockType string) interface{}                                                               //返回所有的未完成订单列表
	GetTrades(stockType string) interface{}                                                               //返回最近的已完成订单列表
	CancelOrder(order Order) bool                                                                         //取消一笔订单
	GetTicker(stockType string, sizes ...interface{}) interface{}                                         //获取交易所的最新市场行情数据
	GetRecords(stockType, period string, sizes ...interface{}) interface{}                                //返回交易所的最新K线数据列表
}

Exchange interface

func NewBigOne

func NewBigOne(opt Option) Exchange

NewBigOne create an exchange struct of big.one

func NewBinance

func NewBinance(opt Option) Exchange

NewBinance create an exchange struct of Binance.com

func NewGateIo

func NewGateIo(opt Option) Exchange

NewGateIo create an exchange struct of gateio.io

func NewHuobi

func NewHuobi(opt Option) Exchange

NewHuobi create an exchange struct of huobi.com

func NewOKEX

func NewOKEX(opt Option) Exchange

NewOKEX create an exchange struct of okex.com

func NewOkexFuture

func NewOkexFuture(opt Option) Exchange

NewOkexFuture create an exchange struct of okex.com

func NewPoloniex

func NewPoloniex(opt Option) Exchange

NewPoloniex create an exchange struct of poloniex

func NewZb

func NewZb(opt Option) Exchange

NewZb create an exchange struct of zb.com

type GateIo

type GateIo struct {
	// contains filtered or unexported fields
}

GateIo the exchange struct of gateio.io

func (*GateIo) AutoSleep

func (e *GateIo) AutoSleep()

AutoSleep auto sleep to achieve the limit calls amount per second of this exchange

func (*GateIo) CancelOrder

func (e *GateIo) CancelOrder(order Order) bool

CancelOrder cancel an order

func (*GateIo) GetAccount

func (e *GateIo) GetAccount() interface{}

GetAccount get the account detail of this exchange

func (*GateIo) GetMinAmount

func (e *GateIo) GetMinAmount(stock string) float64

GetMinAmount get the min trade amonut of this exchange

func (*GateIo) GetName

func (e *GateIo) GetName() string

GetName get the name of this exchange

func (*GateIo) GetOrder

func (e *GateIo) GetOrder(stockType, id string) interface{}

GetOrder get details of an order

func (*GateIo) GetOrders

func (e *GateIo) GetOrders(stockType string) interface{}

GetOrders get all unfilled orders

func (*GateIo) GetRecords

func (e *GateIo) GetRecords(stockType, period string, sizes ...interface{}) interface{}

GetRecords get candlestick data

func (*GateIo) GetTicker

func (e *GateIo) GetTicker(stockType string, sizes ...interface{}) interface{}

GetTicker get market ticker & depth

func (*GateIo) GetTrades

func (e *GateIo) GetTrades(stockType string) interface{}

GetTrades get all filled orders recently

func (*GateIo) GetType

func (e *GateIo) GetType() string

GetType get the type of this exchange

func (*GateIo) Log

func (e *GateIo) Log(msgs ...interface{})

Log print something to console

func (*GateIo) SetLimit

func (e *GateIo) SetLimit(times interface{}) float64

SetLimit set the limit calls amount per second of this exchange

func (*GateIo) Trade

func (e *GateIo) Trade(tradeType string, stockType string, _price, _amount interface{}, msgs ...interface{}) interface{}

Trade place an order

type Huobi

type Huobi struct {
	// contains filtered or unexported fields
}

Huobi the exchange struct of huobi.com

func (*Huobi) AutoSleep

func (e *Huobi) AutoSleep()

AutoSleep auto sleep to achieve the limit calls amount per second of this exchange

func (*Huobi) CancelOrder

func (e *Huobi) CancelOrder(order Order) bool

CancelOrder cancel an order

func (*Huobi) GetAccount

func (e *Huobi) GetAccount() interface{}

GetAccount get the account detail of this exchange

func (*Huobi) GetMinAmount

func (e *Huobi) GetMinAmount(stock string) float64

GetMinAmount get the min trade amonut of this exchange

func (*Huobi) GetName

func (e *Huobi) GetName() string

GetName get the name of this exchange

func (*Huobi) GetOrder

func (e *Huobi) GetOrder(stockType, id string) interface{}

GetOrder get details of an order

func (*Huobi) GetOrders

func (e *Huobi) GetOrders(stockType string) interface{}

GetOrders get all unfilled orders

func (*Huobi) GetRecords

func (e *Huobi) GetRecords(stockType, period string, sizes ...interface{}) interface{}

GetRecords get candlestick data

func (*Huobi) GetTicker

func (e *Huobi) GetTicker(stockType string, sizes ...interface{}) interface{}

GetTicker get market ticker & depth

func (*Huobi) GetTrades

func (e *Huobi) GetTrades(stockType string) interface{}

GetTrades get all filled orders recently

func (*Huobi) GetType

func (e *Huobi) GetType() string

GetType get the type of this exchange

func (*Huobi) Log

func (e *Huobi) Log(msgs ...interface{})

Log print something to console

func (*Huobi) SetLimit

func (e *Huobi) SetLimit(times interface{}) float64

SetLimit set the limit calls amount per second of this exchange

func (*Huobi) Trade

func (e *Huobi) Trade(tradeType string, stockType string, _price, _amount interface{}, msgs ...interface{}) interface{}

Trade place an order

type OKEX

type OKEX struct {
	// contains filtered or unexported fields
}

OKEX the exchange struct of okex.com

func (*OKEX) AutoSleep

func (e *OKEX) AutoSleep()

AutoSleep auto sleep to achieve the limit calls amount per second of this exchange

func (*OKEX) CancelOrder

func (e *OKEX) CancelOrder(order Order) bool

CancelOrder cancel an order

func (*OKEX) GetAccount

func (e *OKEX) GetAccount() interface{}

GetAccount get the account detail of this exchange

func (*OKEX) GetMinAmount

func (e *OKEX) GetMinAmount(stock string) float64

GetMinAmount get the min trade amonut of this exchange

func (*OKEX) GetName

func (e *OKEX) GetName() string

GetName get the name of this exchange

func (*OKEX) GetOrder

func (e *OKEX) GetOrder(stockType, id string) interface{}

GetOrder get details of an order

func (*OKEX) GetOrders

func (e *OKEX) GetOrders(stockType string) interface{}

GetOrders get all unfilled orders

func (*OKEX) GetRecords

func (e *OKEX) GetRecords(stockType, period string, sizes ...interface{}) interface{}

GetRecords get candlestick data

func (*OKEX) GetTicker

func (e *OKEX) GetTicker(stockType string, sizes ...interface{}) interface{}

GetTicker get market ticker & depth

func (*OKEX) GetTrades

func (e *OKEX) GetTrades(stockType string) interface{}

GetTrades get all filled orders recently

func (*OKEX) GetType

func (e *OKEX) GetType() string

GetType get the type of this exchange

func (*OKEX) Log

func (e *OKEX) Log(msgs ...interface{})

Log print something to console

func (*OKEX) SetLimit

func (e *OKEX) SetLimit(times interface{}) float64

SetLimit set the limit calls amount per second of this exchange

func (*OKEX) Trade

func (e *OKEX) Trade(tradeType string, stockType string, _price, _amount interface{}, msgs ...interface{}) interface{}

Trade place an order

type OkexFuture

type OkexFuture struct {
	// contains filtered or unexported fields
}

OkexFuture the exchange struct of okex.com future

func (*OkexFuture) AutoSleep

func (e *OkexFuture) AutoSleep()

AutoSleep auto sleep to achieve the limit calls amount per second of this exchange

func (*OkexFuture) CancelOrder

func (e *OkexFuture) CancelOrder(order Order) bool

CancelOrder cancel an order

func (*OkexFuture) GetAccount

func (e *OkexFuture) GetAccount() interface{}

GetAccount get the account detail of this exchange

func (*OkexFuture) GetMinAmount

func (e *OkexFuture) GetMinAmount(stock string) float64

GetMinAmount get the min trade amonut of this exchange

func (*OkexFuture) GetName

func (e *OkexFuture) GetName() string

GetName get the name of this exchange

func (*OkexFuture) GetOrder

func (e *OkexFuture) GetOrder(stockType, id string) interface{}

GetOrder get details of an order

func (*OkexFuture) GetOrders

func (e *OkexFuture) GetOrders(stockType string) interface{}

GetOrders get all unfilled orders

func (*OkexFuture) GetPositions

func (e *OkexFuture) GetPositions(stockType string) interface{}

GetPositions get the positions detail of this exchange

func (*OkexFuture) GetRecords

func (e *OkexFuture) GetRecords(stockType, period string, sizes ...interface{}) interface{}

GetRecords get candlestick data

func (*OkexFuture) GetTicker

func (e *OkexFuture) GetTicker(stockType string, sizes ...interface{}) interface{}

GetTicker get market ticker & depth

func (*OkexFuture) GetTrades

func (e *OkexFuture) GetTrades(stockType string) interface{}

GetTrades get all filled orders recently

func (*OkexFuture) GetType

func (e *OkexFuture) GetType() string

GetType get the type of this exchange

func (*OkexFuture) Log

func (e *OkexFuture) Log(msgs ...interface{})

Log print something to console

func (*OkexFuture) SetLimit

func (e *OkexFuture) SetLimit(times interface{}) float64

SetLimit set the limit calls amount per second of this exchange

func (*OkexFuture) Trade

func (e *OkexFuture) Trade(tradeType string, stockType string, _price, _amount interface{}, msgs ...interface{}) interface{}

Trade place an order

type Option

type Option struct {
	TraderID  int64
	Type      string
	Name      string
	AccessKey string
	SecretKey string
}

Option is an exchange option

type Order

type Order struct {
	ID         string  //订单ID
	Price      float64 //价格
	Amount     float64 //总量
	DealAmount float64 //成交量
	Fee        float64 //这个订单的交易费
	TradeType  string  //交易类型
	StockType  string  //货币类型
}

Order struct

type OrderBook

type OrderBook struct {
	Price  float64 //价格
	Amount float64 //市场深度量
}

OrderBook struct

type Poloniex

type Poloniex struct {
	// contains filtered or unexported fields
}

Poloniex the exchange struct of poloniex

func (*Poloniex) AutoSleep

func (e *Poloniex) AutoSleep()

AutoSleep auto sleep to achieve the limit calls amount per second of this exchange

func (*Poloniex) CancelOrder

func (e *Poloniex) CancelOrder(order Order) bool

CancelOrder cancel an order

func (*Poloniex) GetAccount

func (e *Poloniex) GetAccount() interface{}

GetAccount get the account detail of this exchange

func (*Poloniex) GetMinAmount

func (e *Poloniex) GetMinAmount(stock string) float64

GetMinAmount get the min trade amonut of this exchange

func (*Poloniex) GetName

func (e *Poloniex) GetName() string

GetName get the name of this exchange

func (*Poloniex) GetOrder

func (e *Poloniex) GetOrder(stockType, id string) interface{}

GetOrder get details of an order

func (*Poloniex) GetOrders

func (e *Poloniex) GetOrders(stockType string) interface{}

GetOrders get all unfilled orders

func (*Poloniex) GetRecords

func (e *Poloniex) GetRecords(stockType, period string, sizes ...interface{}) interface{}

GetRecords get candlestick data

func (*Poloniex) GetTicker

func (e *Poloniex) GetTicker(stockType string, sizes ...interface{}) interface{}

GetTicker get market ticker & depth

func (*Poloniex) GetTrades

func (e *Poloniex) GetTrades(stockType string) interface{}

GetTrades get all filled orders recently

func (*Poloniex) GetType

func (e *Poloniex) GetType() string

GetType get the type of this exchange

func (*Poloniex) Log

func (e *Poloniex) Log(msgs ...interface{})

Log print something to console

func (*Poloniex) SetLimit

func (e *Poloniex) SetLimit(times interface{}) float64

SetLimit set the limit calls amount per second of this exchange

func (*Poloniex) Trade

func (e *Poloniex) Trade(tradeType string, stockType string, _price, _amount interface{}, msgs ...interface{}) interface{}

Trade place an order

type Position

type Position struct {
	Price         float64 //价格
	Leverage      int     //杠杆比例
	Amount        float64 //总合约数量
	ConfirmAmount float64
	FrozenAmount  float64 //冻结的合约数量
	Profit        float64 //收益
	ContractType  string  //合约类型
	TradeType     string  //交易类型
	StockType     string  //货币类型
}

Position struct

type Record

type Record struct {
	Time   int64   //unix时间戳
	Open   float64 //开盘价
	High   float64 //最高价
	Low    float64 //最低价
	Close  float64 //收盘价
	Volume float64 //交易量
}

Record struct

type Ticker

type Ticker struct {
	Bids []OrderBook //买单市场深度列表
	Buy  float64     //买一价, Bids[0].Price
	Mid  float64     //(Buy + Sell) / 2
	Sell float64     //卖一价, Asks[0].Price
	Asks []OrderBook //卖单市场深度列表
}

Ticker struct

type Zb

type Zb struct {
	// contains filtered or unexported fields
}

Zb the exchange struct of zb.com

func (*Zb) AutoSleep

func (e *Zb) AutoSleep()

AutoSleep auto sleep to achieve the limit calls amount per second of this exchange

func (*Zb) CancelOrder

func (e *Zb) CancelOrder(order Order) bool

CancelOrder cancel an order

func (*Zb) GetAccount

func (e *Zb) GetAccount() interface{}

GetAccount get the account detail of this exchange

func (*Zb) GetMinAmount

func (e *Zb) GetMinAmount(stock string) float64

GetMinAmount get the min trade amonut of this exchange

func (*Zb) GetName

func (e *Zb) GetName() string

GetName get the name of this exchange

func (*Zb) GetOrder

func (e *Zb) GetOrder(stockType, id string) interface{}

GetOrder get details of an order

func (*Zb) GetOrders

func (e *Zb) GetOrders(stockType string) interface{}

GetOrders get all unfilled orders

func (*Zb) GetRecords

func (e *Zb) GetRecords(stockType, period string, sizes ...interface{}) interface{}

GetRecords get candlestick data

func (*Zb) GetTicker

func (e *Zb) GetTicker(stockType string, sizes ...interface{}) interface{}

GetTicker get market ticker & depth

func (*Zb) GetTrades

func (e *Zb) GetTrades(stockType string) interface{}

GetTrades get all filled orders recently

func (*Zb) GetType

func (e *Zb) GetType() string

GetType get the type of this exchange

func (*Zb) Log

func (e *Zb) Log(msgs ...interface{})

Log print something to console

func (*Zb) SetLimit

func (e *Zb) SetLimit(times interface{}) float64

SetLimit set the limit calls amount per second of this exchange

func (*Zb) Trade

func (e *Zb) Trade(tradeType string, stockType string, _price, _amount interface{}, msgs ...interface{}) interface{}

Trade place an order

Directories

Path Synopsis
HuobiProAPI

Jump to

Keyboard shortcuts

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