bitfinex

package
v0.0.0-...-cfa26d7 Latest Latest
Warning

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

Go to latest
Published: Feb 20, 2018 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Balance

type Balance struct {
	Type      string  `json:"type,omitempty"`
	Currency  string  `json:"currency,omitempty"`
	Amount    float64 `json:"amount,string,omitempty"`
	Available float64 `json:"available,string,omitempty"`
}

type Client

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

func NewClient

func NewClient() (*Client, error)

func NewClientFromEnv

func NewClientFromEnv() (*Client, error)

func (*Client) Balances

func (c *Client) Balances() ([]*Balance, error)

func (*Client) Buy

func (c *Client) Buy(amount float64, symbol string, price float64, typ Type) (*OrderResponse, error)

Buy is a convenience method to buy a currency instead of invoking Order.

func (*Client) Cancel

func (c *Client) Cancel(id interface{}) (*OrderResponse, error)

func (*Client) Order

func (c *Client) Order(order *Order) (*OrderResponse, error)

func (*Client) RealtimeTicker

func (c *Client) RealtimeTicker(ts *TickerSubscription) (tkCh chan *Ticker, cancelFunc func() error, err error)

func (*Client) Sell

func (c *Client) Sell(amount float64, symbol string, price float64, typ Type) (*OrderResponse, error)

Sell is a convenience method to sell a currency instead of invoking Order.

func (*Client) SetCredentials

func (c *Client) SetCredentials(ak *Credentials)

func (*Client) SetHTTPRoundTripper

func (c *Client) SetHTTPRoundTripper(rt http.RoundTripper)

func (*Client) Status

func (c *Client) Status(id interface{}) (*OrderResponse, error)

func (*Client) Ticker

func (c *Client) Ticker(symbol string) (*Ticker, error)

func (*Client) VolumeInDays

func (c *Client) VolumeInDays(symbol string) (*Volume, error)

type Credentials

type Credentials struct {
	Key    string `json:"key"`
	Secret string `json:"secret"`
}

type Order

type Order struct {
	// Side is required, even in the zero value.
	Side Side `json:"side,omitempty"`

	Type Type `json:"type,omitempty"`

	// Symbol is required, even in the zero value.
	Symbol string `json:"symbol,omitempty"`

	// Price is required, even in the zero value.
	Price float64 `json:"price,string"`

	// Amount is required, even in the zero value.
	Amount float64 `json:"amount,string,omitempty"`

	// Hidden if set, means that the order should be hidden.
	Hidden bool `json:"is_hidden,omitempty"`

	// PostOnly is only relevant for limit orders.
	PostOnly bool `json:"is_postonly,omitempty"`

	// UseAllAvailable if set will post an order
	// that will use all of your available balance.
	UseAllAvailable otils.NumericBool `json:"use_all_available,omitempty"`

	// OCOOrder sets an additional STOP OCO order
	// that will be linked with the current order.
	// OCOOrder is optional but its serialized form
	// must be sent even with the zero value.
	OCOOrder bool `json:"ocoorder"`

	// BuyPriceOCO represents the price of the OCO
	// stop order to place iff OCOOrder is set.
	// BuyPriceOCO is optional but its serialized form
	// must be sent even with the zero value.
	BuyPriceOCO float64 `json:"buy_price_oco"`

	// SellPriceOCO represents the price of the OCO
	// stop order to place if OCOOrder is set.
	// SellPriceOCO is optional but its serialized form
	// must be sent even with the zero value.
	SellPriceOCO float64 `json:"sell_price_oco"`
}

func (*Order) Validate

func (o *Order) Validate() error

type OrderResponse

type OrderResponse struct {
	ID       uint64  `json:"id,omitempty"`
	Symbol   string  `json:"symbol,omitempty"`
	Exchange string  `json:"exchange,omitempty"`
	Price    float64 `json:"price,string,omitempty"`

	AverageExecutionPrice float64 `json:"avg_execution_price,string,omitempty"`

	Side            Side    `json:"side,omitempty"`
	Type            string  `json:"type,omitempty"`
	TimestampMs     float64 `json:"timestamp,string,omitempty"`
	Live            bool    `json:"is_live,omitempty"`
	Cancelled       bool    `json:"is_cancelled,omitempty"`
	Hidden          bool    `json:"is_hidden,omitempty"`
	WasForced       bool    `json:"was_forced,omitempty"`
	OriginalAmount  float64 `json:"original_amount,string,omitempty"`
	RemainingAmount float64 `json:"remaining_amount,string,omitempty"`
	ExecutedAmount  float64 `json:"executed_amount,string,omitempty"`
	OrderID         uint64  `json:"order_id,omitempty"`

	// OCOOrderID will be set if the order is
	// an OCO order, otherwise it will be null.
	OCOOrderID interface{} `json:"oco_order,omitempty"`
}

type Side

type Side string
const (
	Buy  Side = "buy"
	Sell Side = "sell"
)

type Subscription

type Subscription struct {
	Event     string  `json:"event"`
	Channel   string  `json:"channel"`
	ChannelID float64 `json:"chanId"`
	Pair      string  `json:"pair"`
}

type Ticker

type Ticker realTimeTicker

type TickerSubscription

type TickerSubscription struct {
	Symbols []string `json:"symbols"`
}

type Type

type Type string
const (
	ExchangeLimit        Type = "exchange limit"
	ExchangeMarket       Type = "exchange market"
	Market               Type = "market"
	Limit                Type = "limit"
	Stop                 Type = "stop"
	TrailingStop         Type = "trailing-stop"
	FillOrKill           Type = "fill-or-kill"
	ExchangeTrailingStop Type = "exchange trailing-stop"
	ExchangeFillOrKill   Type = "exchange fill-or-kill"
)

type Volume

type Volume struct {
	Day   float64 `json:"day,omitempty"`
	Week  float64 `json:"week,omitempty"`
	Month float64 `json:"month,omitempty"`
}

Jump to

Keyboard shortcuts

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