trademodel

package module
v1.0.5 Latest Latest
Warning

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

Go to latest
Published: Dec 26, 2020 License: GPL-3.0 Imports: 2 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

README

trademodel

Common trade structs used by coinex

Documentation

Index

Constants

View Source
const (
	DirectLong  TradeType = 1
	DirectShort TradeType = 1 << 1

	Limit  TradeType = 1 << 3
	Market TradeType = 1 << 4
	Stop   TradeType = 1 << 5

	Open  TradeType = 1 << 6
	Close TradeType = 1 << 7

	OpenLong   = Open | DirectLong
	OpenShort  = Open | DirectShort
	CloseLong  = Close | DirectLong
	CloseShort = Close | DirectShort
	StopLong   = Stop | DirectLong
	StopShort  = Stop | DirectShort
)

Variables

View Source
var (
	OrderStatusFilled   = "FILLED"
	OrderStatusCanceled = "CANCELED"
)

Functions

This section is empty.

Types

type Balance

type Balance struct {
	Currency  string
	Available float64
	Frozen    float64
	Balance   float64
}

type Candle

type Candle struct {
	ID     int64   `xorm:"pk autoincr null 'id'"`
	Start  int64   `xorm:"unique index 'start'"`
	Open   float64 `xorm:"notnull 'open'"`
	High   float64 `xorm:"notnull 'high'"`
	Low    float64 `xorm:"notnull 'low'"`
	Close  float64 `xorm:"notnull 'close'"`
	VWP    float64 `xorm:"notnull 'vwp'"`
	Volume float64 `xorm:"notnull 'volume'"`
	Trades int64   `xorm:"notnull 'trades'"`
	Table  string  `xorm:"-"`
}

func (Candle) GetStart added in v1.0.3

func (c Candle) GetStart() int64

func (Candle) GetTable added in v1.0.3

func (c Candle) GetTable() string

func (*Candle) SetTable added in v1.0.3

func (c *Candle) SetTable(tbl string)

func (Candle) String

func (c Candle) String() string

func (Candle) TableName

func (c Candle) TableName() string

func (Candle) Time

func (c Candle) Time() time.Time

type CandleList added in v1.0.4

type CandleList []*Candle

CandleList candle list

func (CandleList) High added in v1.0.4

func (l CandleList) High() (ret float64)

func (CandleList) Low added in v1.0.4

func (l CandleList) Low() (ret float64)

func (CandleList) Merge added in v1.0.4

func (l CandleList) Merge() (ret *Candle)

Merge merge multi candle to one

type Currency added in v1.0.4

type Currency struct {
	Coin string
	Base string
}

func (Currency) String added in v1.0.4

func (currency Currency) String() string

type Depth

type Depth Orderbook

type DepthInfo

type DepthInfo struct {
	Price  float64
	Amount float64
}

type Order

type Order struct {
	OrderID  string
	Symbol   string
	Currency string
	Amount   float64
	Price    float64
	Status   string
	Side     string
	Time     time.Time
}

type Orderbook

type Orderbook struct {
	Sells      []DepthInfo
	Buys       []DepthInfo
	UpdateTime time.Time
}

type Symbol

type Symbol struct {
	Name          string
	BaseCurrency  string `json:"base_currency"`
	QuoteCurrency string `json:"quote_currency"`
	PriceDecimal  int    `json:"price_decimal"`
	AmountDecimal int    `json:"amount_decimal"`
}

type Ticker

type Ticker struct {
	CurrencyPair string
	Last         float64
	High         float64
	Low          float64
	Bid          float64
	Ask          float64
	Volume       float64
}

type Trade

type Trade struct {
	ID     string
	Action TradeType
	Time   time.Time
	Price  float64
	Amount float64
	Side   string
	Remark string
}

type TradeAction

type TradeAction struct {
	Action TradeType
	Amount float64
	Price  float64
	Time   time.Time
}

TradeAction trade action

type TradeType added in v1.0.1

type TradeType int

func (TradeType) IsLong added in v1.0.1

func (a TradeType) IsLong() bool

func (TradeType) IsOpen added in v1.0.1

func (a TradeType) IsOpen() bool

func (TradeType) IsStop added in v1.0.2

func (a TradeType) IsStop() bool

func (TradeType) String added in v1.0.1

func (t TradeType) String() (ret string)

Jump to

Keyboard shortcuts

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