dex

package
v0.0.0-...-9d4922b Latest Latest
Warning

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

Go to latest
Published: May 1, 2023 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Unix = iota // unix second
	High
	Open
	Low
	Close
	Quantity
	Volume
)
View Source
const Columns = 7

Variables

This section is empty.

Functions

func BinanceFutures

func BinanceFutures(n int) chan string

func GetBinancePrice

func GetBinancePrice(tickerid string) (float64, error)

func GetPrice

func GetPrice(tickerid string) (float64, error)

Types

type Data

type Data struct {
	Kline [][]float64 `json:"kline"`
}

type DataFrame

type DataFrame struct {
	*mat.Dense
}

func (*DataFrame) Close

func (df *DataFrame) Close() []float64

func (*DataFrame) CloseAt

func (df *DataFrame) CloseAt(i int) float64

func (*DataFrame) High

func (df *DataFrame) High() []float64

func (*DataFrame) HighAt

func (df *DataFrame) HighAt(i int) float64

func (*DataFrame) Len

func (df *DataFrame) Len() int

func (*DataFrame) Low

func (df *DataFrame) Low() []float64

func (*DataFrame) LowAt

func (df *DataFrame) LowAt(i int) float64

func (*DataFrame) Open

func (df *DataFrame) Open() []float64

func (*DataFrame) OpenAt

func (df *DataFrame) OpenAt(i int) float64

func (*DataFrame) Print

func (df *DataFrame) Print()

func (*DataFrame) Quantity

func (df *DataFrame) Quantity() []float64

func (*DataFrame) QuantityAt

func (df *DataFrame) QuantityAt(i int) float64

func (*DataFrame) SearchByTime

func (df *DataFrame) SearchByTime(t time.Time) int

func (*DataFrame) SetCloseAt

func (df *DataFrame) SetCloseAt(i int, v float64)

func (*DataFrame) SetHighAt

func (df *DataFrame) SetHighAt(i int, v float64)

func (*DataFrame) SetLowAt

func (df *DataFrame) SetLowAt(i int, v float64)

func (*DataFrame) SetOpenAt

func (df *DataFrame) SetOpenAt(i int, v float64)

func (*DataFrame) SetQuantityAt

func (df *DataFrame) SetQuantityAt(i int, v float64)

func (*DataFrame) SetUnixAt

func (df *DataFrame) SetUnixAt(i int, v float64)

func (*DataFrame) SetVolumeAt

func (df *DataFrame) SetVolumeAt(i int, v float64)

func (*DataFrame) Slice

func (df *DataFrame) Slice(i, k, j, l int) *DataFrame

func (*DataFrame) Unix

func (df *DataFrame) Unix() []float64

func (*DataFrame) UnixAt

func (df *DataFrame) UnixAt(i int) float64

func (*DataFrame) Volume

func (df *DataFrame) Volume() []float64

交易额

func (*DataFrame) VolumeAt

func (df *DataFrame) VolumeAt(i int) float64

type Data_

type Data_ struct {
	TotalCount int64  `json:"total_count"`
	TotalPages int64  `json:"total_pages"`
	Page       int64  `json:"page"`
	List       []List `json:"list"`
}

type KLine

type KLine struct {
	Data Data   `json:"data"`
	Code int64  `json:"code"`
	Msg  string `json:"msg"`
}
{
    "data": {
        "kline": [
            [
                1603065600,  //时间
                39.7777, // 最高价
                32.3569, // 开盘
                20.6023, // 最低价
                38.6663, // 收盘
                5387902.82,   // 成交量
                154196745.159039 // 交易额
            ]
        ]
    },
    "code": 200,
    "msg": "success"
}

func GetKline

func GetKline(tickerid string, period time.Duration) *KLine

func (*KLine) IsEmpty

func (k *KLine) IsEmpty() bool

func (*KLine) ToDataFrame

func (k *KLine) ToDataFrame() (DataFrame, error)

type List

type List struct {
	Code           string   `json:"code"`
	Symbol         string   `json:"symbol"`
	Name           string   `json:"name"`
	Price          float64  `json:"price"`
	Contracttype   string   `json:"contracttype"`
	Contractvalue  string   `json:"contractvalue"`
	Minunitchange  string   `json:"minunitchange"`
	Leveragechoose string   `json:"leveragechoose"`
	Openingcharge  string   `json:"openingcharge"`
	Closingcharge  string   `json:"closingcharge"`
	Tradingtime    string   `json:"tradingtime"`
	Fundsrate      float64  `json:"fundsrate"`
	OpenInterest   float64  `json:"open_interest"`
	Markets        []Market `json:"martkets"`
}

type Market

type Market struct {
	Tickerid     string  `json:"tickerid"`
	Code         string  `json:"code"`
	Name         string  `json:"name"`
	Pair1        string  `json:"pair1"`
	Pair2        Pair2   `json:"pair2"`
	Title        string  `json:"title"`
	Price        float64 `json:"price"`
	Changerate   float64 `json:"changerate"`
	Amount       float64 `json:"amount"`
	OpenInterest float64 `json:"open_interest"`
	Refreshtime  int64   `json:"refreshtime"`
	IsFocus      int64   `json:"is_focus"`
	Showkline    int64   `json:"showkline"`
}

type Pair2

type Pair2 string
const (
	Usd  Pair2 = "USD"
	Usdt Pair2 = "USDT"
)

type PriceResponse

type PriceResponse struct {
	Data Data_  `json:"data"`
	Code int64  `json:"code"`
	Msg  string `json:"msg"`
}

Jump to

Keyboard shortcuts

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