Main Menu

Yet Another Price Feed Mod

Started by emski, October 04, 2014, 11:42:19 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

xeroc

Quote from: emski on October 05, 2014, 08:16:00 AM
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:

### Discount
  price_in_btsx_weighted[asset] = price_in_btsx_weighted[asset] / config["discount"]


My code:

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

emski

I've merged the fix for btc38 failure (thanks alt).
[url="https://bitsharestalk.org/index.php/topic,9857.0.html"]https://bitsharestalk.org/index.php/topic,9857.0.html[/url]

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.

emski

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:

### Discount
  price_in_btsx_weighted[asset] = price_in_btsx_weighted[asset] / config["discount"]


My code:

### Discount
  price_in_btsx_weighted[asset] = price_in_btsx_weighted[asset] * config["discount"]
[url="https://bitsharestalk.org/index.php/topic,9857.0.html"]https://bitsharestalk.org/index.php/topic,9857.0.html[/url]

liondani

Quote from: tonyk on October 05, 2014, 12:48:39 AM

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   ;)
[url="https://www.steempeak.com/@liondani"]https://www.steempeak.com/@liondani[/url]

tonyk


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.

emski

#1
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)
[url="https://bitsharestalk.org/index.php/topic,9857.0.html"]https://bitsharestalk.org/index.php/topic,9857.0.html[/url]