platform

package
v0.3.1 Latest Latest
Warning

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

Go to latest
Published: Dec 19, 2021 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

View Source
const (
	OrderSideBuy  = "buy"
	OrderSideSell = "sell"
)
View Source
const (
	OrderTypeMarket = "MARKET"
	OrderTypeLimit  = "LIMIT"
)
View Source
const (
	StatusFilled = "FILLED"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Account

type Account interface {
	Wallet(ctx context.Context) (wallet map[string]Fixed, err error)
}

type BookTicker added in v0.2.0

type BookTicker struct {
	Time         int64
	UpdateID     string
	BestBidPrice Fixed
	BestBidQty   Fixed
	BestAskPrice Fixed
	BestAskQty   Fixed
}

type Candle

type Candle struct {
	Time                int64
	Open                Fixed
	High                Fixed
	Low                 Fixed
	Close               Fixed
	Volume              Fixed
	TimeClose           int64
	VolumeQuote         Fixed
	CountTrades         int64
	VolumeTakerBuyBase  Fixed
	VolumeTakerBuyQuote Fixed
}

type Event

type Event struct {
	Trade      Trade
	Candle     Candle
	BookTicker BookTicker
}

type EventContainer

type EventContainer struct {
	Type  EventType
	Event Event
	Error error
}

func MakeBookTicker added in v0.2.0

func MakeBookTicker(b BookTicker) EventContainer

func MakeCandle

func MakeCandle(c Candle) EventContainer

func MakeError

func MakeError(err error) EventContainer

func MakeTrade

func MakeTrade(t Trade) EventContainer

type EventType

type EventType int
const (
	EventErr EventType = iota
	EventCandle
	EventTrade
	EventBookTicker
)

type Fixed

type Fixed = fixed.Fixed

type OptionsOCO added in v0.1.3

type OptionsOCO struct {
	Price    Fixed
	Stop     Fixed
	Limit    Fixed
	Quantity Fixed
}

type Order

type Order struct {
	Symbol                   string
	OrderID                  string
	Price                    string
	OrigQuantity             string
	ExecutedQuantity         string
	CummulativeQuoteQuantity string
	Status                   string
	Type                     string
	Side                     string
	StopPrice                string
	Time                     int64
}

type OrderSide

type OrderSide string

type OrderType

type OrderType string

type Public

type Public interface {
	Subscribe(ctx context.Context, symbol string) (events <-chan EventContainer)
}

type Spot

type Spot interface {
	OrderMarket(ctx context.Context, symbol string, side OrderSide, quantity Fixed) (orderID string, err error)
	OrderOCO(ctx context.Context, symbol string, side OrderSide, opt OptionsOCO) (orderID string, err error)
	Cancel(ctx context.Context, symbol string, orderID string) (err error)
	CancelAll(ctx context.Context, symbol string) (err error)
	QueryOrder(ctx context.Context) (err error)
	ListOrders(ctx context.Context, symbol string) (orders []Order, err error)
}

type Status

type Status string

type Trade

type Trade struct {
	TradeID      int64
	Time         int64
	Historic     bool
	Symbol       string
	Price        Fixed
	Quantity     Fixed
	IsBuyerMaker bool
}

Jump to

Keyboard shortcuts

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