jobs

package
v1.3.37 Latest Latest
Warning

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

Go to latest
Published: Jan 21, 2024 License: GPL-3.0 Imports: 19 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) Publish

func (j *CalendarJob) Publish() *CalendarJob

Publish will set the job to publish events to the channel.

func (*CalendarJob) RunCalendarUpdatesJob

func (j *CalendarJob) RunCalendarUpdatesJob() JobFunc

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

func (*CalendarJob) RunWeeklyCalendarJob

func (j *CalendarJob) RunWeeklyCalendarJob() JobFunc

RunWeeklyCalendarJob creates events plan for the upcoming week and publishes them to the channel. It should be run once a week on Monday.

type CalendarJobOptions

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

CalendarJobOptions is the struct that contains options for the calendar job.

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) Publish

func (job *Job) Publish() *Job

Publish sets the flag that will publish news to the channel. Else: will just print them to the console (for development).

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) Publish

func (j *SummaryJob) Publish() *SummaryJob

Publish sets the flag that will publish summary to the channel. Else: will just print them to the console (for development).

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