btcpayserver / btcpayserver

Accept Bitcoin payments. Free, open-source & self-hosted, Bitcoin payment processor.
https://btcpayserver.org/
MIT License
6.27k stars 1.63k forks source link

Set Current Rates source: in API or predefined settings for all stores. #3884

Closed hell0-w closed 2 years ago

hell0-w commented 2 years ago

Discussed in https://github.com/btcpayserver/btcpayserver/discussions/3882

Originally posted by **hell0-w** June 18, 2022 Good day to everyone I have some problems when I create a new store. First is: Where is the sting for (store/rates/Default: Current Rates source) price in USD in API? Faced an issue that I couldn’t get the price of DOGE. The default settings for store is: to get the price from Coingecko. But Price for doge somehow gets from Bittrex. Maybe the main problems are in the hosting provider where my VM is installed(don’t want to change it, or use VPN). I want to solve this issue or have the functionality to bypass and finally solve it. Second: Can it be predefined via an Advanced rate rule scripting settings when I create a new store? So all new stores and existing will have the same settings? My testing: Store settings: Created new store Add wallet to coin Doge Didn’t change any option (Default: Current Rates source is coingecko.) Create invoice Got error: 06/18/2022 12:49:25:Info Creation of invoice starting 06/18/2022 12:49:25:Info DOGE_USD: The rating rule is bittrex(DOGE_BTC) * coingecko(BTC_USD) 06/18/2022 12:49:25:Info DOGE_USD: The evaluated rating rule is ERR_RATE_UNAVAILABLE(bittrex, DOGE_BTC) * 19227.517 06/18/2022 12:49:25:Error DOGE_USD: Rate rule error (RateUnavailable) 06/18/2022 12:49:25:Error DOGE_USD: Exception reaching exchange bittrex (error code: 1020) If I open page I see this: https://btcpay.local/api/rates?storeId={storeid} {"error":"You need to setup the default currency pairs in 'Store Settings / Rates' or specify 'currencyPairs' query parameter (eg. BTC_USD,LTC_CAD)."} If I do testing pair DOGE_USD I got this error and no matter which source is chosen DOGE_USD ERR_RATE_UNAVAILABLE(bittrex, DOGE_BTC) * ERR_RATE_UNAVAILABLE(bittrex, BTC_USD) If I open link source https://bittrex.com/api/v1.1/public/getmarketsummaries i got this: Sorry, you’re not able to access this page. The page you are trying to access isn’t available to you in the locale you are accessing from. If you think you are seeing this by mistake, please contact Bittrex Support. I found how to solve this from the Advanced rate rule scripting: // Default rate rules for LTC LTC_X = LTC_BTC * BTC_X; LTC_BTC = coingecko(LTC_BTC); //////// BTC_USD = coingecko(BTC_USD); //////// // Default rate rules for DOGE DOGE_X = DOGE_BTC * BTC_X; DOGE_BTC = coinbasepro(DOGE_BTC); //////// X_X = coinbasepro(X_X); //////// //////// // Default rate rules for LTC DASH_X = DASH_BTC * BTC_X; DASH_BTC = coinbasepro(DASH_BTC); But I can’t set this value when I create a new store or predefined it for all stores. Checked api coigecko, the price exist, from Advanced rate rule scripting couldn't get it work, only coinbasepro working. https://api.coingecko.com/api/v3/simple/price?ids=dogecoin&vs_currencies=usd Can we make this functionality in API? Thanks for the answers.
pavlenex commented 2 years ago

Please do not open issues when there's a discussion opened already.