BitShares Forum

Main => General Discussion => Topic started by: bytemaster on September 04, 2014, 05:00:24 pm

Title: The Market Peg Works!
Post by: bytemaster on September 04, 2014, 05:00:24 pm
Markets have been trading for almost 2 weeks and despite a buggy client and difficult to use interface and low liquidity, BitUSD has held up and is highly correlated to the BTSX / USD market moves.   Recent changes that have been made will provide further assurance that the PEG will hold and as the market gains confidence in this fact liquidity will slowly rise and spreads will narrow.

I wanted to take an opportunity to discuss how the market rules are implemented and why I am confident that they will be sufficient.   

First I will summarize the rules for BitAsset markets assuming the BTSX : USD market where BTSX is priced in terms of USD.  For the purpose of providing concrete examples, we will assume a median price of $0.03 per BTSX.

1) 51 delegates or more must publish a price feed at least once per day
     - if they do not publish the feed, then the market reverts to a 1hr moving average.
     - if a feed is published, the 1hr moving average is set to the feed.
2) No short orders can be published to the network at a price 11% above the 1 hour moving average. (ie: they must be less than 0.0333)
     - the minimal short quantity is 100 BTSX
3) Short orders will only be matched against asks that are below the moving average. (ie: people must be selling BTSX for less than $0.03)
     - the highest short order is matched first, so a short selling USD at $0.03333 will be matched against someone buying USD at $.02999 and the difference (0.003333) * volume is captured as a fee.
4) A margin call will be executed any time the highest bid is greater than 90% of the moving average and the highest bid is less than the call price.
    - the initial call price is 66% of the short price (ie: $0.022 for a short entered at $.033).  This is the price at which 75% of the collateral would be required to buy back the USD necessary to cover the position.
    - If a margin call is executed and there is any collateral left over, then 5% is kept as network fees and 95% is returned to the owner. 
5) There are no restrictions on what prices people can set for normal BitUSD/BTSX trading.  All parties will receive what they ask for.
6) Rounding errors are inevitable when using fixed point math, any such rounding error is deemed to be a network fee.
    - for example you may place an order to buy $1.00 USD but end up with $0.99999 USD. 
7) The network saves all fees earned in USD and in the event that a short position lacks the necessary collateral to cover during rapid market movements, then the network will provide the stored USD.
8) You cannot use the collateral of your short position to buy the USD necessary to cover the position.  This USD must be purchased separately. 
    - This requirement creates a kind of "virtual collateral" that all shorts must maintain so they can cover for either profit taking or loss prevention.
9) When you partially cover a position it will reduce your exposure, but your collateral is not returned until the position is fully covered. 

So our original goal for BitShares X was to enable the creation of "market pegged" assets that do not rely on an IOU to maintain their purchasing power.  We had hopped that no feeds would be necessary, but that hope will have to wait for a future day when the BitAsset markets mature and have enough liquidity to set prices on their own.   In the mean time we have to use price feeds, so I would like to discuss what this means for the peg.

Prices feeds are considered undesirable because they are always "delayed" and potentially subject to manipulation.  They represent a kind of price fixing that generally hurts markets and prevents them from adapting to rapidly changing conditions.   With the way BitShares X uses price feeds however, most of these pitfalls are completely avoided.   The price feed is used for exactly two purposes: limit when new shorts can execute and limit when margin calls can happen.  The feed provides no restrictions whatsoever on how BitUSD vs BTSX can trade which means that BitUSD vs BTSX is a fully free market that is able to respond instantly and honestly to all market conditions.  Once the market grows large enough the volume of straight BitUSD to BTSX trades will be able to provide enough liquidity that restrictions on the shorts will have little impact on the price discovery. 

When it comes to margin calls, it is still subject to market fluctuations within 10% of the price feed and thus at best the price feed can delay a margin call slightly in extreme volatility.  Under normal market conditions where the volatility is less than -10% of the price feed we can safely claim that margin calls are also market-based and not artificial.

At the end of the day the price feed prevents BitUSD from ever being shorted to 0 and prevents market manipulators from seizing collateral.  It will have very little influence once the market matures and thus market participants are mostly trusting the market rather than the feed producers.

There is only one "edge-case" risk that needs to be noted:  if 51% of the feed producing delegates collude to publish a very high price feed *AND* they have sufficient BTSX they could end up shorting more BitUSD than the market can currently support.  The result will be BitUSD temporarily trading below a dollar.  The other risk is for delegates to collude and publish a lower feed and then using significant capital to buy up the order book and trigger fake margin calls.    Both of these "attacks" require large amounts of capital and a large amount of collusion.   They would hurt BTSX value and thus these delegates would likely be voted out very quickly and accurate price feeds restored.   In both cases the attacker would likely lose more money than they could make, especially if they attempted to short BitUSD while attacking the network.  Such an attacker would end up margin called when the network corrects.

Conclusion:  the market pegs are working and will get better! 


   


Title: Re: The Market Peg Works!
Post by: 38PTSWarrior on September 04, 2014, 05:17:58 pm
Very happy for you and your achievement (and everyone who worked for it)! You are true master of the bytes!
Title: Re: The Market Peg Works!
Post by: Riverhead on September 04, 2014, 05:21:35 pm
Very happy for you and your achievement (and everyone who worked for it)! You are true master of the bytes!


 +5%  Well said :)
Title: Re: The Market Peg Works!
Post by: soniq on September 04, 2014, 05:22:32 pm
Very happy for you and your achievement (and everyone who worked for it)! You are true master of the bytes!

hear, hear
Title: Re: The Market Peg Works!
Post by: GaltReport on September 04, 2014, 05:28:29 pm
 +5% Sounds like a plan!!
Title: Re: The Market Peg Works!
Post by: xeroc on September 04, 2014, 05:31:45 pm
Mabye we should emphazise that the feed really only affects shorts and margin calls

participants trading bitUSD back and forth can chose whatever price they want!!
Title: Re: The Market Peg Works!
Post by: GaltReport on September 04, 2014, 05:33:25 pm
Mabye we should emphazise that the feed really only affects shorts and margin calls

participants trading bitUSD back and forth can chose whatever price they want!!

Very good idea.
Title: Re: The Market Peg Works!
Post by: Riverhead on September 04, 2014, 05:39:12 pm
Mabye we should emphazise that the feed really only affects shorts and margin calls

participants trading bitUSD back and forth can chose whatever price they want!!


Indeed. Once there is sufficient liquidity with bitUSD the desire to short may decrease.
Title: Re: The Market Peg Works!
Post by: xeroc on September 04, 2014, 05:41:12 pm
Indeed. Once there is sufficient liquidity with bitUSD the desire to short may decrease.
depends on the definition of "sufficient"


Anyway .. we MUST ensure that people do not think that the market value is DERIVED from the feed ... because that is not true!!!
Title: Re: The Market Peg Works!
Post by: CalabiYau on September 04, 2014, 05:46:43 pm
Mabye we should emphazise that the feed really only affects shorts and margin calls

participants trading bitUSD back and forth can chose whatever price they want!!

Very good idea.

Makes sense to me  +5%
Title: Re: The Market Peg Works!
Post by: Riverhead on September 04, 2014, 05:52:37 pm
Indeed. Once there is sufficient liquidity with bitUSD the desire to short may decrease.
depends on the definition of "sufficient"

In this case it means that there is enough supply that people don't feel the need to short it into existence but can buy it on the open market.

Anyway .. we MUST ensure that people do not think that the market value is DERIVED from the feed ... because that is not true!!!


YES!!!  +5%
Title: Re: The Market Peg Works!
Post by: oco101 on September 04, 2014, 05:52:49 pm
Mabye we should emphazise that the feed really only affects shorts and margin calls

participants trading bitUSD back and forth can chose whatever price they want!!

Very good idea.

We should emphasize the market peg works this was the only unknown a few weeks ago. I could see that the peg was working but for some reason  that is not the impression that  we get right now from the forum. The whole system depended on it. It is absolutely amazing that it is working so smoothly. Please let the world know  the peg is working, now the sky is the limit  ;D

And yes I agree we should also  emphasize that the feed really only affects shorts and margin calls :)
Title: Re: The Market Peg Works!
Post by: xeroc on September 04, 2014, 05:58:07 pm
Give reddit some love:
http://www.reddit.com/r/BitShares/comments/2fgz3p/the_market_peg_works/

Maybe we can also bring this in r/CryptoCurrency or r/Bitcoin (probably not)
Title: Re: The Market Peg Works!
Post by: yellowecho on September 04, 2014, 06:05:31 pm
Is there a chart of bitUSD/USD available anywhere so we can see the correlation over time?  Also, what's the current correlation?  Has it reached parity?
Title: Re: The Market Peg Works!
Post by: bytemaster on September 04, 2014, 06:11:47 pm
Is there a chart of bitUSD/USD available anywhere so we can see the correlation over time?  Also, what's the current correlation?  Has it reached parity?

$0.0323   Bid   $0.0328 Ask

Coin market cap: $ 0.031793   

Discount: 3.1415%
Title: Re: The Market Peg Works!
Post by: ripplexiaoshan on September 04, 2014, 06:21:15 pm
Indeed, it's working, bitUSD is pegging USD much better than a few days ago.

However, it's at the cost of less transactions in the on-chain market. As we are aiming to build the decentralized market, is the current status sustainable?  Because currently it seems that internal market is pegging external market. 
 
Title: Re: The Market Peg Works!
Post by: tonyk on September 04, 2014, 06:42:17 pm
One the price feed - emphasize what they really are.

'Price feeds are the fastest, most accurate way to introduce into the system the information regarding the actual BTSX:USD price.'



Other than that, I would have written the OP as  BTSX being the currency and bitUSD the product/asset, but that is just me.

 +5%

[edit]  is there a command to see the black-swan reserve already or not yet?
Title: Re: The Market Peg Works!
Post by: bytemaster on September 04, 2014, 06:55:07 pm
One the price feed - emphasize what they really are.

'Price feeds are the fastest, most accurate way to introduce into the system the information regarding the actual BTSX:USD price.'



Other than that, I would have written the OP as  BTSX being the currency and bitUSD the product/asset, but that is just me.

 +5%

[edit]  is there a command to see the black-swan reserve already or not yet?

Code: [Select]
>> blockchain_get_asset USD
{
  "id": 22,
  "symbol": "USD",
  "name": "United States Dollar",
  "description": "1 United States dollar",
  "public_data": "",
  "issuer_account_id": -2,
  "precision": 10000,
  "registration_date": "20140719T000000",
  "last_update": "20140719T000000",
  "current_share_supply": 4852503572,
  "maximum_share_supply": 1000000000000000,
  "collected_fees": 17934081
}

$1793.4081 is the reserve fund at the moment. 
Title: Re: The Market Peg Works!
Post by: liondani on September 04, 2014, 07:01:29 pm
Goodbye USA banks officially!

(http://makeameme.org/media/created/This-is-Not-1bdt8k.jpg)
Title: Re: The Market Peg Works!
Post by: Method-X on September 04, 2014, 07:06:54 pm
My main takeaway from all of this has been that this experiment is like learning to ride a bike. At first you don’t have the confidence to give yourself  momentum. Instead, you learn with training wheels. Once you have confidence to give yourself momentum, the training wheels can be removed and you’ll never forget how to ride a bike.
Title: Re: The Market Peg Works!
Post by: bytemaster on September 04, 2014, 07:11:24 pm
My main takeaway from all of this has been that this experiment is like learning to ride a bike. At first you don’t have the confidence to give yourself  momentum. Instead, you learn with training wheels. Once you have confidence to give yourself momentum, the training wheels can be removed and you’ll never forget how to ride a bike.

+1
Title: Re: The Market Peg Works!
Post by: Riverhead on September 04, 2014, 07:25:33 pm
My main takeaway from all of this has been that this experiment is like learning to ride a bike. At first you don’t have the confidence to give yourself  momentum. Instead, you learn with training wheels. Once you have confidence to give yourself momentum, the training wheels can be removed and you’ll never forget how to ride a bike.


Agreed. If nothing else I have learned a TON of economics during this project.

Title: Re: The Market Peg Works!
Post by: oldman on September 04, 2014, 07:31:12 pm
My main takeaway from all of this has been that this experiment is like learning to ride a bike. At first you don’t have the confidence to give yourself  momentum. Instead, you learn with training wheels. Once you have confidence to give yourself momentum, the training wheels can be removed and you’ll never forget how to ride a bike.

 +5%
Title: Re: The Market Peg Works!
Post by: mf-tzo on September 04, 2014, 07:33:52 pm
of course it does. :)
Title: Re: The Market Peg Works!
Post by: Method-X on September 04, 2014, 07:34:22 pm
I posted this (http://nullstreet.com/bytemaster-proclaims-the-market-peg-works/) to reddit:

http://www.reddit.com/r/CryptoCurrency/comments/2fhcjt/bitsharesx_the_market_peg_works/

http://www.reddit.com/r/Bitcoin/comments/2fhe52/bitsharesx_the_market_peg_works/

http://www.reddit.com/r/BitShares/comments/2fhat7/bytemaster_proclaims_the_market_peg_works/

Upvote for visibility please.
Title: Re: The Market Peg Works!
Post by: bytemaster on September 04, 2014, 07:39:32 pm
(http://s2.quickmeme.com/img/67/6759ff044c6366116a82b8507ccecdd4480d40b0af18462342931a05622791dc.jpg)
Title: Re: The Market Peg Works!
Post by: svk on September 04, 2014, 09:06:00 pm
Great news :)

For some visual information about how this works, I've added shorts and the 90% rule for shorts to my asset pages, check it out:

http://bitsharesblocks.com/assets/asset?id=USD

Btw you can click on "Bid","Ask" or "Short" to enable or disable a given series, oh and I added the "reserve fund" info as well :)
Title: Re: The Market Peg Works!
Post by: Riverhead on September 04, 2014, 09:08:12 pm
Great news :)

For some visual information about how this works, I've added shorts and the 90% rule for shorts to my asset pages, check it out:

http://bitsharesblocks.com/assets/asset?id=USD

Btw you can click on "Bid","Ask" or "Short" to enable or disable a given series, oh and I added the "reserve fund" info as well :)
So awesome!! Looks great on my phone. Now I'll NEVER get any work done.
I'm not seeing any bids (black) on the graph...
Title: Re: The Market Peg Works!
Post by: svk on September 04, 2014, 09:26:31 pm
Great news :)

For some visual information about how this works, I've added shorts and the 90% rule for shorts to my asset pages, check it out:

http://bitsharesblocks.com/assets/asset?id=USD

Btw you can click on "Bid","Ask" or "Short" to enable or disable a given series, oh and I added the "reserve fund" info as well :)
So awesome!! Looks great on my phone. Now I'll NEVER get any work done.
I'm not seeing any bids (black) on the graph...

They should be there, but the depth of bids is only ~5k BTSX in the range I'm showing, so if Asks and Shorts are activated you'll have a hard time seeing the bids. Try disabling the asks and shorts, you should see the bids show up then. I just pushed a new version that includes the 11% upper range where shorts get accepted by the market, assuming I understood BM correctly..

If you have any more feedback on the plots we should probably move this conversation to my thread about the site itself..
Title: Re: The Market Peg Works!
Post by: liondani on September 04, 2014, 09:36:53 pm
Great news :)

For some visual information about how this works, I've added shorts and the 90% rule for shorts to my asset pages, check it out:

http://bitsharesblocks.com/assets/asset?id=USD

Btw you can click on "Bid","Ask" or "Short" to enable or disable a given series, oh and I added the "reserve fund" info as well :)

thanks for your efforts man!
Title: Re: The Market Peg Works!
Post by: bytemaster on September 04, 2014, 09:43:26 pm
Great news :)

For some visual information about how this works, I've added shorts and the 90% rule for shorts to my asset pages, check it out:

http://bitsharesblocks.com/assets/asset?id=USD

Btw you can click on "Bid","Ask" or "Short" to enable or disable a given series, oh and I added the "reserve fund" info as well :)

thanks for your efforts man!

Some suggestions: 
    remove the "point boxes" in the depth chart.
    display "shorts" as a 3rd volume on the depth chart that has "2 colors"... one for those over the median and one for those under.  We are adding this for the built in wallet.
    I would love to see a price history chart.   
Title: Re: The Market Peg Works!
Post by: Troglodactyl on September 04, 2014, 10:24:57 pm
...
     - the minimal short quantity is 100 BTSX
...

Thanks for the summary!

Why the 100 BTSX minimum?  Shouldn't the transaction fees take care of this?  Not a terribly big deal, but this is another arbitrary number to worry about updating when the value rises, and it's nice for newbies to be able to experiment on a micro scale.
Title: Re: The Market Peg Works!
Post by: bytemaster on September 04, 2014, 10:29:25 pm
...
     - the minimal short quantity is 100 BTSX
...

Thanks for the summary!

Why the 100 BTSX minimum?  Shouldn't the transaction fees take care of this?  Not a terribly big deal, but this is another arbitrary number to worry about updating when the value rises, and it's nice for newbies to be able to experiment on a micro scale.

Because shorts that are above the median get "processed" every block and skipped. 
Title: Re: The Market Peg Works!
Post by: jakub on September 04, 2014, 10:35:24 pm

First I will summarize the rules for BitAsset markets assuming the BTSX : USD market where BTSX is priced in terms of USD.  For the purpose of providing concrete examples, we will assume a median price of $0.03 per BTSX.

1) 51 delegates or more must publish a price feed at least once per day
     - if they do not publish the feed, then the market reverts to a 1hr moving average.
     - if a feed is published, the 1hr moving average is set to the feed.
2) No short orders can be published to the network at a price 11% above the 1 hour moving average. (ie: they must be less than 0.0333)
     - the minimal short quantity is 100 BTSX
3) Short orders will only be matched against asks that are below the moving average. (ie: people must be selling BTSX for less than $0.03)
     - the highest short order is matched first, so a short selling USD at $0.03333 will be matched against someone buying USD at $.02999 and the difference (0.003333) * volume is captured as a fee.
4) A margin call will be executed any time the highest bid is greater than 90% of the moving average and the highest bid is less than the call price.
    - the initial call price is 66% of the short price (ie: $0.022 for a short entered at $.033).  This is the price at which 75% of the collateral would be required to buy back the USD necessary to cover the position.
    - If a margin call is executed and there is any collateral left over, then 5% is kept as network fees and 95% is returned to the owner. 
5) There are no restrictions on what prices people can set for normal BitUSD/BTSX trading.  All parties will receive what they ask for.
6) Rounding errors are inevitable when using fixed point math, any such rounding error is deemed to be a network fee.
    - for example you may place an order to buy $1.00 USD but end up with $0.99999 USD. 
7) The network saves all fees earned in USD and in the event that a short position lacks the necessary collateral to cover during rapid market movements, then the network will provide the stored USD.
8) You cannot use the collateral of your short position to buy the USD necessary to cover the position.  This USD must be purchased separately. 
    - This requirement creates a kind of "virtual collateral" that all shorts must maintain so they can cover for either profit taking or loss prevention.
9) When you partially cover a position it will reduce your exposure, but your collateral is not returned until the position is fully covered. 


I fully agree with the new rules but I find it confusing when we talk about short orders while looking at the market of BTSX being priced in terms of USD. So I've made an attempt to translate the rules into USD/BTSX terms. Maybe some of you will find it useful. The changes are marked in bold. Please correct me if I made any mistakes.


The rules for BitAsset markets assuming the USD/BTSX market where USD is priced in terms of BTSX.  For the purpose of providing concrete examples, we will assume a median price of BTSX 30 per USD.

1.) 51 delegates or more must publish a price feed at least once per day
     - if they do not publish the feed, then the market reverts to a 1hr moving average.
     - if a feed is published, the 1hr moving average is set to the feed.

2.) No short orders can be published to the network at a price below 90% of the 1 hour moving average. (ie: they must be more than BTSX 27.00)
     - the minimal short quantity is 100 BTSX

3.) Short orders will only be matched against bids that are above the moving average. (ie: people must be buying USD for more than BTSX 30.00)
     - the lowest short order is matched first, so a short selling USD at BTSX 27.01 will be matched against someone buying USD at BTSX 30.01 and the difference (BTSX 3.00) * volume is captured as a fee.

4.) A margin call will be executed any time the lowest ask is less than 110% of the moving average and the lowest ask is more than the call price.
    - the initial call price is 150% of the short price (ie: BTSX 45.00 for a short entered at BTSX 30.00).  This is the price at which 75% of the collateral would be required to buy back the USD necessary to cover the position.
    - If a margin call is executed and there is any collateral left over, then 5% is kept as network fees and 95% is returned to the owner. 

5.) There are no restrictions on what prices people can set for normal BitUSD/BTSX trading.  All parties will receive what they ask for.

6.) Rounding errors are inevitable when using fixed point math, any such rounding error is deemed to be a network fee.
    - for example you may place an order to buy $1.00 USD but end up with $0.99999 USD. 

7.) The network saves all fees earned in BTSX and in the event that a short position lacks the necessary collateral to cover during rapid market movements, then the network will provide the stored BTSX.

8.) You cannot use the collateral of your short position to buy the USD necessary to cover the position.  This USD must be purchased separately. 
    - This requirement creates a kind of "virtual collateral" that all shorts must maintain so they can cover for either profit taking or loss prevention.

9.) When you partially cover a position it will reduce your exposure, but your collateral is not returned until the position is fully covered. 
Title: Re: The Market Peg Works!
Post by: svk on September 04, 2014, 11:05:58 pm
Great news :)

For some visual information about how this works, I've added shorts and the 90% rule for shorts to my asset pages, check it out:

http://bitsharesblocks.com/assets/asset?id=USD

Btw you can click on "Bid","Ask" or "Short" to enable or disable a given series, oh and I added the "reserve fund" info as well :)

thanks for your efforts man!

Some suggestions: 
    remove the "point boxes" in the depth chart.
    display "shorts" as a 3rd volume on the depth chart that has "2 colors"... one for those over the median and one for those under.  We are adding this for the built in wallet.
    I would love to see a price history chart.   

1 and 3 done! Splitting the shorts will have to wait, but you'll find the price history below the market depth info! I used the hourly data only for now, looks like it's good enough.

That asset page is starting to get a little messy now however, will have to clean things up a bit next, but going to bed for now.
Title: Re: The Market Peg Works!
Post by: James212 on September 04, 2014, 11:12:20 pm
My main takeaway from all of this has been that this experiment is like learning to ride a bike. At first you don’t have the confidence to give yourself  momentum. Instead, you learn with training wheels. Once you have confidence to give yourself momentum, the training wheels can be removed and you’ll never forget how to ride a bike.

 +5%
Title: Re: The Market Peg Works!
Post by: biophil on September 04, 2014, 11:37:16 pm
Great news :)

For some visual information about how this works, I've added shorts and the 90% rule for shorts to my asset pages, check it out:

http://bitsharesblocks.com/assets/asset?id=USD

Btw you can click on "Bid","Ask" or "Short" to enable or disable a given series, oh and I added the "reserve fund" info as well :)

thanks for your efforts man!

Some suggestions: 
    remove the "point boxes" in the depth chart.
    display "shorts" as a 3rd volume on the depth chart that has "2 colors"... one for those over the median and one for those under.  We are adding this for the built in wallet.
    I would love to see a price history chart.   

1 and 3 done! Splitting the shorts will have to wait, but you'll find the price history below the market depth info! I used the hourly data only for now, looks like it's good enough.

That asset page is starting to get a little messy now however, will have to clean things up a bit next, but going to bed for now.

Looking great! this will be fantastic for on-the-fly peg checking :) Could you also put the option of overlaying the real-world USD/BTSX price on the graph so that we can see how close the peg is holding? Or, putting a USD/BitUSD chart might be even better.
Title: Re: The Market Peg Works!
Post by: liondani on September 04, 2014, 11:44:15 pm
Could you also put the option of overlaying the real-world USD/BTSX price on the graph so that we can see how close the peg is holding? Or, putting a USD/BitUSD chart might be even better.

 +5%
Title: Re: The Market Peg Works!
Post by: starspirit on September 05, 2014, 01:43:38 am

First I will summarize the rules for BitAsset markets assuming the BTSX : USD market where BTSX is priced in terms of USD.  For the purpose of providing concrete examples, we will assume a median price of $0.03 per BTSX.

1) 51 delegates or more must publish a price feed at least once per day
     - if they do not publish the feed, then the market reverts to a 1hr moving average.
     - if a feed is published, the 1hr moving average is set to the feed.
2) No short orders can be published to the network at a price 11% above the 1 hour moving average. (ie: they must be less than 0.0333)
     - the minimal short quantity is 100 BTSX
3) Short orders will only be matched against asks that are below the moving average. (ie: people must be selling BTSX for less than $0.03)
     - the highest short order is matched first, so a short selling USD at $0.03333 will be matched against someone buying USD at $.02999 and the difference (0.003333) * volume is captured as a fee.
4) A margin call will be executed any time the highest bid is greater than 90% of the moving average and the highest bid is less than the call price.
    - the initial call price is 66% of the short price (ie: $0.022 for a short entered at $.033).  This is the price at which 75% of the collateral would be required to buy back the USD necessary to cover the position.
    - If a margin call is executed and there is any collateral left over, then 5% is kept as network fees and 95% is returned to the owner. 
5) There are no restrictions on what prices people can set for normal BitUSD/BTSX trading.  All parties will receive what they ask for.
6) Rounding errors are inevitable when using fixed point math, any such rounding error is deemed to be a network fee.
    - for example you may place an order to buy $1.00 USD but end up with $0.99999 USD. 
7) The network saves all fees earned in USD and in the event that a short position lacks the necessary collateral to cover during rapid market movements, then the network will provide the stored USD.
8) You cannot use the collateral of your short position to buy the USD necessary to cover the position.  This USD must be purchased separately. 
    - This requirement creates a kind of "virtual collateral" that all shorts must maintain so they can cover for either profit taking or loss prevention.
9) When you partially cover a position it will reduce your exposure, but your collateral is not returned until the position is fully covered. 


I fully agree with the new rules but I find it confusing when we talk about short orders while looking at the market of BTSX being priced in terms of USD. So I've made an attempt to translate the rules into USD/BTSX terms. Maybe some of you will find it useful. The changes are marked in bold. Please correct me if I made any mistakes.


The rules for BitAsset markets assuming the USD/BTSX market where USD is priced in terms of BTSX.  For the purpose of providing concrete examples, we will assume a median price of BTSX 30 per USD.

1.) 51 delegates or more must publish a price feed at least once per day
     - if they do not publish the feed, then the market reverts to a 1hr moving average.
     - if a feed is published, the 1hr moving average is set to the feed.

2.) No short orders can be published to the network at a price below 90% of the 1 hour moving average. (ie: they must be more than BTSX 27.00)
     - the minimal short quantity is 100 BTSX

3.) Short orders will only be matched against bids that are above the moving average. (ie: people must be buying USD for more than BTSX 30.00)
     - the lowest short order is matched first, so a short selling USD at BTSX 27.01 will be matched against someone buying USD at BTSX 30.01 and the difference (BTSX 3.00) * volume is captured as a fee.

4.) A margin call will be executed any time the lowest ask is less than 110% of the moving average and the lowest ask is more than the call price.
    - the initial call price is 150% of the short price (ie: BTSX 45.00 for a short entered at BTSX 30.00).  This is the price at which 75% of the collateral would be required to buy back the USD necessary to cover the position.
    - If a margin call is executed and there is any collateral left over, then 5% is kept as network fees and 95% is returned to the owner. 

5.) There are no restrictions on what prices people can set for normal BitUSD/BTSX trading.  All parties will receive what they ask for.

6.) Rounding errors are inevitable when using fixed point math, any such rounding error is deemed to be a network fee.
    - for example you may place an order to buy $1.00 USD but end up with $0.99999 USD. 

7.) The network saves all fees earned in BTSX and in the event that a short position lacks the necessary collateral to cover during rapid market movements, then the network will provide the stored BTSX.

8.) You cannot use the collateral of your short position to buy the USD necessary to cover the position.  This USD must be purchased separately. 
    - This requirement creates a kind of "virtual collateral" that all shorts must maintain so they can cover for either profit taking or loss prevention.

9.) When you partially cover a position it will reduce your exposure, but your collateral is not returned until the position is fully covered.

Brilliant, thanks for that. I had a hard time trying to reverse everything in my head as I read the original...
Title: Re: The Market Peg Works!
Post by: boombastic on September 05, 2014, 01:49:51 am


First I will summarize the rules for BitAsset markets assuming the BTSX : USD market where BTSX is priced in terms of USD.  For the purpose of providing concrete examples, we will assume a median price of $0.03 per BTSX.

1) 51 delegates or more must publish a price feed at least once per day
     - if they do not publish the feed, then the market reverts to a 1hr moving average.
     - if a feed is published, the 1hr moving average is set to the feed.
2) No short orders can be published to the network at a price 11% above the 1 hour moving average. (ie: they must be less than 0.0333)
     - the minimal short quantity is 100 BTSX
3) Short orders will only be matched against asks that are below the moving average. (ie: people must be selling BTSX for less than $0.03)
     - the highest short order is matched first, so a short selling USD at $0.03333 will be matched against someone buying USD at $.02999 and the difference (0.003333) * volume is captured as a fee.
4) A margin call will be executed any time the highest bid is greater than 90% of the moving average and the highest bid is less than the call price.
    - the initial call price is 66% of the short price (ie: $0.022 for a short entered at $.033).  This is the price at which 75% of the collateral would be required to buy back the USD necessary to cover the position.
    - If a margin call is executed and there is any collateral left over, then 5% is kept as network fees and 95% is returned to the owner. 
5) There are no restrictions on what prices people can set for normal BitUSD/BTSX trading.  All parties will receive what they ask for.
6) Rounding errors are inevitable when using fixed point math, any such rounding error is deemed to be a network fee.
    - for example you may place an order to buy $1.00 USD but end up with $0.99999 USD. 
7) The network saves all fees earned in USD and in the event that a short position lacks the necessary collateral to cover during rapid market movements, then the network will provide the stored USD.
8) You cannot use the collateral of your short position to buy the USD necessary to cover the position.  This USD must be purchased separately. 
    - This requirement creates a kind of "virtual collateral" that all shorts must maintain so they can cover for either profit taking or loss prevention.
9) When you partially cover a position it will reduce your exposure, but your collateral is not returned until the position is fully covered. 


I fully agree with the new rules but I find it confusing when we talk about short orders while looking at the market of BTSX being priced in terms of USD. So I've made an attempt to translate the rules into USD/BTSX terms. Maybe some of you will find it useful. The changes are marked in bold. Please correct me if I made any mistakes.


The rules for BitAsset markets assuming the USD/BTSX market where USD is priced in terms of BTSX.  For the purpose of providing concrete examples, we will assume a median price of BTSX 30 per USD.

1.) 51 delegates or more must publish a price feed at least once per day
     - if they do not publish the feed, then the market reverts to a 1hr moving average.
     - if a feed is published, the 1hr moving average is set to the feed.

2.) No short orders can be published to the network at a price below 90% of the 1 hour moving average. (ie: they must be more than BTSX 27.00)
     - the minimal short quantity is 100 BTSX

3.) Short orders will only be matched against bids that are above the moving average. (ie: people must be buying USD for more than BTSX 30.00)
     - the lowest short order is matched first, so a short selling USD at BTSX 27.01 will be matched against someone buying USD at BTSX 30.01 and the difference (BTSX 3.00) * volume is captured as a fee.

4.) A margin call will be executed any time the lowest ask is less than 110% of the moving average and the lowest ask is more than the call price.
    - the initial call price is 150% of the short price (ie: BTSX 45.00 for a short entered at BTSX 30.00).  This is the price at which 75% of the collateral would be required to buy back the USD necessary to cover the position.
    - If a margin call is executed and there is any collateral left over, then 5% is kept as network fees and 95% is returned to the owner. 

5.) There are no restrictions on what prices people can set for normal BitUSD/BTSX trading.  All parties will receive what they ask for.

6.) Rounding errors are inevitable when using fixed point math, any such rounding error is deemed to be a network fee.
    - for example you may place an order to buy $1.00 USD but end up with $0.99999 USD. 

7.) The network saves all fees earned in BTSX and in the event that a short position lacks the necessary collateral to cover during rapid market movements, then the network will provide the stored BTSX.

8.) You cannot use the collateral of your short position to buy the USD necessary to cover the position.  This USD must be purchased separately. 
    - This requirement creates a kind of "virtual collateral" that all shorts must maintain so they can cover for either profit taking or loss prevention.

9.) When you partially cover a position it will reduce your exposure, but your collateral is not returned until the position is fully covered.

+5%


Sent from my iPhone using Tapatalk
Title: Re: The Market Peg Works!
Post by: biophil on September 05, 2014, 02:29:46 am
+5% for jakub!

Sent from my SCH-S720C using Tapatalk 2

Title: Re: The Market Peg Works!
Post by: alt on September 05, 2014, 02:41:17 am

3) Short orders will only be matched against asks that are below the moving average. (ie: people must be selling BTSX for less than $0.03)
     - the highest short order is matched first, so a short selling USD at $0.03333 will be matched against someone buying USD at $.02999 and the difference (0.003333) * volume is captured as a fee.

with this rule, It seems like a mistake at the source code? I think should be  if( mtrx.ask_price > max_short_bid )
Code: [Select]
                       if( mtrx.ask_price <= max_short_bid )
                       {
                          // wlog( "skipping short ${x} < max_short_bid ${b}", ("x",mtrx.bid_price)("b", max_short_bid)  );
                          // TODO: cancel the short order...
                          _current_bid.reset();
                          continue;
                       }
Title: Re: The Market Peg Works!
Post by: Xeldal on September 05, 2014, 02:43:36 am
Thanks Jakub, that was helpful.

4) A margin call will be executed any time the highest bid is greater than 90% of the moving average

4.) A margin call will be executed any time the lowest ask is less than 110% of the moving average

I just spent the last 40 mins staring this one down. I couldn't make sense of it.  Tell me if I've understood.  This is so that a short volatile spike (manipulation) can't trigger the margin call?  It requires a sustain movement, where both conditions must be true?? 
Quote
the lowest ask is less than 110% of the moving average
AND
Quote
lowest ask is more than the call price.

If I've understood correctly:
How many hours would the ask have to be more than 110% of the average before the short runs out of collateral?
If you consistently gain 10.01% hour after hour.  The first condition is never true and margin doesn't get called, right?
Title: Re: The Market Peg Works!
Post by: jakub on September 05, 2014, 10:53:28 am
Thanks Jakub, that was helpful.

4) A margin call will be executed any time the highest bid is greater than 90% of the moving average

4.) A margin call will be executed any time the lowest ask is less than 110% of the moving average

I just spent the last 40 mins staring this one down. I couldn't make sense of it.  Tell me if I've understood.  This is so that a short volatile spike (manipulation) can't trigger the margin call?  It requires a sustain movement, where both conditions must be true?? 
Quote
the lowest ask is less than 110% of the moving average
AND
Quote
lowest ask is more than the call price.

If I've understood correctly:
How many hours would the ask have to be more than 110% of the average before the short runs out of collateral?
If you consistently gain 10.01% hour after hour.  The first condition is never true and margin doesn't get called, right?

I had the most doubts about rule #4 as well. It's possible I got it wrong as I do not fully understand BM's intentions regarding #4 so this one was translated 'mechanically'.
I guess we need BM to clarify what the intentions are in this case.
Title: Re: The Market Peg Works!
Post by: Markus on September 05, 2014, 11:34:10 am
I'll try to explain how I understand.
Quote
a) the lowest ask is less than 110% of the moving average
AND
Quote
b) lowest ask is more than the call price.

This is to prevent a margin call to be triggered if the spread widens but your call price is still a fair bit above the average trading price.

For example you shorted at 30 BTSX so your call price is 45 BTSX.
Now if the moving average of actual trades was 40 BTSX and the lowest ask went up to 50 BTSX the margin would not be triggered because condition a) is not fulfilled. The lowest ask can rise to these levels without trades actually occuring at that price.
Your margin would only be called if the moving average rose above 40.909 BTSX.

One thing to have clarified by BM: Is the initial margin really 66% (or flipped 150%)? My current experience trading with 0.4.12 is more like 75% (133%)
Title: Re: The Market Peg Works!
Post by: tonyk on September 05, 2014, 12:53:44 pm
Quote
4) A margin call will be executed any time the highest bid is greater than 90% of the moving average and the highest bid is less than the call price.
    - the initial call price is 66% of the short price (ie: $0.022 for a short entered at $.033).  This is the price at which 75% of the collateral would be required to buy back the USD necessary to cover the position.
    - If a margin call is executed and there is any collateral left over, then 5% is kept as network fees and 95% is returned to the owner.
 
4.) A margin call will be executed any time the lowest ask is less than 110% of the moving average and the lowest ask is more than the call price.
    - the initial call price is 150% of the short price (ie: BTSX 45.00 for a short entered at BTSX 30.00).  This is the price at which 75% of the collateral would be required to buy back the USD necessary to cover the position.
    - If a margin call is executed and there is any collateral left over, then 5% is kept as network fees and 95% is returned to the owner.   
@jakub, Markus, Xeldal, others if interested.

Here is how I read 4), even though I realize I am changing the content as written.
A margin call will be executed any time the
1.lowest ask is more than the call price.
2.highest bid is more than 90% of the moving average.
...
Reading it again I seem to not be correct.... It should be

2.lowes ask is less than 110% of the moving average.

in other words:

  110% of call price > forced cover price => call price

additionally the 110% are not from the cover price but from the moving average; so it can 'slowly grow to more than 110% if it is not filled right way. (or it can wait for reversal. Or can it???, maybe the system sells those bitUSD right away)

Clarification on BM's part will be appreciated.
Title: Re: The Market Peg Works!
Post by: bytemaster on September 05, 2014, 02:18:09 pm
To clarify the margin call restraint.. I admit it was confusing re-reading it myself:

0) The "call price" is the price in terms of USD where 75% of the collateral would be required to repay the loan. 
       - it can be calculated as  DEBT / (.75*collateral) and has units of $ per BTSX
1) A margin call is looking to buy USD from those wanting to sell USD and needs to get USD as cheaply as possible.
       - but it gets confusing because the market is "reversed" and thus it should be viewed as the
         margin call is looking to SELL BTSX for as much as possible.
2) If there is someone willing to buy BTSX at a price more than the call price then NO call is executed
       - in other words it would require less than 75% of the collateral to cover against that buy.

3) Suppose there were "no buyers of BTSX anywhere close to the median" because someone bought up the order book.  This would normally result in #2 triggering and an automatic margin call, *except* that we have a safety valve that is the moral equivalent of someone offering to buy BTSX at 90% of the median price feed.  This means the market is free to set the price and automatically issue margin calls within 10% of the feed, but that shorts are protected against manipulation.

Title: Re: The Market Peg Works!
Post by: jakub on September 05, 2014, 04:34:45 pm
To clarify the margin call restraint.. I admit it was confusing re-reading it myself:

0) The "call price" is the price in terms of USD where 75% of the collateral would be required to repay the loan. 
       - it can be calculated as  DEBT / (.75*collateral) and has units of $ per BTSX
1) A margin call is looking to buy USD from those wanting to sell USD and needs to get USD as cheaply as possible.
       - but it gets confusing because the market is "reversed" and thus it should be viewed as the
         margin call is looking to SELL BTSX for as much as possible.
2) If there is someone willing to buy BTSX at a price more than the call price then NO call is executed
       - in other words it would require less than 75% of the collateral to cover against that buy.

3) Suppose there were "no buyers of BTSX anywhere close to the median" because someone bought up the order book.  This would normally result in #2 triggering and an automatic margin call, *except* that we have a safety valve that is the moral equivalent of someone offering to buy BTSX at 90% of the median price feed.  This means the market is free to set the price and automatically issue margin calls within 10% of the feed, but that shorts are protected against manipulation.

I wonder why you prefer to look at the market in terms of BTSX being priced in USD and not the other way round?
Indeed that's the way BTSX is priced on external exchanges but on the internal exchange inside Bitshares X I think the other way is less confusing. Especially when we refer to those people who issue bitUSD as shorts.


4.) A margin call will be executed any time the lowest ask is less than 110% of the moving average and the lowest ask is more than the call price.

It seems this translation of rule #4 is correct, isn't it? (in the USD/BTSX perspective)
Title: Re: The Market Peg Works!
Post by: Xeldal on September 05, 2014, 06:17:56 pm
Quote from: jakub
I wonder why you prefer to look at the market in terms of BTSX being priced in USD and not the other way round?
+5% Its quite a mental workout flipping back and forth.  Its takes twice as long for me to figure things out because I'm never sure which way its trying to be said and often both sides are used.

Both work and mean the same thing obviously, its just few people, if any, think of shorting APPL in terms of going long USD or that their margin call will force them to sell their USD.  When I tell my brain "short=buy" or "margin call=sell" it returns "error".  Maybe that's just my own bugs.

so I would rewrite
Quote from: bytemaster
2) If there is someone willing to buy BTSX at a price more than the call price then NO call is executed
2)If there is someone willing to sell USD at a price less than the call price then NO call is executed

the following is confusing, possible mix of traditional and reverse terms. 'No buyer because of buying up the book' doesn't make sense.  should be selling down the book?
Quote from: bytemaster
3) Suppose there were "no buyers of BTSX anywhere close to the median" because someone bought up the order book.
or better, should it be:
Suppose there were "no sellers of USD anywhere close to the median" because someone bought up the order book.

Title: Re: The Market Peg Works!
Post by: bytemaster on September 05, 2014, 06:23:27 pm
Quote from: jakub
I wonder why you prefer to look at the market in terms of BTSX being priced in USD and not the other way round?
+5% Its quite a mental workout flipping back and forth.  Its takes twice as long for me to figure things out because I'm never sure which way its trying to be said and often both sides are used.

Both work and mean the same thing obviously, its just few people, if any, think of shorting APPL in terms of going long USD or that their margin call will force them to sell their USD.  When I tell my brain "short=buy" or "margin call=sell" it returns "error".  Maybe that's just my own bugs.

so I would rewrite
Quote from: bytemaster
2) If there is someone willing to buy BTSX at a price more than the call price then NO call is executed
2)If there is someone willing to sell USD at a price less than the call price then NO call is executed

the following is confusing, possible mix of traditional and reverse terms. 'No buyer because of buying up the book' doesn't make sense.  should be selling down the book?
Quote from: bytemaster
3) Suppose there were "no buyers of BTSX anywhere close to the median" because someone bought up the order book.
or better, should it be:
Suppose there were "no sellers of USD anywhere close to the median" because someone bought up the order book.

Please rewrite it in a way that is clear for all.
Title: Re: The Market Peg Works!
Post by: Xeldal on September 06, 2014, 01:38:29 am
To clarify the margin call restraint.. I admit it was confusing re-reading it myself:

0) The "call price" is the price in terms of USD where 75% of the collateral would be required to repay the loan. 
       - it can be calculated as  DEBT / (.75*collateral) and has units of $ per BTSX
1) A margin call is looking to buy USD from those wanting to sell USD and needs to get USD as cheaply as possible.
       - but it gets confusing because the market is "reversed" and thus it should be viewed as the
         margin call is looking to SELL BTSX for as much as possible.
2) If there is someone willing to buy BTSX at a price more than the call price then NO call is executed
       - in other words it would require less than 75% of the collateral to cover against that buy.

3) Suppose there were "no buyers of BTSX anywhere close to the median" because someone bought up the order book.  This would normally result in #2 triggering and an automatic margin call, *except* that we have a safety valve that is the moral equivalent of someone offering to buy BTSX at 90% of the median price feed.  This means the market is free to set the price and automatically issue margin calls within 10% of the feed, but that shorts are protected against manipulation.

Quote from: bytemaster
Please rewrite it in a way that is clear for all.
I think your explanation made perfect sense but if I were to rewrite it, this is what I would say.

#4 Short Margin Call:
-The Collateral on a short must maintain a value of at least 133% of what it would cost to repurchase the asset that was sold with the short.
-A Margin call is a forced cover on a short and is executed when both of the following 2 conditions are met.
  Condition1: The Collateral Value is less than the minimum 133% of what it would cost to repurchase the asset that was sold with the short.
  Condition2: The lowest price at which the asset can be repurchased to cover the short is within 10% of the moving average.

in the event that both these conditions are met, A margin call is executed. The short is automatically covered by repurchasing the asset on the market at the cheapest available prices.  If there is any collateral left after the margin call, 5% of the remaining collateral is collected as a fee and the rest is returned to the owner.

You can calculate the price at which a call will be executed with the following formula:

BTSX_Call_Price =  BTSX_Collateral / Asset_Amount_Shorted  / 1.33

______________________________
I still have a question of whether this is the best approach.  As Condition 2 can remain FALSE until there is not enough collateral to cover the short.
Title: Re: The Market Peg Works!
Post by: tonyk on September 06, 2014, 05:19:18 am
Xeldal's explanation above + the following additions/changes:

Condition2: The lowest price at which the asset can be repurchased to cover the short is within 10% of the moving average.


Condition2: The lowest price at which the asset can be repurchased to cover the short is up to 110% of the moving average.


4b. If all the collateral is used to repurchase the asset and the short position is still not fully covered, the uncovered (asset) amount is covered/provided by the system insurance fund.


? ? ? ? ?
Title: Re: The Market Peg Works!
Post by: bytemaster on September 06, 2014, 03:11:34 pm
Xeldal's explanation above + the following additions/changes:

Condition2: The lowest price at which the asset can be repurchased to cover the short is within 10% of the moving average.


Condition2: The lowest price at which the asset can be repurchased to cover the short is up to 110% of the moving average.


4b. If all the collateral is used to repurchase the asset and the short position is still not fully covered, the uncovered (asset) amount is covered/provided by the system insurance fund.


? ? ? ? ?

Insurance fund is no more... it will just mean that all the remaining BitUSD will have slightly less collateral "on average".    You can think of all BitUSD being backed by "all collateral".   If a few shorts run out of collateral then the USD is still circulating.  It will reduce the "interest" paid to USD holders until the extra BitUSD is made up from market activities.
Title: Re: The Market Peg Works!
Post by: tonyk on September 06, 2014, 03:23:21 pm
Xeldal's explanation above + the following additions/changes:

Condition2: The lowest price at which the asset can be repurchased to cover the short is within 10% of the moving average.


Condition2: The lowest price at which the asset can be repurchased to cover the short is up to 110% of the moving average.


4b. If all the collateral is used to repurchase the asset and the short position is still not fully covered, the uncovered (asset) amount is covered/provided by the system insurance fund.


? ? ? ? ?

Insurance fund is no more... it will just mean that all the remaining BitUSD will have slightly less collateral "on average".    You can think of all BitUSD being backed by "all collateral".   If a few shorts run out of collateral then the USD is still circulating.  It will reduce the "interest" paid to USD holders until the extra BitUSD is made up from market activities.
The last sentence suggest that in such cases, the position is still closed from the 'interest fund's' bitUSDs. Is this indeed the case, or the position is just closed (with no particular bitAssets being used) leading to slight reduction on overall/average collateralization?
Title: Re: The Market Peg Works!
Post by: bytemaster on September 06, 2014, 03:26:57 pm
The position is still closed from the 'interest fund's' bitUSDs..... if the interest fund is not sufficient then... The position is just closed (with no particular bitAssets being used) leading to slight reduction on overall/average collateralization?    Yes
Title: Re: The Market Peg Works!
Post by: arhag on September 06, 2014, 03:30:26 pm
Insurance fund is no more... it will just mean that all the remaining BitUSD will have slightly less collateral "on average".    You can think of all BitUSD being backed by "all collateral".   If a few shorts run out of collateral then the USD is still circulating.  It will reduce the "interest" paid to USD holders until the extra BitUSD is made up from market activities.

I disagree with your opinion that no insurance fund is necessary because of the rewards program. If a black swan event happens and there is temporarily not enough collateral to fully back the issued BitUSD, the market may respond by dropping the price of BitUSD below the peg until BitUSD fees eventually allow the BitUSD to be fully backed again. During this time, recent BitUSD buyers (who purchased before the black swan) will have had a sudden loss in their purchasing power (which is not great even if it is temporary). It would be smarter IMO for the DAC to have some reserves to immediately fix the collateral backing issue after a black swan event.

See further discussion of this here:
One other thing I didn't like in bytemaster's proposal was that he seemed to consider the interest to BitUSD as a substitute to the insurance fund. But someone who purchases some BitUSD right before a black swan event is still going to be damaged by it if they need to spend the money shortly afterward (the accumulated interest could only be considered a replacement of the lost value of BitUSD after some period of time of holding the BitUSD). So, I think it is important to keep a reasonable amount of BitUSD in an insurance fund (scaling with the amount of BitUSD issued).

But I don't like the way you say "reverse BitUSD destruction." I generally agree with the following idea:
Quote
A fund below its minimum capitalization level has first priority for income, and gradually takes a smaller fraction of the available income until it claims zero income at its maximum capitalization level. A fund above its maximum capitalization level will have negative income, actually paying its balance over time to one or both of the other funds until it is again at or below its maximum capitalization level.
But only applied to the insurance fund. I think that for each block a certain amount of BitUSD should be pulled out from that insurance fund to cover the interest added to all BitUSD balances during that block. That BitUSD is considered out of the possession of the DAC and cannot be reclaimed. If the fund levels in the insurance fund get too low, the interest rates should be lowered to build up the balance in the fund.