woo

package
v0.0.194 Latest Latest
Warning

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

Go to latest
Published: Dec 31, 2021 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	BeforeRequest func(method, path string, rps float64) error = nil
	AfterRequest  func()                                       = nil
)

Functions

func FormatSymbol

func FormatSymbol(base, quote string) string

func IsError

func IsError(response []byte) (bool, string)

func ParseSymbol

func ParseSymbol(symbol string) (string, string, error)

Types

type BookEntry

type BookEntry struct {
	Price    float64 `json:"price"`
	Quantity float64 `json:"quantity"`
}

type Client

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

func New

func New(URL, apiKey, apiSecret string) *Client

func (*Client) CancelOrder

func (client *Client) CancelOrder(symbol string, orderID int64) error

func (*Client) Order

func (client *Client) Order(symbol string, side OrderSide, orderType OrderType, quantity, price float64, tag string) (*NewOrder, error)

func (*Client) OrderBook

func (client *Client) OrderBook(symbol string) (*OrderBook, error)

func (*Client) Orders

func (client *Client) Orders(symbol string, status OrderStatus) ([]Order, error)

func (*Client) Summary

func (client *Client) Summary() (Summary, error)

func (*Client) Symbols

func (client *Client) Symbols() ([]Symbol, error)

func (*Client) Ticker

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

type Error

type Error struct {
	Success bool   `json:"success"`
	Message string `json:"message"`
}

func (*Error) Failure

func (err *Error) Failure() bool

type NewOrder

type NewOrder struct {
	ID       int64       `json:"order_id"`
	Type     string      `json:"order_type"`
	Price    float64     `json:"order_price"`
	Quantity float64     `json:"order_quantity"`
	Amount   interface{} `json:"order_amount"`
}

type Order

type Order struct {
	Symbol               string      `json:"symbol"`
	Status               OrderStatus `json:"status"`
	Side                 OrderSide   `json:"side"`
	CreatedTime          string      `json:"created_time"`
	UpdatedTime          string      `json:"updated_time"`
	OrderID              int64       `json:"order_id"`
	ApplicationID        string      `json:"application_id"`
	OrderTag             string      `json:"order_tag"`
	Price                float64     `json:"price"`
	Type                 OrderType   `json:"type"`
	Quantity             float64     `json:"quantity"`
	Amount               interface{} `json:"amount"`
	Executed             float64     `json:"executed"`
	TotalFee             float64     `json:"total_fee"`
	AverageExecutedPrice float64     `json:"average_executed_price"`
}

func (*Order) CreatedAt

func (order *Order) CreatedAt() time.Time

func (*Order) ExecutedAt added in v0.0.180

func (order *Order) ExecutedAt() float64

func (*Order) QuantityMinusFee added in v0.0.180

func (order *Order) QuantityMinusFee() float64

func (*Order) UpdatedAt

func (order *Order) UpdatedAt() time.Time

type OrderBook

type OrderBook struct {
	Bids []BookEntry `json:"bids"`
	Asks []BookEntry `json:"asks"`
}

type OrderSide

type OrderSide string
const (
	OrderSideBuy  OrderSide = "BUY"
	OrderSideSell OrderSide = "SELL"
)

type OrderStatus

type OrderStatus string
const (
	OrderStatusNew           OrderStatus = "NEW"
	OrderStatusCancelled     OrderStatus = "CANCELLED"
	OrderStatusPartialFilled OrderStatus = "PARTIAL_FILLED"
	OrderStatusFilled        OrderStatus = "FILLED"
	OrderStatusRejected      OrderStatus = "REJECTED"
	OrderStatusIncomplete    OrderStatus = "INCOMPLETE"
	OrderStatusCompleted     OrderStatus = "COMPLETED"
)

type OrderType

type OrderType string
const (
	OrderTypeLimit  OrderType = "LIMIT"
	OrderTypeMarket OrderType = "MARKET"
)

type Orders

type Orders struct {
	Meta struct {
		RecordsPerPage int64 `json:"records_per_page"`
		CurrentPage    int64 `json:"current_page"`
	} `json:"meta"`
	Rows []Order `json:"rows"`
}

type Summary

type Summary []Ticker

type Symbol

type Symbol struct {
	Symbol      string  `json:"symbol"`
	QuoteMin    float64 `json:"quote_min"`
	QuoteMax    float64 `json:"quote_max"`
	QuoteTick   float64 `json:"quote_tick"`
	BaseMin     float64 `json:"base_min"`
	BaseMax     float64 `json:"base_max"`
	BaseTick    float64 `json:"base_tick"`
	MinNotional float64 `json:"min_notional"`
	PriceRange  float64 `json:"price_range"`
	CreatedTime string  `json:"created_time"`
	UpdatedTime string  `json:"updated_time"`
}

type Symbols

type Symbols struct {
	Rows []Symbol `json:"rows"`
}

type Ticker

type Ticker struct {
	Symbol                string  `json:"trading_pairs"`
	LastPrice             float64 `json:"last_price"`
	LowestAsk             float64 `json:"lowest_ask"`
	HighestBid            float64 `json:"highest_bid"`
	BaseVolume            float64 `json:"base_volume"`
	QuoteVolume           float64 `json:"quote_volume"`
	PriceChangePercent24h float64 `json:"price_change_percent_24h"`
	HighestPrice24h       float64 `json:"highest_price_24h"`
	LowestPrice24h        float64 `json:"lowest_price_24h"`
}

Jump to

Keyboard shortcuts

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