[idea]new cny price feed

The btc/cny price on bter now is more close to bitfinex-btc/usd combined with yahoo cny/usd price. if you use huobi’s high btc/cny price to derive nbt/cny you might open an arbitrage channel. the result could be that one side of the nbt/cny peg is always 0.

I’m confused, isn’t that currently the case? Isn’t huobi the arbitrage channel?

Well btc/cny on bter drifts. Sometimes it is more close to bitfinex. But now btc price is moving so bter seems more close to huobi price. Well I guess it doesn’t hurt to try huobi price .

I think you’ll find that bter btc price is only close to bitfinex btc price when huobi is too. If you check out the bottom of the btc section on coinmarketcap you’ll see all the Chinese exchanges (excluded for no trading fees) and they all have the same price. Using huobi as a price feed is certainly a solution to this problem, but it opens up others. Also, work to implement.

Ok, so I plan on using OkCoin with BTCChina as a backup:

https://www.okcoin.cn/api/ticker.do
https://data.btcchina.com/data/ticker

I’ll be using the ‘last price’

I will also be suggesting that LPs start using a 0.25% deviation instead of 0.15%, as this basically promotes CNY volatility to crypto-status rather than fiat.

@desrever What sources is your price stream server using for CNY? (I suppose it’s operational already, sorry I’m not very up-to-date on NuBot dev)

https://bitbucket.org/JordanLeePeershares/nubottrading/src/7dea551e0794f102b8bc904268e4c42e6e48b064/docs/FEEDS.md?at=master&fileviewer=file-view-default

and with yahoo price, which price will be used?

@desrever I think you should consider the solution we are applying here, but only for CNY. This is a super open-ended question of whether Nu follows black market price feeds or legitimate ones, but it really only applies to CNY. At least for now it does, who ever really know with fiat?

@huafei I don’t understand. The proposal is to not use feeds like yahoo anymore, and instead to calculate a blackmarket cny price indirectly using BTC/CNY and BTC/USD price feeds.

good , we are in the word of BTC:smiling_imp:

of course, if OkCoin experiences a flash dump or pump our CNY price would go crazy. This is actually a serious concern, and I’m sure we will see it in action as time goes on. However, there are ways to counteract it (have a maximum velocity for price changes) but I’m not going to be implementing them. NuBot may be able to do such advanced protections later.

that may fluctuate wildly and easily be subject to manipulation. why not taking an MA or EMA?

Cause that’s hard to implement. If you wanna help code it, I’d be happy to review and accept pushes on github.

I will see when a working version comes out.

1 Like

Do you agree that all price feeds would benefit from an EMA? Would it be best to implement such a price feed protection in NuBot rather than PyBot.

I thought nubot has already had such sophisticated price filtering implemented. @desrever

https://bitbucket.org/JordanLeePeershares/nubottrading/src/7dea551e0794f102b8bc904268e4c42e6e48b064/src/main/java/com/nubits/nubot/pricefeeds/feedservices/BitfinexPriceFeed.java?at=master&fileviewer=file-view-default

This is the price feed for BitFinex. It’s possible the bot does something with the price feed deeper in, but it looks to me like it grabs the last price and/or the the average between buy and sell.

Probably. An moving average doesn;t look difficult to implement. You record the last N lastPrice (in class variables i guess) and return the average of them.

I’d wait for @desrever’s comment.

Black CNY vs white CNY is something I was not aware of. Please advise me and I’ll implement it, I don’t know enough on the matter.

The average is already done internally both in price service and client-side as a protection mechanism, across feeds and across samples from the same feeds.

https://bitbucket.org/JordanLeePeershares/nubottrading/src/7dea551e0794f102b8bc904268e4c42e6e48b064/src/main/java/com/nubits/nubot/tasks/PriceMonitorTriggerTask.java?at=master&fileviewer=file-view-default#PriceMonitorTriggerTask.java-566

1 Like

Thanks!

Official on-shore CNY’s midian price is announced by PBOC and prices are allowed to float within a band, enforced by several hundred billion USD liquidity walls from Chinese banks. Off-shore CNH is traded by overseas banks and its price is determined by the market. CNH is separated from CNY via captital control schemes enforced by the CN government. CNH has limited arbitrage channel with CNY. The price of Yuan anywhere in the world is determined by its proximity to CNY or CNH and friction of deposite/withdrawals.

3 Likes