vwap

package
v0.0.0-...-99e30f2 Latest Latest
Warning

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

Go to latest
Published: Dec 6, 2021 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DataPoint

type DataPoint struct {
	Price     decimal.Decimal
	Volume    decimal.Decimal
	ProductID string
}

DataPoint represents a single data point from coinbase.

type List

type List struct {
	DataPoints        []DataPoint
	SumVolumeWeighted map[string]decimal.Decimal
	SumVolume         map[string]decimal.Decimal
	VWAP              map[string]decimal.Decimal

	MaxSize uint
	// contains filtered or unexported fields
}

List represents a queue of DataPoints.

func NewList

func NewList(dataPoint []DataPoint, maxSize uint) (List, error)

NewList creates a new queue.

func (*List) Len

func (q *List) Len() int

Len returns the length of the queue.

func (*List) Push

func (q *List) Push(d DataPoint)

Push pushes an element onto the queue, drops the first one when MaxSize is reached.

Jump to

Keyboard shortcuts

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