transmitter update: New markets and price outlier detection

in #utopian-io5 years ago


Repository: https://github.com/emre/transmitter

Transmitter is a CLI tool for STEEM blockchain witnesses. It quickly allows you to enable/disable your witness or set some properties for the new witness_set_properties call introduced in Hard Fork 20. - announcement post

I have been testing the publish_feed command in the last couple of days and it works like a charm!

New market adapters


Initial support for the markets were limited to Poloniex, Bittrex, and Binance. While these markets are enough to create an average price, I have also added two more markets: Upbit and Huobi.


Exchanges lists STEEM, sorted by volume.

Both these markets don't have a direct BTC-USD market, so to calculate the price, I have used BTC-USDT pair.

Pull Request:
https://github.com/emre/transmitter/pull/4/files

Price outlier detection


Sometimes, STEEM prices on the mark fluctuates a lot in different markets due to wallet lockouts. I remember poloniex having low prices, or some korean markets having absurdly high prices.

Witnesses should feed the price with a stable amount to make sure the blockchain processes the correct information.

It's possible to enable/disable markets by hand but these market movements may happen anytime. In order to solve that, I have implemented a simple outlier detection.


The logic of detecting price outliers


This uses a simplified "modified z score" to detect outliers in the price.

Since it works best when more data available, outlier logic works only if you have enabled at least three markets.

Let's have a look at the current STEEM prices and test the outlier:

ExchangeSTEEM in USD
Binance0.373316
Bithumb1.75
Bittrex0.372458
Upbit0.378082
Huobi0.375992
Poloniex0.370313
from transmitter.pricefeed.markets import exclude_outliers

prices = [0.3733, 1.7500, 0.3724, 0.3780, 0.3759, 0.3703]

print(" - Price list before outlier detection", prices)
print(" - Price list after exclusion", exclude_outliers(prices))

The output is perfect where Bithumb's price is excluded:

 - Price list before outlier detection [0.3733, 1.75, 0.3724, 0.378, 0.3759, 0.3703]
 - Price list after exclusion [0.3733, 0.3724, 0.378, 0.3759, 0.3703]

More tests with different prices

Disclaimer: This feature is kind of experimental and it's possible for it to create false positives. If you use publish_feed command make sure to monitor it's output to check the outlier detection feature.

Upgrading

$ pip install transmitter --upgrade
Using the publish_feed

$ transmitter publish_feed
INFO:transmitter.main:Connecting to the blockchain using mainnet.
INFO:transmitter.main:Got the SIGNING_KEY in the config file.
INFO:transmitter.main:Got the WITNESS_ACCOUNT in the config file.
INFO:transmitter.pricefeed.adapters.base:PoloniexAdapter: Price: 0.3818
INFO:transmitter.pricefeed.adapters.base:BinanceAdapter: Price: 0.3822
INFO:transmitter.pricefeed.adapters.base:BittrexAdapter: Price: 0.3681
INFO:transmitter.pricefeed.adapters.base:HuobiAdapter: Price: 0.3822
INFO:transmitter.pricefeed.adapters.base:UpbitAdapter: Price: 0.3802
INFO:transmitter.main:Prices: [0.3818, 0.3822, 0.3681, 0.3822, 0.3802]
INFO:transmitter.main:Base price: 0.379 SBD, Quote price: 1.000 STEEM
INFO:transmitter.main:Operation broadcasted.

Make sure you have SIGNING_KEY and WITNESS_ACCOUNT placed on your configuration file.( ~/.transmitter/config.json.)

Sort:  
  • Great job, more price feed should make a better average.
  • The new outlier functions has comments, not much elsewhere.
  • What are your thoughts on USDT not keeping it's peg these days?

Your contribution has been evaluated according to Utopian policies and guidelines, as well as a predefined set of questions pertaining to the category.

To view those questions and the relevant answers related to your post, click here.


Need help? Write a ticket on https://support.utopian.io/.
Chat with us on Discord.
[utopian-moderator]

Thank you for your review, @helo! Keep up the good work!

I really wish all this code made sense to me. Where did you learn it from?

Posted using Partiko Android

Do you ask your doctor where did he learnt to be a doctor? :)

Hi @emrebeyler!

Your post was upvoted by @steem-ua, new Steem dApp, using UserAuthority for algorithmic post curation!
Your post is eligible for our upvote, thanks to our collaboration with @utopian-io!
Feel free to join our @steem-ua Discord server

Hey, @emrebeyler!

Thanks for contributing on Utopian.
We’re already looking forward to your next contribution!

Get higher incentives and support Utopian.io!
Simply set @utopian.pay as a 5% (or higher) payout beneficiary on your contribution post (via SteemPlus or Steeditor).

Want to chat? Join us on Discord https://discord.gg/h52nFrV.

Vote for Utopian Witness!

If I could turn back !BEER



Hey @emrebeyler, here is a little bit of BEER from @isnochys for you. Enjoy it!

Coin Marketplace

STEEM 0.29
TRX 0.12
JST 0.034
BTC 63425.40
ETH 3253.95
USDT 1.00
SBD 3.88