common

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: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ZeroQuantity  = "ZeroQuantity"
	DeleteHolding = "DeleteHolding"
)
View Source
const (
	AddHolding = 1 << iota
	RemoveHolding
	UpdateHolding
	SkipZeroQuantity
	SkipMinorDifferences
)

Variables

This section is empty.

Functions

func DumpRequestResponse added in v0.2.2

func DumpRequestResponse(req *http.Request, handler mediary.Handler) (*http.Response, error)

func DumpRequestResponseWrappedLogger added in v0.3.0

func DumpRequestResponseWrappedLogger(logger *zap.SugaredLogger) func(req *http.Request, handler mediary.Handler) (*http.Response, error)

func MustParseFloatStringFloat64

func MustParseFloatStringFloat64(val string) float64

Types

type Config added in v0.2.2

type Config struct {
	// Debug
	// Prints Debug Information
	Debug bool `toml:"debug"`
	// Destination will the aggregated information will go
	// Supported: person capital
	Destination string `toml:"destination"`
	// PriceDataSource will fetch the currency pricing data from this
	// Supported: coinbase
	PriceDataSource string `toml:"priceDataSource"`
	// OnHoldingNotFound will determine the actions performed when a holding
	// exists in the destination but not in the source
	// Available values:
	// ZeroQuantity - This will not remove the holding, and instead just set the quantity to zero
	// DeleteHolding - This will remove the holding
	OnHoldingNotFound OnHoldingNotFoundType `toml:"onHoldingNotFound"`
	// DestinationCurrencyAs will fetch the converted pricing data of the concurrency in the specified format
	// Data Matrix:
	// Coinbase: USD, many others look at their api
	DestinationCurrencyAs string `toml:"destinationCurrencyAs"`
	// List of crypto currency holdings with their configurations
	// Supported: coinbase
	Holdings map[string]map[string]interface{} `toml:"holdings"`
	// Pricing holds a list of configuration for pricing data
	Pricing map[string]map[string]interface{} `toml:"pricing"`
	// Symbols holds a map of overrides for symbols
	Symbols SymbolConfig `toml:"symbols"`
	// List of Destinations holding their configuration
	// Supported: personalcapital
	Destinations map[string]map[string]interface{} `toml:"destinations"`
}

Config holds details when syncing

func GetConfigFromTomlFile added in v0.2.2

func GetConfigFromTomlFile(vars ...string) Config

func (Config) Validate added in v0.2.2

func (conf Config) Validate() error

Validate configuration will add an error for each field not complying to its type

type Errors added in v0.2.2

type Errors []error

func (*Errors) Add added in v0.2.2

func (c *Errors) Add(e error)

func (*Errors) AsError added in v0.2.2

func (c *Errors) AsError() error

AsError returns as error, returning nil if errors is empty

func (*Errors) Error added in v0.2.2

func (c *Errors) Error() (err string)

type HoldingOperation added in v0.3.1

type HoldingOperation int

func (HoldingOperation) Has added in v0.3.1

func (ao HoldingOperation) Has(flag HoldingOperation) bool

type OnHoldingNotFoundType added in v0.2.2

type OnHoldingNotFoundType string

func (OnHoldingNotFoundType) IsValid added in v0.2.2

func (o OnHoldingNotFoundType) IsValid() bool

type SymbolConfig added in v0.3.0

type SymbolConfig struct {
	Global    map[string]string            `toml:"global"`
	Overrides map[string]map[string]string `toml:"override"`
}

Jump to

Keyboard shortcuts

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