ynab-portfolio-monitor/accountProviders.go

25 lines
1.1 KiB
Go

package main
import (
"deadbeef.codes/steven/ynab-portfolio-monitor/providers/bitcoin"
"deadbeef.codes/steven/ynab-portfolio-monitor/providers/questrade"
"deadbeef.codes/steven/ynab-portfolio-monitor/providers/staticjsonFinnhub"
"deadbeef.codes/steven/ynab-portfolio-monitor/providers/staticjsonYahooFinance"
)
// AccountProvider is the base set of requirements to be implemented for any integration
type AccountProvider interface {
Name() string // Returns the name of the provider
Configure() error // Configures the provider for first use - if an error is returned the provider is not used
GetBalances() ([]int, []string, error) // A slice of balances, and an index mapped slice of ynab account IDs this provider handles is returned
}
// Instantiate all providers for configuration
// If configuration for a provider does not exist, it will be pruned during init()
var allProviders []AccountProvider = []AccountProvider{
&questrade.Provider{},
&bitcoin.Provider{},
&staticjsonFinnhub.Provider{},
&staticjsonYahooFinance.Provider{},
}