providers

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Feb 13, 2022 License: BSD-3-Clause Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Register

func Register(name string, provider Provider)

Types

type Account

type Account interface {
	IProvider
	// GetHoldings returns all holdings that is has
	GetHoldings() (Holdings, error)
}

Account Interface to providing holding across different third party accounts

type CommonElements

type CommonElements struct {
	LPos int
	RPos int
}

CommonElements contains positioning information about holdings in two lists

func (CommonElements) FoundBoth

func (hi CommonElements) FoundBoth() bool

FoundBoth when both are not -1

func (CommonElements) LeftOnly

func (hi CommonElements) LeftOnly() bool

LeftOnly when holding found in the Left List or the origination list

func (CommonElements) Result

func (hi CommonElements) Result() Existence

Result returns a enum result of what is the account status across the two lists

func (CommonElements) RightOnly

func (hi CommonElements) RightOnly() bool

RightOnly when holding found in the Right List or the target list

type Config

type Config struct {
	Logger *zap.Logger
	Config *common.Config
}

type ConvertSymbolPricingProvider

type ConvertSymbolPricingProvider struct {
	Price
	LookupName map[string]string
}

func (*ConvertSymbolPricingProvider) GetExchange

func (c *ConvertSymbolPricingProvider) GetExchange(currency1, currency2 string) (res string, err error)

func (*ConvertSymbolPricingProvider) Name

type Existence

type Existence int
const (
	ExistenceUnknown Existence = iota
	ExistsInOriginationOnly
	ExistsInTargetOnly
	ExistsInBoth
)

type FallBackPricingProvider

type FallBackPricingProvider struct {
	Pricing []Price
}

func (*FallBackPricingProvider) GetExchange

func (f *FallBackPricingProvider) GetExchange(currency1, currency2 string) (res string, err error)

func (*FallBackPricingProvider) Name

func (f *FallBackPricingProvider) Name() string

type Holding

type Holding struct {
	SymbolName  string
	FullName    string
	TotalShares string
}

func (Holding) CurrencyName

func (h Holding) CurrencyName() string

func (Holding) CurrencySymbolName

func (h Holding) CurrencySymbolName() string

func (Holding) TotalSharesString

func (h Holding) TotalSharesString() string

type Holdings

type Holdings []Holding

func (*Holdings) AddHolding

func (h *Holdings) AddHolding(hh Holding)

func (*Holdings) AddHoldings

func (h *Holdings) AddHoldings(hh Holdings)

func (Holdings) FilterTokens added in v0.3.1

func (h Holdings) FilterTokens(by string, rexes ...*regexp.Regexp) (final Holdings)

FilterTokens by the provided regular expressions

func (Holdings) HasCurrencyMap

func (h Holdings) HasCurrencyMap(left func(l IHolding) string, right func(r IHolding) string, ih ...IHolding) map[string]CommonElements

HasCurrencyMap compares holdings with another Holdings account to check for existence

func (Holdings) HasCurrencyName

func (h Holdings) HasCurrencyName(name string) bool

HasCurrencyName check if holdings account has a currency by name

func (Holdings) HasCurrencySymbolName

func (h Holdings) HasCurrencySymbolName(symbol string) bool

HasCurrencySymbolName check if holdings account has a currency by symbol name

func (Holdings) MapReduce

func (h Holdings) MapReduce() (final Holdings)

MapReduce will return Holdings that have been summed across the same SymbolName

func (Holdings) SearchByPattern

func (h Holdings) SearchByPattern(pattern regexp.Regexp) []int

type IHolding

type IHolding interface {
	CurrencySymbolName() string
	CurrencyName() string
	TotalSharesString() string
}

type IProvider

type IProvider interface {
	// Returns Friendly Name
	Name() string
}

Base Provider interface

type Price

type Price interface {
	IProvider
	// GetExchange gets the value of currency1 in currency2
	GetExchange(currency1, currency2 string) (string, error)
}

Price Interface to providing pricing data

func OpenPricingProvider

func OpenPricingProvider(pricingProvider string, config Config, params ...interface{}) (Price, error)

type Provider

type Provider interface {
	Open(config Config, params ...interface{}) (IProvider, error)
}

func GetAccountProvider

func GetAccountProvider(name string) (Provider, error)

GetAccountProvider gets a provider by name that implements the Account interface

func GetPricingProvider

func GetPricingProvider(name string) (Provider, error)

func GetProvider

func GetProvider(name string) (Provider, error)

type ProviderIterator

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

func GetProviderIterator

func GetProviderIterator() *ProviderIterator

func (*ProviderIterator) HasNext

func (it *ProviderIterator) HasNext() bool

func (*ProviderIterator) Next

func (it *ProviderIterator) Next() Provider

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL