BitShares Forum

Main => General Discussion => Topic started by: Jansky on December 08, 2015, 11:37:12 pm

Title: Leveraged Trade
Post by: Jansky on December 08, 2015, 11:37:12 pm
I like BTS 2.o :-)

is there a way to open a leveraged trade?  I really want bts to be Bitfinex lol, is there a plan to implement loans?
Title: Re: Leveraged Trade
Post by: carpet ride on December 08, 2015, 11:42:45 pm
Thanks for posting your feedback :)

I understand Cryptonomex is delivering margin trading in in the next few months.
Title: Re: Leveraged Trade
Post by: lil_jay890 on December 08, 2015, 11:51:38 pm
Thanks for posting your feedback :)

I understand Cryptonomex is delivering margin trading in in the next few months.

I follow these forums very closely and I have not heard that they will be delivering margin trading/bond market any time in the near future.

It sounds like stealth transactions are first and that isn't scheduled to be done until mid February
Title: Re: Leveraged Trade
Post by: carpet ride on December 09, 2015, 02:16:27 am
Thanks for posting your feedback :)

I understand Cryptonomex is delivering margin trading in in the next few months.

I follow these forums very closely and I have not heard that they will be delivering margin trading/bond market any time in the near future.

It sounds like stealth transactions are first and that isn't scheduled to be done until mid February

I'm going to default to your recollection then.  I must be remembering something that was said in a mumble session about polo-style margin trading being easy enough to implement.  good thing I can proxy my votes. ...
Title: Re: Leveraged Trade
Post by: Jansky on December 09, 2015, 11:25:13 pm
thanks
Thanks for posting your feedback :)

I understand Cryptonomex is delivering margin trading in in the next few months.

I follow these forums very closely and I have not heard that they will be delivering margin trading/bond market any time in the near future.

It sounds like stealth transactions are first and that isn't scheduled to be done until mid February


Thanks for the info.  I do think that implementing those features [capital market, leveraged trading] would help drive adoption substantially, and would be fairly straightforward to implement.  Bringing traders to the yard would be a good thing.  I for one would like to lend out my parked funds to traders for a yeild.  Also I'd really like to buy at the market and place stop orders (without writing scripts to do so)  any plans to implement this in the UI?
Title: Re: Leveraged Trade
Post by: eagleeye on December 10, 2015, 09:08:40 am
thanks
Thanks for posting your feedback :)

I understand Cryptonomex is delivering margin trading in in the next few months.

I follow these forums very closely and I have not heard that they will be delivering margin trading/bond market any time in the near future.

It sounds like stealth transactions are first and that isn't scheduled to be done until mid February


Thanks for the info.  I do think that implementing those features [capital market, leveraged trading] would help drive adoption substantially, and would be fairly straightforward to implement.  Bringing traders to the yard would be a good thing.  I for one would like to lend out my parked funds to traders for a yeild.  Also I'd really like to buy at the market and place stop orders (without writing scripts to do so)  any plans to implement this in the UI?

I agree with you.  Margin trading and a loan market are very important.
Title: Re: Leveraged Trade
Post by: theoretical on December 10, 2015, 04:13:26 pm
If you create an asset A and set the price feed of A to be a function F(x) of the price x of some other asset like

Code: [Select]
F(x) = x^n

then how many percent does F(x) move for a given percent movement of x?

Code: [Select]
log(F) = n*log(x)

So a d% gain in x will increase log(x) by log(d%) which will increase log(F) by n*log(d%), which is nearly log(n*d%) for small d, i.e. a 1% gain in X will lead to an approximately n% gain in F(x) -- and likewise a 1% loss will lead to an approximately n% fall in F(x):

Code: [Select]
log(F) = log(x) + log(1%)

Effectively A has the same gain/loss profile as borrowing money to invest in the underlying, then borrowing / repaying on the loan as needed to maintain the same leverage continuously as the price of underlying moves, without actually requiring any actual loan to take place.

There are a couple problems:


Having a way for the system to automatically compute these derived feeds was on my wishlist for Graphene, but nobody seemed to care much about implementing leverage this way.
Title: Re: Leveraged Trade
Post by: tonyk on December 11, 2015, 12:43:04 am
What is log (x)?  So, x is supposedly being the price.[leaving aside that this does not work with prices <=1]
what is log (d%)?


----
price = 5 ; log (5) = 0.69897

1% increase; 1.01*5=5.05; log(5.05) = 0.70329

 log(5.05) / log (5) = 1.006180




I definitely got some part of this post wrong. Which one?
Title: Re: Leveraged Trade
Post by: xeroc on December 11, 2015, 09:28:27 am
x is the price of another token/asset ...
n is a parameter for your newly created "derivative" (literally)
F is the "derivative":

F = log(x^n) = n*log(x)

log can be of any base

Then, there is an approximation that states

n*log(x) = log(n*x)    // for small x

Let's say x_0 is the initial price, then we get

F(x_0) = n*log(x_0)

if the price moves by 1%, we get:   x_0*1.01 and the derivatives becomes

F(x_0*1.01) = n*log(x_0*1.01)  = (approximation)  log(n*x_0*1.01) = log(n*x_0) + log(1.01) = F(x_0) + log(1.01)  (!!! note the PLUS over here!!! )

Hence:
- log creates a non-linear mapping of x -> F(x)
- n is a scaling factor which allows for fine-tuning
Title: Re: Leveraged Trade
Post by: monsterer on December 11, 2015, 09:55:06 am
So I guess you guys are saying that if the feed price was scaled by, say 2 times, it's conceptually similar to having 2 x leverage, but not exactly in practice?
Title: Re: Leveraged Trade
Post by: tonyk on December 11, 2015, 12:14:27 pm
x is the price of another token/asset ...
n is a parameter for your newly created "derivative" (literally)
F is the "derivative":

F = log(x^n) = n*log(x)

log can be of any base

Then, there is an approximation that states

n*log(x) = log(n*x)    // for small x

Let's say x_0 is the initial price, then we get

F(x_0) = n*log(x_0)

if the price moves by 1%, we get:   x_0*1.01 and the derivatives becomes

F(x_0*1.01) = n*log(x_0*1.01)  = (approximation)  log(n*x_0*1.01) = log(n*x_0) + log(1.01) = F(x_0) + log(1.01)  (!!! note the PLUS over here!!! )

Hence:
- log creates a non-linear mapping of x -> F(x)
- n is a scaling factor which allows for fine-tuning

ohh you mean if n=2, this does not represent 2x leverage. For some reason I read it like that. Now  rereading it  really does not say so, and I came up with this on my own.
Thanks.
Title: Re: Leveraged Trade
Post by: Jansky on December 11, 2015, 01:09:16 pm
In my mind I thought that it could be implemented as a market for an interest rate on an asset borrowed for a certain amount of time(second, minute, hour, day, whatever) coupled with the ability to lock funds in protocol based on the loan contract.
Title: Re: Leveraged Trade
Post by: monsterer on December 11, 2015, 01:34:13 pm
In my mind I thought that it could be implemented as a market for an interest rate on an asset borrowed for a certain amount of time(second, minute, hour, day, whatever) coupled with the ability to lock funds in protocol based on the loan contract.

Indeed this is the more correct way to do it. I think they are just discussing how to achieve a similar effect very quickly.