api

package
v0.0.0-...-69a75dd Latest Latest
Warning

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

Go to latest
Published: Sep 6, 2022 License: MIT Imports: 24 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Binance

type Binance struct {
	*binance.Binance
	// contains filtered or unexported fields
}

OKEX the exchange struct of okex.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 (o *Binance) CancelOrder(orderId string, currency goex.CurrencyPair) (bool, error)

func (*Binance) GetAccount

func (o *Binance) GetAccount() (*goex.Account, error)

func (*Binance) GetDepth

func (o *Binance) GetDepth(size int, currency goex.CurrencyPair) (*goex.Depth, error)

func (*Binance) GetExchangeName

func (o *Binance) GetExchangeName() string

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

func (o *Binance) GetOneOrder(orderId string, currency goex.CurrencyPair) (*goex.Order, error)

func (*Binance) GetOrderHistorys

func (o *Binance) GetOrderHistorys(currency goex.CurrencyPair, opt ...goex.OptionalParameter) ([]goex.Order, error)

func (*Binance) GetTicker

func (o *Binance) GetTicker(currency goex.CurrencyPair) (*goex.Ticker, error)

func (*Binance) GetTrades

func (o *Binance) GetTrades(currencyPair goex.CurrencyPair, since int64) ([]goex.Trade, error)

非个人,整个交易所的交易记录

func (*Binance) GetType

func (e *Binance) GetType() string

GetType get the type of this exchange

func (*Binance) GetUnfinishOrders

func (o *Binance) GetUnfinishOrders(currency goex.CurrencyPair) ([]goex.Order, error)

func (*Binance) LimitBuy

func (o *Binance) LimitBuy(amount, price string, currency goex.CurrencyPair, opt ...goex.LimitOrderOptionalParameter) (*goex.Order, error)

func (*Binance) LimitSell

func (o *Binance) LimitSell(amount, price string, currency goex.CurrencyPair, opt ...goex.LimitOrderOptionalParameter) (*goex.Order, error)

func (*Binance) Log

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

Log print something to console

func (*Binance) MarketBuy

func (o *Binance) MarketBuy(amount, price string, currency goex.CurrencyPair) (*goex.Order, error)

func (*Binance) MarketSell

func (o *Binance) MarketSell(amount, price string, currency goex.CurrencyPair) (*goex.Order, error)

func (*Binance) SetLimit

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

SetLimit set the limit calls amount per second of this exchange

type Exchange

type Exchange interface {
	GetKlineRecords(instId string, period goex.KlinePeriod, size int, optional ...goex.OptionalParameter) ([]goex.Kline, error)
	LimitBuy(instId string, amount, price string, optional ...goex.OptionalParameter) (*goex.Order, error)
	LimitSell(instId string, amount, price string, optional ...goex.OptionalParameter) (*goex.Order, error)
	//gx	goex.API
	Log(...interface{})
	GetType() string
	SetLimit(times interface{}) float64
	AutoSleep()
	GetMinAmount(stock string) float64
}

Exchange interface

func NewOKEX

func NewOKEX(opt interface{}) Exchange

type OKEX

type OKEX struct {
	*okex.OKExV5
	*okex.OKExV5Swap
	*okex.OKExV5Spot
	// 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 (o *OKEX) CancelOrder(orderId string, currency goex.CurrencyPair) (bool, error)

func (*OKEX) GetAccount

func (o *OKEX) GetAccount() (*goex.Account, error)

func (*OKEX) GetDepth

func (o *OKEX) GetDepth(size int, currency goex.CurrencyPair) (*goex.Depth, error)

func (*OKEX) GetExchangeName

func (o *OKEX) GetExchangeName() string

func (*OKEX) GetInstIdTicker

func (e *OKEX) GetInstIdTicker(instId string) interface{}

获取单个产品行情信息

func (*OKEX) GetKline

func (e *OKEX) GetKline(instId string, period int, options ...utils.OptionalParameter) ([]goex.Kline, error)

func (*OKEX) GetKlineFuture

func (e *OKEX) GetKlineFuture(contractType string, currency goex.CurrencyPair, period goex.KlinePeriod, size int, options ...goex.OptionalParameter) ([]goex.Kline, error)

func (*OKEX) GetKlineRecords

func (o *OKEX) GetKlineRecords(instId string, period goex.KlinePeriod, size int, optional ...goex.OptionalParameter) ([]goex.Kline, error)

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

func (o *OKEX) GetOneOrder(orderId string, currency goex.CurrencyPair) (*goex.Order, error)

func (*OKEX) GetOrderHistorys

func (o *OKEX) GetOrderHistorys(currency goex.CurrencyPair, opt ...goex.OptionalParameter) ([]goex.Order, error)

func (*OKEX) GetTicker

func (o *OKEX) GetTicker(currency goex.CurrencyPair) (*goex.Ticker, error)

func (*OKEX) GetTrades

func (o *OKEX) GetTrades(currencyPair goex.CurrencyPair, since int64) ([]goex.Trade, error)

非个人,整个交易所的交易记录

func (*OKEX) GetType

func (e *OKEX) GetType() string

GetType get the type of this exchange

func (*OKEX) GetUnfinishOrders

func (o *OKEX) GetUnfinishOrders(currency goex.CurrencyPair) ([]goex.Order, error)

func (*OKEX) LimitBuy

func (o *OKEX) LimitBuy(instId string, amount, price string, optional ...goex.OptionalParameter) (*goex.Order, error)

func (*OKEX) LimitSell

func (o *OKEX) LimitSell(instId string, amount, price string, optional ...goex.OptionalParameter) (*goex.Order, error)

func (*OKEX) Log

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

Log print something to console

func (*OKEX) MarketBuy

func (o *OKEX) MarketBuy(amount, price string, currency goex.CurrencyPair) (*goex.Order, error)

func (*OKEX) MarketSell

func (o *OKEX) MarketSell(amount, price string, currency goex.CurrencyPair) (*goex.Order, error)

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(options utils.OptionalParameter) interface{}

type Option

type Option struct {
	TraderID   int64
	Type       string
	Name       string
	AccessKey  string
	SecretKey  string
	Passphrase string
	Test       string
	HttpProxy  string
	HttpsProxy 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  //货币类型
	Pnl        float64
}

Order struct

type OrderBook

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

OrderBook struct

type Position

type Position struct {
	InstId        string
	MgnMode       string
	Price         float64 //价格
	Leverage      int     //杠杆比例
	Amount        float64 //总合约数量
	ConfirmAmount float64
	FrozenAmount  float64 //冻结的合约数量
	Profit        float64 //收益
	ContractType  string  //合约类型
	TradeType     string  //交易类型
	StockType     string  //货币类型
	PosId         string  //持仓ID
	PosSide       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

Jump to

Keyboard shortcuts

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