-
Notifications
You must be signed in to change notification settings - Fork 14
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feature/ars pricenode redundancy #17
Feature/ars pricenode redundancy #17
Conversation
@jmacxx Copying your last comment here to continue the conversation:
From your experience what would be the best way of doing this?
|
Yes, in general, something like that.
|
Awesome, to your point:
|
c2b0c2d
to
7db74c8
Compare
@jmacxx think this one is ready to start reviewing and start working our way towards merging. Please have a look when you have some time, thanks! 🙏 |
@rodvar I've started testing:
|
thanks for taking some time to test this @jmacxx ! Very helpful comments:
may I ask exactly which JDK are you using please? gonna try to repro this here |
|
ccee8d9
to
843badc
Compare
@jmacxx can you help me test this again, please? Do you still face the same exceptions? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Testing: working OK now, I have not changed JDK. I checked out your branch directly instead of applying the patch.
- Please rename BlueLyticsUsdRates to BlueLyticsDto
- Please rename BlueLyticsUsdRate to BlueLyticsService
- Please remove needless
this.
references. - Please include Bisq standard file header comment.
I'm curious as to why you choose to launch a BlueLytics reference data update triggered by the Bisq client querying the API, instead of periodically based on a timer. All the other reference data are periodic.
I'll probably have some more comments later, back to testing for now!
@rodvar I think your solution could be reconfigured to follow the Controller, Service, and Provider roles that are used in ExchangeRateController is the overall manager, containing an instance of each Service. It can pass the blue gaps to the ExchangeRateService before calling getAllMarketPrices. |
@jmacxx thanks for all the comments and greatly detailed suggestions, I'll get my hands on this ASAP. |
843badc
to
e368438
Compare
Hi @jmacxx ! I've done the requested changes (#17 (review)) now. I haven't had time to go through the last suggestion of changing the approach. On a surface level, it looks like the right thing to do though. |
Hi @rodvar I've requested another maintainer to review this PR. Regarding releases, pricenodes get upgraded when necessary, they are not tied to the Bisq client release schedule. So, no rush, and best to get the code right the first time. |
Hi @rodvar |
Hi @jmacxx, thanks for all the clarifications! That makes sense why a friend of mine was telling me that the ARS/BTC price is already fixed in the current Bisq 1.9.12... 😄 Hi @alvasw, looking forward to your review! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @rodvar!
Thank you for taking your time to implement solution for all ARS users. Because of you, Bisq will be usable there! 😄
It was easier for me to play around with your code to find a good solution. Hence, I forked your PR branch and to make some changes. Unfortunately, the changes are hard to put into individual code review comments.
I wanted to set you as the commit author before pushing the changes. Sadly, Git won't let me set you as an author because of the GPG signature.
Please set yourself as the author and push the commit to your PR branch! 😄
https://github.com/alvasw/bisq-pricenode/tree/implement_ars_exchange_rate_transformer
Review
-
I think you updated the bisq submodule by accident.
-
You made cosmetic changes in the
CoinGecko
,CoinGeckoTest
, andAbstractExchangeRateProviderTest
classes. It's better to commit these changes separately: "Refactor CoinGecko's ExchangeRateProvider", "Cleanup AbstractExchangeRateProviderTest" -
The majority of the price providers don't and won't support the blue rate. At the moment, only the CryptoYa provider supports it. Therefore, we should abstract away the blue rate concept and create a generic ExchangeRateTransformer that can be used for multiple use-cases in the future.
Afterward, we can hide the ARS blue rate transformation in the ArsBlueRateTransformer. This transformer only supports the Argentine Peso and exludes
ExchangeRate
s fromBlueRateProvider
s (CryptoYa
). -
You created your threading logic for the API calls to BlueLytics and handled all possible edge cases. The Timer class from the JDK does most of that already. Moreover, we can reuse
PriceProvider<T>
which already implements caching and threading for us.
bisq
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think you updated the submodule by accident.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
that's correct!
Hi @alvasw , thanks so much for this effort. I don't really care who the author is as long as we achieve this goal 💪 , but thank you! I'll review your fork changes and bring them in! 😄 I'll get my hands on this soon!!! |
@alvasw I've integrated your changes in now. Do you know why this is happening? ExchangeRateServiceTest > getAllMarketPrices_withSingleExchangeRate() FAILED 26 tests completed, 1 failed I'll dig into this ASAP and wrap up this PR, thanks! |
@rodvar please compare your branch to Alva's. Looks like a lot of dead code in yours, for example While testing (both yours and Alva's branches) I noticed that the price feed is only providing
|
@jmacxx I know I still have to clean up, but I did run it individually and the test was not passing (before my changes) |
252820a
to
b5aaf60
Compare
- Remove ban over ARS fiat - ExchangeRateProvider by default does not consider rates with blue markets. CryptoYimplementation does. - ExchangeRateService uses ubiquous place for generating the rates / consider bluemarket prices / update tests accordingly - avoid procesing of blue markets if its already handled by EP / move bluelytics to its own util package - bluelytics util is singleton and updates gap async less frequently (1hr) - make sure getMarkets won't gel blocked even on the first use of blue gap - naming conventions and docs
- setup cryptoya api price provider - add cryptoya pricenode provider - algorithm to decide rate based on fetched tickers - add test for new exchange rate provider - code review suggestions
04f37ba
to
21381db
Compare
- Implement ExchangeRateTransformer (@alvasw) - Implement BlueLyticsApi (@alvasw) - Implement ArsBlueMarketGapProvider (@alvasw) - Implement ArsBlueRateTransformer (@alvasw) - merge @alvasw improvements - fixed bug lossing prices after merge - fix tests, all green - delete unused code - comment most important methods/classes
21381db
to
d67f1e2
Compare
@jmacxx @alvasw OK guys, finally had some time to finish this up. Found the issue with the test and fixed it - I think this is ready to go please have a look :D |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
utACK
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
utACK
I still have not finished testing this PR. One question relates to the rate calculated from Bluelytics. It currently shows as 18052497. CryptoYa gives 19940160. Seems like a huge difference, has it been looked into?
Looking at the raw feed from https://criptoya.com/api/btc/ars/0.1 it shows most lineitems with around 19000000. But there is one that is very different, (ripioexchange) 34652283, so that inflates cryptoYa. Even if CryptoYa was correct, Bluelytics is way lower. |
Yes, @jmacxx I've seen this and been thinking about it, as you correctly pointed out: cryptoya values are a bit higher (sometimes way too high like ripio). Hence it is why in Argentina among the 50+ rates for the dollar one of them is called the "dollar crypto" which is an even higher value than the free/blue price. Crypto ya is sourcing from real CeFi exchanges that trade bitcoin in Argentina. I'm not an economist/financial person but I understand there is a fair bit of risk in these trades and some exchanges are more capable of handling those risks than others, that's why the big price is different. Our current algorithm is doing an average of all the exchange's sell price. For the redundancy, we use the blue dollar factor to estimate a real market value for the BTC. A fair question would be - Are we "arrogantly" adding these redundancy prices that in reality wouldn't be free traded in Argentina and therefore introducing some noise? Tapping on your knowledge of the platform here, what would be the final market price used for market comparison in Bisq from all these new price points we are adding? One option to do a better estimation would be:
Happy to work on this, I want to hear your comments first. |
We have 19 blue rates excluding ripio coming from cryptoYa and Binance, Average=19516121 Bisq Average=19459253. So the Bisq index is pulled down only 0.3% by the CoinGecko/bluelytics rate. |
@jmacxx Yeah not cool... how about we modify the averaging algorithm for Cryptoya to calculate the mean and the std deviation and exclude values out of the range [mean - 2sd, mean + 2sd ]? That would definitely kick out that huge Ripio value! I'm happy to work on this on another PR, just wanna know your thoughts first |
awesome guys! @alvasw @jmacxx |
Brief:
After merging pull request #15 we have a real market pricenode exhange rate provider of ARS/BTC, but its only one which is a liability for the system. This PR is meant to give redundancy to the ARS/BTC pricenode.
** Approach **
Use BlueLytics API to identify what's the gap multiplier ARS/USD and apply it to ARS/BTC since they are strictly correlated.
An example is provided from previous work but the approach is gonna be moved to the Service level to avoid tapping on individual exhange providers codes.
Related Issues:
This PR requires #14.
bisq-network/bisq#6601
Testing
Passing tests provided in this PR
Hope you enjoy reviewing this code, thanks!