Documentation ¶
Index ¶
- func DeleteAllPortfolios() (bool, error)
- func DeletePortfolio(portfolioID string) (bool, error)
- func Init(config Config) error
- type Config
- type Currency
- type Operation
- type Portfolio
- func (p *Portfolio) AddOperation(op Operation) (string, error)
- func (p *Portfolio) DeleteAllOperations() (int64, error)
- func (p *Portfolio) GetAllOperations() ([]Operation, error)
- func (p *Portfolio) GetAllOperationsByFigi(figi string) ([]Operation, error)
- func (p *Portfolio) GetAveragePriceByFigi(figi string) (float64, error)
- func (p *Portfolio) GetAveragePriceByFigiTillDate(figi string, dt time.Time) (float64, error)
- func (p *Portfolio) GetBalanceByCurrency(curr Currency) (float64, error)
- func (p *Portfolio) GetBalanceByCurrencyTillDate(curr Currency, dt time.Time) (float64, error)
- func (p *Portfolio) GetBalanceByFigi(figi string) (float64, error)
- func (p *Portfolio) GetBalanceByFigiTillDate(figi string, dt time.Time) (float64, error)
- func (p *Portfolio) GetOperationByID(operationID string) (Operation, error)
- func (p *Portfolio) String() string
- func (p *Portfolio) UpdatePortfolio() (bool, error)
- type Type
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DeleteAllPortfolios ¶
DeleteAllPortfolios removes all portfolios
func DeletePortfolio ¶
DeletePortfolio removes portfolio by Id
Types ¶
type Operation ¶
type Operation struct { PortfolioID string `json:"pid" bson:"portfolio"` OperationID string `json:"id" bson:"_id,omitempty"` Currency Currency `json:"currency"` Price float64 `json:"price"` Volume int64 `json:"vol"` FIGI string `json:"figi"` DateTime time.Time `json:"date"` OperationType Type `json:"operationType"` }
Operation represents market operation
type Portfolio ¶
type Portfolio struct { PortfolioID string `json:"id" bson:"_id,omitempty"` Name string `json:"name"` Description string `json:"description"` }
Portfolio represets a range of investments
func AddPortfolio ¶
AddPortfolio adds new potrfolio
func GetAllPortfolios ¶
GetAllPortfolios finds all available portfolios at the moment
func GetPortfolio ¶
GetPortfolio gets operation by id
func (*Portfolio) AddOperation ¶
AddOperation adds operation to the portfolio
func (*Portfolio) DeleteAllOperations ¶
DeleteAllOperations removes all operations associated with given portfolio
func (*Portfolio) GetAllOperations ¶
GetAllOperations finds all available operations at the moment
func (*Portfolio) GetAllOperationsByFigi ¶
GetAllOperationsByFigi finds all available operations for the specified figi at the moment
func (*Portfolio) GetAveragePriceByFigi ¶
GetAveragePriceByFigi returns average price of specified figi (FIFO)
func (*Portfolio) GetAveragePriceByFigiTillDate ¶
GetAveragePriceByFigiTillDate returns average price of specified figi (FIFO) on specified date
func (*Portfolio) GetBalanceByCurrency ¶
GetBalanceByCurrency returns balance of specified currency
func (*Portfolio) GetBalanceByCurrencyTillDate ¶
GetBalanceByCurrencyTillDate returns balance of specified currency till specified date
func (*Portfolio) GetBalanceByFigi ¶
GetBalanceByFigi returns balance of specified figi
func (*Portfolio) GetBalanceByFigiTillDate ¶
GetBalanceByFigiTillDate returns balance of specified figi till specified date
func (*Portfolio) GetOperationByID ¶
GetOperationByID gets operation by id
func (*Portfolio) UpdatePortfolio ¶
UpdatePortfolio updates current portfolio
type Type ¶
type Type string
Type is market operation type
const ( // Buy operation Buy Type = "buy" // Sell operation Sell Type = "sell" // BrokerCommission operation BrokerCommission Type = "brokerCommission" // ExchangeCommission operation ExchangeCommission Type = "exchangeCommission" // PayIn operation PayIn Type = "payIn" // PayOut operation PayOut Type = "payOut" // Coupon operation Coupon Type = "coupon" )