项目介绍

KonishchevDmitry/investments 是一个托管在 GitHub 上的开源项目,主要使用 Rust 编写,目前获得 552 个 Star、63 次 Fork。

仓库全名
KonishchevDmitry/investments
Star 数
552
Fork 数
63
未关闭 Issue
10

README 摘要

Investments Helps you with managing your investments: Analysis: calculates average rate of return from cash investments by comparing portfolio performance to performance of a bank deposit in USD and RUB currency with exactly the same investments and monthly capitalization. Considers taxes, commissions, dividends, tax deductions and optionally inflation when calculates portfolio performance. Backtesting: backtests…

完整内容见 GitHub 原始 README 或本页 。

常见问题

investments 用什么语言开发?

主要使用 Rust 编写,目前有 552 个 Star。

如何获取 investments 的源码?

可以直接克隆仓库:git clone https://github.com/KonishchevDmitry/investments.git,默认分支为 master;安装与运行步骤见仓库 README。

investments 最近还在维护吗?

仓库最近一次更新为 8月12日,当前有 10 个未关闭 Issue;Star 数为 552,可作为社区活跃度的参考。

关于

Helps you with managing your investments

描述取自 GitHub 官方 API,中文内容由 GitRead 中文社区 编辑团队整理。

语言占比

Dockerfile
Rust
Shell

Release

README

Test status

Investments

Helps you with managing your investments:

  • Analysis: calculates average rate of return from cash investments by comparing portfolio performance to performance of a bank deposit in USD and RUB currency with exactly the same investments and monthly capitalization. Considers taxes, commissions, dividends, tax deductions and optionally inflation when calculates portfolio performance.
  • Backtesting: backtests you portfolio against configured benchmarks.
  • Portfolio rebalancing: instructs you which orders you have to submit to make your portfolio in order with your asset allocation.
  • Stock selling simulation: calculates revenue, profit, taxes and real profit percent which considers taxes into account.
  • Automatic tax statement generation: reads broker statements and alters *.deX file (created by Russian tax program named Декларация) by adding all required information about income from stock selling, paid dividends and idle cash interest.
  • Bank deposits control: view opened bank deposits all in one place and get notified about upcoming deposit closures.
  • Metrics: exports analysis results in Prometheus format.

Targeted for Russian investors who use Firstrade, Interactive Brokers, БКС, Сбер, Т-Банк or non-exchange-traded unit investment funds.

Installation

See installation instructions.

Configuration

Create ~/.investments/config.yaml configuration file. See example which contains typical configuration for each broker, tax exemptions that are applicable to the account and more. Don’t forget to obtain API token for FCS API and Finnhub (see stock and forex quotes providers for details).

Usage

Stocks

Investments is designed to work with your broker statements — there is no need to enter all trades and transactions manually, but it requires you to have all broker statements starting from account opening day. It may be either one broker statement or many — it doesn’t matter, but what matters is that the first statement must be with zero starting assets and statements’ periods mustn’t overlap or have missing days in between.

For now the following brokers are supported:

Investments keeps some data in local database located at ~/.investments/db.sqlite and supports a number of commands which can be grouped as:

Performance analysis

investments analyse command calculates average rate of return from cash investments by comparing portfolio performance to performance of a bank deposit in USD and RUB currency with exactly the same investments and monthly capitalization. Considers taxes, commissions, dividends, tax deductions and optionally inflation when calculates portfolio performance.

investments analyse

Backtesting

investments backtest command backtests all your cash flows against configured benchmarks which allows you to compare your portfolio performace with these benchmarks.

The command also allows to backfill backtesting results (historical data) to VictoriaMetrics for further analysis.

investments backtest

Portfolio rebalancing

See instructions for portfolio rebalancing.

investments rebalance

Tax statement generation

See instructions for tax statement generation and recommendations for interacting with Russian Federal Tax Service.

investments tax-statement

Sell simulation

investments simulate-sell command simulates closing of the specified positions by current market price and allows you to estimate your profits, taxes and tax exemption applicability.

investments simulate-sell

Prometheus metrics

investments metrics command allows you to export analysis results in Prometheus format to be collected by Node exporter’s Textfile Collector.

Here is an example of Grafana dashboard which displays aggregated statistics and investment results for multiple portfolios opened in different brokers:

Investments Grafana dashboard

Non-exchange-traded unit investment funds

There is a support for non-exchange-traded unit investment funds. The program doesn’t support specific fund providers along with their statements, but allows to manually specify all operations in the configuration file.

Deposits

You can also view opened bank deposits all in one place and get notified about upcoming deposit closures. Register your opened deposits in the configuration file and then execute:

$ investments deposits

                            Open deposits

 Open date   Close date    Name     Amount   Interest  Current amount
 19.06.2019  19.03.2020  Тинькофф  465,000₽         7     473,343.49₽
 21.06.2019  21.06.2020  Тинькофф  200,000₽       7.5     203,763.08₽
                                   665,000₽               677,106.57₽

This command has a cron mode (investments deposits --cron) which you can use in combination with notify_deposit_closing_days configuration option. For example, if you create a cron job and configure it to send the command output to your email, then on 11.06.2020 having notify_deposit_closing_days: 10 you get an email with the following contents:

The following deposits are about to close:
* 21.06.2020 Тинькофф: 200,000₽ -> 215,570.51₽

The following deposits are closed:
* 19.03.2020 Тинькофф: 465,000₽ -> 490,013.27₽

Unsupported features

The program is focused on passive investing use cases and supports only those cases which I saw in my broker statements or statements sent to me by other people, which I assured to be handled properly and wrote regression tests for. For example, the following aren’t supported yet:

Denial of responsibility

Any automation is imperfect and the author is a software developer, not a tax lawyer, so always be critical to all program’s calculation results.

The project is developed as a pet project, mainly for my personal use. The code is written in a way that if it finds something unusual in broker statement it returns an error and doesn’t try to pass through the error to avoid the case when it will get you to misleading results, so there may be many cases that it’s not able to handle yet and I can’t guarantee that I’ll find a free time to support your specific case.

Contacts

Issues and Discussions are the preferred way for requests and questions. Please use email only for privacy reasons.

评论

暂无评论