bittrex

package
v2.4.0 Latest Latest
Warning

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

Go to latest
Published: Oct 6, 2022 License: MIT Imports: 20 Imported by: 0

Documentation

Index

Constants

View Source
const (
	AddAction    = Action("add")
	UpdateAction = Action("update")
	DeleteAction = Action("delete")
)
View Source
const (
	OrderStatusOpen   = OrderStatus("OPEN")
	OrderStatusClosed = OrderStatus("CLOSED")
)
View Source
const (
	Endpoint = "https://api.bittrex.com/v3"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Action

type Action string

type Balance

type Balance struct {
	CurrencySymbol string          `json:"currencySymbol"`
	Total          decimal.Decimal `json:"decimal"`
	Available      decimal.Decimal `json:"available"`
}

type Client

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

func NewClient

func NewClient(httpClient *http.Client, signalrClient *signalr.Client, apiKey, apiSecret string) *Client

func (*Client) GetBalances

func (c *Client) GetBalances(ctx context.Context) ([]Balance, error)

func (*Client) GetClosedOrders

func (c *Client) GetClosedOrders(ctx context.Context, start time.Time) (*Orders, error)

func (*Client) GetOpenOrders

func (c *Client) GetOpenOrders(ctx context.Context) (*Orders, error)

func (*Client) GetOrderBook

func (c *Client) GetOrderBook(ctx context.Context, marketSymbol string, depth int) (*OrderBook, error)

func (*Client) Run

func (c *Client) Run(ctx context.Context) error

func (*Client) SubscribeOpenOrders

func (c *Client) SubscribeOpenOrders(ctx context.Context, start time.Time, callback func(*Orders, *OrderDelta) error) error

func (*Client) SubscribeOrderBook

func (c *Client) SubscribeOrderBook(ctx context.Context, marketSymbol string, depth int, callback func(orderBook *OrderBook, delta *OrderBookDelta) error) error

type Order

type Order struct {
	ID            string              `json:"id"`
	ClientOrderID string              `json:"clientOrderId"`
	MarketSymbol  string              `json:"marketSymbol"`
	Side          string              `json:"direction"`
	Type          string              `json:"type"`
	Quantity      decimal.NullDecimal `json:"quantity"`
	Ceiling       decimal.NullDecimal `json:"ceiling"`
	Limit         decimal.NullDecimal `json:"limit"`
	Option        string              `json:"timeInForce"`
	FillQuantity  decimal.Decimal     `json:"fillQuantity"`
	Commission    decimal.Decimal     `json:"commission"`
	Proceeds      decimal.Decimal     `json:"proceeds"`
	Status        OrderStatus         `json:"status"`
	CreatedAt     time.Time           `json:"createdAt"`
	UpdatedAt     time.Time           `json:"updatedAt"`
	ClosedAt      time.Time           `json:"closedAt"`
}

type OrderBook

type OrderBook struct {
	MarketSymbol string
	Depth        int
	Sequence     int
	Bids         OrderBookEntries
	Asks         OrderBookEntries
}

func (*OrderBook) Apply

func (b *OrderBook) Apply(delta *OrderBook) *OrderBookDelta

type OrderBookDelta

type OrderBookDelta struct {
	MarketSymbol string
	Depth        int
	Sequence     int
	Bids         OrderBookDeltaEntries
	Asks         OrderBookDeltaEntries
}

type OrderBookDeltaEntries

type OrderBookDeltaEntries []OrderBookDeltaEntry

func (OrderBookDeltaEntries) SearchRate

func (e OrderBookDeltaEntries) SearchRate(rate decimal.Decimal, cmp func(l, r decimal.Decimal) bool) int

func (OrderBookDeltaEntries) String

func (e OrderBookDeltaEntries) String() string

type OrderBookDeltaEntry

type OrderBookDeltaEntry struct {
	Action   Action
	Rate     decimal.Decimal
	Quantity decimal.Decimal
}

type OrderBookEntries

type OrderBookEntries []OrderBookEntry

func (OrderBookEntries) Apply

func (OrderBookEntries) OrderBookDeltaEntries

func (e OrderBookEntries) OrderBookDeltaEntries(action Action) OrderBookDeltaEntries

func (OrderBookEntries) SearchRate

func (e OrderBookEntries) SearchRate(rate decimal.Decimal, f func(l, r decimal.Decimal) bool) int

func (OrderBookEntries) String

func (e OrderBookEntries) String() string

type OrderBookEntry

type OrderBookEntry struct {
	Rate     decimal.Decimal
	Quantity decimal.Decimal
}

func (OrderBookEntry) OrderBookDiffEntry

func (e OrderBookEntry) OrderBookDiffEntry(action Action) OrderBookDeltaEntry

type OrderDelta

type OrderDelta struct {
	Sequence int
	Action   Action
	Order    *Order
}

type OrderNotFoundError

type OrderNotFoundError struct {
	ID string
}

func (*OrderNotFoundError) Error

func (e *OrderNotFoundError) Error() string

type OrderStatus

type OrderStatus string

func (*OrderStatus) UnmarshalJSON

func (s *OrderStatus) UnmarshalJSON(data []byte) error

type Orders

type Orders struct {
	Sequence int
	Data     []*Order
}

func (*Orders) Apply

func (o *Orders) Apply(sequence int, order *Order) (*OrderDelta, error)

func (*Orders) SearchOrder

func (o *Orders) SearchOrder(order *Order) int

type SequenceError

type SequenceError struct {
	Expected, Actual int
}

func (*SequenceError) Error

func (e *SequenceError) Error() string

type SubscriptionError

type SubscriptionError struct {
	Streams []string
}

func (*SubscriptionError) Error

func (e *SubscriptionError) Error() string

Jump to

Keyboard shortcuts

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