handlers

package
v0.0.0-...-ab9b54e Latest Latest
Warning

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

Go to latest
Published: Mar 14, 2018 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Context

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

Context contains resources that needs to be access in http handlers

func NewContext

func NewContext(
	es *elastic.Client,
	sh SchemaDecoder,
	validator StructValidator,
	historyAPI finance.HistoryAPI,
	quotesAPI finance.QuotesAPI,
	esStock es.IStock,
	esPosition es.IPositionStock) *Context

NewContext creates a new context for handlers

type GetDateFunc

type GetDateFunc func() time.Time

GetDateFunc is responsible for get end date

type HandlerERROR

type HandlerERROR struct {
	Status int
	// contains filtered or unexported fields
}

HandlerERROR represents an error to send through http

type HistoryListParams

type HistoryListParams struct {
	HistoryParams
	Symbols []string `schema:"symbols"`
}

HistoryListParams contains all the parameters for the history list route

type HistoryParams

type HistoryParams struct {
	Days   int `schema:"days" validate:"gt=0"`
	Window int `schema:"window" validate:"gt=0"`
	Step   int `schema:"step" validate:"gt=0"`
}

HistoryParams contains all the parameters for the history route

type Indicator

type Indicator struct {
	Symbol   string
	Name     string
	Value    float32
	MM200    float32
	MM50     float32
	MM50D200 float32
	V50      float64
	V200     float64
}

Indicator contains all values of a stock indicator

type IndicatorHandlers

type IndicatorHandlers struct {
	*Context
	// contains filtered or unexported fields
}

IndicatorHandlers handles all request to avergaes requrests

func NewIndicatorHandlers

func NewIndicatorHandlers(context *Context) IndicatorHandlers

NewIndicatorHandlers creates a new averages handlers object

func (*IndicatorHandlers) GetStocks

func (handlers *IndicatorHandlers) GetStocks(c echo.Context) error

GetStocks retrieves the indicators for a list of stocks

This function is a handler for http server, it should not be called directly

type PositionDisplay

type PositionDisplay struct {
	es.PositionAgg
	Name  string
	Value float32
}

PositionDisplay contains all fields to display to the client

type PositionHandlers

type PositionHandlers struct {
	*Context
	// contains filtered or unexported fields
}

PositionHandlers handles all request to position management

func NewPositionHandlers

func NewPositionHandlers(context *Context) *PositionHandlers

NewPositionHandlers creates a new position handlers object

func (*PositionHandlers) AddPosition

func (handlers *PositionHandlers) AddPosition(c echo.Context) error

AddPosition handles http request to save a position

This function is a handler for http server, it should not be called directly

func (*PositionHandlers) GetPositions

func (handlers *PositionHandlers) GetPositions(c echo.Context) error

GetPositions handles http request to retrieve the user's positions

This function is a handler for http server, it should not be called directly

type SchemaDecoder

type SchemaDecoder interface {
	Decode(dst interface{}, src map[string][]string) error
}

SchemaDecoder decodes URL query to struct

type StockHandlers

type StockHandlers struct {
	*Context
	// contains filtered or unexported fields
}

StockHandlers is an object containing all the handlers concerning stocks

func NewStockHandlers

func NewStockHandlers(context *Context) *StockHandlers

NewStockHandlers creates a new stock handlers object

func (*StockHandlers) History

func (handlers *StockHandlers) History(c echo.Context) error

History retrieve stocks history

handlers.History(w, r)

This function is a handler for http server, it should not be called directly

func (*StockHandlers) HistoryList

func (handlers *StockHandlers) HistoryList(c echo.Context) error

HistoryList retrieve a stock history list

handlers.History(w, r)

This function is a handler for http server, it should not be called directly

type StructValidator

type StructValidator interface {
	Struct(s interface{}) (err error)
}

StructValidator validates structures

Jump to

Keyboard shortcuts

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