[idea]new cny price feed

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

Ok, I have it reading 6.59 CNY/NBT from the OKCoin and BTCChina tickers. I’m looking for advice on the best way to go about this. Do I need to submit a motion? I need to switch the server over, so I’m unsure whether it breaks contract or not. Also, all participants will go down until they update their clients.

I say do a fully dressed experimental run first. What if the okcoin price feed doesn’t work out?

current peg is broken anyway.

What do you mean by ‘doesn’t work out’? What’s a ‘fully dressed run’? The feed gives the correct price. It’s just reading it off the alp website. Did we do a ‘fully dressed run’ for any of the other feeds? The current peg is broken because of this, this would fix the peg.

I could run a dummy server, but the two prices are so wildly different that custodians on the dummy server would buy from the real server and people could easily lose a bunch of funds. If we do this properly and apply to the true server directly, no bot will place orders far from the server feed.

e.g. behaves irratically, is unreliable …

run the real server with the new feed and pay the participants to observe if the exchange and all participants work as intended with the new feed.

Isn’t running the real server with the price feed the same as implementation?

I watched the price feed for an hour or so yesterday. It read between 6.5 and 6.7. I’ll post a github fork later and you can check it out yourself, when you run the not it tells you what the price feed is because it’s out of compliance.

I gotta be honest, the price really starts deviating when the BTC price gets going. I dunno, give it a shot. There’s a live server at nupond.net port 3336.
DO NOT RUN ON BOTH CNY SERVERS AT ONCE
IF YOU LOSE MONEY IT’S NOT MY FAULT
https://github.com/Nagalim/alp-collection/tree/CNYfeed

This is a fully operational server.py script. It will put up your funds at the new price and it will credit it you, but I will not be processing payouts, so you will be doing this for free.

^now has a new update for plug and play on port 3336 (as well as several bug fixes). The pool is still not paying out, and you still shouldn’t run on both ports at once, but you should be able to just drop your info into the pool config file and it’ll run just fine.

P.S. when the grant passes all I have to do is change the port numbers, merge the branches, and restart the server script.