2023-11-13 04:40:00 +00:00
|
|
|
package main
|
|
|
|
|
|
|
|
import (
|
|
|
|
"deadbeef.codes/steven/ynab-portfolio-monitor/bitcoin"
|
|
|
|
"deadbeef.codes/steven/ynab-portfolio-monitor/questrade"
|
2023-11-13 07:33:22 +00:00
|
|
|
"deadbeef.codes/steven/ynab-portfolio-monitor/staticjsonFinnhub"
|
2023-11-13 18:52:45 +00:00
|
|
|
"deadbeef.codes/steven/ynab-portfolio-monitor/staticjsonYahooFinance"
|
2023-11-13 04:40:00 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
// 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{},
|
2023-11-13 07:33:22 +00:00
|
|
|
&staticjsonFinnhub.Provider{},
|
2023-11-13 18:52:45 +00:00
|
|
|
&staticjsonYahooFinance.Provider{},
|
2023-11-13 04:40:00 +00:00
|
|
|
}
|