100 BitUSD to First Person to Publish a working Price Feed Script for Graphene

Started by bytemaster, September 10, 2015, 06:54:35 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

bytemaster

Quote from: xeroc on October 07, 2015, 04:08:31 PM
So @bytemaster, what else needs to be done for the price feed script to qualify for the bounty?

I think you have qualified.   In the test net your script published some prices with the wrong asset id.     We tightened the validation to catch those errors, but it appears Ben has not committed them yet.
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.


xeroc

So @bytemaster, what else needs to be done for the price feed script to qualify for the bounty?

abit

Quote from: xeroc on September 25, 2015, 08:15:51 AM
I know see what you mean.

This patch (https://github.com/xeroc/python-graphenelib/commit/421d9c04785b5ce3d70f77376485109f808133cd) will result in the following output:


            "core_exchange_rate": {
                "quote": {
                    "amount": 52,
                    "asset_id": "1.3.626"
                },
                "base": {
                    "amount": 92170,
                    "asset_id": "1.3.0"
                }
            }

would the numbers now fit you too?
Yes they are right.
Quote
BTW, I am using "fractions" to get a numerator and denominator instead of just using 10^x .. but in the end, they all represent the same ratio ..
Yes I saw it. But personally I like 10^x more because I don't need to take out a calculator to check the numbers ;D

Quote from: xeroc on September 25, 2015, 08:22:59 AM
Quote from: theoretical on September 24, 2015, 08:23:37 PM
Then you need to publish a feed.  If you did it today on the testnet, you'd use the publish_asset_feed command.  But soon (as in I'm working on it right now) there will be a much better command for this (publish_asset_feed requires you to specify prices in satoshis which is...inconvenient).
Good news. Easier to use is better.
BitShares committee member: abit
BitShares witness: in.abit

xeroc

Quote from: theoretical on September 24, 2015, 08:23:37 PM
Then you need to publish a feed.  If you did it today on the testnet, you'd use the publish_asset_feed command.  But soon (as in I'm working on it right now) there will be a much better command for this (publish_asset_feed requires you to specify prices in satoshis which is...inconvenient).

xeroc

I know see what you mean.

This patch (https://github.com/xeroc/python-graphenelib/commit/421d9c04785b5ce3d70f77376485109f808133cd) will result in the following output:


            "core_exchange_rate": {
                "quote": {
                    "amount": 52,
                    "asset_id": "1.3.626"
                },
                "base": {
                    "amount": 92170,
                    "asset_id": "1.3.0"
                }
            }

would the numbers now fit you too?

BTW, I am using "fractions" to get a numerator and denominator instead of just using 10^x .. but in the end, they all represent the same ratio ..

abit

Quote from: xeroc on September 24, 2015, 05:55:18 AM
Quote from: abit on September 23, 2015, 09:05:13 PM
The numbers are wrong..
How so?

The output says:


   "settlement_price": {
       "base": {
           "asset_id": "1.3.626",
           "amount": 85427
       },
       "quote": {
           "asset_id": "1.3.0",
           "amount": 55
       }
   },


which is:
55/85427 BTS/USD = 0.000644 * 10 (precision) BTS/USD
That has been the price yesterday.

For the core_exchange rate (if you look at the code), I added a 5% premium.

Don't see how that is 'wrong'

The result says 85427/10^4 USD == 55/10^5 CORE. (it can be checked with https://graphene.bitshares.org/ after pushed a price feed.)
The correct result should be like 0.00644 USD == 1 CORE, or 0.0644 USD = 10 CORE. Bring in the precision, it should be 644/10^4 USD == 1000000/10^5 CORE, so the json should be

   "settlement_price": {
       "base": {
           "asset_id": "1.3.626",
           "amount": 644
       },
       "quote": {
           "asset_id": "1.3.0",
           "amount": 1000000
       }
   },

By the way, I think
1, it's more human-readable if one of the amount is 10^n
2, a little more precision could be better
BitShares committee member: abit
BitShares witness: in.abit

xeroc

From what I understa.d I shouldn really matter since you have the asset-id side by side with the amount ... 10 x/y is identical to 0.1 y/x. ... isnt it?

svk

Quote from: xeroc on September 24, 2015, 05:55:18 AM
Quote from: abit on September 23, 2015, 09:05:13 PM
The numbers are wrong..
How so?

The output says:


   "settlement_price": {
       "base": {
           "asset_id": "1.3.626",
           "amount": 85427
       },
       "quote": {
           "asset_id": "1.3.0",
           "amount": 55
       }
   },


which is:
55/85427 BTS/USD = 0.000644 * 10 (precision) BTS/USD
That has been the price yesterday.

For the core_exchange rate (if you look at the code), I added a 5% premium.

Don't see how that is 'wrong'

Why are the base and quote assets inverted for settlement_price and core_exchange_rate?
Worker: dev.bitsharesblocks

xeroc

Quote from: abit on September 23, 2015, 09:05:13 PM
The numbers are wrong..
How so?

The output says:


   "settlement_price": {
       "base": {
           "asset_id": "1.3.626",
           "amount": 85427
       },
       "quote": {
           "asset_id": "1.3.0",
           "amount": 55
       }
   },


which is:
55/85427 BTS/USD = 0.000644 * 10 (precision) BTS/USD
That has been the price yesterday.

For the core_exchange rate (if you look at the code), I added a 5% premium.

Don't see how that is 'wrong'

abit

Quote from: xeroc on September 23, 2015, 08:23:40 PM
@abit: thanks for your inputs .. I took some of your patch but sticked to my philisophy of [base][qu ote] ..
anyway .. I also added another btc price feed and modified the price feed structure .. it should now do what it is supposed to do ..

also, the exchange_rate is for transactions fees that are paid in bitasset .. in my script .. paying your transactions in bitUSD (or any other bitasset) is 5% more expensive (read: supposed to be)

If you find the time, please go through the script .. I appreciate your input!!! +5%

Result of your latest script is here:

    [
        "USD",
        {
            "settlement_price": {
                "base": {
                    "asset_id": "1.3.626",
                    "amount": 85427
                },
                "quote": {
                    "asset_id": "1.3.0",
                    "amount": 55
                }
            },
            "core_exchange_rate": {
                "base": {
                    "asset_id": "1.3.0",
                    "amount": 55
                },
                "quote": {
                    "asset_id": "1.3.626",
                    "amount": 89698
                }
            }
        }
    ]

The numbers are wrong..
BitShares committee member: abit
BitShares witness: in.abit

xeroc

@abit: thanks for your inputs .. I took some of your patch but sticked to my philisophy of [base][qu ote] ..
anyway .. I also added another btc price feed and modified the price feed structure .. it should now do what it is supposed to do ..

also, the exchange_rate is for transactions fees that are paid in bitasset .. in my script .. paying your transactions in bitUSD (or any other bitasset) is 5% more expensive (read: supposed to be)

If you find the time, please go through the script .. I appreciate your input!!! +5%

abit

@bytemaster: should "core_exchange_rate" equal to external exchanges, and "settlement_price" be a bit higher?
BitShares committee member: abit
BitShares witness: in.abit

abit

Quote from: xeroc on September 23, 2015, 05:49:58 PM
It lacks the ratio between precisions .. i will fix this tomorrow ..
Not only that.. I'll submit a pull request soon.
//Update:
pull request requested. https://github.com/xeroc/python-graphenelib/pull/1
New source can be found here:
https://github.com/abitmore/python-graphenelib/
https://github.com/abitmore/python-graphenelib/blob/master/scripts/pricefeeds.py
BitShares committee member: abit
BitShares witness: in.abit

xeroc

It lacks the ratio between precisions .. i will fix this tomorrow ..