Author Topic: [Witness Proposal] 1.6.129 - zapata42-witness  (Read 2262 times)

0 Members and 1 Guest are viewing this topic.

Offline zapata42

  • Full Member
  • ***
  • Posts: 58
    • View Profile
  • BitShares: zapata42
Re: [Witness Proposal] 1.6.129 - zapata42-witness
« Reply #30 on: November 16, 2018, 03:38:35 pm »
In order to give more visibility on what I currently use, and summarize the changes since my initial setup, here is an update of the my algorithm:

CNY:
   
  • Compute CNY/BTS price from a weighted mean of those routes:
           
    • 'aex - CNY:BTS'
    • 'magicwallet - CNY:BITCNY', 'bitshares - BITCNY:BTS'
    • 'qc_fees - CNY:QC', 'zb - QC:BITCNY', 'bitshares - BITCNY:BTS'
    • 'qc_fees - CNY:QC', 'zb - QC:BTS'
    • 'magicwallet - CNY:BITCNY', 'zb - BITCNY:QC', 'zb - QC:BTS'
    • 'magicwallet - CNY:BITCNY', 'cointiger - BITCNY:BTC', 'zb - BTC:BTS'
    • 'magicwallet - CNY:BITCNY', 'cointiger - BITCNY:BTC', 'binance - BTC:BTS'
    • 'magicwallet - CNY:BITCNY', 'cointiger - BITCNY:BTC', 'poloniex - BTC:BTS'
    • 'magicwallet - CNY:BITCNY', 'cointiger - BITCNY:BTC', 'openledger - BTC:BTS'
    • 'magicwallet - CNY:BITCNY', 'cointiger - BITCNY:BTC', 'gdex - BTC:BTS'
    • 'magicwallet - CNY:BITCNY', 'cointiger - BITCNY:BTC', 'coinegg - BTC:BTS'
    • 'magicwallet - CNY:BITCNY', 'cointiger - BITCNY:BTC', 'cointiger - BTC:BTS'
    • 'magicwallet - CNY:BITCNY', 'cointiger - BITCNY:ETH', 'cointiger - ETH:BTS'
    • 'magicwallet - CNY:BITCNY', 'cointiger - BITCNY:BTC', 'huobi - BTC:BTS'
    • 'magicwallet - CNY:BITCNY', 'cointiger - BITCNY:ETH', 'huobi - ETH:BTS'

          Notes:
         
    • 'magicwallet - CNY:BITCNY' is computed using 1h deposit/withdrawal ratio, if less than 10 operation where made the 24h volume is used.
    • 'qc_fees - CNY:QC' is manually set using ZB OTC market, currently is 0.997
       
  • Get BITCNY/BTS price from Bitshares DEX
  • Get current feed price from Bitshares DEX
  • Compute premium or discount: CNY/BTS / BITCNY/BTS
  • Compute adjusted feed price: current_feed_price * (1 + premium_or_discount * adjustment_scale)
            adjustment_scale is manually adjusted depending my appreciation on how fast the market react. Current value is 1.
  • Publish the adjusted feed price (this means BSIP-42 is activated on BitCNY)


USD:
   
  • Compute USD/BTS price from a weighted mean of those routes:
           
    • 'weighted_mean(coinbase, kraken, bitstamp) - USD:BTC', 'binance - BTC:BTS'
    • 'weighted_mean(coinbase, kraken, bitstamp) - USD:BTC', 'openledger - BTC:BTS'
    • 'weighted_mean(coinbase, kraken, bitstamp) - USD:BTC', 'gdex - BTC:BTS'
    • 'weighted_mean(coinbase, kraken, bitstamp) - USD:BTC', 'coinegg - BTC:BTS'
    • 'weighted_mean(coinbase, kraken, bitstamp) - USD:BTC', 'cointiger - BTC:BTS'
    • 'weighted_mean(coinbase, kraken, bitstamp) - USD:BTC', 'huobi - BTC:BTS'
    • 'weighted_mean(coinbase, kraken, bitstamp) - USD:BTC', 'poloniex - BTC:BTS'
    • 'weighted_mean(coinbase, kraken, bitstamp) - USD:BTC', 'zb - BTC:BTS'
    • 'weighted_mean(bittrex, kraken) - USD:USDT', 'huobi - USDT:BTS'
    • 'weighted_mean(bittrex, kraken) - USD:USDT', 'zb - USDT:BTS'
    • 'weighted_mean(coinbase, kraken, bitstamp) - USD:ETH', 'cointiger - ETH:BTS'
    • 'weighted_mean(coinbase, kraken, bitstamp) - USD:ETH', 'huobi - ETH:BTS'
    • 'weighted_mean(coinbase, kraken, bitstamp) - USD:BTC', 'cointiger - BTC:BITCNY', 'bitshares - BITCNY:BTS'
    • 'weighted_mean(coinbase, kraken, bitstamp) - USD:ETH', 'cointiger - ETH:BITCNY', 'bitshares - BITCNY:BTS'

            Notes:
           
    • USD:BTC is computed only from CEX that have a FIAT ramp
         
  • Get BITUSD/BTS price from Bitshares DEX
  • Get current feed price from Bitshares DEX
  • Compute premium or discount: USD/BTS / BITUSD/BTS
  • Compute adjusted feed price: current_feed_price * (1 + premium_or_discount * adjustment_scale)
            adjustment_scale is manually adjusted depending my appreciation on how fast the market react. Current value is 1.2.
         
  • Publish the adjusted feed price (this means BSIP-42 is activated on BitUSD)


BTC:
   
  • Compute BTC/BTS price from a weighted mean of those routes:
           
    • 'binance - BTC:BTS'
    • 'openledger - BTC:BTS'
    • 'gdex - BTC:BTS'
    • 'coinegg - BTC:BTS'
    • 'cointiger - BTC:BTS'
    • 'huobi - BTC:BTS'
    • 'poloniex - BTC:BTS'
    • 'zb - BTC:BTS'
    • 'cointiger - BTC:BITCNY', 'bitshares - BITCNY:BTS'
    • 'weighted_mean(coinbase, kraken, bitstamp) - BTC:USD', 'weighted_mean(bittrex, kraken) - USD:USDT', 'huobi - USDT:BTS'
    • 'weighted_mean(coinbase, kraken, bitstamp) - BTC:USD', 'weighted_mean(bittrex, kraken) - USD:USDT', 'zb - USDT:BTS'
    • 'weighted_mean(coinbase, kraken, bitstamp) - BTC:USD', 'weighted_mean(coinbase, kraken, bitstamp) - USD:ETH', 'cointiger - ETH:BTS'
    • 'weighted_mean(coinbase, kraken, bitstamp) - BTC:USD', 'weighted_mean(coinbase, kraken, bitstamp) - USD:ETH', 'huobi - ETH:BTS'
    • 'cointiger - BTC:BITCNY', 'cointiger - BITCNY:ETH', 'cointiger - ETH:BTS'
    • 'cointiger - BTC:BITCNY', 'cointiger - BITCNY:ETH', 'huobi - ETH:BTS'
    • 'cointiger - BTC:BITCNY', 'zb - BITCNY:QC', 'zb - QC:BTS'
       
  • Publish BTC/BTS unadjusted (no BSIP-42)

RUBLE/EUR/AUD/JPY/CHF/MXN/GBP/CAD/ARS/HKD/SEK/SGD/NZD/KRW:
  • Get USD/BTS price from Bitshares DEX (I do not use the feed price since BSIP-42 is applied to USD)
  • Get XXX/USD from the mean of CurrencyLayer and OpenExchangeRates
  • Then apply XXX/USD * USD/BTS to publish XXX/BTS (no BSIP-42)

GOLD/SILVER:
  • Get USD/BTS price from Bitshares DEX (I do not use the feed price since BSIP-42 is applied to USD)
  • Get XXX/USD from Quadl LMBA source
  • Then apply XXX/USD * USD/BTS to publish XXX/BTS  (no BSIP-42)

HERTZ:
  • Apply the formula to USD/BTS price from Bitshares DEX (I do not use the feed price since BSIP-42 is applied to USD)

AMAZONCOM:
  • Get USD/BTS price from Bitshares DEX (I do not use the feed price since BSIP-42 is applied to USD)
  • Get AMAZONCOM/USD from IEX source
  • Then apply XXX/USD * USD/BTS to publish XXX/BTS  (no BSIP-42)

The up-to-date version of the code used is available there.
It contains implementations for many BSIP 42 algorithms, a large variety of price sources, and is largely configurable.

You can use the pricefeed tracker to check the published prices over time and against other witnesses, and/or to compare feed price to CEX and DEX price and track premium/discount.

I plan to update my setup to:
  • implement the "protect discount limit" as disccussed here.
  • use a lower scale at discount and a higher scale at premium as suggested by abit here.
  • publish all my intermediary values to the pricefeed tracker website so anyone would be able to analyze where my price comes from.


Edit:
  - 20181116 17:55 UTC : Added forgotten AEX source for BitCNY (api is unstable, so sometime it's not used).
« Last Edit: November 16, 2018, 05:56:29 pm by zapata42 »

Offline xeroc

  • Board Moderator
  • Hero Member
  • *****
  • Posts: 12722
  • ChainSquad GmbH
    • View Profile
    • ChainSquad GmbH
  • BitShares: xeroc
  • GitHub: xeroc
Re: [Witness Proposal] 1.6.129 - zapata42-witness
« Reply #31 on: November 16, 2018, 04:26:21 pm »
+5% for transparency and your work on the price feed script!
Give BitShares a try! Use the http://testnet.bitshares.eu provided by http://bitshares.eu powered by ChainSquad GmbH

Offline matle85

  • Full Member
  • ***
  • Posts: 69
    • View Profile
Re: [Witness Proposal] 1.6.129 - zapata42-witness
« Reply #32 on: November 16, 2018, 05:10:06 pm »
That's great - thank you!

Have we got agreed weighting for the different price feed sources? I.e. if we are concerned one exchange has faked volume it could be having an unjustified impact on the feed - I can see various discussions on the reliability of different sources but not sure if we maintain a weighting somewhere?
« Last Edit: November 16, 2018, 05:52:57 pm by matle85 »

Offline zapata42

  • Full Member
  • ***
  • Posts: 58
    • View Profile
  • BitShares: zapata42
Re: [Witness Proposal] 1.6.129 - zapata42-witness
« Reply #33 on: November 16, 2018, 06:11:30 pm »
Have we got agreed weighting for the different price feed sources? I.e. if we are concerned one exchange has faked volume it could be having an unjustified impact on the feed.

Currently my weighting is volume based average.
I currently don't apply any adjustment by market, however the script has a `scaleVolumeBy` feature that let you adjust each source volume according to an arbitrary ratio.
I'm not aware of any agreed weighting, but abit has publicly expressed his opinions, and this topic has been discussed multiple times here and on telegram.
I agree that some volumes (and trade history) seems faked, so I'll take some time to forge an updated opinion and scale my volumes accordingly.
I'll keep you informed.

Offline matle85

  • Full Member
  • ***
  • Posts: 69
    • View Profile
Re: [Witness Proposal] 1.6.129 - zapata42-witness
« Reply #34 on: November 17, 2018, 11:34:18 am »
I'm not aware of any agreed weighting, but abit has publicly expressed his opinions, and this topic has been discussed multiple times here and on telegram.
I agree that some volumes (and trade history) seems faked, so I'll take some time to forge an updated opinion and scale my volumes accordingly.
I'll keep you informed.

Thanks Zapata and just to say, reading through all your posts I'm really impressed by the professional approach you have to this work. You're a great asset to the community.

It would be really interesting to see how the prices at different exchanges vary over time. That will show if some are skewing the price and causing some of the odd effects that Bitcrab & others are concerned about around discounts and force settlements etc.

It may be we consider some more reliable / relevant than others for bitCNY specifically. If the weighting is transparent and justified then it would be fine in my view to give some greater weight and others a reduced weight.
« Last Edit: November 17, 2018, 12:06:24 pm by matle85 »