app

package
v0.0.0-...-ce4fd6a Latest Latest
Warning

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

Go to latest
Published: Dec 11, 2023 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func HandleBadRequest

func HandleBadRequest(w http.ResponseWriter, err error)

func HandleInternalError

func HandleInternalError(w http.ResponseWriter, err error)

func ResponseJSON

func ResponseJSON(w http.ResponseWriter, val any)

Types

type CandleStick

type CandleStick struct {
	Open  float64 `json:"open"`
	High  float64 `json:"high"`
	Low   float64 `json:"low"`
	Close float64 `json:"close"`
}

type Chart

type Chart struct {
	Data []Stamp `json:"stamps"`
}

Chart contains aggregated info to be displayed as a chart.

type Config

type Config struct {
	DatabaseConn string `yaml:"databaseConn"`
}

type Delivery

type Delivery struct {
	// contains filtered or unexported fields
}

func NewDelivery

func NewDelivery(s *Service) *Delivery

func (*Delivery) GetChart

func (h *Delivery) GetChart(w http.ResponseWriter, req *http.Request)

func (*Delivery) GetUpdates

func (h *Delivery) GetUpdates(w http.ResponseWriter, req *http.Request)

type Service

type Service struct {
	// contains filtered or unexported fields
}

func New

func New(c *Config) *Service

func (*Service) GetInPeriod

func (e *Service) GetInPeriod(ctx context.Context, ticker string, from, to int64) (Chart, error)

func (*Service) GetLatest

func (e *Service) GetLatest(ctx context.Context, ticker string, from int64) (Chart, error)

type Stamp

type Stamp struct {
	Time        int64       `json:"x"`
	Candlestick CandleStick `json:"y"`

	TopLine   float64 `json:"topLine"`
	DownLine  float64 `json:"downLine"`
	BlueLine  float64 `json:"blueLine"`
	NeedPoint *bool   `json:"needPoint"`
}

func (*Stamp) Scan

func (s *Stamp) Scan(val any) error

Jump to

Keyboard shortcuts

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