Major bitshares_toolkit flaw that needs to be solved.

Started by dxtr, October 06, 2014, 06:52:30 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

vikram

Quote from: vikram on October 11, 2014, 06:20:24 PM
Quote from: drltc on October 10, 2014, 10:34:46 PM
Quote from: monsterer on October 10, 2014, 10:22:07 PM
What is the reason for not storing the actual price in the market? Why not keep things simple and ignore flipped markets?

Then you have to decide which one is "natural" and which one is "flipped".

bytemaster says the "natural" market is BTSX priced in BitUSD, because US dollars are a relatively stable and familiar unit of value.

I say the "natural" market is BitUSD priced in BTSX, because BTSX is like "real money" (a limited-issue token) and BitUSD is some kind of derivative contract.

Letting each investor have their own preferences is a compromise between these viewpoints.

The "natural" markets are the ones where x = asset_id(X) and y = asset_id(Y) such that x < y and thus X (e.g. BTSX) is priced in Y (e.g. USD). Everything in the backend is handled this way.

This is why USD has the highest asset id of all genesis assets, so that all other genesis assets can be priced in USD. New assets that are added to BTSX cannot be priced in USD in the backend.

The "flipped" markets are a hack we display only in the GUI, and are subject to the inversion issue:

Quote from: monsterer on October 10, 2014, 09:24:29 PM
Quote from: bytemaster on October 06, 2014, 02:39:07 PM
Prices are represented as 128 bit. 64.64 fixed point.

The problem is not the representation, but the model.

Price is stored as a ratio, which means you will always have problems like this:

ratio = 1.0001
1 / ratio = 0.99990000999900009999000099990000 recurring - this cannot be stored accurately no matter the precision.

User confusion due to likely this same inversion problem: https://bitsharestalk.org/index.php?topic=8935.msg131390#msg131390

vikram

Quote from: drltc on October 10, 2014, 10:34:46 PM
Quote from: monsterer on October 10, 2014, 10:22:07 PM
What is the reason for not storing the actual price in the market? Why not keep things simple and ignore flipped markets?

Then you have to decide which one is "natural" and which one is "flipped".

bytemaster says the "natural" market is BTSX priced in BitUSD, because US dollars are a relatively stable and familiar unit of value.

I say the "natural" market is BitUSD priced in BTSX, because BTSX is like "real money" (a limited-issue token) and BitUSD is some kind of derivative contract.

Letting each investor have their own preferences is a compromise between these viewpoints.

The "natural" markets are the ones where x = asset_id(X) and y = asset_id(Y) such that x < y and thus X (e.g. BTSX) is priced in Y (e.g. USD). Everything in the backend is handled this way.

This is why USD has the highest asset id of all genesis assets, so that all other genesis assets can be priced in USD. New assets that are added to BTSX cannot be priced in USD in the backend.

The "flipped" markets are a hack we display only in the GUI, and are subject to the inversion issue:

Quote from: monsterer on October 10, 2014, 09:24:29 PM
Quote from: bytemaster on October 06, 2014, 02:39:07 PM
Prices are represented as 128 bit. 64.64 fixed point.

The problem is not the representation, but the model.

Price is stored as a ratio, which means you will always have problems like this:

ratio = 1.0001
1 / ratio = 0.99990000999900009999000099990000 recurring - this cannot be stored accurately no matter the precision.

monsterer

Quote from: xeroc on October 11, 2014, 12:48:43 PM
yes .. but user experience will also suffer

Consider an outside investor from the world of Forex. They're used to using metaquotes, you can't flip the markets, you just have to go with what each broker has listed.

Now consider an outsider from the world of crypto - same story.

In fact, flipped markets is a feature novel to bitshares, isn't it? So the only people who might miss the feature are existing users?

Cheers, Paul.
My opinions do not represent those of metaexchange unless explicitly stated.
[url="https://metaexchange.info"]https://metaexchange.info[/url] | Bitcoin<->Altcoin exchange | Instant | Safe | Low spreads

xeroc

Quote from: monsterer on October 11, 2014, 12:13:26 PM
Quote from: bytemaster on October 11, 2014, 10:40:13 AM
Try to store and sort an order book in two different orientations and the problem is not trivial.

I suggest ditching the flipped market. Then wont all the problems simply 'go away'?
yes .. but user experience will also suffer

monsterer

Quote from: bytemaster on October 11, 2014, 10:40:13 AM
Try to store and sort an order book in two different orientations and the problem is not trivial.

I suggest ditching the flipped market. Then wont all the problems simply 'go away'?
My opinions do not represent those of metaexchange unless explicitly stated.
[url="https://metaexchange.info"]https://metaexchange.info[/url] | Bitcoin<->Altcoin exchange | Instant | Safe | Low spreads

bytemaster

Try to store and sort an order book in two different orientations and the problem is not trivial.

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

monsterer

Quote from: drltc on October 10, 2014, 10:34:46 PM
Then you have to decide which one is "natural" and which one is "flipped".

bytemaster says the "natural" market is BTSX priced in BitUSD, because US dollars are a relatively stable and familiar unit of value.

I say the "natural" market is BitUSD priced in BTSX, because BTSX is like "real money" (a limited-issue token) and BitUSD is some kind of derivative contract.

Letting each investor have their own preferences is a compromise between these viewpoints.

And that is literally the only reason for storing a ratio? Pretty *major* compromise for something so trivial.

What happens, if when down the line BTSX is valued as much as BTC you're talking about rounding off quite large sums as fees?

IMO, it looks like a bug. If you need to install confidence in the platform and attract institutional investors and big money, things like this will put them off.

Cheers, Paul.

My opinions do not represent those of metaexchange unless explicitly stated.
[url="https://metaexchange.info"]https://metaexchange.info[/url] | Bitcoin<->Altcoin exchange | Instant | Safe | Low spreads


jamesc


biophil

Quote from: monsterer on October 10, 2014, 09:41:00 PM
Quote from: Riverhead on October 10, 2014, 09:27:26 PM
Can you just floor or ceiling the irrational?

You can try to round it, but really this is a patch not a fix.

I think rounding errors are considered "fees." So they're kind of good.

Sent from my SCH-S720C using Tapatalk 2

Support our research efforts to improve BitAsset price-pegging! Vote for worker 1.14.204 "201907-uccs-research-project."

theoretical

Quote from: monsterer on October 10, 2014, 10:22:07 PM
What is the reason for not storing the actual price in the market? Why not keep things simple and ignore flipped markets?

Then you have to decide which one is "natural" and which one is "flipped".

bytemaster says the "natural" market is BTSX priced in BitUSD, because US dollars are a relatively stable and familiar unit of value.

I say the "natural" market is BitUSD priced in BTSX, because BTSX is like "real money" (a limited-issue token) and BitUSD is some kind of derivative contract.

Letting each investor have their own preferences is a compromise between these viewpoints.
BTS- theoretical / PTS- PZxpdC8RqWsdU3pVJeobZY7JFKVPfNpy5z / BTC- 1NfGejohzoVGffAD1CnCRgo9vApjCU2viY / the delegate formerly known as drltc / Nothing said on these forums is intended to be legally binding / All opinions are my own unless otherwise noted / Take action due to my posts at your own risk

monsterer

Quote from: xeroc on October 10, 2014, 09:43:04 PM
I am not a CS expert ... but IMHO there just is no fix .. it's a issue of double<->float<->integer in combination with the inverse 1/x

What is the reason for not storing the actual price in the market? Why not keep things simple and ignore flipped markets?
My opinions do not represent those of metaexchange unless explicitly stated.
[url="https://metaexchange.info"]https://metaexchange.info[/url] | Bitcoin<->Altcoin exchange | Instant | Safe | Low spreads

xeroc

Quote from: monsterer on October 10, 2014, 09:41:00 PM
You can try to round it, but really this is a patch not a fix.
I am not a CS expert ... but IMHO there just is no fix .. it's a issue of double<->float<->integer in combination with the inverse 1/x

monsterer

Quote from: Riverhead on October 10, 2014, 09:27:26 PM
Can you just floor or ceiling the irrational?

You can try to round it, but really this is a patch not a fix.
My opinions do not represent those of metaexchange unless explicitly stated.
[url="https://metaexchange.info"]https://metaexchange.info[/url] | Bitcoin<->Altcoin exchange | Instant | Safe | Low spreads

xeroc

Quote from: Riverhead on October 10, 2014, 09:27:26 PM
Can you just floor or ceiling the irrational?
I think thats not so easy .. legally ... financial software is not supposed to round