M
M
Michio-sempaiq2019-06-26 08:49:49
Fintech
Michio-sempaiq, 2019-06-26 08:49:49

Library or algorithm for balancing values, who knows?

An object is an array of some abstract assets (similar to stocks or bonds)
An asset has the fields:
Quantity
Price
Weight relative to the entire portfolio You
can perform actions with it
Buy - at a given price
Sell - sell at a given price
The portfolio itself has the fields:
Total amount of capital
And can rebalance within itself in two different ways:
1. By allocating external funds without taking into account the sale of assets
2. By selling assets within the portfolio so that the final weights are as close as possible to the benchmark
Example:
Our portfolio has a total size of: 100,000
It consists
Asset 1 - 10 for 2500 (25%)
Asset 2 - 5 at 10,000 (50%)
Asset 3 - 100 at 250 (25)
We need to distribute 50,000 so that in the end our portfolio would be as close as possible to such a structure
Asset 1 - 70%
Asset 2 - 20%
Asset 3 - 10%
The price of the entire portfolio will increase to 150,000
Option 2
We need to sell a part of something and buy a part of something so that the size of our portfolio does not change but the ratios remain new
. Are there any ready-made libraries that provide the most optimal solution?
I understand that this is something from the "portfolio theory" or "search for the optimal solution"
But I can not correctly formulate a question to Google so that it would give out the necessary.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
L
longclaps, 2019-06-26
@longclaps

Subtract and multiply are taught in school.
Sign up for school, master the "portfolio theory".
And that's a shame.

E
EVGENY T., 2019-06-26
@Beshere

Elementary:
1. Find out the cost of one percent of the portfolio: P = capital/100.
2. Target asset value n: Sn = target asset share * P.
3. Target asset size n: Kn = Sn / face value
4. Asset settlement n: Delta = Current asset size - Kn.
Something like this.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question