money

package
v0.0.0-...-901c18c Latest Latest
Warning

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

Go to latest
Published: Jan 10, 2019 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Currencies []string

Currencies contains money.Name for cryptocurrencies

View Source
var Prices map[string]float64

Prices map contains updated prices

View Source
var Symbols []string

Symbols contains money.Symbol for cryptocurrencies

Functions

func FetchPrices

func FetchPrices()

FetchPrices updates prices in Prices

Types

type Asset

type Asset struct {
	Name    string  `json:"name"`
	Symbol  string  `json:"symbol"`
	Holding float64 `json:"holding"`
	Worth   float64 `json:"worth"`
}

Asset stuct contain 1 asset type

type Assets

type Assets struct {
	Type   string  `json:"type"`
	Assets []Asset `json:"assets"`
}

Assets contain an arrah of type Asset and a catgorie

type Budget

type Budget struct {
	Expenses []Expense `json:"expenses"`
	Total    float64   `json:"total"`
}

Budget carries an array for open trades, and an array for closed trades

func (*Budget) Update

func (b *Budget) Update()

Update runs after commands that modify the struct fields

type Config

type Config struct {
	DataDir    string
	DataFile   string
	TradeFile  string
	BudgetFile string
	LogFile    string
}

Config contains important data paths

func NewConfig

func NewConfig() *Config

NewConfig returns a pointer to an empty Config struct

func (*Config) Configure

func (c *Config) Configure()

Configure initilizes the app's Config struct, creates the neccassary dirctories and files

type Expense

type Expense struct {
	Name      string  `json:"name"`
	CostMonth float64 `json:"cost_month"`
}

type Fn

type Fn func(Resource, *logrus.Logger, *cli.Context) (bool, error)

Fn function type

type Pair

type Pair struct {
	Base  string  `json:"base"`
	Invs  string  `json:"invs"`
	Open  []Trade `json:"open"`
	Close []Trade `json:"close"`
}

Trade carries trade info

type Resource

type Resource interface {
	Update()
}

Resource interface

type Trade

type Trade struct {
	Status  bool    `json:"status"`
	Claim   bool    `json:"claim"`
	Cost    float64 `json:"cost"`
	Amount  float64 `json:"amount"`
	Buy     float64 `json:"buy"`
	Sell    float64 `json:"sell"`
	Percent float64 `json:"percent"`
	Current float64 `json:"current"`
	Profit  float64 `json:"profit"`
}

Tradec closed trades

type Trades

type Trades struct {
	Pairs []Pair `json:"pairs"`
}

Trades carries an array for open trades, and an array for closed trades

func (*Trades) Update

func (t *Trades) Update()

Update runs after commands that modify the struct fields

type Wealth

type Wealth struct {
	Wealth []Assets `json:"wealth"`
	Worth  float64  `json:"worth"`
}

Wealth an object containing assets

func (*Wealth) Update

func (w *Wealth) Update()

Update sets struct fields to the most recent Prices

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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