Author Topic: 100 BitUSD to First Person to Publish a working Price Feed Script for Graphene  (Read 10774 times)

0 Members and 1 Guest are viewing this topic.

Offline bytemaster

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: http://bytemaster.bitshares.org
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.

Offline xeroc

  • Board Moderator
  • Hero Member
  • *****
  • Posts: 12922
  • ChainSquad GmbH
    • View Profile
    • ChainSquad GmbH
  • BitShares: xeroc
  • GitHub: xeroc

Offline xeroc

  • Board Moderator
  • Hero Member
  • *****
  • Posts: 12922
  • ChainSquad GmbH
    • View Profile
    • ChainSquad GmbH
  • BitShares: xeroc
  • GitHub: xeroc
So @bytemaster, what else needs to be done for the price feed script to qualify for the bounty?

Offline abit

  • Committee member
  • Hero Member
  • *
  • Posts: 4664
    • View Profile
    • Abit's Hive Blog
  • BitShares: abit
  • GitHub: abitmore
I know see what you mean.

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

Code: [Select]
            "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

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

Offline xeroc

  • Board Moderator
  • Hero Member
  • *****
  • Posts: 12922
  • ChainSquad GmbH
    • View Profile
    • ChainSquad GmbH
  • BitShares: xeroc
  • GitHub: xeroc
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).

Offline xeroc

  • Board Moderator
  • Hero Member
  • *****
  • Posts: 12922
  • ChainSquad GmbH
    • View Profile
    • ChainSquad GmbH
  • BitShares: xeroc
  • GitHub: xeroc
I know see what you mean.

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

Code: [Select]
            "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 ..

Offline abit

  • Committee member
  • Hero Member
  • *
  • Posts: 4664
    • View Profile
    • Abit's Hive Blog
  • BitShares: abit
  • GitHub: abitmore
The numbers are wrong..
How so?

The output says:

Code: [Select]
   "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
Code: [Select]
   "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

Offline xeroc

  • Board Moderator
  • Hero Member
  • *****
  • Posts: 12922
  • ChainSquad GmbH
    • View Profile
    • ChainSquad GmbH
  • BitShares: xeroc
  • GitHub: 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?

Offline svk

The numbers are wrong..
How so?

The output says:

Code: [Select]
   "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

Offline xeroc

  • Board Moderator
  • Hero Member
  • *****
  • Posts: 12922
  • ChainSquad GmbH
    • View Profile
    • ChainSquad GmbH
  • BitShares: xeroc
  • GitHub: xeroc
The numbers are wrong..
How so?

The output says:

Code: [Select]
   "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'

Offline abit

  • Committee member
  • Hero Member
  • *
  • Posts: 4664
    • View Profile
    • Abit's Hive Blog
  • BitShares: abit
  • GitHub: abitmore
@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:
Code: [Select]
    [
        "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

Offline xeroc

  • Board Moderator
  • Hero Member
  • *****
  • Posts: 12922
  • ChainSquad GmbH
    • View Profile
    • ChainSquad GmbH
  • BitShares: xeroc
  • GitHub: 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%

Offline abit

  • Committee member
  • Hero Member
  • *
  • Posts: 4664
    • View Profile
    • Abit's Hive Blog
  • BitShares: abit
  • GitHub: abitmore
@bytemaster: should "core_exchange_rate" equal to external exchanges, and "settlement_price" be a bit higher?
BitShares committee member: abit
BitShares witness: in.abit

Offline abit

  • Committee member
  • Hero Member
  • *
  • Posts: 4664
    • View Profile
    • Abit's Hive Blog
  • BitShares: abit
  • GitHub: abitmore
« Last Edit: September 23, 2015, 07:41:48 pm by abit »
BitShares committee member: abit
BitShares witness: in.abit

Offline xeroc

  • Board Moderator
  • Hero Member
  • *****
  • Posts: 12922
  • ChainSquad GmbH
    • View Profile
    • ChainSquad GmbH
  • BitShares: xeroc
  • GitHub: xeroc
It lacks the ratio between precisions .. i will fix this tomorrow ..