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

0 Members and 1 Guest are viewing this topic.

Offline tonyk

  • Hero Member
  • *****
  • Posts: 3308
    • View Profile
FYI this bounty has been paid.

That's worth mentioning for sure ... not paid in timely manner but for sure better than

 half ass excuses citing unseen yet but upcoming best practices.
Lack of arbitrage is the problem, isn't it. And this 'should' solves it.

Offline bytemaster

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 abit

  • Committee member
  • Hero Member
  • *
  • Posts: 4664
    • View Profile
    • Abit's Hive Blog
  • BitShares: abit
  • GitHub: abitmore
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
Bounty is all yours, where do you want the BitUSD sent?
you can send it all to "xeroc" .. I'll share a cut with @abit
Thanks  ;) my account is "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
Bounty is all yours, where do you want the BitUSD sent?
you can send it all to "xeroc" .. I'll share a cut with @abit

Offline Thom

That payout took awhile. Luck for you BM many of us here are a patient lot. Some of us grumble more than others but we're still here.

Xeroc certainly deserves the bounty, and perhaps some BROWNIES for the patience.
Injustice anywhere is a threat to justice everywhere - MLK |  Verbaltech2 Witness Reports: https://bitsharestalk.org/index.php/topic,23902.0.html

Offline bytemaster

Bounty is all yours, where do you want the BitUSD sent?
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
We are looking for testers who will publish a BitUSD price feed in graphene.  You will need to be an elected witness to publish the feed.

You can either provide the script to an existing witness tester or become a tester yourself. 

Unfortunately there is little documentation on HOW to do this right now, hence the bounty.   Xeroc may be able to help.
Can I request the bounty now?

Offline BunkerChainLabs-DataSecurityNode

I have updated the code:

+ reneabled bter
+ added another parameter "core_exchange_factor"
+ readded publishing rules which now allows to run it in a cron job on only publish every X seconds or on larger price changes (config parameter)
+ reenabled all other currencies that have been available in BTS1 already (INDICES still not complete)

TODO:
 + indices
 + bundle prices into a single transaction

 +5%
+-+-+-+-+-+-+-+-+-+-+
www.Peerplays.com | Decentralized Gaming Built with Graphene - Now with BookiePro and Sweeps!
+-+-+-+-+-+-+-+-+-+-+

Offline xeroc

  • Board Moderator
  • Hero Member
  • *****
  • Posts: 12922
  • ChainSquad GmbH
    • View Profile
    • ChainSquad GmbH
  • BitShares: xeroc
  • GitHub: xeroc
I have updated the code:

+ reneabled bter
+ added another parameter "core_exchange_factor"
+ readded publishing rules which now allows to run it in a cron job on only publish every X seconds or on larger price changes (config parameter)
+ reenabled all other currencies that have been available in BTS1 already (INDICES still not complete)

TODO:
 + indices
 + bundle prices into a single transaction

Offline xeroc

  • Board Moderator
  • Hero Member
  • *****
  • Posts: 12922
  • ChainSquad GmbH
    • View Profile
    • ChainSquad GmbH
  • BitShares: xeroc
  • GitHub: xeroc
You script should attempt to include all feed update operations in a single transaction to minimize load on the network.
Sounds like a good idea .. but for that I need to use the transaction_builder ..
I can do this but I may not be able to finish this up until after Shanghai

Beside that, could you please give you thoughts on this topic?
https://bitsharestalk.org/index.php/topic,18831.msg242310.html#msg242310

Offline bytemaster

You script should attempt to include all feed update operations in a single transaction to minimize load on the network.
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
Can we get a summary of what data sources are being used by this script?
Code: [Select]
mythreads["yahoo"]    = threading.Thread(target = fetch_from_yahoo)
 mythreads["yunbi"]    = threading.Thread(target = fetch_from_yunbi)
 mythreads["btc38"]    = threading.Thread(target = fetch_from_btc38)
 #mythreads["bter"]     = threading.Thread(target = fetch_from_bter)
 mythreads["poloniex"] = threading.Thread(target = fetch_from_poloniex)
 mythreads["bittrex"]  = threading.Thread(target = fetch_from_bittrex)
 mythreads["btcavg"]   = threading.Thread(target = fetch_bitcoinaverage)

Yahoo for traditional assets like GOLD, Silver.
Yunbi, btc38, bter (disabled atm), poloniex and bittrex for BTS/BTC pair
btcavg for USD/EUR to BTC pair ..


I am not sure how my script was even possible to submit prices for the wrong
paris.
Code: [Select]
  price_feed = {
                      "settlement_price": {
                        "quote": {
                          "asset_id": "1.3.0",
                          "amount": denominator
                        },
                        "base": {
                          "asset_id": assets[asset]["id"],
                          "amount": numerator
                        }
                      },
                      "core_exchange_rate": {
                        "quote": {
                          "asset_id": assets[asset]["id"],
                          "amount": numerator
                        },
                        "base": {
                          "asset_id": "1.3.0",
                          "amount": int(denominator * 1.05) # 5% extra
                        }
                      }
                    }
I load all publishing assets into ``assets`` and read the id JIT.
I'll investigate

Offline bytemaster

Can we get a summary of what data sources are being used by this script?
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 Riverhead


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 ..

Offline abit

  • Committee member
  • Hero Member
  • *
  • Posts: 4664
    • View Profile
    • Abit's Hive Blog
  • BitShares: abit
  • GitHub: abitmore
I've managed to get the script run, but the result seems a bit wrong.
Code: [Select]
[
    [
        "CNY",
        {
            "core_exchange_rate": {
                "quote": {
                    "amount": 6670,
                    "asset_id": "1.3.379"
                },
                "base": {
                    "amount": 100000,
                    "asset_id": "1.3.0"
                }
            },
            "settlement_price": {
                "quote": {
                    "amount": 100000,
                    "asset_id": "1.3.0"
                },
                "base": {
                    "amount": 6353,
                    "asset_id": "1.3.379"
                }
            }
        }
    ],
...
...
    [
        "USD",
        {
            "core_exchange_rate": {
                "quote": {
                    "amount": 1044,
                    "asset_id": "1.3.626"
                },
                "base": {
                    "amount": 100000,
                    "asset_id": "1.3.0"
                }
            },
            "settlement_price": {
                "quote": {
                    "amount": 100000,
                    "asset_id": "1.3.0"
                },
                "base": {
                    "amount": 995,
                    "asset_id": "1.3.626"
                }
            }
        }
    ]
]
BitShares committee member: abit
BitShares witness: in.abit

Offline bytemaster

So ... assuming the following to be correct:
Code: [Select]
[
    [   
        "USD",
        {
            "core_exchange_rate": {
                "quote": {
                    "amount": 1044,
                    "asset_id": "1.3.626"
                },
                "base": {
                    "amount": 100000,
                    "asset_id": "1.3.0"
                }
            }, 
            "settlement_price": {
                "quote": {
                    "amount": 100000,
                    "asset_id": "1.3.0"
                }, 
                "base": {
                    "amount": 995,
                    "asset_id": "1.3.626"
                }   
            }   
        }   
    ], 
    [
        "EUR",
        {
            "core_exchange_rate": {
                "quote": {
                    "amount": 928,
                    "asset_id": "1.3.424"
                }, 
                "base": {
                    "amount": 100000,
                    "asset_id": "1.3.0"
                }   
            }, 
            "settlement_price": {
                "quote": {
                    "amount": 100000,
                    "asset_id": "1.3.0"
                }, 
                "base": {
                    "amount": 884,
                    "asset_id": "1.3.424"
                }   
            }   
        }   
    ]   
]
.. I have successfully modified my current price feed script to run for graphene ..
@bytemaster: if 1 BTS is worth $0.007 .. would the following price feed be correct?
Code: [Select]
                "quote": {
                    "amount": 700,
                    "asset_id": "1.3.424"
                }, 
                "base": {
                    "amount": 100000,
                    "asset_id": "1.3.0"
                }   
For now, I used the precision as base amount and the price multiplied by base amount as quote amount ..
Is this how it is supposed to be or am I understanding something wrong?


Code:
https://github.com/xeroc/python-graphenelib/blob/develop/scripts/pricefeeds.py
It requires installation of the python-graphenelib


What you have is almost correct, except it fails to consider the precision difference between BITUSD and BTS.   BTS has 5 digits and BitUSD has 4 so you are off by a factor of 10.
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
hmm .. thinking about this approach .. it should be possible to just represent the float as a rational (which is what you had in mind I suppose) and put nominator and denominator into base and quote ..
I will pimp this script this week ..

Offline xeroc

  • Board Moderator
  • Hero Member
  • *****
  • Posts: 12922
  • ChainSquad GmbH
    • View Profile
    • ChainSquad GmbH
  • BitShares: xeroc
  • GitHub: xeroc
So ... assuming the following to be correct:
Code: [Select]
[
    [   
        "USD",
        {
            "core_exchange_rate": {
                "quote": {
                    "amount": 1044,
                    "asset_id": "1.3.626"
                },
                "base": {
                    "amount": 100000,
                    "asset_id": "1.3.0"
                }
            }, 
            "settlement_price": {
                "quote": {
                    "amount": 100000,
                    "asset_id": "1.3.0"
                }, 
                "base": {
                    "amount": 995,
                    "asset_id": "1.3.626"
                }   
            }   
        }   
    ], 
    [
        "EUR",
        {
            "core_exchange_rate": {
                "quote": {
                    "amount": 928,
                    "asset_id": "1.3.424"
                }, 
                "base": {
                    "amount": 100000,
                    "asset_id": "1.3.0"
                }   
            }, 
            "settlement_price": {
                "quote": {
                    "amount": 100000,
                    "asset_id": "1.3.0"
                }, 
                "base": {
                    "amount": 884,
                    "asset_id": "1.3.424"
                }   
            }   
        }   
    ]   
]
.. I have successfully modified my current price feed script to run for graphene ..
@bytemaster: if 1 BTS is worth $0.007 .. would the following price feed be correct?
Code: [Select]
                "quote": {
                    "amount": 700,
                    "asset_id": "1.3.424"
                }, 
                "base": {
                    "amount": 100000,
                    "asset_id": "1.3.0"
                }   
For now, I used the precision as base amount and the price multiplied by base amount as quote amount ..
Is this how it is supposed to be or am I understanding something wrong?


Code:
https://github.com/xeroc/python-graphenelib/blob/develop/scripts/pricefeeds.py
It requires installation of the python-graphenelib

Offline abit

  • Committee member
  • Hero Member
  • *
  • Posts: 4664
    • View Profile
    • Abit's Hive Blog
  • BitShares: abit
  • GitHub: abitmore
I did successfully published price feed for my bitAsset "ABITUSDA".  :D

Code: [Select]
publish_asset_feed in.abit ABITUSDA {"settlement_price":{"base":{"amount":50000,"asset_id":"1.3.662"},"quote":{"amount":1000000000,"asset_id":"1.3.0"}},"core_exchange_rate":{"base":{"amount":100000,"asset_id":"1.3.0"},"quote":{"amount":10000,"asset_id":"1.3.662"}}} true
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 figuring this out .. ill try to finish the script when back home (unless someone else can do more quickly) .. i'd be happy to share the bounty ..

Offline abit

  • Committee member
  • Hero Member
  • *
  • Posts: 4664
    • View Profile
    • Abit's Hive Blog
  • BitShares: abit
  • GitHub: abitmore
I am stuck ..
What's the syntax to hand over a price_feed object?
I am getting:
Code: [Select]
unlocked >>> publish_asset_feed init0 CORE {settlement_price:"0.4"} false
publish_asset_feed init0 CORE {settlement_price:"0.4"} false
4 parse_error_exception: Parse Error
Expected ':' after key "settlement_price"
    {"key":"settlement_price"}
    th_a  json_relaxed.hpp:589 objectFromStream
Error parsing object
    {}
    th_a  json_relaxed.hpp:611 objectFromStream

    {"str":"publish_asset_feed init0 CORE {settlement_price:\"0.4\"} false"}
    th_a  json.cpp:494 variants_from_string

Here is my command which was able to create a transaction, but the transaction got refused by the chain:
Code: [Select]
publish_asset_feed in.abit USD {"settlement_price":{"base":{"amount":50000,"asset_id":"1.3.626"},"quote":{"amount":1000000000,"asset_id":"1.3.0"}},"core_exchange_rate":{"base":{"amount":100000,"asset_id":"1.3.0"},"quote":{"amount":10000,"asset_id":"1.3.626"}}} true

Looks like there is a bug. With current implementation, it's only possible to publish price feed for "committee issued assets" or "private assets", but all bitAssets are "witness issued assets". Submitted an issue here https://github.com/cryptonomex/graphene/issues/328.

p.s.
1. I think the command syntax isn't user-friendly (at all).
2. Can I get some part of the bounty?  8)
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
I am stuck ..
What's the syntax to hand over a price_feed object?
I am getting:
Code: [Select]
unlocked >>> publish_asset_feed init0 CORE {settlement_price:"0.4"} false
publish_asset_feed init0 CORE {settlement_price:"0.4"} false
4 parse_error_exception: Parse Error
Expected ':' after key "settlement_price"
    {"key":"settlement_price"}
    th_a  json_relaxed.hpp:589 objectFromStream
Error parsing object
    {}
    th_a  json_relaxed.hpp:611 objectFromStream

    {"str":"publish_asset_feed init0 CORE {settlement_price:\"0.4\"} false�"}
    th_a  json.cpp:494 variants_from_string

Offline betax

  • Hero Member
  • *****
  • Posts: 808
    • View Profile
Have you developed a split forum personality, xeroc? :)

except that there are now 3!!!! prices per bitasset.

Unfortunatelly, I have no clue why you say there are three prices in price_feed ..  I only see settlement_price, and core_exchange_rate. The other two are 'constants'

lol one forum account isn't enough let's get another one that talks to me :)

LOL that is what I thought!
https://metaexchange.info | Bitcoin<->Altcoin exchange | Instant | Safe | Low spreads

Offline xeroc

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

Offline santaclause102

  • Hero Member
  • *****
  • Posts: 2486
    • View Profile
Have you developed a split forum personality, xeroc? :)

except that there are now 3!!!! prices per bitasset.

Unfortunatelly, I have no clue why you say there are three prices in price_feed ..  I only see settlement_price, and core_exchange_rate. The other two are 'constants'

lol one forum account isn't enough let's get another one that talks to me :)

Offline xeroc

  • Board Moderator
  • Hero Member
  • *****
  • Posts: 12922
  • ChainSquad GmbH
    • View Profile
    • ChainSquad GmbH
  • BitShares: xeroc
  • GitHub: xeroc
More related info:
https://github.com/cryptonomex/graphene/blob/3eedabbac251b8afa585cb644f4b2b4596f2d37a/libraries/chain/include/graphene/chain/protocol/asset.hpp#L147-L194

Unfortunatelly, I have no clue why you say there are three prices in price_feed ..  I only see settlement_price, and core_exchange_rate. The other two are 'constants'
« Last Edit: September 15, 2015, 08:45:49 am by xeroc »

Offline xeroc

  • Board Moderator
  • Hero Member
  • *****
  • Posts: 12922
  • ChainSquad GmbH
    • View Profile
    • ChainSquad GmbH
  • BitShares: xeroc
  • GitHub: xeroc
It means bitusd works like it does in 1.0. 


Sent from my iPhone using Tapatalk
That statement will definitelly be misinterprered. Bitusd works differently in bts2 .. just the price feeds for bitusd work the same way .. except that there are now 3!!!! prices per bitasset.

Offline sittingduck

  • Sr. Member
  • ****
  • Posts: 246
    • View Profile
It means bitusd works like it does in 1.0. 


Sent from my iPhone using Tapatalk

Offline xeroc

  • Board Moderator
  • Hero Member
  • *****
  • Posts: 12922
  • ChainSquad GmbH
    • View Profile
    • ChainSquad GmbH
  • BitShares: xeroc
  • GitHub: xeroc
I'm still unclear on who will be publishing feeds for assets?  I was under the impression that this would be something workers would do.  Is this something I will be expected to do as a witness?  Not that I mind or anything, just looking for clarity.
Witnesses publish for the network.
What that means is (iiuc) that witnesses produce feeds for bitassets .. there are also privatized smartcoins which mmay have different producers ..

Offline bytemaster

I'm still unclear on who will be publishing feeds for assets?  I was under the impression that this would be something workers would do.  Is this something I will be expected to do as a witness?  Not that I mind or anything, just looking for clarity.
Witnesses publish for the network.
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 puppies

  • Hero Member
  • *****
  • Posts: 1659
    • View Profile
  • BitShares: puppies
I'm still unclear on who will be publishing feeds for assets?  I was under the impression that this would be something workers would do.  Is this something I will be expected to do as a witness?  Not that I mind or anything, just looking for clarity.
https://metaexchange.info | Bitcoin<->Altcoin exchange | Instant | Safe | Low spreads

Offline svk

is there bta in genesis block in bts 2.0?
Yes, all assets transfer over as is, including bit assets.
Worker: dev.bitsharesblocks

Offline BTSdac

  • Hero Member
  • *****
  • Posts: 1219
    • View Profile
  • BitShares: K1
github.com :pureland
BTS2.0 API :ws://139.196.37.179:8091
BTS2.0 API 数据源ws://139.196.37.179:8091

Offline xeroc

  • Board Moderator
  • Hero Member
  • *****
  • Posts: 12922
  • ChainSquad GmbH
    • View Profile
    • ChainSquad GmbH
  • BitShares: xeroc
  • GitHub: xeroc
This is what you need

Code: [Select]
/** Publishes a price feed for the named asset. * * Price feed providers use this command to publish their price feeds for market-issued assets. A price feed is * used to tune the market for a particular market-issued asset. For each value in the feed, the median across all * committee_member feeds for that asset is calculated and the market for the asset is configured with the median of that * value. * * The feed object in this command contains three prices: a call price limit, a short price limit, and a settlement price. * The call limit price is structured as (collateral asset) / (debt asset) and the short limit price is structured * as (asset for sale) / (collateral asset). Note that the asset IDs are opposite to eachother, so if we're * publishing a feed for USD, the call limit price will be CORE/USD and the short limit price will be USD/CORE. The * settlement price may be flipped either direction, as long as it is a ratio between the market-issued asset and * its collateral. * * @param publishing_account the account publishing the price feed * @param symbol the name or id of the asset whose feed we're publishing * @param feed the price_feed object containing the three prices making up the feed * @param broadcast true to broadcast the transaction on the network * @returns the signed transaction updating the price feed for the given asset */ signed_transaction publish_asset_feed(string publishing_account, string symbol, price_feed feed, bool broadcast = false);

I'll try to work out a basic script tomorrow .. but I dont have much time this week ..


wallet.hpp line 930

Offline bytemaster

We are looking for testers who will publish a BitUSD price feed in graphene.  You will need to be an elected witness to publish the feed.

You can either provide the script to an existing witness tester or become a tester yourself. 

Unfortunately there is little documentation on HOW to do this right now, hence the bounty.   Xeroc may be able to help.

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.