services

package
v0.0.0-...-e053338 Latest Latest
Warning

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

Go to latest
Published: May 11, 2026 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

Functions

func NewIndustryService

func NewIndustryService(store stores.IndustryStore) *industryService

func NewMarketDayService

func NewMarketDayService(marketHolidayStore stores.MarketHolidayStore) *marketDayService

func NewMarketHolidayService

func NewMarketHolidayService(store stores.MarketHolidayStore) *marketHolidayService

func NewMetricService

func NewMetricService(store stores.MetricStore) *metricService

func NewSecurityMetricService

func NewSecurityMetricService(marketDayService MarketDayService, metricService MetricService, securityStatStore stores.SecurityStatStore) *securityMetricService

func NewSecurityService

func NewSecurityService(marketDayService MarketDayService, securityMetricService SecurityMetricService, metricStore stores.MetricStore,
	securityStatStore stores.SecurityStatStore, store stores.SecurityStore) *securityService

func NewSecurityStatService

func NewSecurityStatService(marketDayService MarketDayService, store stores.SecurityStatStore) *securityStatService

Types

type ErrResp

type ErrResp struct {
	Code    int
	Message string
}

func (*ErrResp) Error

func (e *ErrResp) Error() string

func (*ErrResp) StatusCode

func (e *ErrResp) StatusCode() int

type IndustryService

type IndustryService interface {
	Index(ctx *gofr.Context) []stores.Industry
}

type MarketDayFilter

type MarketDayFilter struct {
	LastNDays              int
	LastNDaysFromReference *struct {
		N         int
		Reference time.Time
	}
	DateBetween *struct {
		StartDate time.Time
		EndDate   time.Time
	}
}

type MarketDayService

type MarketDayService interface {
	Index(ctx *gofr.Context, f *MarketDayFilter) ([]time.Time, int, error)
}

type MarketHoliday

type MarketHoliday struct {
	ID          int
	Date        time.Time
	Description string
	CreatedAt   time.Time
	UpdatedAt   time.Time
}

type MarketHolidayCreate

type MarketHolidayCreate struct {
	UserID      int
	Date        time.Time
	Description string
}

type MarketHolidayFilter

type MarketHolidayFilter struct {
	Date        time.Time
	DateBetween *struct {
		StartDate time.Time
		EndDate   time.Time
	}
}

type MarketHolidayService

type MarketHolidayService interface {
	Index(ctx *gofr.Context, f *MarketHolidayFilter, page, perPage int) ([]*MarketHoliday, int, error)
	Read(ctx *gofr.Context, id int) (*MarketHoliday, error)
	Create(ctx *gofr.Context, payload *MarketHolidayCreate) (*MarketHoliday, error)
	Patch(ctx *gofr.Context, id int, payload *MarketHolidayUpdate) (*MarketHoliday, error)
	Delete(ctx *gofr.Context, id, userID int) error
}

type MarketHolidayUpdate

type MarketHolidayUpdate struct {
	UserID      int
	Date        time.Time
	Description string
}

type Metric

type Metric struct {
	ID        int
	Name      string
	Type      stores.MetricType
	Period    int
	Indicator stores.MetricIndicator
	Tier      int
	CreatedAt time.Time
	UpdatedAt time.Time
}

type MetricCreate

type MetricCreate struct {
	UserID int
	Name   string
	Type   string
	Period int
	Tier   int
}

type MetricService

type MetricService interface {
	Index(ctx *gofr.Context) ([]*Metric, error)
	Read(ctx *gofr.Context, id int) (*Metric, error)
	Create(ctx *gofr.Context, payload *MetricCreate) (*Metric, error)
	Patch(ctx *gofr.Context, id int, payload *MetricUpdate) (*Metric, error)
}

type MetricUpdate

type MetricUpdate struct {
	UserID int
	Name   string
	Tier   *int
}

type Security

type Security struct {
	ID              int
	ISIN            string
	Symbol          string
	Industry        string
	Name            string
	Image           string
	LTP             float64
	PreviousClose   float64
	CreatedAt       time.Time
	UpdatedAt       time.Time
	SecurityStat    *SecurityStat
	SecurityMetrics []*SecurityMetric
}

type SecurityCreate

type SecurityCreate struct {
	UserID   int
	ISIN     string
	Symbol   string
	Industry string
	Name     string
	Image    string
	LTP      float64
}

type SecurityFilter

type SecurityFilter struct {
	Symbol string
	Date   time.Time
}

type SecurityMetric

type SecurityMetric struct {
	Metric *Metric
	Value  float64
	ZValue float64
}

type SecurityMetricService

type SecurityMetricService interface {
	Get(ctx *gofr.Context, securityIDs []int, date time.Time) (map[int][]*SecurityMetric, error)
}

type SecurityService

type SecurityService interface {
	Index(ctx *gofr.Context, f *SecurityFilter, page, perPage int) ([]*Security, int, error)
	Read(ctx *gofr.Context, id int) (*Security, error)
	Create(ctx *gofr.Context, payload *SecurityCreate) (*Security, error)
	Patch(ctx *gofr.Context, id int, payload *SecurityUpdate) (*Security, error)
}

type SecurityStat

type SecurityStat struct {
	ID         int
	SecurityID int
	Date       time.Time
	Open       float64
	Close      float64
	High       float64
	Low        float64
	Volume     int
	CreatedAt  time.Time
	UpdatedAt  time.Time
}

type SecurityStatCreate

type SecurityStatCreate struct {
	UserID     int
	SecurityID int
	Date       time.Time
	Open       float64
	Close      float64
	High       float64
	Low        float64
	Volume     int
}

type SecurityStatFilter

type SecurityStatFilter struct {
	Date       time.Time
	SecurityID int
}

type SecurityStatService

type SecurityStatService interface {
	Index(ctx *gofr.Context, f *SecurityStatFilter, page, perPage int) ([]*SecurityStat, int, error)
	Read(ctx *gofr.Context, id int) (*SecurityStat, error)
	Create(ctx *gofr.Context, payload *SecurityStatCreate) (*SecurityStat, error)
	Patch(ctx *gofr.Context, id int, payload *SecurityStatUpdate) (*SecurityStat, error)
}

type SecurityStatUpdate

type SecurityStatUpdate struct {
	UserID int
	Open   float64
	Close  float64
	High   float64
	Low    float64
	Volume int
}

type SecurityUpdate

type SecurityUpdate struct {
	UserID   int
	Symbol   string
	Industry string
	Name     string
	Image    string
	LTP      float64
}

Jump to

Keyboard shortcuts

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