Jump to content

Distribution coefficient


dNY
 Share

Recommended Posts

Hey guys,


I'm building a financial app and I need some help with making a "distribution coefficient/index" (best math name I could give it). The idea behind it is:

- There's a total balance. Let's call it "X".
- There are users with different shares at stake on "X": A, B, C and D (users).
- Each user has a % allocation depending on how much they have at stake on "X". Let's say:


- A --> 10 units --> 10%
- B --> 20 units --> 20%
- C --> 30 units --> 30%
- D --> 40 units --> 40%
X = 100 ---> 100%

I need a coefficient (let's call it "Y") capable of determining the new allocation % of each user once any of them has added more units to "X", and the formula to calculate this coefficient. It would be something like:

                   oldUnits + newUnits
- A --> 30 (10 + 20) --> Y --> 25%
- B --> 20 --> Y --> 16.66%
- C --> 30 --> Y --> 25%
- D --> 40 --> Y --> 33.33%

The limitations/constraints/requirements are:

- The only parameter that I (my app) can freely modify is "Y".
- The users are in charge of modifying their own stake of "units".
- The % allocation is the result of the interaction of "units" with "Y" and it must return 100% when adding up the % allocation of all users.

I don't have any high-level math background (mine it's business), so go easy on me please. 😅

Thanks a lot again for your help!

 

Cheers.
 

Link to comment
Share on other sites

Here is an attempt, assuming I interpret the requirements correctly:

[math]Y=\frac{X}{X+A}[/math] where X is "initial total balance" (or the sum of all users' initial number of units) and A is the amount added (newUnits in the example above).

The new allocation for a user is calculated as YU where U is the number of units the user has. For one user (A in the example above) that means using the updated number of units.

Trying the example:

1 hour ago, dNY said:

 oldUnits + newUnits
- A --> 30 (10 + 20) --> Y --> 25%
- B --> 20 --> Y --> 16.66%
- C --> 30 --> Y --> 25%
- D --> 40 --> Y --> 33.33%

X=100, A=20 -> [math]Y=\frac{X}{X+A}=\frac{100}{100+20}=\frac{5}{6}[/math]

A: [math]\frac{30*5}{6}=25[/math]

B : [math]\frac{20*5}{6}\approx 16.67[/math]
C [math]\frac{30*5}{6}=25[/math]
D [math]\frac{40*5}{6}\approx 33.33[/math]

 

Edited by Ghideon
format fix
Link to comment
Share on other sites

Sounds like dilution of shares.

https://www.google.com/search?q=dilution+of+shares

If you have an array/list of integers. Sum them together ("total").

For each one list[index] × 100 / total is percentage of shares.

Give some more shares list[index] += new_shares

Make a copy of array/list and repeat calculation of percentages.

Divide new percentage by old percentage for each entry. They can be <1, =1 or >1. Sort them to learn who gained the most and who lost the most.

 

In the real world it is a more complicated because shares can be voting and non-voting i.e. voting minority (or unaware shareholders) can dilute larger shareholders and screw them up (not nicely. Facebook is an example).

Also people can buy, sell or receive options. Usually insiders like management and employees. Typically with restrictions.

Edited by Sensei
Link to comment
Share on other sites

Thanks lot for these answers, guys! 

I completely got your solution @Sensei but I'm going to with @Ghideon's. It's an app in Solidity what I'm building so it makes more sense from a gas-saving perspective, but you introduced me to a concept that I've heard before but never really got into it until now.

 

 

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.