Author Topic: price feeding review  (Read 2127 times)

0 Members and 1 Guest are viewing this topic.

Offline bitcrab

  • Committee member
  • Hero Member
  • *
  • Posts: 1067
    • View Profile
  • BitShares: bitcrab
  • GitHub: bitcrab
price feeding review
« on: November 06, 2018, 03:57:47 am »
price feeding become more critical after the BSIP42 implementation.

currently the feed price in CNY is 4.5% lower than the latest price, in the past several days the gap was even bigger.


according to the negative feedback logic, it's possible and acceptable that the feed price be lower than the latest price, but we still need to review whether there are some flaws here that may hurt the ecosystem.

there are always some price gap between DEX and CEX, if the gap is not big enough, we can not expect the gap be removed by arbitrage,if the CEX price keeps a little lower than DEX price, the negative feedback algorithm may respond and reduce the feed price, in some extreme situation the reducing feed price may trigger continuous margin call which is not so necessary.

while reducing feed price directly lead to margin call that force sell, increasing feed price do not lead to force buy, witnesses need to be more careful while reducing the feed price.

I suggest that we can introduce a "protect discount limit" in the price feeding algorithm, if the smartcoin discount is not bigger than this limit, algorithm does not start the negative feedback process.

that's why gdex-witness updated the algorithm as below:

Code: [Select]
Pdex:BTS price in DEX in smartcoin
Pf: current feed price
premium: current premium

scale=1;
get Pdex, Pf, premium;

while True:
   
   get Pdex, Pf, premium;
   if 0.3%>premium>-0.5%: ##just adopt the current median if the absolute premium is low enough.
       feed price = Pf;
   else:
       feed price = Pf*(1+premium*scale);
   time.sleep(120); ##update every 2 minutes.

I also suggest that each witness publish the price feed algorithm, which can help proxies to review and evaluate the witness work.


Offline binggo

  • Hero Member
  • *****
  • Posts: 698
    • View Profile
Re: price feeding review
« Reply #1 on: November 06, 2018, 07:06:18 am »
I suggest to choose the highest price as the last feed price  from the CEX price and the dynamically feed price.

https://bitsharestalk.org/index.php?topic=27357.0
« Last Edit: November 06, 2018, 11:17:11 am by binggo »

Offline sschiessl

Re: price feeding review
« Reply #2 on: November 06, 2018, 09:04:48 am »
price feeding become more critical after the BSIP42 implementation.

currently the feed price in CNY is 4.5% lower than the latest price, in the past several days the gap was even bigger.


according to the negative feedback logic, it's possible and acceptable that the feed price be lower than the latest price, but we still need to review whether there are some flaws here that may hurt the ecosystem.

there are always some price gap between DEX and CEX, if the gap is not big enough, we can not expect the gap be removed by arbitrage,if the CEX price keeps a little lower than DEX price, the negative feedback algorithm may respond and reduce the feed price, in some extreme situation the reducing feed price may trigger continuous margin call which is not so necessary.

while reducing feed price directly lead to margin call that force sell, increasing feed price do not lead to force buy, witnesses need to be more careful while reducing the feed price.

I suggest that we can introduce a "protect discount limit" in the price feeding algorithm, if the smartcoin discount is not bigger than this limit, algorithm does not start the negative feedback process.

that's why gdex-witness updated the algorithm as below:

Code: [Select]
Pdex:BTS price in DEX in smartcoin
Pf: current feed price
premium: current premium

scale=1;
get Pdex, Pf, premium;

while True:
   
   get Pdex, Pf, premium;
   if 0.3%>premium>-0.5%: ##just adopt the current median if the absolute premium is low enough.
       feed price = Pf;
   else:
       feed price = Pf*(1+premium*scale);
   time.sleep(120); ##update every 2 minutes.

I also suggest that each witness publish the price feed algorithm, which can help proxies to review and evaluate the witness work.

The ''protect discount limit' is -0.5% is that algorithm?

Offline johnson

  • Full Member
  • ***
  • Posts: 93
    • View Profile
Re: price feeding review
« Reply #3 on: November 06, 2018, 02:14:56 pm »
0.5% is not enough.  at least 1%

Offline johnson

  • Full Member
  • ***
  • Posts: 93
    • View Profile
Re: price feeding review
« Reply #4 on: November 07, 2018, 04:49:20 am »
这个算法有个问题,就是起始的时候,那个喂价如果是偏离理想值的,那么就会导致经过很长的时间也调整不到理想值。

算法里,至少要考虑一下内盘的价格。完全依赖充值费率这个间接因素有很多弊端。

尤其是当市场不景气,充值提现的人都很少的时候,充值费率就更不能保证客观了。

如果你坚持认为当前的充值费率就代表了市场对bitcny的需求,那么,按照当前的喂价,就应该去打压抵押单,减少bitcny
的产量。就应该有强清,你为什么又要取消强清呢?

我们的目的是什么?维持bitcny的锚定精准?要锚定精准,就要动态的调节bitcny产量, 那该强清的时候就强清。但是,这么一来,
肯定打压了人们参与bts的积极性。
所以,我们的目标不仅仅是维持bitcny的锚定精准,更是要维护bts的发展。

所以,当喂价过低的时候,就应该把喂价提高,bitcny折价到1%有什么关系?5%有什么关系?吸引人们进入bts系统,这才是最关键的。





Offline bitcrab

  • Committee member
  • Hero Member
  • *
  • Posts: 1067
    • View Profile
  • BitShares: bitcrab
  • GitHub: bitcrab
Re: price feeding review
« Reply #5 on: November 07, 2018, 07:49:19 am »
这个算法有个问题,就是起始的时候,那个喂价如果是偏离理想值的,那么就会导致经过很长的时间也调整不到理想值。

算法里,至少要考虑一下内盘的价格。完全依赖充值费率这个间接因素有很多弊端。

尤其是当市场不景气,充值提现的人都很少的时候,充值费率就更不能保证客观了。

如果你坚持认为当前的充值费率就代表了市场对bitcny的需求,那么,按照当前的喂价,就应该去打压抵押单,减少bitcny
的产量。就应该有强清,你为什么又要取消强清呢?

我们的目的是什么?维持bitcny的锚定精准?要锚定精准,就要动态的调节bitcny产量, 那该强清的时候就强清。但是,这么一来,
肯定打压了人们参与bts的积极性。
所以,我们的目标不仅仅是维持bitcny的锚定精准,更是要维护bts的发展。

所以,当喂价过低的时候,就应该把喂价提高,bitcny折价到1%有什么关系?5%有什么关系?吸引人们进入bts系统,这才是最关键的。

margin call已经可以起到打压的作用了,根本用不着强清,强清就是个鸡肋,还是动不动就惹麻烦的鸡肋。

不可能放弃锚定精准这一目标。

Offline binggo

  • Hero Member
  • *****
  • Posts: 698
    • View Profile
Re: price feeding review
« Reply #6 on: November 07, 2018, 12:45:54 pm »
这个算法有个问题,就是起始的时候,那个喂价如果是偏离理想值的,那么就会导致经过很长的时间也调整不到理想值。

算法里,至少要考虑一下内盘的价格。完全依赖充值费率这个间接因素有很多弊端。

尤其是当市场不景气,充值提现的人都很少的时候,充值费率就更不能保证客观了。

如果你坚持认为当前的充值费率就代表了市场对bitcny的需求,那么,按照当前的喂价,就应该去打压抵押单,减少bitcny
的产量。就应该有强清,你为什么又要取消强清呢?

我们的目的是什么?维持bitcny的锚定精准?要锚定精准,就要动态的调节bitcny产量, 那该强清的时候就强清。但是,这么一来,
肯定打压了人们参与bts的积极性。
所以,我们的目标不仅仅是维持bitcny的锚定精准,更是要维护bts的发展。

所以,当喂价过低的时候,就应该把喂价提高,bitcny折价到1%有什么关系?5%有什么关系?吸引人们进入bts系统,这才是最关键的。

margin call已经可以起到打压的作用了,根本用不着强清,强清就是个鸡肋,还是动不动就惹麻烦的鸡肋。

不可能放弃锚定精准这一目标。

不可能放弃锚定精准这一目标,

If we can call this is market manipulation?it really is.

Offline johnson

  • Full Member
  • ***
  • Posts: 93
    • View Profile
Re: price feeding review
« Reply #7 on: November 07, 2018, 02:37:43 pm »
算法里的premium 怎么算出来的?是鼓鼓的充值提现费率吗?

Offline bitcrab

  • Committee member
  • Hero Member
  • *
  • Posts: 1067
    • View Profile
  • BitShares: bitcrab
  • GitHub: bitcrab
Re: price feeding review
« Reply #8 on: November 11, 2018, 09:44:21 am »
now as I know at least gdex, abit, btspp, magicwallet has adopt "discount tolerance" (other name for "protect discount limit" and I think it is better).

it means that while the smartcoin discount is low enough, price feeding program dot not reduce feed price.

no need to treat premium as same as discount, it's ok not to tolerate premium or just set a little limit for tolerance.

gdex now adopt a limit of -0.5%-0.3%, we plan to upgraded it to -1%-0.3% next time.

the "discount tolerance" can give the market some space, if there's 0 tolerance, DEX price have to adapt closely following CEX price and give DEX users little space.

hope more witnesses can adopt "discount tolerance" method, not only in CNY, but also in USD price feeding.   
« Last Edit: November 15, 2018, 10:21:15 am by bitcrab »

Offline ljk424

  • Full Member
  • ***
  • Posts: 83
    • View Profile
  • BitShares: ljk424
Re: price feeding review
« Reply #9 on: November 14, 2018, 08:28:40 am »
support bitcrab

Offline yamtt

  • Jr. Member
  • **
  • Posts: 43
    • View Profile
Re: price feeding review
« Reply #10 on: November 14, 2018, 09:03:13 am »
支持巨蟹

Offline bitcrab

  • Committee member
  • Hero Member
  • *
  • Posts: 1067
    • View Profile
  • BitShares: bitcrab
  • GitHub: bitcrab
Re: price feeding review
« Reply #11 on: November 15, 2018, 10:22:24 am »
算法里的premium 怎么算出来的?是鼓鼓的充值提现费率吗?

premium =Pcex/Pdex-1

Offline johnson

  • Full Member
  • ***
  • Posts: 93
    • View Profile
Re: price feeding review
« Reply #12 on: November 15, 2018, 11:46:14 pm »
算法里的premium 怎么算出来的?是鼓鼓的充值提现费率吗?

premium =Pcex/Pdex-1

这个和充值费率没关系啊。而且也不是负反馈啊。就是内盘跟随外盘联动而已。把内盘和外绑定在一起。如果外盘动,内盘跟随。如果内盘动,就把喂价向相反方向操作。
总的效果就是把内盘活力压制了。导致内盘交易积极性下降。
这个算法和你当初号召喂价改革的初衷不同啊。当时你说内盘交易量大,应该让喂价回归内盘,让内盘有定价权。
但是你仔细看看这个算法,定价权完全交给外盘了

还有一点,你希望bitcny 锚定精准。但是这个喂价公式里没有bitcny 相关的东西。
而且锚定精准与否要看承兑商的手续费计算公式。那个算法你知道么?我比较担心的是,承兑商的算法
有问题,导致喂价算法去适应它,这样看似锚定精准了,但是却是在一个非正常的平衡点

Offline bitcrab

  • Committee member
  • Hero Member
  • *
  • Posts: 1067
    • View Profile
  • BitShares: bitcrab
  • GitHub: bitcrab
Re: price feeding review
« Reply #13 on: November 16, 2018, 08:21:01 am »
price feeding is so important for Bitshares and it need witnesses to pay more attention and efforts on this.

witnesses need to publish their algorithm to for voters to evaluate and check with the real feed price.

the published algorithm need to include

1. how the premium is calculated out.
2. how the feed price is calculated out based on premium and other factors.

I am sorry that I'll use my voting power to push this thing, after 20th, Nov, I may update voting on witnesses if the behavior on this is not satisfactory. 
« Last Edit: November 16, 2018, 10:00:00 am by bitcrab »

Offline xeroc

  • Board Moderator
  • Hero Member
  • *****
  • Posts: 12722
  • ChainSquad GmbH
    • View Profile
    • ChainSquad GmbH
  • BitShares: xeroc
  • GitHub: xeroc
Re: price feeding review
« Reply #14 on: November 16, 2018, 08:29:20 am »
price feeding is so important for Bitshares and it need witnesses to pay more attention and efforts on this.

witnesses need to publish their algorithm to evaluate and check with the real feed price.

the published algorithm need to include

1. how the premium is calculated out.
2. how the feed price is calculated out based on premium and other factors.

I am sorry that I'll use my voting power to push this thing, after 20th, Nov, I may update voting on witnesses if the behavior on this is not satisfactory. 
I agree with this, assuming that satisfactory == transparent.

This finally leads to requiring more transparency from witnesses and their actions. The times where witnesses just needed to setup "some script" and keep their block producers reliable are over. Competition is heating up and witnesses have to be more pro-active.

I used to have a rather lose set of requirements from witnesses - this will change.
Give BitShares a try! Use the http://testnet.bitshares.eu provided by http://bitshares.eu powered by ChainSquad GmbH

Offline valera

Re: price feeding review
« Reply #15 on: November 16, 2018, 08:29:40 am »
Absolutely agree with you about publishing ! I feel the same !

Offline johnson

  • Full Member
  • ***
  • Posts: 93
    • View Profile
Re: price feeding review
« Reply #16 on: November 16, 2018, 09:57:42 am »
price feeding is so important for Bitshares and it need witnesses to pay more attention and efforts on this.

witnesses need to publish their algorithm to evaluate and check with the real feed price.

the published algorithm need to include

1. how the premium is calculated out.
2. how the feed price is calculated out based on premium and other factors.

I am sorry that I'll use my voting power to push this thing, after 20th, Nov, I may update voting on witnesses if the behavior on this is not satisfactory.
support

Offline Thom

Re: price feeding review
« Reply #17 on: November 16, 2018, 02:38:19 pm »
I will resume cny and usd feeds when a proper fix is available thru MCR AND a reasonable algo is established that doesn't need minute by minute "adjustments".

We actually can't be certain without doubt bitcrab's objectives can be achieved through MCR, but that is our best hope. Time will tell.

I'm not a fan of rushing when it comes to these things. I wish more witnesses would think independently and question what is actually going on, not just trust in proxies blindly.

I also wish more witnesses took their roll more seriously and work to set standards and conventions, to "tighten the ship" and consider the many factors, not only focus on 1 or 2 aspects like feeds. Very few are even wiling to discuss those matters, such as better ways to track witness operations. What can be automated and what are the metrics we could measure?

That is MY appeal to witnesses.
Injustice anywhere is a threat to justice everywhere - MLK |  Verbaltech2 Witness Reports: https://bitsharestalk.org/index.php/topic,23902.0.html

Offline matle85

  • Full Member
  • ***
  • Posts: 69
    • View Profile
Re: price feeding review
« Reply #18 on: November 16, 2018, 02:42:30 pm »
price feeding is so important for Bitshares and it need witnesses to pay more attention and efforts on this.

witnesses need to publish their algorithm to for voters to evaluate and check with the real feed price.

the published algorithm need to include

1. how the premium is calculated out.
2. how the feed price is calculated out based on premium and other factors.

I am sorry that I'll use my voting power to push this thing, after 20th, Nov, I may update voting on witnesses if the behavior on this is not satisfactory.

I agree price feeding is absolutely critical and the more transparent the better. The clearer we are on what is going on the easier it is to understand / discuss the various adjustments being considered.

Offline ouresw

  • Jr. Member
  • **
  • Posts: 23
    • View Profile
Re: price feeding review
« Reply #19 on: November 16, 2018, 03:11:34 pm »
Our views are slowly becoming more consistent in practice. From the beginning of the reform, I have always suggested that without the chain acceptance function, there is no objective judgment on whether the supply of bitCNY is sufficient or not. Based on this, the strength of the negative feedback should not be too large. In addition, the establishment of the chain acceptance function helps the commercialization and promotion of bitCNY. Now I think the most important thing is to discuss the feasibility of accepting on the chain. By the way, we can also "pull it."

Offline Thom

Re: price feeding review
« Reply #20 on: November 16, 2018, 03:28:17 pm »
Our views are slowly becoming more consistent in practice. From the beginning of the reform, I have always suggested that without the chain acceptance function, there is no objective judgment on whether the supply of bitCNY is sufficient or not. Based on this, the strength of the negative feedback should not be too large. In addition, the establishment of the chain acceptance function helps the commercialization and promotion of bitCNY. Now I think the most important thing is to discuss the feasibility of accepting on the chain. By the way, we can also "pull it."

WTH? "chain acceptance" "pull it" ? I do agree an lack of objective judgement for BitCNY supply being "sufficient", depends on who you ask. We've heard from bitcrab and his followers. The same thing can be said for all other bit assets.
Injustice anywhere is a threat to justice everywhere - MLK |  Verbaltech2 Witness Reports: https://bitsharestalk.org/index.php/topic,23902.0.html

Offline zapata42

  • Full Member
  • ***
  • Posts: 58
    • View Profile
  • BitShares: zapata42
Re: price feeding review
« Reply #21 on: November 16, 2018, 03:44:04 pm »
price feeding is so important for Bitshares and it need witnesses to pay more attention and efforts on this.

witnesses need to publish their algorithm to for voters to evaluate and check with the real feed price.

the published algorithm need to include

1. how the premium is calculated out.
2. how the feed price is calculated out based on premium and other factors.

I am sorry that I'll use my voting power to push this thing, after 20th, Nov, I may update voting on witnesses if the behavior on this is not satisfactory.

I agree transparency on pricefeed is a must.

You can find the up-to-date details of my algorithm there.

Note that, I always tryed to be the more transparent as I can:
  • My algorithm and the various changes are discused in my application thread.
  • My pricefeed code is public, and I always used the public version of the code.
  • I've build a tool to help shareholders to monitor the witnesses prices over time, and compare against each other, median feed/dex/cex prices.

Offline Thom

Re: price feeding review
« Reply #22 on: November 17, 2018, 03:13:09 am »
I find this talk of transparency somewhat disingenuous, as very few witnesses produce a report of their operations periodically.

I will soften that to the extent I don't monitor non-English publications, so if there are non-English witness reports out there, great. Would be nice to see them announced on a prominent platform or in the Bitshares_Witnesses channel of Telegram. I asked one Chinese speaker to translate for me once, but he never followed thru. Neither did I in finding another.

I think Google translate has probably gotten good enough where it is adequate to bridge the language barrier between Mandarin & English now.

I have very consistently published a monthly witness report, I have been more transparent than most witnesses in what I do each month. I have repeatedly stated I use bts_tools for my price feeds. That will change when the MCR fix is released, at which time I will use zapata's price feed script.

I have been publishing my reports on steemit, but given the recent changes on that platform I will be moving to the whaleshares platform. I have no idea which sites Chinese shareholders have access to, given their governments censorship of the internet. I will make it a point to update my witness proposal thread here on this forum, to at least provide a link to my full report on Whaleshares.

I encourage all witnesses to follow the lead of zapata and myself to improve your level of transparency of ALL of your witness operations, at least those that don't compromise security, not just transparency in how you produce feeds.

Maximum respect to you @zapata. As a relatively new witness you set a good example for others to follow.
« Last Edit: November 17, 2018, 03:15:11 am by Thom »
Injustice anywhere is a threat to justice everywhere - MLK |  Verbaltech2 Witness Reports: https://bitsharestalk.org/index.php/topic,23902.0.html

Offline ouresw

  • Jr. Member
  • **
  • Posts: 23
    • View Profile
Re: price feeding review
« Reply #23 on: November 17, 2018, 09:45:42 am »
Our views are slowly becoming more consistent in practice. From the beginning of the reform, I have always suggested that without the chain acceptance function, there is no objective judgment on whether the supply of bitCNY is sufficient or not. Based on this, the strength of the negative feedback should not be too large. In addition, the establishment of the chain acceptance function helps the commercialization and promotion of bitCNY. Now I think the most important thing is to discuss the feasibility of accepting on the chain. By the way, we can also "pull it."

WTH? "chain acceptance" "pull it" ? I do agree an lack of objective judgement for BitCNY supply being "sufficient", depends on who you ask. We've heard from bitcrab and his followers. The same thing can be said for all other bit assets.
ha! ha! ha!
The chain acceptance means is Exchange function between bitCNY and French currency,Sorry!  I can't find a word to express this meaning.
As for the translation of <pull it> into Chinese, it is to express that ,"扯一扯"!

Offline ouresw

  • Jr. Member
  • **
  • Posts: 23
    • View Profile
Re: price feeding review
« Reply #24 on: November 17, 2018, 09:54:04 am »
I find this talk of transparency somewhat disingenuous, as very few witnesses produce a report of their operations periodically.

I will soften that to the extent I don't monitor non-English publications, so if there are non-English witness reports out there, great. Would be nice to see them announced on a prominent platform or in the Bitshares_Witnesses channel of Telegram. I asked one Chinese speaker to translate for me once, but he never followed thru. Neither did I in finding another.

I think Google translate has probably gotten good enough where it is adequate to bridge the language barrier between Mandarin & English now.

I have very consistently published a monthly witness report, I have been more transparent than most witnesses in what I do each month. I have repeatedly stated I use bts_tools for my price feeds. That will change when the MCR fix is released, at which time I will use zapata's price feed script.

I have been publishing my reports on steemit, but given the recent changes on that platform I will be moving to the whaleshares platform. I have no idea which sites Chinese shareholders have access to, given their governments censorship of the internet. I will make it a point to update my witness proposal thread here on this forum, to at least provide a link to my full report on Whaleshares.

I encourage all witnesses to follow the lead of zapata and myself to improve your level of transparency of ALL of your witness operations, at least those that don't compromise security, not just transparency in how you produce feeds.

Maximum respect to you @zapata. As a relatively new witness you set a good example for others to follow.

Good suggestion!But it's best to use the proposal form to determine it.

Online btspp

Re: price feeding review
« Reply #25 on: November 17, 2018, 02:33:44 pm »
btspp-witness algorithm:

Code: [Select]
# => pseudocode
item = magicwallet_json.find{|item| item['datatype'] == '12h'}
premium = (item['depositFiatCNY'].to_f + item['withdrawFiatCNY'].to_f) / (item['depositBitCNY'].to_f + item['withdrawBitCNY'].to_f)
if premium < 0.99
  premium = [premium, 0.94].max
else
  premium = [[1.0, premium].max, 1.06].min
end
feed_price = current_feed_price * premium
« Last Edit: November 17, 2018, 02:36:07 pm by btspp »
Email:[email protected]
Website:http://btspp.io
Witness:btspp-witness

Offline yamtt

  • Jr. Member
  • **
  • Posts: 43
    • View Profile
Re: price feeding review
« Reply #26 on: November 17, 2018, 04:02:31 pm »
支持

Offline sahkan

  • Full Member
  • ***
  • Posts: 188
    • View Profile
    • BitShares DEX
Re: price feeding review
« Reply #27 on: November 17, 2018, 04:52:16 pm »
Witness sahkan-bitshares is using Zapata's script to provide the bsip price feeds. In addition to the script I utilize paid services from currencylayer and bitcoinaverage for more reliable currency pricing and increased api availability with closer to real time market pricing.

On second note, I believe that transparency or not, witnesses' job is to provide price feeds in accordance with current rules (ie BSIP42) and it should not matter if a particular witness agrees with it or not. This should also be true for the future, if there are any changes that are voted in, the witnesses should provide data according to those changes. What I don't agree with is making changes without voters approval.

price feeding is so important for Bitshares and it need witnesses to pay more attention and efforts on this.

witnesses need to publish their algorithm to for voters to evaluate and check with the real feed price.

the published algorithm need to include

1. how the premium is calculated out.
2. how the feed price is calculated out based on premium and other factors.

I am sorry that I'll use my voting power to push this thing, after 20th, Nov, I may update voting on witnesses if the behavior on this is not satisfactory.

I agree transparency on pricefeed is a must.

You can find the up-to-date details of my algorithm there.

Note that, I always tryed to be the more transparent as I can:
  • My algorithm and the various changes are discused in my application thread.
  • My pricefeed code is public, and I always used the public version of the code.
  • I've build a tool to help shareholders to monitor the witnesses prices over time, and compare against each other, median feed/dex/cex prices.

Offline abit

  • Committee member
  • Hero Member
  • *
  • Posts: 3482
    • View Profile
    • Steemit Blog
  • BitShares: abit
  • GitHub: abitmore
Re: price feeding review
« Reply #28 on: November 18, 2018, 05:35:52 pm »
Witness sahkan-bitshares is using Zapata's script to provide the bsip price feeds. In addition to the script I utilize paid services from currencylayer and bitcoinaverage for more reliable currency pricing and increased api availability with closer to real time market pricing.

Please be aware that bitcoinaverage's BTC price is not good since it consider USDT as 1:1 peg to USD. But actually USDT now is trading around 0.98 USD and it's volatile. See http://www.untether.space/ for more info.
BTS account: abit
BTS committee member: abit
BTS witness: in.abit

Offline Fox

Re: price feeding review
« Reply #29 on: November 19, 2018, 08:30:04 pm »
Using Zapata's script to provide feeds in a similar way he documented here with the following differences:
 - do NOT use ZB as a source
 - do NOT provide feed for AMAZONCOM
 - do source additional pricing data from paid subscriptions: Currency Layer

« Last Edit: November 19, 2018, 08:35:15 pm by Fox »
Witness: fox

Offline Bhuz

  • Committee member
  • Sr. Member
  • *
  • Posts: 424
    • View Profile
  • BitShares: bhuz
Re: price feeding review
« Reply #30 on: November 19, 2018, 11:23:45 pm »
I am using my own script for bsip42:
  • premium = (real_price / dex_price) - 1
  • feedprice = settlement_price * (1 + premium)  // having been one of the first to start applying bsip42 to bitusd this formula was pretty ok
  • main sources are AEX and ZB, both adjusted
  • usdt/usd ratio from Bittrex and Kraken
  • everything is volume weighted

Offline Bangzi

  • Full Member
  • ***
  • Posts: 182
    • View Profile
    • Steemit: Bangzi
  • BitShares: bangzi
Re: price feeding review
« Reply #31 on: November 20, 2018, 12:12:20 am »
Bangzi and winex.witness:

1) Premium:  1 - (TotalFiat / TotalBitCNY) from MagicWallet 24Hours Data

2) Threshold:
if 0.3% > Premium > -1%:
    Premium = 0
else:
    Premium = Premium

3) Feed Price = QuoteSettlementPrice * (1 + Premium)
Please Vote for My Witness: Bangzi
My Blog: https://steemit.com/@bangzi
请投票支持比特股见证人: Bangzi

Offline clockwork

  • Committee member
  • Full Member
  • *
  • Posts: 188
    • View Profile
  • BitShares: clockwork
Re: price feeding review
« Reply #32 on: November 20, 2018, 08:09:48 am »
so noone is actually using the fucking markets price anywhere? even though abit specifically said that it's DANGEROUS for everyone to use the lazy formula and it was just a stopgap measure?

good job guys...seriously...good job /s

Offline abit

  • Committee member
  • Hero Member
  • *
  • Posts: 3482
    • View Profile
    • Steemit Blog
  • BitShares: abit
  • GitHub: abitmore
Re: price feeding review
« Reply #33 on: November 20, 2018, 04:21:05 pm »
My algorithm:

* get BTC trading price from Kraken (BTC/fiatUSD), Bittrex (BTC/fiatUSD), AEX (USDT,CNC), ZB (USDT,QC), calculate USD/CNY price from these data
* get USDT/USD price from Kraken, Bittrex
* manually set ZB's QC price according to https://vip.zb.com/otc/trade/qc_cny?type=1, currently it's 1
* also got bitcny/fiatCNY price from magicwallet, AEX and ZB, but not using them

* get BTS trading price and volume from ZB(USDT,QC,BTC), AEX(USDT,CNC), Poloniex(BTC), Binance(BTC), Huobi(BTC,USDT), GDEX(BTC), CryptoBridge(BTC), Openledger(BTC), convert the price to CNY as well as USD using above data
* adjust BTS trading volume, currently, Poloniex_volume *0.2, ZB_volume *0.08, AEX_volume * 0.6, OpenLedger_volume *0.01
* calculate average BTS price weighted by adjusted volume

* get BTS/bitcny and BTS/bitusd price from DEX,
bitcny_premium = volume weighted average BTS price in CNY / price(BTS/bitcny) - 1
bitusd_premium = volume weighted average BTS price in USD / price(BTS/bitusd) - 1

* get current median feed price

* if premium > 0, new_feed_price = current_feed * (1+premium*1.2)
* if premium <=0 and premium >=-0.01, new_feed_price = current_feed
* if premium < -0.01, new_feed_price = current_feed * (1+premium*0.3)

Considering adding a blackswan protection to the algorithm.
« Last Edit: November 20, 2018, 04:24:41 pm by abit »
BTS account: abit
BTS committee member: abit
BTS witness: in.abit

Offline clockwork

  • Committee member
  • Full Member
  • *
  • Posts: 188
    • View Profile
  • BitShares: clockwork
Re: price feeding review
« Reply #34 on: November 20, 2018, 09:29:37 pm »
last one is too slow to respond to downward movements...

maybe it protects from sudden/big margin calls but peg goes to hell

need to keep a state of market price and factor the market movement into those equations

Offline clockwork

  • Committee member
  • Full Member
  • *
  • Posts: 188
    • View Profile
  • BitShares: clockwork
Re: price feeding review
« Reply #35 on: November 22, 2018, 09:38:47 am »
last one is too slow to respond to downward movements...

maybe it protects from sudden/big margin calls but peg goes to hell

need to keep a state of market price and factor the market movement into those equations

Quick example:

Let's assume bitUSD  is at premium and negative feedback has brought feed price to 15-20% above market price.

Suddenly, we have a big drop. BTS drops sharply.

People start selling bitUSD to buy BTS. Now bitUSD becomes oversupplied and moves to discount territory.

The algorithms above do not take reversals into account. Especially with that discount protection, the feed price will respond VERY VERY slowly, leading to:

 a) lost peg. A sudden 5% drop in the market with the feed price at +15% will only bring a tiny move downwards from the previous feed price. Thus market to feed price distance will increase which will FURTHER increase discount

b)  as squeeze protection kicks in, margins will pile up and not get eaten. Perhaps some of them shouldn't (by design) but not all of them.

In fact, we saw this during this downtrend with bitUSD going into discount. This means that bitUSD was oversupplied. Which means that effective MCR should be increased to tighten the peg, yet we had positions with a CR of 1.1 with their margins not being eaten.

Pure negative feedback does NOT work. it deals terribly with reversals and is way too slow to respond to sudden market moves.

We need a stateful feed algorithm that ALSO applies the market movement to the price.

e.g. if we're feeding 10% above market and still have a premium, this means that we should feed a bit higher than 10% over market.But if market has also dropped 5%, we need to take that into account and feed LOWER than what we were or completely overshoot.

Offline Bangzi

  • Full Member
  • ***
  • Posts: 182
    • View Profile
    • Steemit: Bangzi
  • BitShares: bangzi
Re: price feeding review
« Reply #36 on: November 22, 2018, 10:19:14 am »
@clockwork Since you are witness and you have the POWER to feed price, my advice is you can feed price based on your interpretation of BSIP42 and then other witnesses can observe your price feed and follow you if it work better.  8)
Please Vote for My Witness: Bangzi
My Blog: https://steemit.com/@bangzi
请投票支持比特股见证人: Bangzi

Offline clockwork

  • Committee member
  • Full Member
  • *
  • Posts: 188
    • View Profile
  • BitShares: clockwork
Re: price feeding review
« Reply #37 on: November 22, 2018, 10:29:05 am »
@clockwork Since you are witness and you have the POWER to feed price, my advice is you can feed price based on your interpretation of BSIP42 and then other witnesses can observe your price feed and follow you if it work better.  8)


And I will once I have some time to rewrite the script appropriately. In the meantime I'm putting thoughts up for discussion so we can cut out suggestions that are fundamentally wrong rather than experiment blindly.

 So I would appreciate any comments on the thought process above seeing as it is what stopped me feeding until I could figure it out.

We all saw how the "try it and we'll see how it goes" attitude worked (didn't) during this market turn.

Offline bitcrab

  • Committee member
  • Hero Member
  • *
  • Posts: 1067
    • View Profile
  • BitShares: bitcrab
  • GitHub: bitcrab
Re: price feeding review
« Reply #38 on: November 22, 2018, 11:20:23 am »
gdex planned to apply the "max premium" rule in feed price algorithm, also we'd like to show some relevant data in a webpage.

the main concept is to get the highest premium of smartcoin in the market, and calculate out the feed price according to the negative feedback logic.

what sense does "highest premium" make?

there are 2 purposes before us: (maybe there are more, now we focus on these 2)

A: make the smartcoin pegging accurate enough.

B. provide some operation space to the market, make the smartcoin ecosystem grow rapidly.

obviously BSIP42 contributed greatly to A, however, it seems what the BSIP42 policy slow purpose B, recently there are a lot of discussion and complaints in Chinese community, mainly the voice focus on:

BSIP42 narrowed the market space of BTS, in DEX, while trading pushed up the price in bitCNY, the feed price always go down as responding according to the negative feedback logic, BTS price in DEX have to follow BTS price in CEX, these discouraged more money to come.

reducing feed price cause more margin calling so need to be careful, increasing feed price do not bring direct hurt to traders.

all these are demanding us to optimize the price feeding after understanding the market, I'd like to try some change on the calculation of premium, the point is, calculate several premium out from different routes, finally select the highest one to feed.

for example, as shown below we calculated out premiums of bitCNY from 3 routes and finally adopt the highest one - 0.97%





as shown below we calculated out premiums of bitUSD from 2 routes and finally adopt the highest one - 1.6%





later we will publish this page, hope it can help BTSers to evaluate witnesses' work.
« Last Edit: November 22, 2018, 12:03:50 pm by bitcrab »

Offline clockwork

  • Committee member
  • Full Member
  • *
  • Posts: 188
    • View Profile
  • BitShares: clockwork
Re: price feeding review
« Reply #39 on: November 22, 2018, 11:48:20 am »

reducing feed price cause more margin calling so need to be careful, increasing feed price do not bring direct hurt to traders.


That is the whole point though.

We are changing the feed price in order to essentially change the effective MCR.

If we have a discount and need to increase demand, effective MCR needs to be increased so that people ARE called and their margins BUY bitUSD from the market thus increasing demand.

If we stop this from happening or those margin calls are way too far from the market price, the effect is lost... this is why BSIP 42 worked well so far when we had a premium against a ranging market, but completely failed to keep the peg on discount on a dropping market (just look at the charts).

It is not nice for those with lower CR but it IS the way to keep a tight peg. And hopefully peopel will learn to keep their CRs high enough.

Online zhouxiaobao

Re: price feeding review
« Reply #40 on: November 22, 2018, 12:02:11 pm »
gdex planned to apply the "max premium" rule in feed price algorithm, also we'd like to show some relevant data in a webpage.

the main concept is to get the highest premium of smartcoin in the market, and the calculate out the feed price according to the negative feedback logic.

what sense does "highest premium" make?

there are 2 purposes before us: (maybe there are more, now we focus on these 2)

A: make the smartcoin pegging accurate enough.

B. provide some operation space to the market, make the smartcoin ecosystem grow rapidly.

obviously BSIP42 contributed greatly to A, however, it seems what the BSIP42 policy slow purpose B, recently there are a lot of discussion and complaints in Chinese community, mainly the voice focus on:

BSIP42 narrowed the market space of BTS, in DEX, while trading pushed up the price in bitCNY, the feed price always go down as responding according to the negative feedback logic, BTS price in DEX have to follow BTS price in CEX, these discouraged more money to come.

reducing feed price cause more margin calling so need to be careful, increasing feed price do not bring direct hurt to traders.

all these are demanding us to optimize the price feeding after understanding the market, I'd like to try some change on the calculation of premium, the point is, calculate several premium out from different routes, finally select the highest one to feed.

for example, as shown below we calculated out premiums of bitCNY from 3 routes and finally adopt the highest one - 0.97%





as shown below we calculated out premiums of bitUSD from 2 routes and finally adopt the highest one - 1.6%





later we will publish this page, hope it can help BTSers to evaluate witnesses' work.

verygood.希望一个点的折价容忍也一起推啊,这很重要,允许cny有波动范围,可以保持喂价稳定,减少过多的喂价上调和下调,就减少了爆仓风险呀。目前可以是一个点,下一步爆仓单消失了,建议可以放到-2%到+1%。

Offline xeroc

  • Board Moderator
  • Hero Member
  • *****
  • Posts: 12722
  • ChainSquad GmbH
    • View Profile
    • ChainSquad GmbH
  • BitShares: xeroc
  • GitHub: xeroc
Re: price feeding review
« Reply #41 on: November 22, 2018, 12:17:36 pm »
I agree with @clockwork.
It seems to be an art to find a balance. Certainly we've learned alot from
BSIP42 even though some people in the community declare it a failure
already.

Maybe we can learn the lessons in such a way that it tells us how to use
a dynamic MCR once we have the backend fixed.
Give BitShares a try! Use the http://testnet.bitshares.eu provided by http://bitshares.eu powered by ChainSquad GmbH

Offline bitcrab

  • Committee member
  • Hero Member
  • *
  • Posts: 1067
    • View Profile
  • BitShares: bitcrab
  • GitHub: bitcrab
Re: price feeding review
« Reply #42 on: November 22, 2018, 01:12:12 pm »
If we have a discount and need to increase demand, effective MCR needs to be increased so that people ARE called and their margins BUY bitUSD from the market thus increasing demand.

If we stop this from happening or those margin calls are way too far from the market price, the effect is lost... this is why BSIP 42 worked well so far when we had a premium against a ranging market, but completely failed to keep the peg on discount on a dropping market (just look at the charts).

It is not nice for those with lower CR but it IS the way to keep a tight peg. And hopefully peopel will learn to keep their CRs high enough.

some factors need to be taken into account while considering this.

as we know, BSIP42 is not completely applied on bitUSD, a compromise is finally reached that witnesses can select to or not to apply BSIP42 on bitUSD.

even though, I believe bitUSD behave much better with BSIP42 than without it.


Offline bitcrab

  • Committee member
  • Hero Member
  • *
  • Posts: 1067
    • View Profile
  • BitShares: bitcrab
  • GitHub: bitcrab
Re: price feeding review
« Reply #43 on: November 23, 2018, 10:39:53 am »
https://www.gdex.io/price here to check the premium data of bitCNY and bitUSD.

Offline clockwork

  • Committee member
  • Full Member
  • *
  • Posts: 188
    • View Profile
  • BitShares: clockwork
Re: price feeding review
« Reply #44 on: November 23, 2018, 11:04:41 am »
I agree with @clockwork.
It seems to be an art to find a balance. Certainly we've learned alot from
BSIP42 even though some people in the community declare it a failure
already.

Maybe we can learn the lessons in such a way that it tells us how to use
a dynamic MCR once we have the backend fixed.

Sure...

My suggestion for dynamic adjustment once the backend is fixed is the following:


Set a range and centerpoint for MSSR..

Obviously, MSSR can't go below 100% so if we keep 110 as the "centerpoint", we allow witnesses to manipulate MSSR up to 120%.

This is our first, go to weapon when fighting a premium or discount.

If premium, we reduce MSSR down to 100 to reduce sell pressure and allow DEX price to climb and close premium

If discount, we increase up to 120 to increase bitUSD supply and close discount.

If we reach either of the limits and STILL in premium or discount, then and ONLY then do we start adjusting the MCR.

Again, let's keep something like 175 as a centerpoint and a range within which we can increase or decrease (say 150-200).

This means that if you keep your collateral above the max end of the range , you know you're safe making the adjustments predictable.

If we go beyond those ranges again, just leave it at those maxiumums or minimums. Behaviour will be the same as we used to have when it comes to premium or discount (sans adjustment) but will happen much less often and within a smaller range.

When "returning" from those maximums or minimums, we do it reversely... bring MCR back to centerpoint and then adjust MSSR afterwards (if still needed)

Offline finn-bts

  • Full Member
  • ***
  • Posts: 56
    • View Profile
Re: price feeding review
« Reply #45 on: November 23, 2018, 01:31:47 pm »
https://www.gdex.io/price here to check the premium data of bitCNY and bitUSD.
I tried him out. He looks great. Thank you.

Offline Thom

Re: price feeding review
« Reply #46 on: November 23, 2018, 03:16:48 pm »
Since very few were willing to contribute to this thread, I am posting a link to it here. @clockwork's description / proposal of how to conduct testing to achieve a tighter peg with sane limits is exactly why I started it.
Injustice anywhere is a threat to justice everywhere - MLK |  Verbaltech2 Witness Reports: https://bitsharestalk.org/index.php/topic,23902.0.html

Offline xeroc

  • Board Moderator
  • Hero Member
  • *****
  • Posts: 12722
  • ChainSquad GmbH
    • View Profile
    • ChainSquad GmbH
  • BitShares: xeroc
  • GitHub: xeroc
Re: price feeding review
« Reply #47 on: November 26, 2018, 01:27:11 pm »
I agree with @clockwork.
It seems to be an art to find a balance. Certainly we've learned alot from
BSIP42 even though some people in the community declare it a failure
already.

Maybe we can learn the lessons in such a way that it tells us how to use
a dynamic MCR once we have the backend fixed.

Sure...

My suggestion for dynamic adjustment once the backend is fixed is the following:


Set a range and centerpoint for MSSR..

Obviously, MSSR can't go below 100% so if we keep 110 as the "centerpoint", we allow witnesses to manipulate MSSR up to 120%.

This is our first, go to weapon when fighting a premium or discount.

If premium, we reduce MSSR down to 100 to reduce sell pressure and allow DEX price to climb and close premium

If discount, we increase up to 120 to increase bitUSD supply and close discount.

If we reach either of the limits and STILL in premium or discount, then and ONLY then do we start adjusting the MCR.

Again, let's keep something like 175 as a centerpoint and a range within which we can increase or decrease (say 150-200).

This means that if you keep your collateral above the max end of the range , you know you're safe making the adjustments predictable.

If we go beyond those ranges again, just leave it at those maxiumums or minimums. Behaviour will be the same as we used to have when it comes to premium or discount (sans adjustment) but will happen much less often and within a smaller range.

When "returning" from those maximums or minimums, we do it reversely... bring MCR back to centerpoint and then adjust MSSR afterwards (if still needed)

We've discusses the general idea on telegram and in other threads already.
Glad to see a witness propose an actual implementation.

+5% I like it
Give BitShares a try! Use the http://testnet.bitshares.eu provided by http://bitshares.eu powered by ChainSquad GmbH

Offline nutela

  • Newbie
  • *
  • Posts: 3
    • View Profile
  • BitShares: nut3l4
Re: price feeding review
« Reply #48 on: November 27, 2018, 05:49:27 pm »


BSIP42 narrowed the market space of BTS, in DEX, while trading pushed up the price in bitCNY, the feed price always go down as responding according to the negative feedback logic, BTS price in DEX have to follow BTS price in CEX, these discouraged more money to come.



"BTS price in DEX have to follow BTS price in CEX" Not sure what you are trying to say, BTS price on CEX would be logically more expensive since the CEX needs to have a price premium to exist.

Offline bitcrab

  • Committee member
  • Hero Member
  • *
  • Posts: 1067
    • View Profile
  • BitShares: bitcrab
  • GitHub: bitcrab
Re: price feeding review
« Reply #49 on: November 28, 2018, 03:43:23 am »
I agree with @clockwork.
It seems to be an art to find a balance. Certainly we've learned alot from
BSIP42 even though some people in the community declare it a failure
already.

Maybe we can learn the lessons in such a way that it tells us how to use
a dynamic MCR once we have the backend fixed.

Sure...

My suggestion for dynamic adjustment once the backend is fixed is the following:


Set a range and centerpoint for MSSR..

Obviously, MSSR can't go below 100% so if we keep 110 as the "centerpoint", we allow witnesses to manipulate MSSR up to 120%.

This is our first, go to weapon when fighting a premium or discount.

If premium, we reduce MSSR down to 100 to reduce sell pressure and allow DEX price to climb and close premium

If discount, we increase up to 120 to increase bitUSD supply and close discount.

If we reach either of the limits and STILL in premium or discount, then and ONLY then do we start adjusting the MCR.

Again, let's keep something like 175 as a centerpoint and a range within which we can increase or decrease (say 150-200).

This means that if you keep your collateral above the max end of the range , you know you're safe making the adjustments predictable.

If we go beyond those ranges again, just leave it at those maxiumums or minimums. Behaviour will be the same as we used to have when it comes to premium or discount (sans adjustment) but will happen much less often and within a smaller range.

When "returning" from those maximums or minimums, we do it reversely... bring MCR back to centerpoint and then adjust MSSR afterwards (if still needed)

in most of the cases, in bitCNY market, there is little difference between MSSR=120% and MSSR=102%, as most of the margin call orders are filled at the price which is very close to market price, I don't think that adjusting MSSR will give impact to premium/discount.

Offline clockwork

  • Committee member
  • Full Member
  • *
  • Posts: 188
    • View Profile
  • BitShares: clockwork
Re: price feeding review
« Reply #50 on: November 28, 2018, 08:32:01 am »
Increasing MSSR will lower the margin call limit and eat away MORE of the bitUSD supply thus fighting discount without messing with MCR.

Similarly, decreasing MSSR will pull those orders away from market price to an extent thus fighting premium.

I think it should be our first adjustment before messing with MCR.

Offline abit

  • Committee member
  • Hero Member
  • *
  • Posts: 3482
    • View Profile
    • Steemit Blog
  • BitShares: abit
  • GitHub: abitmore
Re: price feeding review
« Reply #51 on: November 28, 2018, 11:01:55 am »
Increasing MSSR will lower the margin call limit and eat away MORE of the bitUSD supply thus fighting discount without messing with MCR.

Similarly, decreasing MSSR will pull those orders away from market price to an extent thus fighting premium.

I think it should be our first adjustment before messing with MCR.
Please keep in mind that if bitCNY is trading around par value, a big MSSR is only possible to pushes it away, especially when feed price is not adjusted.
BTS account: abit
BTS committee member: abit
BTS witness: in.abit

Offline clockwork

  • Committee member
  • Full Member
  • *
  • Posts: 188
    • View Profile
  • BitShares: clockwork
Re: price feeding review
« Reply #52 on: November 28, 2018, 11:06:46 am »
Increasing MSSR will lower the margin call limit and eat away MORE of the bitUSD supply thus fighting discount without messing with MCR.

Similarly, decreasing MSSR will pull those orders away from market price to an extent thus fighting premium.

I think it should be our first adjustment before messing with MCR.
Please keep in mind that if bitCNY is trading around par value, a big MSSR is only possible to pushes it away, especially when feed price is not adjusted.

if it's trading near par , then hardly any premium/discount exists hence no reason to adjust MSSR.

The whole concept is about it being dynamic to tighten the peg.

Then again BSIP42 is voted out so all this is irrelevant

Offline abit

  • Committee member
  • Hero Member
  • *
  • Posts: 3482
    • View Profile
    • Steemit Blog
  • BitShares: abit
  • GitHub: abitmore
Re: price feeding review
« Reply #53 on: November 28, 2018, 01:34:06 pm »
Since BSIP42 is voted out, I'm now feeding market price for CNY, with a floor to avoid global settlement.
Weighting algorithm didn't change.
BTS account: abit
BTS committee member: abit
BTS witness: in.abit

Offline clockwork

  • Committee member
  • Full Member
  • *
  • Posts: 188
    • View Profile
  • BitShares: clockwork
Re: price feeding review
« Reply #54 on: December 04, 2018, 10:01:17 am »
I agree with @clockwork.
It seems to be an art to find a balance. Certainly we've learned alot from
BSIP42 even though some people in the community declare it a failure
already.

Maybe we can learn the lessons in such a way that it tells us how to use
a dynamic MCR once we have the backend fixed.

Sure...

My suggestion for dynamic adjustment once the backend is fixed is the following:


Set a range and centerpoint for MSSR..

Obviously, MSSR can't go below 100% so if we keep 110 as the "centerpoint", we allow witnesses to manipulate MSSR up to 120%.

This is our first, go to weapon when fighting a premium or discount.

If premium, we reduce MSSR down to 100 to reduce sell pressure and allow DEX price to climb and close premium

If discount, we increase up to 120 to decrease bitUSD supply and close discount.

If we reach either of the limits and STILL in premium or discount, then and ONLY then do we start adjusting the MCR.

Again, let's keep something like 175 as a centerpoint and a range within which we can increase or decrease (say 150-200).

This means that if you keep your collateral above the max end of the range , you know you're safe making the adjustments predictable.

If we go beyond those ranges again, just leave it at those maxiumums or minimums. Behaviour will be the same as we used to have when it comes to premium or discount (sans adjustment) but will happen much less often and within a smaller range.

When "returning" from those maximums or minimums, we do it reversely... bring MCR back to centerpoint and then adjust MSSR afterwards (if still needed)