package jobs
import "github.com/samgozman/fin-thread/jobs"
Index
- Constants
- type CalendarJob
-
type Job
- func NewJob(composer *composer.Composer, publisher *publisher.TelegramPublisher, ...) *Job
- func (job *Job) ComposeText() *Job
- func (job *Job) FetchUntil(until time.Time) *Job
- func (job *Job) OmitEmptyMeta(key metaKey) *Job
- func (job *Job) OmitIfAllKeysEmpty() *Job
- func (job *Job) OmitSuspicious() *Job
- func (job *Job) OmitUnlistedStocks() *Job
- func (job *Job) RemoveClones() *Job
- func (job *Job) Run() JobFunc
- func (job *Job) SaveToDB() *Job
- type JobFunc
- type SummaryJob
Constants
const ( MetaTickers metaKey = "Tickers" MetaMarkets metaKey = "Markets" metaKey = "Hashtags" )
Based on the composer.ComposedMeta struct keys.
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
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.