alipirpiran / Crypto-Price-Tracker-for-Gnome-Shell

An extension for Gnome-Shell to track price of crypto-currencies
https://extensions.gnome.org/extension/2817/crypto-price-tracker/
MIT License
47 stars 13 forks source link

feature to allow to set which exchange per pair #17

Closed azorpax closed 1 year ago

azorpax commented 1 year ago

There are some pairs that are not available in some currently supported exchanges (Binance and OKX). eg. BNB/USDT is available in Binance but not in OKX CRO/USDT is available in OKX but not in Binance etc...

Currently, we get the price from the supported exchange which is Binance and OKX, and we can only select one exchange to be used for all the pairs.

This request will allow the user to set an exchange per pair. With this request, I'm thinking we could add an option during adding a pair to select a specific exchange or use the active exchange.

Any thoughts?

alipirpiran commented 1 year ago

Yes its good idea. In the add coin section, we can add options to select specific exchange, and an option for default or active ... exchange. Or we can remove the section that is for selecting exchange, and the user just select exchange when adding new pair.

azorpax commented 1 year ago

I like the idea of removing the section for selecting an exchange. with that, we don't need an additional handler for those pairs that have no specific exchange defined. In relation to that, I have a question about how we are going to handle the old data of the users that have no defined exchange if we implement this. Do you have any idea or reference on how we can fix those data?

alipirpiran commented 1 year ago

I think we can check current active exchange for those users. And in the init function or the function that is setting the coins array,whene we get coins from setting, check for each coin, if exchange property is null, set current active exchange for them and save it. Because we just delete exchange section from ui, and active exchange is stil saved because it is in the schema file. And next time, all the coins have their specific exchange and the active exchange in the schema file become useless.

azorpax commented 1 year ago

alright, I got the idea. you can assign this to me if you want.

alipirpiran commented 1 year ago

Ok, thanks. For the schema file we neet to compile it again after edit it. Do you know the command?

azorpax commented 1 year ago

Yes, with this guide. https://gjs.guide/extensions/development/preferences.html#compiling-the-schema

I'm going to add a new property named "exchange" with a default value of "Binance"