v1

package
v0.0.0-...-30c84b1 Latest Latest
Warning

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

Go to latest
Published: Jun 6, 2020 License: MIT Imports: 29 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// APIREMAIN API Limit for same IP
	APIREMAIN = 500
	// APIREMAINFORORDER API Limit for orders/cancelAll
	APIREMAINFORORDER = 300
)
View Source
const (
	// APIHOST is Endpoint
	APIHOST = "https://api.bitflyer.com"

	// APITIMEOUT http wait
	APITIMEOUT = 10 * time.Second
)

Variables

This section is empty.

Functions

func SetAuthHeaders

func SetAuthHeaders(method string, payload []byte, config *Config, u *url.URL, req Requester) (*http.Header, error)

SetAuthHeaders Signture to header

func WsParamForPrivate

func WsParamForPrivate(sercret string) (now int, nonce, sign string)

WsParamForPrivate return util for private websocket

Types

type Client

type Client struct {
	HTTPClient *http.Client
	Limit      *Limit
	// contains filtered or unexported fields
}

func New

func New(config *Config) *Client

func (*Client) Addresses

func (c *Client) Addresses(req *address.Request) (*address.Response, error)

func (*Client) Balance

func (c *Client) Balance(req *balance.Request) (*balance.Response, error)

func (*Client) Balances

func (*Client) Bankin

func (c *Client) Bankin(req *banks.RequestForIn) (*banks.ResponseForIn, error)

func (*Client) Bankout

func (c *Client) Bankout(req *banks.RequestForOut) (*banks.ResponseForOut, error)

func (*Client) Banks

func (*Client) Board

func (c *Client) Board(req *board.Request) (*board.Response, error)

func (*Client) BoardHealth

func (c *Client) BoardHealth(req *health.RequestForBoard) (*health.Board, error)

func (*Client) CancelAll

func (c *Client) CancelAll(req *cancels.RequestForAllCancel) error

func (*Client) CancelByID

func (c *Client) CancelByID(req *cancels.RequestByID) error

func (*Client) CancelByIDForParent

func (c *Client) CancelByIDForParent(req *cancels.RequestByIDForParentCancel) error

func (*Client) Chats

func (c *Client) Chats(req *chat.Request) (*chat.Response, error)

func (*Client) ChildOrder

func (*Client) ChildOrders

一覧系

func (*Client) Coinin

func (c *Client) Coinin(req *coins.RequestForIn) (*coins.ResponseForIn, error)

func (*Client) Coinout

func (c *Client) Coinout(req *coins.RequestForOut) (*coins.ResponseForOut, error)

func (*Client) Collateral

func (c *Client) Collateral(req *collateral.Request) (*collateral.Response, error)

func (*Client) Collaterals

func (*Client) Commission

func (c *Client) Commission(req *commission.Request) (*commission.Response, error)

func (*Client) Config

func (p *Client) Config() *Config

func (*Client) Do

func (p *Client) Do(req Requester, result interface{}) error

Do request APILimit.Private(req.Header) APILimit.Public(req.Header)

func (*Client) ExchangeHealth

func (c *Client) ExchangeHealth(req *health.RequestForExchange) (*health.Exchange, error)

func (*Client) Executions

func (c *Client) Executions(req *execution.Request) (*execution.Response, error)

func (*Client) Host

func (p *Client) Host() string

func (*Client) MyExecutions

func (c *Client) MyExecutions(req *list.RequestForExecutions) (*list.ResponseForExecutions, error)

func (*Client) ParentOrder

func (*Client) ParentOrders

func (*Client) Positions

func (*Client) Ticker

func (c *Client) Ticker(req *ticker.Request) (*ticker.Response, error)

func (*Client) Withdraw

type Config

type Config struct {
	Key    string
	Secret string
	// contains filtered or unexported fields
}

func (*Config) Check

func (p *Config) Check() *Config

type Headers

type Headers struct {
	Public  Limit
	Private Limit
}

APIHeaders 基本的には5分毎リセット

type Limit

type Limit struct {
	sync.RWMutex
	// contains filtered or unexported fields
}

Limit is API Limit, ForOrder is Order(child/parent), CancelAll

func NewLimit

func NewLimit(comparisonValue int) *Limit

func (*Limit) Check

func (p *Limit) Check() error

func (*Limit) CheckForOrder

func (p *Limit) CheckForOrder() error

CheckForOrder is check API limit for Order method

func (*Limit) Period

func (p *Limit) Period(isOrder bool) int

func (*Limit) Remain

func (p *Limit) Remain(isOrder bool) int

func (*Limit) Reset

func (p *Limit) Reset(isOrder bool) time.Time

func (*Limit) Set

func (p *Limit) Set(h http.Header)

Set X-xxxからLimitを取得 wg.Workgroup: 174748 6572 ns/op permutation: 414080 2934 ns/op

func (*Limit) SetThreshold

func (p *Limit) SetThreshold(i int)

type Requester

type Requester interface {
	Path() string
	Method() string
	Query() string
	Payload() []byte
}

Directories

Path Synopsis
private
public
realtime

Jump to

Keyboard shortcuts

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