Author Topic: BitUSD Yield (aka Interest) Scheduled for Launch Wednesday  (Read 29563 times)

0 Members and 1 Guest are viewing this topic.

Offline emski

  • Hero Member
  • *****
  • Posts: 1282
    • View Profile
    • http://lnkd.in/nPbhxG
What happens If I want to change vote with my savings account?

Offline theoretical

Is this because it would take too much time to compute the factor to multiply the BitUSD value by for each transaction? Meaning if each block determines a factor f_i (representing e^y where y is the per block variable yield rate) for each BitAsset, then for each transaction with BitAsset inputs you would need to get all the BitAsset's f_i from block i = m where the transaction was created to block i = n which is the current block where the transaction was spent, and then multiply the BitAsset value by f_m * f_(m+1) * ... * f_n to get its new value with yield.

Yes.  It would greatly increase database size and transaction processing time.  I know how to "do it proper" from the original dividends design for BTSX.  It requires an accumulation table that must be updated every block for 1 years worth of blocks. 


I'm guessing bytemaster wants to save the product between b[m] and b[n] for all pairs of blocks m, n.  I posted how to avoid this earlier in this thread (four word answer: partial sum skip list), but I'll go into more detail since both of you apparently missed (or misunderstood) that post.

I propose using sums of logarithms instead of multiplying (so we can do many-block sequences without worrying too much about various approximation issues).  Then only save partial sums that are aligned power-of-two length.  So you save (in your notation):

Code: [Select]
run(m,  1) = f_m                                     # for all blocks
run(m,  2) = f_m + f_{m+1}                           # for every 2nd block
run(m,  4) = f_m + f_{m+1} + f_{m+2} + f_{m+3}       # for every 4th block
run(m,  8) = f_m + f_{m+1} + f_{m+2} + f_{m+3} + f_{m+4} + f_{m+5} + f_{m+6} + f_{m+7}
                                                     # for every 8th block, etc... for every power of 2

If total number of blocks is N, this data structure needs at most 2N-1 entries (hint: total size is a geometric series).

So if you want to find e.g. the sum of logs from 0x7159 (inclusive) to 0x1258a (exclusive), you can compute that as:

Code: [Select]
run(0x7159, 1) + run(0x715a, 2) + run(0x715c, 4) + run(0x7160, 0x20) + run(0x7180, 0x80) + run(0x7200, 0x200) + run(0x7400, 0x400) + run(0x7800, 0x800) + run(0x8000, 0x8000) + run(0x10000, 0x2000) + run(0x12000, 0x400) + run(0x12400, 0x100) + run(0x12500, 0x80) + run(0x12580, 8) + run(0x12588, 2)

The proper bit twiddling operations to implement this are left as an exercise to the reader.

Updating a block will usually be fast, requiring only the last few blocks.  Block heights divisible by large powers of 2 will happen and reach higher in the blockchain (on an exponentially rare basis), but in all cases at most log(N) values need be saved, each of which requires at most log(N) time.  (I think the actual bound is just log(N) instead of log(N)^2 because you re-use the tail part and only need to reach back one more entry, but log^2(N) is still fast enough.)
« Last Edit: September 10, 2014, 06:32:29 am by drltc »
BTS- theoretical / PTS- PZxpdC8RqWsdU3pVJeobZY7JFKVPfNpy5z / BTC- 1NfGejohzoVGffAD1CnCRgo9vApjCU2viY / the delegate formerly known as drltc / Nothing said on these forums is intended to be legally binding / All opinions are my own unless otherwise noted / Take action due to my posts at your own risk

Offline arhag

  • Hero Member
  • *****
  • Posts: 1214
    • View Profile
    • My posts on Steem
  • BitShares: arhag
  • GitHub: arhag
There is no computationally simple way to perform "compound interest" because the "interest rate" is variable over time and a number of other complexities.

Is this because it would take too much time to compute the factor to multiply the BitUSD value by for each transaction? Meaning if each block determines a factor f_i (representing e^y where y is the per block variable yield rate) for each BitAsset, then for each transaction with BitAsset inputs you would need to get all the BitAsset's f_i from block i = m where the transaction was created to block i = n which is the current block where the transaction was spent, and then multiply the BitAsset value by f_m * f_(m+1) * ... * f_n to get its new value with yield.

Yes.  It would greatly increase database size and transaction processing time.  I know how to "do it proper" from the original dividends design for BTSX.  It requires an accumulation table that must be updated every block for 1 years worth of blocks. 

Alright, that's too bad. Is this accumulation table the accumulating product from f_0 (factor for block in which the BitAsset was created) to f_n (current block) for each BitAsset? I don't quite understand why it has to increase the database size and transaction processing time by much. First, let me define that accumulating product for BitUSD to be p_n = f_c * f_(c+1) * ... * f_n, where block c was when yields for the BitAsset began. Also p_n = 1 for n < c. Then when creating a new transaction the after yield value of a BitUSD input = before yield value * p_n / p_m, where the current block is block n and the transaction containing the BitUSD output that is spent in the new transaction is on block m. Only the values for p_i for each block i and for each BitAsset need to be stored in the local client database. When validating the transaction the p_n value is already calculated (and stored in the database) for the current block and a look up from the database of the value p_m for each input of each transaction to be validated in the current block should be pretty fast (I think). Is the issue that this approach would have too much numerical error? Could rounding in favor of lower yields resolve that? What else am I missing?

Quote
I said it before and I will say it again, this isn't really "interest" because it doesn't "accrue" in a monotonic manner.   Your "estimated yield" could go down from day to day depending upon the rate of new fees, rewards claimed by others, and new issuance.   

Well as long as the yield rate is non-negative (which it should be) the value of your BitAssets are monotonically increasing.

Well the GUI shows "Estimated Yield" if you made a transaction "right now"... but the estimation could go down relative to an earlier estimation but it will never be negative.

Ah, I see. Yeah, I momentarily forgot that the current yield implementation is the compromising, easier-to-implement version rather than the one that compounds at every block. I get how the estimated yield on top of the current BitAsset balances would fluctuate over time. Which is what I find annoying about the compromising approach: that it can be gamed. But if it really does complicate validation and increase database size then I guess it isn't that big of a deal.

Offline GaltReport

There is no computationally simple way to perform "compound interest" because the "interest rate" is variable over time and a number of other complexities.

Is this because it would take too much time to compute the factor to multiply the BitUSD value by for each transaction? Meaning if each block determines a factor f_i (representing e^y where y is the per block variable yield rate) for each BitAsset, then for each transaction with BitAsset inputs you would need to get all the BitAsset's f_i from block i = m where the transaction was created to block i = n which is the current block where the transaction was spent, and then multiply the BitAsset value by f_m * f_(m+1) * ... * f_n to get its new value with yield.

Yes.  It would greatly increase database size and transaction processing time.  I know how to "do it proper" from the original dividends design for BTSX.  It requires an accumulation table that must be updated every block for 1 years worth of blocks. 

Quote
I said it before and I will say it again, this isn't really "interest" because it doesn't "accrue" in a monotonic manner.   Your "estimated yield" could go down from day to day depending upon the rate of new fees, rewards claimed by others, and new issuance.   

Well as long as the yield rate is non-negative (which it should be) the value of your BitAssets are monotonically increasing.

Well the GUI shows "Estimated Yield" if you made a transaction "right now"... but the estimation could go down relative to an earlier estimation but it will never be negative.

Great you got something in the GUI for it already !!  +5%

Offline bytemaster

There is no computationally simple way to perform "compound interest" because the "interest rate" is variable over time and a number of other complexities.

Is this because it would take too much time to compute the factor to multiply the BitUSD value by for each transaction? Meaning if each block determines a factor f_i (representing e^y where y is the per block variable yield rate) for each BitAsset, then for each transaction with BitAsset inputs you would need to get all the BitAsset's f_i from block i = m where the transaction was created to block i = n which is the current block where the transaction was spent, and then multiply the BitAsset value by f_m * f_(m+1) * ... * f_n to get its new value with yield.

Yes.  It would greatly increase database size and transaction processing time.  I know how to "do it proper" from the original dividends design for BTSX.  It requires an accumulation table that must be updated every block for 1 years worth of blocks. 

Quote
I said it before and I will say it again, this isn't really "interest" because it doesn't "accrue" in a monotonic manner.   Your "estimated yield" could go down from day to day depending upon the rate of new fees, rewards claimed by others, and new issuance.   

Well as long as the yield rate is non-negative (which it should be) the value of your BitAssets are monotonically increasing.

Well the GUI shows "Estimated Yield" if you made a transaction "right now"... but the estimation could go down relative to an earlier estimation but it will never be negative. 
For the latest updates checkout my blog: http://bytemaster.bitshares.org
Anything said on these forums does not constitute an intent to create a legal obligation or contract between myself and anyone else.   These are merely my opinions and I reserve the right to change them at any time.

Offline arhag

  • Hero Member
  • *****
  • Posts: 1214
    • View Profile
    • My posts on Steem
  • BitShares: arhag
  • GitHub: arhag
There is no computationally simple way to perform "compound interest" because the "interest rate" is variable over time and a number of other complexities.

Is this because it would take too much time to compute the factor to multiply the BitUSD value by for each transaction? Meaning if each block determines a factor f_i (representing e^y where y is the per block variable yield rate) for each BitAsset, then for each transaction with BitAsset inputs you would need to get all the BitAsset's f_i from block i = m where the transaction was created to block i = n which is the current block where the transaction was spent, and then multiply the BitAsset value by f_m * f_(m+1) * ... * f_n to get its new value with yield.

I said it before and I will say it again, this isn't really "interest" because it doesn't "accrue" in a monotonic manner.   Your "estimated yield" could go down from day to day depending upon the rate of new fees, rewards claimed by others, and new issuance.   

Well as long as the yield rate is non-negative (which it should be) the value of your BitAssets are monotonically increasing.

Offline oldman

  • Hero Member
  • *****
  • Posts: 556
    • View Profile

'Yield' could replace rewards as a non-contentious alternative to interest.

A bit awkward in common use but still an improvement over 'reward'.

Exactly which is why the UI + API use yield rather than interest :)

Bravo! Great news!  +5%

Offline bytemaster

Latest updates on this yield...

If we make it fully linear with time, then people will attempt to use "compounding" to maximize their return by claiming their interest anytime the benefit from compounding exceeds the transaction fee. 
If we make it non-linear with time then it could make account deposits non-fungible: old balances are worth more than new balances.
There is no computationally simple way to perform "compound interest" because the "interest rate" is variable over time and a number of other complexities.

So we have implemented a compromise rewards system.
1) Any balance held less than 1 day gets nothing.  This rule sets the maximum rate of compounding to daily. 
2) 80% of your balance earns "simple interest" proportional to how long you have held it.
3) 20% of your balance earns "interest^2" proportional to how long you have held it squared... the goal of this rule is to make "long-term holders" better off than if they had attempted to compound it. 

I said it before and I will say it again, this isn't really "interest" because it doesn't "accrue" in a monotonic manner.   Your "estimated yield" could go down from day to day depending upon the rate of new fees, rewards claimed by others, and new issuance.   

So there is no "right or wrong" way to calculate the yield.  I am sure there will be many "games" and "strategies" people will have to maximize their yield at the expense of others such as:
1) claiming their yield right before they expect a supply increase
2) claiming their yield right after a bunch of margin calls reduces BitUSD supply
3) claiming their yield before a large balance hits maturity.

The expectation is that this "bonus" is something that will "average out" as people make transactions and that (for most people) it isn't worth attempting to game.   However, the mere fact that it can be "gamed" will drive people who like this kind of thing to get involved. 

Yes the numbers are a tad arbitrary, the calculations simplistic, but they get the job done of causing BitUSD to have a positive yield proportional to fees earned.

'Yield' could replace rewards as a non-contentious alternative to interest.

A bit awkward in common use but still an improvement over 'reward'.

Exactly which is why the UI + API use yield rather than interest :)
For the latest updates checkout my blog: http://bytemaster.bitshares.org
Anything said on these forums does not constitute an intent to create a legal obligation or contract between myself and anyone else.   These are merely my opinions and I reserve the right to change them at any time.

Offline oldman

  • Hero Member
  • *****
  • Posts: 556
    • View Profile
Latest updates on this yield...

If we make it fully linear with time, then people will attempt to use "compounding" to maximize their return by claiming their interest anytime the benefit from compounding exceeds the transaction fee. 
If we make it non-linear with time then it could make account deposits non-fungible: old balances are worth more than new balances.
There is no computationally simple way to perform "compound interest" because the "interest rate" is variable over time and a number of other complexities.

So we have implemented a compromise rewards system.
1) Any balance held less than 1 day gets nothing.  This rule sets the maximum rate of compounding to daily. 
2) 80% of your balance earns "simple interest" proportional to how long you have held it.
3) 20% of your balance earns "interest^2" proportional to how long you have held it squared... the goal of this rule is to make "long-term holders" better off than if they had attempted to compound it. 

I said it before and I will say it again, this isn't really "interest" because it doesn't "accrue" in a monotonic manner.   Your "estimated yield" could go down from day to day depending upon the rate of new fees, rewards claimed by others, and new issuance.   

So there is no "right or wrong" way to calculate the yield.  I am sure there will be many "games" and "strategies" people will have to maximize their yield at the expense of others such as:
1) claiming their yield right before they expect a supply increase
2) claiming their yield right after a bunch of margin calls reduces BitUSD supply
3) claiming their yield before a large balance hits maturity.

The expectation is that this "bonus" is something that will "average out" as people make transactions and that (for most people) it isn't worth attempting to game.   However, the mere fact that it can be "gamed" will drive people who like this kind of thing to get involved. 

Yes the numbers are a tad arbitrary, the calculations simplistic, but they get the job done of causing BitUSD to have a positive yield proportional to fees earned.

'Yield' could replace rewards as a non-contentious alternative to interest.

A bit awkward in common use but still an improvement over 'reward'.

Offline bytemaster

If you compound daily at 5% then you will earn $5.13 per $100 vs $5 for simple interest (2.6% compounding advantage)
If you compound daily at 10% then you will earn $110.52  (5.2%) compounding advantage
If you compound daily at 20% then you will earn $122.13  (10.6%) compounding advantage

Bottom line even the most aggressive attempt at compounding / bit asset rewards means it is better to "hold" than to "churn".   

This design makes it over 4x better to hold for 1 year than attempt compounding; however, because we are using T^2 (for calculation simplicity), if you hold for shorter periods of time (say just a few months) then the gains from compounding are about equal to the gains from T^2.

There is probably a point where compounding is better than the "long-term reward" by these calculations, but anyone with that short of a time horizon probably doesn't care about compounding that much anyway *or* have that much money on the table. 

I am sure someone will open up a "savings account" that does long term holding of BitUSD... the market will take these arbitrary rules and rebalance around it.

The easiest way to manage this is to have 2 accounts:  checking.me and savings.me and avoid spending from savings. 

Like most things in life, those that do extra work can reap extra rewards. 




For the latest updates checkout my blog: http://bytemaster.bitshares.org
Anything said on these forums does not constitute an intent to create a legal obligation or contract between myself and anyone else.   These are merely my opinions and I reserve the right to change them at any time.

Offline serejandmyself

  • Sr. Member
  • ****
  • Posts: 358
    • View Profile
Latest updates on this yield...

If we make it fully linear with time, then people will attempt to use "compounding" to maximize their return by claiming their interest anytime the benefit from compounding exceeds the transaction fee. 
If we make it non-linear with time then it could make account deposits non-fungible: old balances are worth more than new balances.
There is no computationally simple way to perform "compound interest" because the "interest rate" is variable over time and a number of other complexities.

So we have implemented a compromise rewards system.
1) Any balance held less than 1 day gets nothing.  This rule sets the maximum rate of compounding to daily. 
2) 80% of your balance earns "simple interest" proportional to how long you have held it.
3) 20% of your balance earns "interest^2" proportional to how long you have held it squared... the goal of this rule is to make "long-term holders" better off than if they had attempted to compound it. 

I said it before and I will say it again, this isn't really "interest" because it doesn't "accrue" in a monotonic manner.   Your "estimated yield" could go down from day to day depending upon the rate of new fees, rewards claimed by others, and new issuance.   

So there is no "right or wrong" way to calculate the yield.  I am sure there will be many "games" and "strategies" people will have to maximize their yield at the expense of others such as:
1) claiming their yield right before they expect a supply increase
2) claiming their yield right after a bunch of margin calls reduces BitUSD supply
3) claiming their yield before a large balance hits maturity.

The expectation is that this "bonus" is something that will "average out" as people make transactions and that (for most people) it isn't worth attempting to game.   However, the mere fact that it can be "gamed" will drive people who like this kind of thing to get involved. 

Yes the numbers are a tad arbitrary, the calculations simplistic, but they get the job done of causing BitUSD to have a positive yield proportional to fees earned.

is there a particular reason you chose 80% mark and 20% mark ?
btsx - bitsharesrussia

Offline bytemaster

Latest updates on this yield...

If we make it fully linear with time, then people will attempt to use "compounding" to maximize their return by claiming their interest anytime the benefit from compounding exceeds the transaction fee. 
If we make it non-linear with time then it could make account deposits non-fungible: old balances are worth more than new balances.
There is no computationally simple way to perform "compound interest" because the "interest rate" is variable over time and a number of other complexities.

So we have implemented a compromise rewards system.
1) Any balance held less than 1 day gets nothing.  This rule sets the maximum rate of compounding to daily. 
2) 80% of your balance earns "simple interest" proportional to how long you have held it.
3) 20% of your balance earns "interest^2" proportional to how long you have held it squared... the goal of this rule is to make "long-term holders" better off than if they had attempted to compound it. 

I said it before and I will say it again, this isn't really "interest" because it doesn't "accrue" in a monotonic manner.   Your "estimated yield" could go down from day to day depending upon the rate of new fees, rewards claimed by others, and new issuance.   

So there is no "right or wrong" way to calculate the yield.  I am sure there will be many "games" and "strategies" people will have to maximize their yield at the expense of others such as:
1) claiming their yield right before they expect a supply increase
2) claiming their yield right after a bunch of margin calls reduces BitUSD supply
3) claiming their yield before a large balance hits maturity.

The expectation is that this "bonus" is something that will "average out" as people make transactions and that (for most people) it isn't worth attempting to game.   However, the mere fact that it can be "gamed" will drive people who like this kind of thing to get involved. 

Yes the numbers are a tad arbitrary, the calculations simplistic, but they get the job done of causing BitUSD to have a positive yield proportional to fees earned.


For the latest updates checkout my blog: http://bytemaster.bitshares.org
Anything said on these forums does not constitute an intent to create a legal obligation or contract between myself and anyone else.   These are merely my opinions and I reserve the right to change them at any time.

Offline Riverhead

There needs to be no minimum amount of time needed for funds being held to receive interest.  If interest is always accruing then traders will flock like geese to these markets


Sent from my iPhone using Tapatalk

Surely its a bit obscure to reciceve interest after 1 day/ Otherwise id come in with a million - get my % and go away.

If I understood the concept correctly, yep, you would get a % of the tx fees, which mean getting a million in bitUSD for a day would only give you a bigger slice of a fixed pie (total amount of fees allocated to "interests" during that day). Basically, the interest for a day would be very low (percentage wise compared to your investment)


Said another way the interest, rewards, dividend, whatever, yield percentage is guestimated as an APR (Annual Percentage Rate). To get the daily rate just divide it by 365. So your 1000000 bitUSD at say 7.5% would earn you about $205/day.

ok but it still seems unsensible to give % over a day


The transaction fee would police that. The more often people cashed out the more fees the system generates the more interest/rewards everyone else earns :).

Offline serejandmyself

  • Sr. Member
  • ****
  • Posts: 358
    • View Profile
There needs to be no minimum amount of time needed for funds being held to receive interest.  If interest is always accruing then traders will flock like geese to these markets


Sent from my iPhone using Tapatalk

Surely its a bit obscure to reciceve interest after 1 day/ Otherwise id come in with a million - get my % and go away.

If I understood the concept correctly, yep, you would get a % of the tx fees, which mean getting a million in bitUSD for a day would only give you a bigger slice of a fixed pie (total amount of fees allocated to "interests" during that day). Basically, the interest for a day would be very low (percentage wise compared to your investment)


Said another way the interest, rewards, dividend, whatever, yield percentage is guestimated as an APR (Annual Percentage Rate). To get the daily rate just divide it by 365. So your 1000000 bitUSD at say 7.5% would earn you about $205/day.

ok but it still seems unsensible to give % over a day
btsx - bitsharesrussia

Offline Riverhead

There needs to be no minimum amount of time needed for funds being held to receive interest.  If interest is always accruing then traders will flock like geese to these markets


Sent from my iPhone using Tapatalk

Surely its a bit obscure to reciceve interest after 1 day/ Otherwise id come in with a million - get my % and go away.

If I understood the concept correctly, yep, you would get a % of the tx fees, which mean getting a million in bitUSD for a day would only give you a bigger slice of a fixed pie (total amount of fees allocated to "interests" during that day). Basically, the interest for a day would be very low (percentage wise compared to your investment)


Said another way the interest, rewards, dividend, whatever, yield percentage is guestimated as an APR (Annual Percentage Rate). To get the daily rate just divide it by 365. So your 1000000 bitUSD at say 7.5% would earn you about $205/day.