-
Notifications
You must be signed in to change notification settings - Fork 1
/
collector.go
34 lines (27 loc) · 891 Bytes
/
collector.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
package valuator
import (
"errors"
"io"
)
// CollectorType is a type definition for different collector types
type CollectorType string
// CollectorEdgar is the collector defined in the edgar package
const CollectorEdgar CollectorType = "edgar"
// Collector interface provides access to the collector
type Collector interface {
// Name of the collector
Name() string
// CollectAnnualData queries the collector to get annual data for the years specified
CollectAnnualData(ticker string, year ...int) ([]Filing, error)
// Write the Collectors content to an IO Writer
Write(string, io.Writer) error
}
// NewCollector creates a collector to collect filings
func NewCollector(name CollectorType, store Store) (Collector, error) {
switch name {
case CollectorEdgar:
return newEdgarCollector(store)
default:
}
return nil, errors.New("Unsupported collector " + string(name))
}