assets

package
v0.0.0-...-a4f4c3c Latest Latest
Warning

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

Go to latest
Published: May 27, 2024 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Analyse

func Analyse(_ context.Context, assets *v1.Assets, opts Options) (report.Report, error)

Analyse 分析资产数据

Types

type Goods

type Goods struct {
	// 商品名
	Name string `json:"name" yaml:"name"`
	// 代号
	Code string `json:"code,omitempty" yaml:"code,omitempty"`
	// 托管机构
	Custodian string `json:"custodian,omitempty" yaml:"custodian,omitempty"`
	// 数量
	Quantity decimal.Decimal `json:"quantity" yaml:"quantity"`
	// 单价
	Price decimal.Decimal `json:"price" yaml:"price"`
	// 风险
	Risk v1.RiskLevel `json:"risk,omitempty" yaml:"risk,omitempty"`
	// 总价值
	Value decimal.Decimal `json:"value,omitempty" yaml:"value,omitempty"`
	// 占比
	Ratio decimal.Decimal `json:"ratio,omitempty" yaml:"ratio,omitempty"`
	// 损益
	ProfitAndLoss decimal.Decimal `json:"profitAndLoss,omitempty" yaml:"profitAndLoss,omitempty"`
	// 收益率
	RateOfReturn decimal.Decimal `json:"rateOfReturn,omitempty" yaml:"rateOfReturn,omitempty"`
	// 年化收益率
	AnnualizedRateOfReturn decimal.Decimal `json:"annualizedRateOfReturn,omitempty" yaml:"annualizedRateOfReturn,omitempty"`

	// 是否基础商品(货币)
	Base bool `json:"base,omitempty" yaml:"base,omitempty"`
	// 是否忽略收益
	IgnoreReturn bool `json:"ignoreReturn,omitempty" yaml:"ignoreReturn,omitempty"`
	// contains filtered or unexported fields
}

Goods 商品

type Options

type Options struct {
	ShowHistory bool
}

Options 分析选项

type Report

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

Report 资产报告

func (*Report) AddGoodsInfo

func (r *Report) AddGoodsInfo(goodsInfos ...v1.GoodsInfo)

AddGoodsInfo 添加商品信息

func (*Report) AllGoods

func (r *Report) AllGoods() []Goods

AllGoods 返回所有商品信息

func (*Report) Complete

func (r *Report) Complete()

Complete 补充完成

func (*Report) HoldingGoods

func (r *Report) HoldingGoods() []Goods

HoldingGoods 返回持仓商品信息

func (*Report) Risks

func (r *Report) Risks() []Goods

Risks 返回风险分布

func (*Report) Text

func (r *Report) Text(w io.Writer, opts report.TextOptions) error

Text 输出文本形式的报告

func (*Report) TotalProfitAndLoss

func (r *Report) TotalProfitAndLoss() (profitAndLoss, rateOfReturn, annualizedRateOfReturn decimal.Decimal)

TotalProfitAndLoss 返回总体损益情况

Jump to

Keyboard shortcuts

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