Bitshares: Margin Trading and Swap contracts on the DEX discussion

Bitshares is the longest running decentralised cryptocurrency exchange and one of the pioneers of collateralised stablecoins. The Bitshares DEX provides a sophisticated set of trading tools already but through this article I hope to be able to add to the discussion on adding one key component which I think would very much benefit the ecosystem- Trading on Margin via an active P2P lending market.

Summary TLDR

  • A lending market (ala Bitfinex style) on Bitshares will provide passive income to holders of Smartcoins like BitCNY and BitUSD at a market set interest rate.
  • Increased lending will incentivise a growth in supply of Smartcoins.
  • Increased collateralisation of Smartcoins will increase demand (and price) of Bitshares.
  • Trading on margin will now be available to all Bitshares DEX users increasing volumes
  • Execution of the P2P swap logic on a DEX is fundamentally better than a CEX as it removes the trusted counterparty- a big risk for traders.
  • Swap logic can be separate to existing smartcoin collateralisation logic making it simpler than looking at other options for passive income requiring changes to the underlying Smartcoin settlement mechanisms in bitshares.
  • All swaps are collateralized and accounted for onchain ensuring optimal transparency.
  • This is not something that is beyond the scope of Bitshares capability and on the contrary I think Bitshares is the best suited Blockchain for this due to the speed, scalability and access to stablecoins.

History

The concept I am discussing today can be called ‘P2P Swap Contracts’, ‘Margin trading and lending’ or ‘CFDs’, terms which I may use interchangeably but essentially I am referring to the concept in operation currently on Bitfinex here. Margin trading is an important addition to efficiently functioning markets.

Mechanism

What I would propose consists of the following constituent parts:

  • Separate Trading at Margin wallet balance
  • A ‘Trade at Margin’ order logic
  • On chain settlement logic

Separate Trading at Margin Wallet

When someone wants to trade at margin, they need to take an Ask from the lending orderbook and apply that directly to the trade on which they’re about to open. Bitfinex ensures that margin trade orders are not commingled with non-margin orders by separating these functions into separate wallets. This ensures that any margin calls will be enacted upon the open orders in the Trading at Margin wallet only and not affect other balances. It is also important that the user cannot get a margin loan then extract the funds and abscond with the money, having a separate wallet ensures that any funding received can only be used to trade on the nominated markets and it can only be used to undertake a few functions (buy and sell limit orders and not withdraws).

Trade at Margin logic

The user should have the option to trade at margin on a given currency pair, for example bitUSD/BTS. In order to do this they need some collateral to ensure that they can cover interest repayments and should the value of their portfolio drop by a certain margin (in Bitfinex this is approximately 15%) then they will be liquidated and lose their collateral while the lender is repaid in full. A full example explanation is provided by Bitfinex here:

On Chain Settlement Logic

In the event of a margin call, if the users balance drops below a certain threshold, the blockchain will sell the users active order in market and return 100% of the funds to the lender with any remaining funds being returned to the margin account of the user. This mechanism is the same for either long or short margin positions (in the case of a short you are taking from the Bid on the Lending orderbook).

Effect on the DEX

The addition of this functionality in my opinion will massively add to liquidity, volume, smartcoin supply and increase positive price pressure on the BTS token.

Next steps

The purpose of this post is to generate discussion in the bitshares community on the feasibility of this endeavor and the technical requirements and changes that may be required to support it. Firstly we need to engage the community and secondly it would be great to get input from the Core team on what may be required to make this a BSIP and a reality for Bitshares. Looking forward to hearing the feedback.

TechnoKing Step.finance