jobs

package
v1.6.1 Latest Latest
Warning

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

Go to latest
Published: Jan 31, 2024 License: GPL-3.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

View Source
const (
	MetaTickers  metaKey = "Tickers"
	MetaMarkets  metaKey = "Markets"
	MetaHashtags metaKey = "Hashtags"
)

Based on the composer.ComposedMeta struct keys.

Variables

This section is empty.

Functions

This section is empty.

Types

type CalendarJob

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

CalendarJob is the struct that will fetch calendar events and publish them to the channel.

func NewCalendarJob

func NewCalendarJob(
	calendarScavenger *ecal.EconomicCalendar,
	publisher *publisher.TelegramPublisher,
	archivist *archivist.Archivist,
	providerName string,
) *CalendarJob

func (*CalendarJob) RunCalendarUpdatesJob

func (j *CalendarJob) RunCalendarUpdatesJob() JobFunc

RunCalendarUpdatesJob fetches "Actual" values for today's events and publishes updates to the channel.

func (*CalendarJob) RunDailyCalendarJob added in v1.6.0

func (j *CalendarJob) RunDailyCalendarJob() JobFunc

RunDailyCalendarJob creates events plan for the upcoming day and publishes them to the channel. It should be run every business day.

type Job

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

Job will be executed by the scheduler and will fetch, compose, publish and save news to the database.

func NewJob

func NewJob(
	composer *composer.Composer,
	publisher *publisher.TelegramPublisher,
	archivist *archivist.Archivist,
	journalist *journalist.Journalist,
	stocks *stocks.StockMap,
) *Job

NewJob creates a new Job instance.

func (*Job) ComposeText

func (job *Job) ComposeText() *Job

ComposeText sets the flag that will compose text for the article using OpenAI.

func (*Job) FetchUntil

func (job *Job) FetchUntil(until time.Time) *Job

FetchUntil sets the date until which the articles will be fetched.

func (*Job) OmitEmptyMeta

func (job *Job) OmitEmptyMeta(key metaKey) *Job

OmitEmptyMeta will omit news with empty meta for the given key from composer.ComposedMeta. Note: requires ComposeText to be set.

func (*Job) OmitIfAllKeysEmpty

func (job *Job) OmitIfAllKeysEmpty() *Job

OmitIfAllKeysEmpty will omit articles with empty meta for all keys from composer.ComposedMeta.

Example: "{"Markets": [], "Tickers": [], "Hashtags": []}" will be omitted, but "{"Markets": ["SPY"], "Tickers": [], "Hashtags": []}" will not.

func (*Job) OmitSuspicious

func (job *Job) OmitSuspicious() *Job

OmitSuspicious sets the flag that will omit suspicious articles.

func (*Job) OmitUnlistedStocks

func (job *Job) OmitUnlistedStocks() *Job

OmitUnlistedStocks sets the flag that will omit articles publishing with stocks unlisted in the Job.stocks.

func (*Job) RemoveClones

func (job *Job) RemoveClones() *Job

RemoveClones sets the flag that will remove duplicated news found in the DB.

func (*Job) Run

func (job *Job) Run() JobFunc

Run return job function that will be executed by the scheduler.

func (*Job) SaveToDB

func (job *Job) SaveToDB() *Job

SaveToDB sets the flag that will save all news to the database.

type JobFunc

type JobFunc func()

JobFunc is a type for job function that will be executed by the scheduler.

type SummaryJob

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

func NewSummaryJob

func NewSummaryJob(
	composer *composer.Composer,
	publisher *publisher.TelegramPublisher,
	archivist *archivist.Archivist,
) *SummaryJob

func (*SummaryJob) Run

func (j *SummaryJob) Run(from time.Time) JobFunc

Run runs the Summary job. From if the time from which events should be processed.

Jump to

Keyboard shortcuts

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