Repository: freqtrade/freqtrade

Issue:
Telegram Daily Is not Working on Freqtrade for coinbasepro
## Step 1: Have you search for this issue before posting it?
Yes
If you have discovered a bug in the bot, please [search our issue tracker](https://github.com/freqtrade/freqtrade/issues?q=is%3Aissue). 
If it hasn't been reported, please create a new issue.

## Step 2: Describe your environment

  * Operating system: _Ubuntu___
  * Python Version: ___3.6__ (`python -V`)
  * CCXT version: __ccxt==1.17.542___ (`pip freeze | grep ccxt`)
  * Branch: Master | Develop
  * Last Commit ID: a0a9c9c21cdec0d50eb1597264414ed0e4aeb98a(`git log --format="%H" -n 1`)
  
## Step 3: Describe the problem:
Running dry run mode, i am trying to check the /daily on telegram, i get the following error:
```
Traceback (most recent call last):
  File "/home/mtg/freqtrade/freqtrade/rpc/telegram.py", line 49, in wrapper
    return command_handler(self, *args, **kwargs)
  File "/home/mtg/freqtrade/freqtrade/rpc/telegram.py", line 247, in _daily
    fiat_disp_cur
  File "/home/mtg/freqtrade/freqtrade/rpc/rpc.py", line 188, in _rpc_daily_profit
    for key, value in profit_days.items()
  File "/home/mtg/freqtrade/freqtrade/rpc/rpc.py", line 188, in <listcomp>
    for key, value in profit_days.items()
ValueError: Unknown format code 'f' for object of type 'str'
```
*Explain the problem you have encountered*

### Steps to reproduce:

  1. _connect to coinbase pro____
  2. _run strategy____
  3. ___on telegram, hit /daily__
  
### Observed Results:

  * What happened? output error
  * What did you expect to happen? Result of daily profit/loss

### Relevant code exceptions or logs:

  ```
  // paste your log here
  ```

Telegram Daily Is not Working on Freqtrade for coinbasepro
## Step 1: Have you search for this issue before posting it?
Yes
If you have discovered a bug in the bot, please [search our issue tracker](https://github.com/freqtrade/freqtrade/issues?q=is%3Aissue). 
If it hasn't been reported, please create a new issue.

## Step 2: Describe your environment

  * Operating system: _Ubuntu___
  * Python Version: ___3.6__ (`python -V`)
  * CCXT version: __ccxt==1.17.542___ (`pip freeze | grep ccxt`)
  * Branch: Master | Develop
  * Last Commit ID: a0a9c9c21cdec0d50eb1597264414ed0e4aeb98a(`git log --format="%H" -n 1`)
  
## Step 3: Describe the problem:
Running dry run mode, i am trying to check the /daily on telegram, i get the following error:
```
Traceback (most recent call last):
  File "/home/mtg/freqtrade/freqtrade/rpc/telegram.py", line 49, in wrapper
    return command_handler(self, *args, **kwargs)
  File "/home/mtg/freqtrade/freqtrade/rpc/telegram.py", line 247, in _daily
    fiat_disp_cur
  File "/home/mtg/freqtrade/freqtrade/rpc/rpc.py", line 188, in _rpc_daily_profit
    for key, value in profit_days.items()
  File "/home/mtg/freqtrade/freqtrade/rpc/rpc.py", line 188, in <listcomp>
    for key, value in profit_days.items()
ValueError: Unknown format code 'f' for object of type 'str'
```
*Explain the problem you have encountered*

### Steps to reproduce:

  1. _connect to coinbase pro____
  2. _run strategy____
  3. ___on telegram, hit /daily__
  
### Observed Results:

  * What happened? output error
  * What did you expect to happen? Result of daily profit/loss

### Relevant code exceptions or logs:

  ```
  // paste your log here
  ```



Discussion:
> ccxt==1.17.542_

Absolutely upgrade. You're behind ~~more than~~ at least 1000 releases from ccxt.

Please run `python -m pip install -U ccxt`.

> Last Commit ID: a0a9c9c

You seem to be on a forked branch (the comit is in the MontrealTradingGroup repo).
This repo is known to be outdated (it's intentional, so the udemy course does not have to be updated whenever something is changed).

You should switch to the main branch (this repository) - using either master (the stable branch) or develop (the faster moving branch). 
Either way, please make sure to install eventual new requirements.

If you want to stay on the forked version, please open this issue there as we do not support issues with outdated, forked versions (you'rs is outdated for more than a year 
 - the commit you link to is from January 2018).
Thanks for the reply.
I did a fresh install using Freqtrade installation guide. 
pip freeze | grep ccxt
ccxt==1.18.1115

git log --format="%H" -n 1
9f5d4a52523175af99f0979123253aff3115d3ea

Still getting the same error:

2019-09-08 21:14:08,864 - freqtrade.rpc.telegram - ERROR - Exception occurred within Telegram module
Traceback (most recent call last):
  File "/home/ali/freqtrade/freqtrade/rpc/telegram.py", line 52, in wrapper
    return command_handler(self, *args, **kwargs)
  File "/home/ali/freqtrade/freqtrade/rpc/telegram.py", line 262, in _daily
    fiat_disp_cur
  File "/home/ali/freqtrade/freqtrade/rpc/rpc.py", line 189, in _rpc_daily_profit
    for key, value in profit_days.items()
  File "/home/ali/freqtrade/freqtrade/rpc/rpc.py", line 189, in <listcomp>
    for key, value in profit_days.items()
ValueError: Unknown format code 'f' for object of type 'str'


Honestly, as the startup message suggests:

> Exchange coinbasepro is supported by ccxt and therefore available for the bot but not officially supported by the Freqtrade development team. It may work flawlessly (please report back) or have serious issues. Use it at your own discretion.

you may be one of the first to try coinbasepro with freqtrade.

Do other commands (like `/balance` or `/profit`) work as expected?
Yes, /balance /profit /status, etc all work except for /daily. 
this issue seems to be more with Telegram then connection to Coinbase pro? I wonder if something needs to be modified with the rpc or telegram file to correct this issue.
When I run the strategy with BTC coins instead of USD coins, /daily works. Is there a way for me to get USD /daily?
so you're using USD as 'stake_currency'? 

what's your 'fiat_display_currency' setting?
USD
> ccxt==1.17.542_

Absolutely upgrade. You're behind ~~more than~~ at least 1000 releases from ccxt.

Please run `python -m pip install -U ccxt`.

> Last Commit ID: a0a9c9c

You seem to be on a forked branch (the comit is in the MontrealTradingGroup repo).
This repo is known to be outdated (it's intentional, so the udemy course does not have to be updated whenever something is changed).

You should switch to the main branch (this repository) - using either master (the stable branch) or develop (the faster moving branch). 
Either way, please make sure to install eventual new requirements.

If you want to stay on the forked version, please open this issue there as we do not support issues with outdated, forked versions (you'rs is outdated for more than a year 
 - the commit you link to is from January 2018).
Thanks for the reply.
I did a fresh install using Freqtrade installation guide. 
pip freeze | grep ccxt
ccxt==1.18.1115

git log --format="%H" -n 1
9f5d4a52523175af99f0979123253aff3115d3ea

Still getting the same error:

2019-09-08 21:14:08,864 - freqtrade.rpc.telegram - ERROR - Exception occurred within Telegram module
Traceback (most recent call last):
  File "/home/ali/freqtrade/freqtrade/rpc/telegram.py", line 52, in wrapper
    return command_handler(self, *args, **kwargs)
  File "/home/ali/freqtrade/freqtrade/rpc/telegram.py", line 262, in _daily
    fiat_disp_cur
  File "/home/ali/freqtrade/freqtrade/rpc/rpc.py", line 189, in _rpc_daily_profit
    for key, value in profit_days.items()
  File "/home/ali/freqtrade/freqtrade/rpc/rpc.py", line 189, in <listcomp>
    for key, value in profit_days.items()
ValueError: Unknown format code 'f' for object of type 'str'


Honestly, as the startup message suggests:

> Exchange coinbasepro is supported by ccxt and therefore available for the bot but not officially supported by the Freqtrade development team. It may work flawlessly (please report back) or have serious issues. Use it at your own discretion.

you may be one of the first to try coinbasepro with freqtrade.

Do other commands (like `/balance` or `/profit`) work as expected?
Yes, /balance /profit /status, etc all work except for /daily. 
this issue seems to be more with Telegram then connection to Coinbase pro? I wonder if something needs to be modified with the rpc or telegram file to correct this issue.
When I run the strategy with BTC coins instead of USD coins, /daily works. Is there a way for me to get USD /daily?
so you're using USD as 'stake_currency'? 

what's your 'fiat_display_currency' setting?
USD

Resolving patch:
diff --git a/freqtrade/rpc/fiat_convert.py b/freqtrade/rpc/fiat_convert.py
--- a/freqtrade/rpc/fiat_convert.py
+++ b/freqtrade/rpc/fiat_convert.py
@@ -104,7 +104,7 @@ def convert_amount(self, crypto_amount: float, crypto_symbol: str, fiat_symbol:
         :return: float, value in fiat of the crypto-currency amount
         """
         if crypto_symbol == fiat_symbol:
-            return crypto_amount
+            return float(crypto_amount)
         price = self.get_price(crypto_symbol=crypto_symbol, fiat_symbol=fiat_symbol)
         return float(crypto_amount) * float(price)
 


Test patch:
diff --git a/tests/rpc/test_fiat_convert.py b/tests/rpc/test_fiat_convert.py
--- a/tests/rpc/test_fiat_convert.py
+++ b/tests/rpc/test_fiat_convert.py
@@ -210,3 +210,10 @@ def test_convert_amount(mocker):
         fiat_symbol="BTC"
     )
     assert result == 1.23
+
+    result = fiat_convert.convert_amount(
+        crypto_amount="1.23",
+        crypto_symbol="BTC",
+        fiat_symbol="BTC"
+    )
+    assert result == 1.23