diff --git a/CHANGELOG.md b/CHANGELOG.md
index 52a8733..6ebc4e9 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -2,6 +2,12 @@
Changelog
=========
+### [3.5.1][v3.5.1] ###
+
+Released 2018-01-13
+
+- Add `CURRENCY_DECIMAL_PLACES` setting to provide alternate number of decimal places for currency conversions.
+
### [3.5][v3.5] ###
@@ -168,4 +174,5 @@ Released 2014-08-09.
[v3.3.1]: https://github.com/deanishe/alfred-convert/releases/tag/v3.3.1
[v3.4]: https://github.com/deanishe/alfred-convert/releases/tag/v3.4
[v3.5]: https://github.com/deanishe/alfred-convert/releases/tag/v3.5
+[v3.5.1]: https://github.com/deanishe/alfred-convert/releases/tag/v3.5.1
[openx]: https://openexchangerates.org/
\ No newline at end of file
diff --git a/Convert-3.5.alfredworkflow b/Convert-3.5.1.alfredworkflow
similarity index 87%
rename from Convert-3.5.alfredworkflow
rename to Convert-3.5.1.alfredworkflow
index 4c8c4e0..4aa8852 100644
Binary files a/Convert-3.5.alfredworkflow and b/Convert-3.5.1.alfredworkflow differ
diff --git a/README.md b/README.md
index 0edf820..87e9cb9 100644
--- a/README.md
+++ b/README.md
@@ -90,15 +90,16 @@ The workflow is configured via the configuration sheet (`[𝒙]`) in Alfred Pref
Basic configuration is performed in the configuration sheet:
-| Option | Meaning |
-|-----------------------|-----------------------------------------------------------------------------------------------------------------------------------------------|
-| `APP_KEY` | API key for [openexchangerates.org][openx]. |
-| `COPY_UNIT` | Include unit when copying conversion result. Any value but `0` or empty turns this option on. |
-| `DECIMAL_PLACES` | Number of decimal places to show in results. |
-| `DECIMAL_SEPARATOR` | Character to separate whole numbers and decimal fractions. Used for parsing input and generating output. |
-| `DYNAMIC_DECIMALS` | Dynamically increase the number of decimal places (up to 10) so that the result is non-zero. Any value but `0` or empty turns this option on. |
-| `THOUSANDS_SEPARATOR` | Character to delimit thousands Used for parsing input and generating output. |
-| `UPDATE_INTERVAL` | How often (in minutes) to update currency exchange rates. |
+| Option | Meaning |
+|---------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------|
+| `APP_KEY` | API key for [openexchangerates.org][openx]. |
+| `COPY_UNIT` | Include unit when copying conversion result. Any value but `0` or empty turns this option on. |
+| `CURRENCY_DECIMAL_PLACES` | Overrides the default `DECIMAL_PLACES` setting for currency conversions. |
+| `DECIMAL_PLACES` | Number of decimal places to show in results. |
+| `DECIMAL_SEPARATOR` | Character to separate whole numbers and decimal fractions. Used for parsing input and generating output. |
+| `DYNAMIC_DECIMALS` | Dynamically increase the number of decimal places (up to 10) so that the result is non-zero. Any value but `0` or empty turns this option on. |
+| `THOUSANDS_SEPARATOR` | Character to delimit thousands Used for parsing input and generating output. |
+| `UPDATE_INTERVAL` | How often (in minutes) to update currency exchange rates. |
#### Active currencies ####
@@ -156,6 +157,7 @@ See [CHANGELOG][changelog] for more information.
| Release | Date |
|-----------------|----------------|
+| [3.5.1][v3.5.1] | 2018-01-13 |
| [3.5][v3.5] | 2018-01-12 |
| [3.4][v3.4] | 2017-12-26 |
| [3.3.1][v3.3.1] | 2017-11-21 |
@@ -219,6 +221,7 @@ All other code/media are released under the [MIT Licence][mit].
[v3.3.1]: https://github.com/deanishe/alfred-convert/releases/tag/v3.3.1
[v3.4]: https://github.com/deanishe/alfred-convert/releases/tag/v3.4
[v3.5]: https://github.com/deanishe/alfred-convert/releases/tag/v3.5
+[v3.5.1]: https://github.com/deanishe/alfred-convert/releases/tag/v3.5.1
[cryptocompare]: https://www.cryptocompare.com/
[openx]: https://openexchangerates.org/
[openx-free]: https://openexchangerates.org/signup/free
diff --git a/docs/currencies.md b/docs/currencies.md
index a0beb8b..730ac56 100644
--- a/docs/currencies.md
+++ b/docs/currencies.md
@@ -2,9 +2,16 @@
Supported Currencies
====================
+
+
- [Fiat currencies](#fiat-currencies)
- [Cryptocurrencies](#cryptocurrencies)
+- [Unsupported currencies](#unsupported-currencies)
+
+
+
+
Fiat currencies
---------------
@@ -187,12 +194,10 @@ The following fiat currencies are supported by the workflow:
| XAU | Gold |
| XBA | Bond Markets Unit European Composite Unit |
| XBB | Bond Markets Unit European Monetary Unit |
-| XBC | Bond Markets Unit European Unit of Account 9 |
| XBD | Bond Markets Unit European Unit of Account 17 |
| XCD | East Caribbean Dollar |
| XDR | SDR (Special Drawing Right) |
| XOF | CFA Franc BCEAO |
-| XPD | Palladium |
| XPF | CFP Franc |
| XPT | Platinum |
| XSU | Sucre |
@@ -205,6 +210,7 @@ The following fiat currencies are supported by the workflow:
+
Cryptocurrencies
----------------
@@ -241,7 +247,6 @@ The following cryptocurrencies are supported by the workflow:
| AHT | Ahoolee |
| AIB | AdvancedInternetBlock |
| AIR | AirToken |
-| AIR* | Aircoin |
| ALC | Arab League Coin |
| ALEX | Alexandrite |
| ALF | AlphaCoin |
@@ -265,7 +270,6 @@ The following cryptocurrencies are supported by the workflow:
| APT | Aptcoin |
| APX | Apx |
| ARB | Arbit Coin |
-| ARC* | ArcticCoin |
| ARCH | ArchCoin |
| ARCO | AquariusCoin |
| ARDR | Ardor |
@@ -279,7 +283,6 @@ The following cryptocurrencies are supported by the workflow:
| ASAFE | Allsafe |
| ASN | Ascension Coin |
| AST | AirSwap |
-| AST* | Astral |
| ATB | ATB coin |
| ATCC | ATC Coin |
| ATL | ATLANT |
@@ -347,12 +350,10 @@ The following cryptocurrencies are supported by the workflow:
| BM | BitMoon |
| BMC | Blackmoon Crypto |
| BNB | Binance Coin |
-| BNB* | Boats and Bitches |
| BNC | Benjacoin |
| BNT | Bancor Network Token |
| BNX | BnrtxCoin |
| BOAT | Doubloon |
-| BOB | Bob Coin |
| BOLI | BolivarCoin |
| BOMB | BombCoin |
| BON | BonesCoin |
@@ -374,7 +375,6 @@ The following cryptocurrencies are supported by the workflow:
| BRX | Breakout Stake |
| BS | BlackShadowCoin |
| BSC | BowsCoin |
-| BSD | BitSend |
| BST | BitStone |
| BSTAR | Blackstar |
| BSTK | BattleStake |
@@ -389,17 +389,14 @@ The following cryptocurrencies are supported by the workflow:
| BTD | Bitcloud |
| BTE | ByteCoin |
| BTG | Bitcoin Gold |
-| BTG* | BitGem |
| BTLC | BitLuckCoin |
| BTM | BitMark |
-| BTM* | Bytom |
| BTMI | BitMiles |
| BTPL | Bitcoin Planet |
| BTQ | BitQuark |
| BTS | Bitshares |
| BTTF | Coin to the Future |
| BTX | Bitcore |
-| BTX* | BitcoinTX |
| BTZ | BitzCoin |
| BUCKS | SwagBucks |
| BUK | CryptoBuk |
@@ -421,7 +418,6 @@ The following cryptocurrencies are supported by the workflow:
| CARBON | Carboncoin |
| CASH | CashCoin |
| CAT | BlockCAT |
-| CAT* | BitClave |
| CBD | CBD Crystals |
| CBX | CryptoBullion |
| CC | CyberCoin |
@@ -474,7 +470,6 @@ The following cryptocurrencies are supported by the workflow:
| CNL | ConcealCoin |
| CNMT | Coinomat |
| CNO | Coino |
-| CNT | Centurion |
| CNX | Cryptonex |
| COB | Cobinhood |
| COC | Community Coin |
@@ -489,7 +484,6 @@ The following cryptocurrencies are supported by the workflow:
| CORE | Core Group Asset |
| COSS | COSS |
| COV | Covesting |
-| COV* | CovenCoin |
| COVAL | Circuits of Value |
| COX | CobraCoin |
| CPC | CapriCoin |
@@ -500,7 +494,6 @@ The following cryptocurrencies are supported by the workflow:
| CRAIG | CraigsCoin |
| CRAVE | CraveCoin |
| CRBIT | Creditbit |
-| CRC | CraftCoin |
| CRE | Credits |
| CREA | CreativeChain |
| CREVA | Creva Coin |
@@ -752,7 +745,6 @@ The following cryptocurrencies are supported by the workflow:
| GGS | Gilgam |
| GHC | GhostCoin |
| GHOUL | Ghoul Coin |
-| GHS | Giga Hash |
| GIFT | GiftNet |
| GIG | GigCoin |
| GIM | Gimli |
@@ -798,7 +790,6 @@ The following cryptocurrencies are supported by the workflow:
| GUNS | GeoFunders |
| GUP | Guppy |
| GXC | Gx Coin |
-| GXC* | GenXCoin |
| HAC | Hackspace Capital |
| HAL | Halcyon |
| HALLO | Halloween Coin |
@@ -908,7 +899,6 @@ The following cryptocurrencies are supported by the workflow:
| KLC | KiloCoin |
| KMD | Komodo |
| KNC | Kyber Network |
-| KNC* | Khancoin |
| KOBO | KoboCoin |
| KOLION | Kolion |
| KORE | Kore |
@@ -974,7 +964,6 @@ The following cryptocurrencies are supported by the workflow:
| LYC | LycanCoin |
| M1 | SupplyShock |
| MAC | MachineCoin |
-| MAD | SatoshiMadness |
| MAID | MaidSafe Coin |
| MANA | Decentraland |
| MAPC | MapCoin |
@@ -983,7 +972,6 @@ The following cryptocurrencies are supported by the workflow:
| MARV | Marvelous |
| MARX | MarxCoin |
| MARYJ | MaryJane Coin |
-| MAT* | Manet Coin |
| MAX | MaxCoin |
| MAY | Theresa May Coin |
| MBI | Monster Byte Inc |
@@ -1062,7 +1050,6 @@ The following cryptocurrencies are supported by the workflow:
| MYB | MyBit |
| MYC | MayaCoin |
| MYST | Mysterium |
-| MYST* | MysteryCoin |
| MZC | MazaCoin |
| N7 | Number7 |
| NAMO | NamoCoin |
@@ -1083,7 +1070,6 @@ The following cryptocurrencies are supported by the workflow:
| NEO | NEO |
| NEOS | NeosCoin |
| NET | NetCoin |
-| NET* | Nimiq Exchange Token |
| NETC | NetworkCoin |
| NETKO | Netko |
| NEU | NeuCoin |
@@ -1170,7 +1156,6 @@ The following cryptocurrencies are supported by the workflow:
| PCS | Pabyosi Coin |
| PDC | Project Decorum |
| PEC | PeaceCoin |
-| PEN | PenCoin |
| PEPECASH | Pepe Cash |
| PEX | PosEx |
| PGL | Prospectors |
@@ -1225,7 +1210,6 @@ The following cryptocurrencies are supported by the workflow:
| PTA | PentaCoin |
| PTC | PesetaCoin |
| PTOY | Patientory |
-| PTS* | Protoshares |
| PULSE | Pulse |
| PUPA | PupaCoin |
| PUT | PutinCoin |
@@ -1263,7 +1247,6 @@ The following cryptocurrencies are supported by the workflow:
| RC | Russiacoin |
| RCC | Reality Clash |
| RCN | Ripio |
-| RCN* | RCoin |
| RCX | RedCrowCoin |
| RDD | ReddCoin |
| RDN | RadonPay |
@@ -1311,10 +1294,8 @@ The following cryptocurrencies are supported by the workflow:
| SAN | Santiment |
| SAND | BeachCoin |
| SANDG | Save and Gain |
-| SAR | SARCoin |
| SAT2 | Saturn2Coin |
| SBC | StableCoin |
-| SBD | Steem Backed Dollars |
| SC | Siacoin |
| SCASH | SpaceCash |
| SCL | Social Nexus |
@@ -1351,7 +1332,6 @@ The following cryptocurrencies are supported by the workflow:
| SLING | Sling Coin |
| SLM | SlimCoin |
| SLR | SolarCoin |
-| SLS | SaluS |
| SMAC | Social Media Coin |
| SMART | SmartCash |
| SMC | SmartCoin |
@@ -1393,10 +1373,8 @@ The following cryptocurrencies are supported by the workflow:
| SSTC | SunShotCoin |
| SSV | SSVCoin |
| STA | Starta |
-| STA* | Stakers |
| STALIN | StalinCoin |
| STAR | Starbase |
-| STAR* | StarCoin |
| START | StartCoin |
| STCN | Stakecoin |
| STEEM | Steem |
@@ -1404,14 +1382,12 @@ The following cryptocurrencies are supported by the workflow:
| STHR | Stakerush |
| STO | Save The Ocean |
| STORJ | Storj |
-| STR* | StarCoin |
| STRAT | Stratis |
| STS | STRESScoin |
| STU | BitJob |
| STV | Sativa Coin |
| STX | Stox |
| SUB | Substratum Network |
-| SUB* | Subscriptio |
| SUMO | Sumokoin |
| SUP | Supcoin |
| SUPER | SuperCoin |
@@ -1579,7 +1555,6 @@ The following cryptocurrencies are supported by the workflow:
| WOP | WorldPay |
| WORM | HealthyWorm |
| WRC | Worldcore |
-| WRC* | WarCoin |
| WRT | WRTcoin |
| WSX | WeAreSatoshi |
| WTC | Waltonchain |
@@ -1618,7 +1593,6 @@ The following cryptocurrencies are supported by the workflow:
| XGR | GoldReserve |
| XHI | HiCoin |
| XID | Sphre AIR |
-| XID* | International Diamond Coin |
| XIOS | Xios |
| XJO | JouleCoin |
| XLB | LibertyCoin |
@@ -1694,7 +1668,6 @@ The following cryptocurrencies are supported by the workflow:
| ZOI | Zoin |
| ZOOM | ZoomCoin |
| ZRC | ZrCoin |
-| ZRC* | ZiftrCoin |
| ZRX | 0x |
| ZSC | Zeusshield |
| ZSE | ZSEcoin |
@@ -1703,5 +1676,66 @@ The following cryptocurrencies are supported by the workflow:
| ZYD | ZayedCoin |
+
+Unsupported currencies
+----------------------
+
+The following (crypto)currencies are unsupported. Some have symbols that conflict with other currencies, and others cannot be understood by the `pint` library as they start with digits or end with `*`.
+
+| Symbol | Name |
+|--------|----------------------------------------------|
+| 007 | 007 coin |
+| 1337 | 1337 |
+| 1CR | 1Credit |
+| 1ST | FirstBlood |
+| 2015 | 2015 coin |
+| 2BACCO | 2BACCO Coin |
+| 2GIVE | 2GiveCoin |
+| 32BIT | 32Bitcoin |
+| 365 | 365Coin |
+| 404 | 404Coin |
+| 42 | 42 Coin |
+| 4CHN | ChanCoin |
+| 611 | SixEleven |
+| 808 | 808 |
+| 888 | Octocoin |
+| 8BIT | 8BIT Coin |
+| 8BT | 8 Circuit Studios |
+| AIR* | Aircoin |
+| ARC* | ArcticCoin |
+| AST* | Astral |
+| BNB* | Boats and Bitches |
+| BOB | Bob Coin |
+| BSD | BitSend |
+| BTG* | BitGem |
+| BTM* | Bytom |
+| BTX* | BitcoinTX |
+| CAT* | BitClave |
+| CNT | Centurion |
+| COV* | CovenCoin |
+| CRC | CraftCoin |
+| GHS | Giga Hash |
+| GXC* | GenXCoin |
+| KNC* | Khancoin |
+| MAD | SatoshiMadness |
+| MAT* | Manet Coin |
+| MYST* | MysteryCoin |
+| NET* | Nimiq Exchange Token |
+| PEN | PenCoin |
+| PTS* | Protoshares |
+| RCN* | RCoin |
+| SAR | SARCoin |
+| SBD | Steem Backed Dollar |
+| SLS | SaluS |
+| STA* | Stakers |
+| STAR* | StarCoin |
+| SUB* | Subscriptio |
+| WRC* | WarCoin |
+| XBC | Bond Markets Unit European Unit of Account 9 |
+| XID* | International Diamond Coin |
+| XPD | Palladium |
+| ZRC* | ZiftrCoin |
+
+
[openx]: https://openexchangerates.org/
[cryptocompare]: https://www.cryptocompare.com/
diff --git a/src/active_currencies.txt.default b/src/active_currencies.txt.default
index e0073f2..6a7834b 100644
--- a/src/active_currencies.txt.default
+++ b/src/active_currencies.txt.default
@@ -179,7 +179,6 @@ XAG
XAU
XBA
XBB
-XBC
XBD
XCD
XDR
@@ -205,6 +204,7 @@ LSK
LTC
MAID
SJCX
+XBC
XEM
XMR
XRP
diff --git a/src/config.py b/src/config.py
index b7d7949..6145288 100644
--- a/src/config.py
+++ b/src/config.py
@@ -23,6 +23,8 @@
# Result display
# ----------------------------------------------------------------------
DECIMAL_PLACES = int(os.getenv('DECIMAL_PLACES') or '2')
+CURRENCY_DECIMAL_PLACES = int(os.getenv('CURRENCY_DECIMAL_PLACES') or
+ str(DECIMAL_PLACES))
DECIMAL_SEPARATOR = os.getenv('DECIMAL_SEPARATOR') or '.'
THOUSANDS_SEPARATOR = os.getenv('THOUSANDS_SEPARATOR') or ''
@@ -293,7 +295,7 @@
u'AHT': u'Ahoolee',
u'AIB': u'AdvancedInternetBlock',
u'AIR': u'AirToken',
- u'AIR*': u'Aircoin',
+ # u'AIR*': u'Aircoin',
u'ALC': u'Arab League Coin',
u'ALEX': u'Alexandrite',
u'ALF': u'AlphaCoin',
@@ -317,7 +319,7 @@
u'APT': u'Aptcoin',
u'APX': u'Apx',
u'ARB': u'Arbit Coin',
- u'ARC*': u'ArcticCoin',
+ # u'ARC*': u'ArcticCoin',
u'ARCH': u'ArchCoin',
u'ARCO': u'AquariusCoin',
u'ARDR': u'Ardor',
@@ -331,7 +333,7 @@
u'ASAFE': u'Allsafe',
u'ASN': u'Ascension Coin',
u'AST': u'AirSwap',
- u'AST*': u'Astral',
+ # u'AST*': u'Astral',
u'ATB': u'ATB coin',
u'ATCC': u'ATC Coin',
u'ATL': u'ATLANT',
@@ -399,7 +401,7 @@
u'BM': u'BitMoon',
u'BMC': u'Blackmoon Crypto',
u'BNB': u'Binance Coin',
- u'BNB*': u'Boats and Bitches',
+ # u'BNB*': u'Boats and Bitches',
u'BNC': u'Benjacoin',
u'BNT': u'Bancor Network Token',
u'BNX': u'BnrtxCoin',
@@ -441,17 +443,17 @@
u'BTD': u'Bitcloud',
u'BTE': u'ByteCoin',
u'BTG': u'Bitcoin Gold',
- u'BTG*': u'BitGem',
+ # u'BTG*': u'BitGem',
u'BTLC': u'BitLuckCoin',
u'BTM': u'BitMark',
- u'BTM*': u'Bytom',
+ # u'BTM*': u'Bytom',
u'BTMI': u'BitMiles',
u'BTPL': u'Bitcoin Planet',
u'BTQ': u'BitQuark',
u'BTS': u'Bitshares',
u'BTTF': u'Coin to the Future',
u'BTX': u'Bitcore',
- u'BTX*': u'BitcoinTX',
+ # u'BTX*': u'BitcoinTX',
u'BTZ': u'BitzCoin',
u'BUCKS': u'SwagBucks',
u'BUK': u'CryptoBuk',
@@ -473,7 +475,7 @@
u'CARBON': u'Carboncoin',
u'CASH': u'CashCoin',
u'CAT': u'BlockCAT',
- u'CAT*': u'BitClave',
+ # u'CAT*': u'BitClave',
u'CBD': u'CBD Crystals',
u'CBX': u'CryptoBullion',
u'CC': u'CyberCoin',
@@ -541,7 +543,7 @@
u'CORE': u'Core Group Asset',
u'COSS': u'COSS',
u'COV': u'Covesting',
- u'COV*': u'CovenCoin',
+ # u'COV*': u'CovenCoin',
u'COVAL': u'Circuits of Value',
u'COX': u'CobraCoin',
u'CPC': u'CapriCoin',
@@ -850,7 +852,7 @@
u'GUNS': u'GeoFunders',
u'GUP': u'Guppy',
u'GXC': u'Gx Coin',
- u'GXC*': u'GenXCoin',
+ # u'GXC*': u'GenXCoin',
u'HAC': u'Hackspace Capital',
u'HAL': u'Halcyon',
u'HALLO': u'Halloween Coin',
@@ -960,7 +962,7 @@
u'KLC': u'KiloCoin',
u'KMD': u'Komodo',
u'KNC': u'Kyber Network',
- u'KNC*': u'Khancoin',
+ # u'KNC*': u'Khancoin',
u'KOBO': u'KoboCoin',
u'KOLION': u'Kolion',
u'KORE': u'Kore',
@@ -1035,7 +1037,7 @@
u'MARV': u'Marvelous',
u'MARX': u'MarxCoin',
u'MARYJ': u'MaryJane Coin',
- u'MAT*': u'Manet Coin',
+ # u'MAT*': u'Manet Coin',
u'MAX': u'MaxCoin',
u'MAY': u'Theresa May Coin',
u'MBI': u'Monster Byte Inc',
@@ -1114,7 +1116,7 @@
u'MYB': u'MyBit',
u'MYC': u'MayaCoin',
u'MYST': u'Mysterium',
- u'MYST*': u'MysteryCoin',
+ # u'MYST*': u'MysteryCoin',
u'MZC': u'MazaCoin',
u'N7': u'Number7',
u'NAMO': u'NamoCoin',
@@ -1135,7 +1137,7 @@
u'NEO': u'NEO',
u'NEOS': u'NeosCoin',
u'NET': u'NetCoin',
- u'NET*': u'Nimiq Exchange Token',
+ # u'NET*': u'Nimiq Exchange Token',
u'NETC': u'NetworkCoin',
u'NETKO': u'Netko',
u'NEU': u'NeuCoin',
@@ -1277,7 +1279,7 @@
u'PTA': u'PentaCoin',
u'PTC': u'PesetaCoin',
u'PTOY': u'Patientory',
- u'PTS*': u'Protoshares',
+ # u'PTS*': u'Protoshares',
u'PULSE': u'Pulse',
u'PUPA': u'PupaCoin',
u'PUT': u'PutinCoin',
@@ -1315,7 +1317,7 @@
u'RC': u'Russiacoin',
u'RCC': u'Reality Clash',
u'RCN': u'Ripio',
- u'RCN*': u'RCoin',
+ # u'RCN*': u'RCoin',
u'RCX': u'RedCrowCoin',
u'RDD': u'ReddCoin',
u'RDN': u'RadonPay',
@@ -1445,10 +1447,10 @@
u'SSTC': u'SunShotCoin',
u'SSV': u'SSVCoin',
u'STA': u'Starta',
- u'STA*': u'Stakers',
+ # u'STA*': u'Stakers',
u'STALIN': u'StalinCoin',
u'STAR': u'Starbase',
- u'STAR*': u'StarCoin',
+ # u'STAR*': u'StarCoin',
u'START': u'StartCoin',
u'STCN': u'Stakecoin',
u'STEEM': u'Steem',
@@ -1463,7 +1465,7 @@
u'STV': u'Sativa Coin',
u'STX': u'Stox',
u'SUB': u'Substratum Network',
- u'SUB*': u'Subscriptio',
+ # u'SUB*': u'Subscriptio',
u'SUMO': u'Sumokoin',
u'SUP': u'Supcoin',
u'SUPER': u'SuperCoin',
@@ -1631,7 +1633,7 @@
u'WOP': u'WorldPay',
u'WORM': u'HealthyWorm',
u'WRC': u'Worldcore',
- u'WRC*': u'WarCoin',
+ # u'WRC*': u'WarCoin',
u'WRT': u'WRTcoin',
u'WSX': u'WeAreSatoshi',
u'WTC': u'Waltonchain',
@@ -1670,7 +1672,7 @@
u'XGR': u'GoldReserve',
u'XHI': u'HiCoin',
u'XID': u'Sphre AIR',
- u'XID*': u'International Diamond Coin',
+ # u'XID*': u'International Diamond Coin',
u'XIOS': u'Xios',
u'XJO': u'JouleCoin',
u'XLB': u'LibertyCoin',
@@ -1746,7 +1748,7 @@
u'ZOI': u'Zoin',
u'ZOOM': u'ZoomCoin',
u'ZRC': u'ZrCoin',
- u'ZRC*': u'ZiftrCoin',
+ # u'ZRC*': u'ZiftrCoin',
u'ZRX': u'0x',
u'ZSC': u'Zeusshield',
u'ZSE': u'ZSEcoin',
diff --git a/src/convert.py b/src/convert.py
index 47d6b2a..5b276ea 100755
--- a/src/convert.py
+++ b/src/convert.py
@@ -27,6 +27,7 @@
COPY_UNIT,
CURRENCY_CACHE_AGE,
CURRENCY_CACHE_NAME,
+ CURRENCY_DECIMAL_PLACES,
CUSTOM_DEFINITIONS_FILENAME,
DECIMAL_PLACES,
DECIMAL_SEPARATOR,
@@ -131,6 +132,11 @@ def __init__(self, number, dimensionality, from_unit, to_unit=None):
self.from_unit = from_unit
self.to_unit = to_unit
+ @property
+ def is_currency(self):
+ """`True` if Input is a currency."""
+ return self.dimensionality == u'[currency]'
+
def __repr__(self):
"""Code-like representation of `Input`."""
return ('Input(number={!r}, dimensionality={!r}, '
@@ -173,10 +179,9 @@ def _decimal_places(self, n):
Returns:
int: Number of decimal places for result.
"""
- log.debug('DYNAMIC_DECIMALS are %s',
- ('off', 'on')[self.dynamic_decimals])
+ log.debug('DYNAMIC_DECIMALS: %s', ('off', 'on')[self.dynamic_decimals])
- if not self.dynamic_decimals:
+ if not self.dynamic_decimals or n == 0.0:
return self.decimal_places
m = max(self.decimal_places, 10) + 1
@@ -184,7 +189,7 @@ def _decimal_places(self, n):
while p < m:
e = 10 ** p
i = n * e
- # log.debug('n=%f, e=%d, i=%f, p=%d', n, e, i, p)
+ # log.debug('n=%r, e=%d, i=%r, p=%d', n, e, i, p)
if n * e >= 10:
break
@@ -195,13 +200,15 @@ def _decimal_places(self, n):
if '.' not in s: # not a fraction
return p
- s = s.split('.')[-1]
+ _, s = s.split('.', 1)
# log.debug('s=%s, p=%d', s, p)
while s.endswith('0'):
s = s[:-1]
p -= 1
# log.debug('s=%s, p=%d', s, p)
+ p = max(p, self.decimal_places)
+ log.debug('places=%d', p)
return p
def formatted(self, n, unit=None):
@@ -565,7 +572,8 @@ def convert(query):
valid=False, icon=ICON_WARNING)
else: # Show results
- f = Formatter(DECIMAL_PLACES, DECIMAL_SEPARATOR, THOUSANDS_SEPARATOR,
+ p = CURRENCY_DECIMAL_PLACES if i.is_currency else DECIMAL_PLACES
+ f = Formatter(p, DECIMAL_SEPARATOR, THOUSANDS_SEPARATOR,
DYNAMIC_DECIMALS)
wf.setvar('query', query)
for conv in results:
diff --git a/src/info.plist b/src/info.plist
index 273c7e7..eff1beb 100644
--- a/src/info.plist
+++ b/src/info.plist
@@ -625,6 +625,8 @@ UPDATE_INTERVAL is the number of minutes between exchange rate updates.
COPY_UNIT
+ CURRENCY_DECIMAL_PLACES
+ 2
DECIMAL_PLACES
2
DECIMAL_SEPARATOR
@@ -641,7 +643,7 @@ UPDATE_INTERVAL is the number of minutes between exchange rate updates.
APP_KEY
version
- 3.5
+ 3.5.1
webaddress