-
Notifications
You must be signed in to change notification settings - Fork 1
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
Countries and Currencies #5
Comments
Looks good to me. I like the dispatchability here. |
Hi All, I forked Currencies.jl to create its equivalent for CryptoCurrencies. If it make sense I'm happy to move the later to JuliaFinance or maybe integrate it to Currencies.jl in some way? In the former case, an AbstractCurrency type may need to be created to cover both types. |
Hi @roshii , I'm a little confused. I'm curious why you needed to fork when Currencies.jl was already designed with cryptocurrency in mind. What was missing? What is different about CryptoCurrencies.jl? |
Hi @EricForgy I have just created a custom csv with cryptocurrencies data and removed the numeric Your package only refers to the official ISO currency list on which crypto aren't listed |
Hi @roshii, That makes sense, but if you are ok, it might be better to include your CSV file in Currencies.jl somehow rather than create a separate repo with a large code overlap. I think if someone does: julia> using Currencies it should just pick up the ISO currencies without the crypto stuff. To get the cryptostuff, I think you should do something like julia> using Currencies, Currencies.Crypto I think this would make a good addition to Currencies.jl. What do you think? |
That would be great! |
Hi guys 👋
I spent more time than I'd like to admit thinking about countries and currencies 😅
In #4 , we discussed a few ways to handle countries and currencies.
An obvious starting point would be to make them
enum
s, but then to dispatch we'd need to dispatch on values and that did not seem ideal. Furthermore, with enums, it is difficult for a user to extend the list of countries or currencies. Given the cryptocurrency craze the last couple years, it makes sense to be able to define your own currency. Similarly, for similations, you may want to create your own country.We also discussed a little bit about a vision of the future involving Holy traits.
Taking all this together, plus a few days of trial an error, I finally came up with something I think might be "OK" and I'm really interested in getting some feedback.
Countries and currencies are now singleton types defined as
Then I run through a list and define
Currencies.jl
There are three methods defined for currencies:
name
code
unit
used as follows:
Countries.jl
There are eight methods defined for countries:
name
code
capital
continent
isdeveloping
region
subregion
currencies
used as follows:
Finally, I moved the original Currencies.jl written by @TotalVerb to CurrencyBaskets.jl.
Please let me know what you think 😊
@simonbyrne @felipenoris @tk3369 @alecloudenback et al
The text was updated successfully, but these errors were encountered: