model

package
v0.0.0-...-890f6be Latest Latest
Warning

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

Go to latest
Published: Mar 17, 2024 License: GPL-3.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	Interval1s  = Interval("1s")
	Interval1m  = Interval("1m")
	Interval3m  = Interval("3m")
	Interval5m  = Interval("5m")
	Interval15m = Interval("15m")
	Interval30m = Interval("30m")
	Interval1h  = Interval("1h")
	Interval2h  = Interval("2h")
	Interval4h  = Interval("4h")
	Interval6h  = Interval("6h")
	Interval12h = Interval("12h")
	Interval1d  = Interval("1d")
	Interval3d  = Interval("3d")
	Interval1w  = Interval("1w")
	Interval2w  = Interval("2w")
	Interval1mo = Interval("1mo")
)
View Source
var SupportedIntervals = IntervalMap{
	Interval1s:  1,
	Interval1m:  1 * 60,
	Interval3m:  3 * 60,
	Interval5m:  5 * 60,
	Interval15m: 15 * 60,
	Interval30m: 30 * 60,
	Interval1h:  60 * 60,
	Interval2h:  60 * 60 * 2,
	Interval4h:  60 * 60 * 4,
	Interval6h:  60 * 60 * 6,
	Interval12h: 60 * 60 * 12,
	Interval1d:  60 * 60 * 24,
	Interval3d:  60 * 60 * 24 * 3,
	Interval1w:  60 * 60 * 24 * 7,
	Interval2w:  60 * 60 * 24 * 14,
	Interval1mo: 60 * 60 * 24 * 30,
}

SupportedIntervals is a map of supported intervals.

Functions

This section is empty.

Types

type CandleType

type CandleType int

CandleType is an enum that represents the type of candle.

const (
	CandleTypeUnknown CandleType = iota
	CandleTypeLongUp
	CandleTypeLongDown
)

func (*CandleType) String

func (x *CandleType) String() string

String returns the string representation of the candle type.

type EarningsCall

type EarningsCall struct {
	ID         uuid.UUID `json:"id,omitempty"`
	Symbol     string    `json:"symbol,omitempty"`
	Host       string    `json:"host,omitempty"`
	OccurredAt time.Time `json:"occurred_at,omitempty"`
}

EarningsCall is an entity that represents an earnings call

type Event

type Event struct {
	ID         string    `json:"id"`
	Symbol     string    `json:"symbol,omitempty"`
	Type       EventType `json:"type,omitempty"`
	OccurredAt time.Time `json:"occurred_at,omitempty"`
}

Event is an entity that represents an event.

func NewEvent

func NewEvent(symbol string, typ EventType, occurredAt time.Time) *Event

NewEvent is to create a new event.

type EventType

type EventType int

EventType is an enum that represents the type of event.

const (
	EventTypeUnknown EventType = iota
	EventTypeEarningsCall
	EventTypeDividend
)

func (*EventType) String

func (x *EventType) String() string

type Interval

type Interval string

Interval is a value object that represents a time interval.

func (*Interval) Seconds

func (i *Interval) Seconds() int

Seconds returns the seconds of the interval.

func (*Interval) String

func (i *Interval) String() string

func (*Interval) UnmarshalJSON

func (i *Interval) UnmarshalJSON(b []byte) error

type IntervalMap

type IntervalMap map[Interval]int

IntervalMap is a map of intervals.

type KLine

type KLine struct {
	StartAt time.Time `json:"start_at"`
	EndAt   time.Time `json:"end_at"`

	Interval Interval `json:"interval"`

	Open   float64 `json:"open"`
	High   float64 `json:"high"`
	Close  float64 `json:"close"`
	Low    float64 `json:"low"`
	Volume float64 `json:"volume"`

	Closed bool `json:"closed"`
}

KLine is a value object that represents a KLine data.

type Stock

type Stock struct {
	Symbol           string `json:"symbol"`
	Name             string `json:"name,omitempty"`
	IndustryCategory string `json:"industry_category,omitempty"`
	ExchangeName     string `json:"exchange_name,omitempty"`
}

Stock is an entity that represents the stock.

type StockQuota

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

StockQuota is a value object that represents the stock quota.

func NewStockQuota

func NewStockQuota(
	open float64,
	high float64,
	closePrice float64,
	low float64,
	volume int,
	updatedAt time.Time,
) StockQuota

NewStockQuota creates a new StockQuota.

func (*StockQuota) GetClose

func (x *StockQuota) GetClose() float64

func (*StockQuota) GetHigh

func (x *StockQuota) GetHigh() float64

func (*StockQuota) GetLow

func (x *StockQuota) GetLow() float64

func (*StockQuota) GetOpen

func (x *StockQuota) GetOpen() float64

func (*StockQuota) GetUpdatedAt

func (x *StockQuota) GetUpdatedAt() time.Time

func (*StockQuota) GetValue

func (x *StockQuota) GetValue() float64

func (*StockQuota) GetVolume

func (x *StockQuota) GetVolume() int

func (*StockQuota) MarshalJSON

func (x *StockQuota) MarshalJSON() ([]byte, error)

func (*StockQuota) SetClose

func (x *StockQuota) SetClose(closePrice float64)

func (*StockQuota) SetHigh

func (x *StockQuota) SetHigh(high float64)

func (*StockQuota) SetLow

func (x *StockQuota) SetLow(low float64)

func (*StockQuota) SetOpen

func (x *StockQuota) SetOpen(open float64)

func (*StockQuota) SetUpdatedAt

func (x *StockQuota) SetUpdatedAt(updatedAt time.Time)

func (*StockQuota) SetValue

func (x *StockQuota) SetValue(value float64)

func (*StockQuota) SetVolume

func (x *StockQuota) SetVolume(volume int)

func (*StockQuota) UnmarshalJSON

func (x *StockQuota) UnmarshalJSON(bytes []byte) error

type Ticker

type Ticker struct {
	Time   time.Time `json:"time,omitempty"`
	Volume float64   `json:"volume,omitempty"`
	Open   float64   `json:"open,omitempty"`
	High   float64   `json:"high,omitempty"`
	Close  float64   `json:"close,omitempty"`
	Low    float64   `json:"low,omitempty"`
}

Ticker is a value object that represents the ticker data.

Jump to

Keyboard shortcuts

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