Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - theoretical

Pages: 1 ... 12 13 14 15 16 17 18 [19] 20 21 22 23 24 25 26 ... 34
271
General Discussion / Re: The lemonade stand
« on: October 04, 2014, 02:31:20 am »
And then the entrepreneurs count the money in the basket and discover there's $116.83 left.  They're very confused about who owns it, but Adam re-assures them that each will be entitled to half of it -- after they wait 30 more days and have each accumulated another 30 shares.

Alice has learned some hard lessons about trusting Adam's accounting advice.  She thinks for a few minutes, then scribbles on a piece of paper.  Showing it to Adam, she says, "But wouldn't that mean that whoever goes first gets half of $116.83, and whoever goes second gets half of a half?"

Adam says, "Yeah, that's right!  My History of Accounting professor says they used to do things differently back in the twentieth century, before DAC's took over the world of finance.  I usually sleep in that class though."

The End

272
General Discussion / Re: The lemonade stand
« on: October 04, 2014, 02:31:02 am »
The entrepreneurs consult Alice's older brother Adam, who is studying DAC's in accounting school.  Adam tells them:

"You're running this stand for a total of 30 days, right?  We give each of you one share a day, and you can trade in any number of shares at any time for a proportional fraction of the basket.  We're giving out a total of 60 shares, so each share will be worth 1/60 of a basket."

The next day, Adam's sister Alice is crying and mad at him because, while the stand earned $10 in profits, her lemonade share was only worth $0.17 which wasn't enough to buy either a candy bar or a soda, and this simply didn't seem right to Alice.  Adam assured her that the accounting math was solid, although the system might take a long time to reach equilibrium.

Thirty days later, Bob's pretty mad at Adam too, because he can't buy his $150 bike.  Bob's 30 shares, cashed in on the last day, were only worth $116.82 while he was expecting to earn $150.

Continued in the next post...

273
General Discussion / The lemonade stand
« on: October 04, 2014, 02:30:27 am »
Let me tell you a little story.

Alice and Bob run a lemonade stand.  Each invested $50 capital, and the lemonade stand turns a profit of $10 per day.

Their cash register is a small basket full of bills and coins.  On odd-numbered days, Alice runs the stand.  On even-numbered days, Bob runs the stand.  They agree that whoever is running the stand will be paid by getting half the contents of the basket at the end of the day.

This system works very well.  Taking profits on alternating days allows Alice and Bob to buy lots of candy and soda.  Bob gets a little more in the beginning, but the dividends quickly even out, and they are not very worried about it.

Over the winter, Bob decides that next summer he's going to buy a bike -- the model he has his eye on costs $150.  He knows this is about what he makes from the lemonade stand, so he no longer wants to take profits daily, instead letting his share accrue in the basket so he's not tempted to blow the money on sweets.  Alice is less of a long-term thinker and wants to still get her share of profits every day, however.

Continued in the next post...

274
Assuming 2 different longs that each control 50% of the USD supply the first long cashes on on the last day... he would hold 50/110 of the USD and get a yield of $4.54 and the supply would now be 55.46 and the yield fund would have 5.46 in it.   The second long cashes out owning 50/55.46 of the USD supply and would receive a yield of $4.92... leaving the yield fund at $0.53 and the USD supply at $0.53 and the USD debt at $0.53. 

Using 110 as the divisor is the first accounting problem I see; the divisor should be 100.  A divisor of 110 would be based on an (incorrect) assumption that the dollars in the yield fund would themselves be eligible to receive yield.  You should compute the investor's share of the yield based on the total of all BitUSD held by investors (50 + 50 = 100), not investors plus network (50 + 50 + 10 = 110).  Then, after the first long's BitUSD plus yield are burned in the partial cover operation, the second long would hold 100% of the supply and receive 100% of the yield fund; each investor would have gotten exactly $5 in yield, which is the "right" behavior.

The second accounting problem, which is actually the complaint I had in mind, is based on the first long transferring his BitUSD to himself (or another person), collecting the yield and having the BitUSD remain in circulation.  My understanding is, if the first long transfers the BitUSD to himself, he would get $4.54 of the yield.  The supply would still be $110 (assuming fees are too small to matter).  The first long would hold 54.54 / 110 of the supply and the second long would hold 50 / 110 of the supply, but the yield fund is down to $4.56.  So the second long would get 50 / 110 of $4.56, or $2.07 in yield.  The remaining $3.37 in the yield fund is untouchable BitUSD, and it is a very substantial percentage of the fund.  Basically the problem is giving the first investor 50 / 110 of the equity in the fund both before and after the distribution.  The extra equity you're giving to the first long has to come from somewhere, and it comes from the second long.

275
The mathematics on the yield fund are simple... it will grow for 1 year and will always contain about 1 years worth of fees.

I think in order to make this assertion, you have to assume that fee income is constant and yield claims are randomly distributed.  Obviously, in the real world fee growth is likely when we're in a growth stage, and there may big lumps of claims from big price movements or news events.  Agent86 also pointed out that claiming yield is non-commutative...if everyone tries to claim their yield on the same day, then the last guy who claims will see a much lower yield than the first guy who claims.  (I realized this independently, but he beat me to publicly describing the phenomenon, so I give him the credit for this one.)

Why must it grow for a year rather than "pay out now"?  Because we reward people for holding USD

You can reward them more by paying out now.

and you cannot "pay out now" to every that would be untenable. 

As I've said before multiple times -- just have a "distribution event" whenever the yield fund grows big enough to pay 0.01% to everybody.  You don't actually go through every balance in the distribution event, rather you just record the block number of the event.  Then when a balance moves you can easily check how many distribution events happened since the last time it moved, and determine yield as 0.01% * balance_amount * number_of_distribution_events.

If some sort of yield curve is desirable that pays older BitUSD more than newer BitUSD, that's fairly simple too [1].

How big must the "reserve fund be" for black swan protection... it doesn't matter...

It does matter.  If it's too small, then it doesn't actually protect against what it claims to protect against.  If it's too large, then we have better uses for the extra BitUSD:  Increasing yield, auctioning it off as interest in a BitBond market to tie up much larger amounts of investor capital, or buying and burning BTSX.

"Too small" or "too large" is a judgment that can only be made by adopting some risk model that places a probability distribution on black swan movements of various sizes.  We need some "policy model" that determines how much we keep on hand.

But if BitUSD investors have transparency about the amount of funds that would be immediately available to make them whole in a black swan event, they are free to apply their own risk models, decide whether the black swan reserve policy is adequate, and invest accordingly.

assuming the average rate paid by shorts is 10% APR then the reserve fund will be 10%+ of BitUSD out there.

I'd like to see a more careful analysis of why this would be the case.

Considering shorts constantly cover every 30 days.... in the event of a black swan even a large percentage of the USD will be covered by collateral...

Which is why I think a year's worth of income, especially if shorts are being charged interest, will grossly overcapitalize the FDIC fund.  A black swan event doesn't mean every BitUSD in existence will suddenly be totally unbacked and need bought up; the majority of them will still be backed by collateral.

thus 10% left over simply means yields on BitUSD get reset to 0 for a while. 

With immediate yield payouts, this reset can be made to last exactly as long as it needs to last to cover any shortfall in the FDIC fund.  Then we can just put 50% brakes on yield growth to recapitalize the FDIC fund.  I think the current yield computation would require at least a year for yield to get fully up to steam after a reset, but again, any model would require assumptions about the rate of fee income and distribution of claim dates.

The funds don't disappear into a black hole..

The funds do "disappear," at least temporarily.  If all of the longs and shorts got together and decided to unwind their positions, they'd be unable to do so because:

- Some of the BitUSD in the yield fund would be unclaimable
- The first claims on the yield fund would reduce later claims' yield
- Short interest accrued but not paid into the yield fund would be untouchable

but I can easily see some benefit for tracking income vs expenses each block.

I'm glad we agree that transparent accounting of the network's use of investor funds is important.

I also think there is great value in being able to explicitly control the amount of network income devoted to various purposes.

[1] Conceptually divide funds into 365 "buckets" based on age in days.  Keep track of how many BitUSD are in each bucket.  When BitUSD balance moves, reset it to bucket 0; at midnight UTC, increase every bucket +1, add a new empty 0 bucket, and dump the contents of bucket #365 into bucket #364.  Then each bucket has its own yield fund that pays out at 0.01%.  Each bucket's fund gets a share of yield proportional to its contents times a multiplier based on its bucket ID (the multipliers determine the yield curve).  If dividing every fee into 365 buckets as it comes in would be too much work or introduce too much rounding error, you could just buffer a day's worth of income and then distribute it when you rotate the buckets.

276

Also, @bytemaster if you're reading this -- please contact me privately.  I've tried to reach you via PM and email, but haven't received any reply.  If you're still thinking about it, I'd appreciate at least knowing my message hasn't gotten caught in a spam filter.  Thanks

277
We are operating BTSX as a DAC banking firm.  Human participants include depositors (BitAsset holders), shareholders (BTSX holders), and management (delegates).  AFAICT no human has access to a complete and reliable income statement or balance sheet for two of the DAC's main activities (BitAsset yield and interest on shorts; the latter has not yet been launched).  Why this makes me uneasy should be obvious.

To be clear, I do not think BTSX is in danger of insolvency anytime soon [1].  Rather, I think the network is tying up more funds than it needs to, for longer periods than it needs to, with little transparency as to the amount or intended purpose of the funds which are tied up [2] [3].

Sending a bunch of BitUSD into an accounting rabbit hole for a year is not the best use of that BitUSD, compared to the alternatives:  Paying to longs as yield, auctioning off as interest in a BitBond market to tie up a much larger sum of investor BitUSD, or buying up and burning BTSX.

I believe there are two justifications for letting this situation happen:

- It is desirable to hold some BitUSD in reserve for policy purposes, such as buffering yields to make them less "lumpy" in order to cater to BitAsset holders' preferences for stable, accurate yield projections (and defeat certain technical trading strategies), or an FDIC fund to get rid of underwater shorts.
- Implementation is done at the "micro-level" of individual long balances and short positions.  Exact "macro-level" computations which maintain continuously updated sums of the micro-level activity of O(n) positions undergoing O(m) updates using O(m*log(n)) or less computational resources, is a hard technical engineering problem.

To these I would reply:

- Under the current implementation, policy funds may end up grossly under- or over-capitalized with respect to how much is needed to achieve their intended objectives.  Regardless of whether we as policymakers decide a sufficient FDIC would be 1%, 5%, 10%, 20%, or 50% of existing BitUSD, it would be an incredible coincidence if the reserve developed by the yield implementation reached an equilibrium near the desired reserve level under most market conditions.  (Unless the yield fund was specifically designed to do so, of course.)
- In various forum posts and whitepapers, I've published macro-level algorithms that solve the engineering problems of how to implement efficient macro-level computations.

[1] The much-discussed case of "black swan" price movements that put too many shorts too far "underwater" is always a possibility, but I won't discuss that further here.

[2] Specifically, there are gross approximations in the yield fund computations that result in an enormous percentage of the yield fund being untouchable -- BitUSD holders could not access most of the fund even if everyone claimed yield in the next block.  Similar approximations are planned for the currently proposed implementation of shorts paying interest to longs.

[3] A while ago I posted somewhere on this forum some back-of-the-envelope calculations about what the amount of untouchable BitUSD may be for the yield fund.  While the amount of untouchable BitUSD could, in principle, be determined from the blockchain, AFAIK nobody has actually done this calculation and published the result.

278
General Discussion / Re: The Future of the BTSX Market Engine...
« on: October 03, 2014, 02:29:18 am »
For me the above is the straight-way to solve this 'incorrectness' but:
-Is it really that easy to update the initial order on a blockchain? Or will we will end up carrying well too much pretty unnecessary info for a average interest of 0.20833% And deference of like less then 10% of that?

The blockchain itself will just contain two things (well not really, this is just a simplification, see [1] for the truth):

- On November 1, a transaction initiating the initial short.
- On November 16, a transaction executing the partial cover.

It's up to the client to compute the new margin call price from the information in these transactions, and figure out how much BitUSD liability the position has in the future when something else happens to it (which might be another partial cover, a full cover, a margin call, or expiration).

So the November 1 transaction remains the same forever (the blockchain is basically an append-only transaction log, that's kinda the whole point of having a blockchain).  The client's database record showing the open BitUSD short positions, OTOH, is a mutable record which is updated by transactions coming from the blockchain.  So when the November 16 transaction comes in, the client updates the principal amount in the database record for the open short position.

My point was that, if you have the client handle the partial cover transaction by updating its database record using the algorithm I described, you'll cause the existing logic to do exactly the right thing for any further operations on that short position (another partial cover, full cover, margin call, expiration).  Without requiring another column in the database.

[1] It actually doesn't even contain this much.  Basically the blockchain only contains the bare minimum information to tell the client how to update its database.  If the client can figure something out on its own from existing information, then that's what the client does.  It'd just be stupid and wasteful to use precious blockchain storage to store a copy of anything we could just have each client store locally.

In a little more detail:  From the answer vikram (one of the devs) gave to one of my questions this forum, BTSX does something called "virtual transactions."  Basically whenever market orders are matched, the resulting transaction is generated locally by the client and never exists on the blockchain itself.  So you'd have blockchain transactions for Alice entering the short order, and Bob entering the bid order.  The matching between Alice's and Bob's order wouldn't show up on the blockchain.  Instead, the client would figure out that the prices overlap, triggering the "virtual transaction" logic which is basically bunch of different database updates showing that Alice now has an active short position, Alice and Bob's BTSX has moved from their orders into the short position's collateral, Bob now has some newly printed BitUSD, and both of the orders are now gone (or maybe just one is gone if the quantity was unequal and one side got a partial fill).  The database updates caused by virtual transactions are only visible on the blockchain insofar as they affect what transactions are accepted in future blocks, i.e. if Bob tries to send BitUSD to Caitlin, it will now be accepted because every client will have performed the database update and every client's database will show that Bob has enough BitUSD (because of the update that happened when his bid overlapped Alice's short).  Whereas before the match, it might have failed because Bob would have had a smaller (maybe zero) BitUSD balance.

Of course there's also logic for fees, partial fills, yield, and lots of rounding going on.  Oh, and this also all has to be undoable to deal with forks, which can happen if a delegate is so late producing a block that the next delegate produces its own block, having decided that the first delegate is offline (but the first delegate did produce a block because it didn't get notified in time that the second delegate had produced a block).

In addition, the production BTSX client has to keep a copy of all previous versions of the market logic to figure out the database from blocks that happened before the current rules came into effect.  (On testnet, they just reset everything to the genesis state when they change the market engine, because testnet XTS / BitAssets are just "play money" and we don't care about resetting their ownership.)

Knowing about all of the machinery that has to exist, explains why I tend to be so patient and understanding when there are frequent updates to deal with various bugs :)

279
General Discussion / Re: The Future of the BTSX Market Engine...
« on: October 03, 2014, 01:50:23 am »
I also think it is unnecessary to complicate the calculations to implement continuous compounding interest for the shorts.

You, me and bytemaster are all agreed that linear interest is preferred to exponential continuously compounding interest.  I just have a different reason for reaching the same conclusion.

I want to eventually implement interest from shorts being paid immediately to longs (via the yield fund), rather than waiting for shorts to close their positions.  With linear interest it should be fairly simple to do, since the network income from short interest would occur at a constant per-block rate that only changes when a short opens, closes or partially covers.  With continuous compounding interest, this immediate-payment feature is likely technically impossible (given practical engineering constraints).  For me, the potential to implement the immediate-payment feature is what really tips the scales in favor of linear interest.

I agree that linear interest computations are slightly simpler to implement, and linear interest is also the approach taken by current (or planned) code.  While certainly valid points, these arguments wouldn't quite be enough to tip the scales for me.  But they're a nice bonus when the potential for the immediate-payment feature has already tipped the scales in favor of linear interest :)

280
General Discussion / Re: The Future of the BTSX Market Engine...
« on: October 03, 2014, 01:08:40 am »
I am aware the issue and know that it does cost extra for partial covering.   You end up paying interest on your interest.... result: partial covering has fees associated with it that are magnified by the insane interest rate used in the example. 

The challenge is calculating the result without adding yet another data field to every order... to track the start date and end date. 

I suppose I might as well store extra data rather than using a crude approximation.

I thought about this issue some more.  I think you can solve it by just figuring out what part of the payment goes to principal, and updating the initial principal.

Consider our example, where $100 short has an interest rate of 10% / month and the user covers with $52.50 at 15 days.

We said that a full cover would be $105 at 15 days, $100 principal and $5 interest.  The partial cover payment goes to principal and interest in the same 100 : 5 proportion.  A $52.50 payment would pay $50 to principal and $2.50 to interest.  (A $50 payment would pay $47.62 to principal and $2.38 to interest.)  So if the user pays $52.50, just update the initial principal to $50.  In other words, you just replace the record that says they took out a $100 short at 10% interest 15 days ago, with a "back-dated" record that says they took out a $50 short at 10% interest 15 days ago.

Then they would need $52.50 to do a full cover right now, so the numbers are right for doing a partial cover quickly followed by a full cover.  In 30 days they'll need $55 to do a full cover, and linearly in between.  The back-dated record is an accounting fiction which happens to make the numbers come out exactly right without needing another database field.

281
General Discussion / Re: The Future of the BTSX Market Engine...
« on: October 02, 2014, 10:27:00 pm »

Let's walk through the bookkeeping of a partial cover with continuous compounding.  Basically you compute f(t), subtract the payment amount, re-figure the initial principal based on the new amount, and treat it the same as you'd treat a loan with that re-figured initial principal.  Let's imagine the user pays $52.50 on $100 at 10% monthly rate at 15 days, just like before.

- (1.10)^(0.5 months) = 1.048809 (always round up), so $104.8809 is the balance at 15 days.
- Subtract the $52.50 payment, you now have $52.3809 left.
- Solve for what the initial principal would have been on a loan with a current balance of $52.3809 at 15 days left ("implied initial principal").
- You get 52.3809 / 1.048808 (always round down here), giving $49.9433 (rounded up) as the implied initial principal.
- Now compound $49.9433 at 1.10 to get the new value of interest due at maturity (basically we un-counted the first 15 days when we did the implied initial principal computation, so we have to re-count it by doing the whole month).
- $4.9944 interest (always round up) + $49.9433 gives a total of $54.9377 due at maturity.  The collateral ratio and margin call price would then be calculated using $54.9377.
- $54.9377 + $52.50 = $107.4377 total repayment.

Of course, to do this bookkeeping, you have to compute f(t) for fractional t.  Which is non-trivial with integer arithmetic.  You can make it easier by having all computations internally use a per-block interest rate; per-month or APR is strictly for the convenience of using human-friendly units when displaying values to the user.  Using fixed-point arithmetic with 32-bit fractional part, per-block interest would have a resolution of under 0.08% APR.  Increasing to 48-bit fractional part gives APR resolution of about 1.1 millionths of a percentage point -- more than good enough.  With 64-bit values you have 16 bits before we overflow, if we ever exceed 100% in some computation.

You'd get some full 128-bit products in intermediate computations, but I think you mentioned in another thread you already have library functions for dealing with 128-bit values.

282
General Discussion / Re: The Future of the BTSX Market Engine...
« on: October 02, 2014, 10:26:46 pm »
I am aware the issue and know that it does cost extra for partial covering.   You end up paying interest on your interest.... result: partial covering has fees associated with it that are magnified by the insane interest rate used in the example. 

The challenge is calculating the result without adding yet another data field to every order... to track the start date and end date. 

I suppose I might as well store extra data rather than using a crude approximation.

If you do continuous compounding, then interest and principal dollars generate interest at the same rate and don't need to be tracked separately.  The amount payable is f(t) = initial_principal * (1+r)^t where t is the time in months and r=1.10 is the monthly rate.

Continuous compounding is technically doable.  I'll post an example of what the numbers would look like in another post.  I would actually recommend doing continuous compounding if the story ended there.  But there's more:  Linear compounding has one highly desirable feature that continuous compounding does not.  With linear interest, you can figure out per-block short interest income for the network as a whole:  Just keep track of the sum of the shorts' per-block interest!  We could (and I think we should) pay the interest income directly to the yield fund as it accrues, rather than waiting for shorts to close.

If you have a bunch of outstanding shorts using exponential compounding with different exponents and expiration dates, I think this immediate payment would be impossible for technical reasons [1] [2].

Therefore, my recommendation is to stick with linear compounding, and consider implementing paying the accrued interest to the yield fund immediately every block (not a super high priority, so we should probably testnet this first).

[1] It would theoretically be possible if we were willing to spend O(N) computation every block, where N is the number of shorts that exist.  We aren't willing to do that, as "not breaking the network" is a higher priority than "paying yield a little sooner" :)

[2] I don't think paying exact interest as it's accrued would be possible with exponential compounding, but you might be able to figure out some approximate lower bound that you only need to update when a short opens or covers.

283
General Discussion / Re: The Future of the BTSX Market Engine...
« on: October 02, 2014, 08:30:13 pm »
If you are paying 10% per month interest... and you are short $100 then you will owe $110 USD to reclaim your collateral after 30 days.
If after 15 days you wish to reclaim your collateral you will owe $105
If on day 15 you partially cover by paying $50 then the network will charge you $2.50 in interest and your balance will be $52.50 and on day 30 you will pay $52.50 + $5.25 to close your position either manually or by automatic margin call. 

There's something amiss with these numbers.  We need to track interest and principal separately, because interest dollars don't generate income, but principal dollars do.

- $100 initial principal generates $5 in interest over the first 15 days.
- $52.50 is used to pay down $50 in principal and $2.50 in interest at 15 days.
- $50 remaining principal has $2.50 interest remaining, and generates $2.50 in interest over the second 15 days.
- The balance at one month is now $50 principal plus $5.00 interest.
- The total interest paid should be $2.50 after 15 days, plus $5.00 after one month.

Your algorithm makes the partial cover operation cause interest dollars to start generating income, and that's why it charges greater interest [1] [2].  In other words, the interest doesn't compound if you let it sit, but a partial cover (in your algorithm) would be "manual compounding".

We don't want this, because it would dis-incentivize partial covering.  (Partial covering is desirable from a policy standpoint because it improves the collateral ratio and makes BitUSD more solid.)

[1] I think you meant $52.50 + $2.625 on the last day, otherwise you'd be double counting somewhere and charging a total of $10.25!

[2] Even if we go with $2.50 + $2.625 on the last day, we get $7.625 in interest with your algorithm.  The $0.125 is 5% of the $2.50 remaining interest after 15 days.

284

Excellent idea.  +5%

285
Now from what I remember you want the excess revenue to be given as additional interest via BitBonds. Why? What are the holders risking to get that kind of return by the way. What are we (the BTSX holders) getting out of them holding the BitBonds?  Just that they hold their BitAssets for a long period of time?

Yes.  I don't like having shorts compete on collateral.  But having them compete on collateral does help take care of the problem of unbalanced short supply / long-holder demand for BitUSD.

If demand is unbalanced, the price of BitBonds will fall until the yield is competitive with investors' projected return on BTSX.  So it achieves the policy goal of giving large amounts of capital something to do other than short BTSX.

Besides if they actually believe in the system and they already have more than enough wealth with price stability for the short-term and want higher returns over the medium to long period of time, then in my view they should hold BTSX (at least during the growth phase).

The problem is that everybody believes in the system so much that going long BTSX isn't sufficient for them, they want to short BitUSD and have effectively a leveraged bet on long BTSX.  If we offer no-reserve auction on BitUSD, we can balance the two sides.

My view is that the money raised from fees on the shorts should be used by the DAC for two purposes: one, used to provide a reasonable yield on BitCurrencies as a marketing strategy to get initial adoption; and two, sent to entities/individuals the shareholders think can grow the value of the DAC best (whether that is regular delegates, business delegates, or workers chosen by proposals ratified by shareholder vote) or alternatively burned as a dividend to shareholders if we are past the growth stage of the DAC.

We would already be making BitUSD and the like extremely attractive to hold with the 5% yield compared to dollars in outside banks. I think we can do smarter things with that extra revenue that would be going to BitBonds in your proposal.

I would support capping the yield on BitAssets to +5% and using the funds for something else.  I like the business delegates idea.

Pages: 1 ... 12 13 14 15 16 17 18 [19] 20 21 22 23 24 25 26 ... 34