Author Topic: Yet Another Price Feed Mod  (Read 17183 times)

0 Members and 1 Guest are viewing this topic.

Offline xeroc

  • Board Moderator
  • Hero Member
  • *****
  • Posts: 12922
  • ChainSquad GmbH
    • View Profile
    • ChainSquad GmbH
  • BitShares: xeroc
  • GitHub: xeroc
I think there might be an error in discount implementation in the original script.
It increases the feed price instead of decreasing it.

assume discount = 0.995
Original code:
Code: [Select]
### Discount
  price_in_btsx_weighted[asset] = price_in_btsx_weighted[asset] / config["discount"]

My code:
Code: [Select]
### Discount
  price_in_btsx_weighted[asset] = price_in_btsx_weighted[asset] * config["discount"]

For sake of completeness :)

I fixed that issue bug in my code :-D

Offline emski

  • Hero Member
  • *****
  • Posts: 1282
    • View Profile
    • http://lnkd.in/nPbhxG
I've merged the fix for btc38 failure (thanks alt).

Offline vikram

Seems like it might be good to make a wiki page listing the different price feed scripts and their main differences. Something in the spirit of this: https://en.wikipedia.org/wiki/Tomato_%28firmware%29#Feature_comparison but of course not so complicated.

Offline emski

  • Hero Member
  • *****
  • Posts: 1282
    • View Profile
    • http://lnkd.in/nPbhxG
I think there might be an error in discount implementation in the original script.
It increases the feed price instead of decreasing it.

assume discount = 0.995
Original code:
Code: [Select]
### Discount
  price_in_btsx_weighted[asset] = price_in_btsx_weighted[asset] / config["discount"]

My code:
Code: [Select]
### Discount
  price_in_btsx_weighted[asset] = price_in_btsx_weighted[asset] * config["discount"]

Offline liondani

  • Hero Member
  • *****
  • Posts: 3737
  • Inch by inch, play by play
    • View Profile
    • My detailed info
  • BitShares: liondani
  • GitHub: liondani

I as a user/owner have always advocated for weighing the price feed from different exchanges, so I am happy to see that and hope more delegates will start using this script.

The other features seem beneficial to the delegates themselves, so I hope for a fast adoption.

0.02 BTSX

until now I published the feeds manually...  With this approach I consider seriously to start using the script.
Thanks to alt, xeroc and emski for their efforts   ;)

Offline tonyk

  • Hero Member
  • *****
  • Posts: 3308
    • View Profile

I as a user/owner have always advocated for weighing the price feed from different exchanges, so I am happy to see that and hope more delegates will start using this script.

The other features seem beneficial to the delegates themselves, so I hope for a fast adoption.

0.02 BTSX
Lack of arbitrage is the problem, isn't it. And this 'should' solves it.

Offline emski

  • Hero Member
  • *****
  • Posts: 1282
    • View Profile
    • http://lnkd.in/nPbhxG
I've done some modifications to xeroc's (which was derived from alt's version) version of the price feed script.
You can see it here: https://github.com/emilvelichkov/pytshares

Basically I've added weighting of each exchange so a delegate could select which exchange matters more.

Also I've changed the conditions when the feed is published:
Nothing except time restrictions and price difference is taken into account. If price differs more than [-max_negative_diff , max_positive_diff]*MyLastFeed feed is published. By default: [-0.2%, 0.5%].
Feeds cannot be published more frequently than minFeedAgeInSeconds.

Also I've changed the logic of price fetching to include additional validation and to ignore error from exchanges with low trust_level. This way failure to fetch price data from low trusted exchange will not prevent the calculation and publishing of feeds.

It is still experimental so some issues might arise. Some proof-read is welcome.

Here is the full changelog:
+ added minFeedAgeInSeconds (minimum time between feed publish)
+ added minValidAssetPrice (any feed for asset with lower price will be ignored)
+ added max_positive_diff/max_negative_diff (asset price should increase more than max_positive_diff in order to be published)
+ added exchange trust level (it multiplies the volume of the exchange.)
* changed publish_rule in the following way:
price is published if maxFeedAgeInSeconds have passed
price is published if price of any asset changes more than [-max_negative_diff, max_positive_diff]
* Errors fetching prices from any exchange are ignored unless exchange_trust_level > 0.8 (this is to prevent single small exchange from stopping all feeds)
« Last Edit: October 05, 2014, 05:49:55 am by emski »