model

package
v0.0.23 Latest Latest
Warning

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

Go to latest
Published: Mar 27, 2022 License: MIT Imports: 5 Imported by: 3

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	SideTypeBuy  SideType = "BUY"
	SideTypeSell SideType = "SELL"

	OrderTypeLimit           OrderType = "LIMIT"
	OrderTypeMarket          OrderType = "MARKET"
	OrderTypeLimitMaker      OrderType = "LIMIT_MAKER"
	OrderTypeStopLoss        OrderType = "STOP_LOSS"
	OrderTypeStopLossLimit   OrderType = "STOP_LOSS_LIMIT"
	OrderTypeTakeProfit      OrderType = "TAKE_PROFIT"
	OrderTypeTakeProfitLimit OrderType = "TAKE_PROFIT_LIMIT"

	OrderStatusTypeNew             OrderStatusType = "NEW"
	OrderStatusTypePartiallyFilled OrderStatusType = "PARTIALLY_FILLED"
	OrderStatusTypeFilled          OrderStatusType = "FILLED"
	OrderStatusTypeCanceled        OrderStatusType = "CANCELED"
	OrderStatusTypePendingCancel   OrderStatusType = "PENDING_CANCEL"
	OrderStatusTypeRejected        OrderStatusType = "REJECTED"
	OrderStatusTypeExpired         OrderStatusType = "EXPIRED"
)

Functions

func NumDecPlaces

func NumDecPlaces(v float64) int64

Types

type Account

type Account struct {
	Balances []Balance
}

func (Account) Balance

func (a Account) Balance(tick string) Balance

func (Account) Equity added in v0.0.15

func (a Account) Equity() float64

type AssetInfo added in v0.0.18

type AssetInfo struct {
	BaseAsset  string
	QuoteAsset string

	MinPrice    float64
	MaxPrice    float64
	MinQuantity float64
	MaxQuantity float64
	StepSize    float64
	TickSize    float64

	// Number of decimal places
	QtyDecimalPrecision   int64
	PriceDecimalPrecision int64
}

type Balance

type Balance struct {
	Tick string
	Free float64
	Lock float64
}

type Candle

type Candle struct {
	Pair     string
	Time     time.Time
	Open     float64
	Close    float64
	Low      float64
	High     float64
	Volume   float64
	Trades   int64
	Complete bool
}

func (Candle) Less

func (c Candle) Less(j Item) bool

func (Candle) ToSlice

func (c Candle) ToSlice(precision int) []string

type Dataframe

type Dataframe struct {
	Pair string

	Close  Series
	Open   Series
	High   Series
	Low    Series
	Volume Series

	Time       []time.Time
	LastUpdate time.Time

	// Custom user metadata
	Metadata map[string]Series
}

type Item added in v0.0.9

type Item interface {
	Less(Item) bool
}

type Order

type Order struct {
	ID         int64           `db:"id" json:"id"`
	ExchangeID int64           `db:"exchange_id" json:"exchange_id"`
	Pair       string          `db:"pair" json:"pair"`
	Side       SideType        `db:"side" json:"side"`
	Type       OrderType       `db:"type" json:"type"`
	Status     OrderStatusType `db:"status" json:"status"`
	Price      float64         `db:"price" json:"price"`
	Quantity   float64         `db:"quantity" json:"quantity"`

	CreatedAt time.Time `db:"created_at" json:"created_at"`
	UpdatedAt time.Time `db:"updated_at" json:"updated_at"`

	// OCO Orders only
	Stop    *float64 `db:"stop" json:"stop"`
	GroupID *int64   `db:"group_id" json:"group_id"`

	// Internal use (Plot)
	RefPrice float64 `json:"-"`
	Profit   float64 `json:"-"`
	Candle   Candle  `json:"-"`
}

func (Order) String

func (o Order) String() string

type OrderStatusType

type OrderStatusType string

type OrderType

type OrderType string

type PriorityQueue

type PriorityQueue struct {
	sync.Mutex
	// contains filtered or unexported fields
}

func NewPriorityQueue

func NewPriorityQueue(data []Item) *PriorityQueue

func (*PriorityQueue) Len

func (q *PriorityQueue) Len() int

func (*PriorityQueue) Peek added in v0.0.9

func (q *PriorityQueue) Peek() Item

func (*PriorityQueue) Pop

func (q *PriorityQueue) Pop() Item

func (*PriorityQueue) Push

func (q *PriorityQueue) Push(item Item)

type Series

type Series []float64

func (Series) Cross added in v0.0.13

func (s Series) Cross(ref Series) bool

func (Series) Crossover

func (s Series) Crossover(ref Series) bool

func (Series) Crossunder

func (s Series) Crossunder(ref Series) bool

func (Series) Last

func (s Series) Last(position int) float64

func (Series) LastValues

func (s Series) LastValues(size int) []float64

func (Series) Values

func (s Series) Values() []float64

type Settings

type Settings struct {
	Pairs    []string
	Telegram TelegramSettings
}

type SideType

type SideType string

type TelegramSettings

type TelegramSettings struct {
	Enabled bool
	Token   string
	Users   []int
}

Jump to

Keyboard shortcuts

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