Coder Social home page Coder Social logo

freqtrade / freqtrade Goto Github PK

View Code? Open in Web Editor NEW
25.6K 622.0 5.6K 347.79 MB

Free, open source crypto trading bot

Home Page: https://www.freqtrade.io

License: GNU General Public License v3.0

Python 98.32% Shell 0.43% Dockerfile 0.04% Jupyter Notebook 0.33% PowerShell 0.01% HTML 0.02% Gnuplot 0.01% Jinja 0.84%
python cryptocurrencies trading-bot telegram-bot bitcoin trade cryptocurrency algorithmic-trading freqtrade

freqtrade's Introduction

freqtrade

Freqtrade CI DOI Coverage Status Documentation Maintainability

Freqtrade is a free and open source crypto trading bot written in Python. It is designed to support all major exchanges and be controlled via Telegram or webUI. It contains backtesting, plotting and money management tools as well as strategy optimization by machine learning.

freqtrade

Disclaimer

This software is for educational purposes only. Do not risk money which you are afraid to lose. USE THE SOFTWARE AT YOUR OWN RISK. THE AUTHORS AND ALL AFFILIATES ASSUME NO RESPONSIBILITY FOR YOUR TRADING RESULTS.

Always start by running a trading bot in Dry-run and do not engage money before you understand how it works and what profit/loss you should expect.

We strongly recommend you to have coding and Python knowledge. Do not hesitate to read the source code and understand the mechanism of this bot.

Supported Exchange marketplaces

Please read the exchange specific notes to learn about eventual, special configurations needed for each exchange.

Supported Futures Exchanges (experimental)

Please make sure to read the exchange specific notes, as well as the trading with leverage documentation before diving in.

Community tested

Exchanges confirmed working by the community:

Documentation

We invite you to read the bot documentation to ensure you understand how the bot is working.

Please find the complete documentation on the freqtrade website.

Features

  • Based on Python 3.9+: For botting on any operating system - Windows, macOS and Linux.
  • Persistence: Persistence is achieved through sqlite.
  • Dry-run: Run the bot without paying money.
  • Backtesting: Run a simulation of your buy/sell strategy.
  • Strategy Optimization by machine learning: Use machine learning to optimize your buy/sell strategy parameters with real exchange data.
  • Adaptive prediction modeling: Build a smart strategy with FreqAI that self-trains to the market via adaptive machine learning methods. Learn more
  • Edge position sizing Calculate your win rate, risk reward ratio, the best stoploss and adjust your position size before taking a position for each specific market. Learn more.
  • Whitelist crypto-currencies: Select which crypto-currency you want to trade or use dynamic whitelists.
  • Blacklist crypto-currencies: Select which crypto-currency you want to avoid.
  • Builtin WebUI: Builtin web UI to manage your bot.
  • Manageable via Telegram: Manage the bot with Telegram.
  • Display profit/loss in fiat: Display your profit/loss in fiat currency.
  • Performance status report: Provide a performance status of your current trades.

Quick start

Please refer to the Docker Quickstart documentation on how to get started quickly.

For further (native) installation methods, please refer to the Installation documentation page.

Basic Usage

Bot commands

usage: freqtrade [-h] [-V]
                 {trade,create-userdir,new-config,new-strategy,download-data,convert-data,convert-trade-data,list-data,backtesting,edge,hyperopt,hyperopt-list,hyperopt-show,list-exchanges,list-hyperopts,list-markets,list-pairs,list-strategies,list-timeframes,show-trades,test-pairlist,install-ui,plot-dataframe,plot-profit,webserver}
                 ...

Free, open source crypto trading bot

positional arguments:
  {trade,create-userdir,new-config,new-strategy,download-data,convert-data,convert-trade-data,list-data,backtesting,edge,hyperopt,hyperopt-list,hyperopt-show,list-exchanges,list-hyperopts,list-markets,list-pairs,list-strategies,list-timeframes,show-trades,test-pairlist,install-ui,plot-dataframe,plot-profit,webserver}
    trade               Trade module.
    create-userdir      Create user-data directory.
    new-config          Create new config
    new-strategy        Create new strategy
    download-data       Download backtesting data.
    convert-data        Convert candle (OHLCV) data from one format to
                        another.
    convert-trade-data  Convert trade data from one format to another.
    list-data           List downloaded data.
    backtesting         Backtesting module.
    edge                Edge module.
    hyperopt            Hyperopt module.
    hyperopt-list       List Hyperopt results
    hyperopt-show       Show details of Hyperopt results
    list-exchanges      Print available exchanges.
    list-hyperopts      Print available hyperopt classes.
    list-markets        Print markets on exchange.
    list-pairs          Print pairs on exchange.
    list-strategies     Print available strategies.
    list-timeframes     Print available timeframes for the exchange.
    show-trades         Show trades.
    test-pairlist       Test your pairlist configuration.
    install-ui          Install FreqUI
    plot-dataframe      Plot candles with indicators.
    plot-profit         Generate plot showing profits.
    webserver           Webserver module.

optional arguments:
  -h, --help            show this help message and exit
  -V, --version         show program's version number and exit

Telegram RPC commands

Telegram is not mandatory. However, this is a great way to control your bot. More details and the full command list on the documentation

  • /start: Starts the trader.
  • /stop: Stops the trader.
  • /stopentry: Stop entering new trades.
  • /status <trade_id>|[table]: Lists all or specific open trades.
  • /profit [<n>]: Lists cumulative profit from all finished trades, over the last n days.
  • /forceexit <trade_id>|all: Instantly exits the given trade (Ignoring minimum_roi).
  • /fx <trade_id>|all: Alias to /forceexit
  • /performance: Show performance of each finished trade grouped by pair
  • /balance: Show account balance per currency.
  • /daily <n>: Shows profit or loss per day, over the last n days.
  • /help: Show help message.
  • /version: Show version.

Development branches

The project is currently setup in two main branches:

  • develop - This branch has often new features, but might also contain breaking changes. We try hard to keep this branch as stable as possible.
  • stable - This branch contains the latest stable release. This branch is generally well tested.
  • feat/* - These are feature branches, which are being worked on heavily. Please don't use these unless you want to test a specific feature.

Support

Help / Discord

For any questions not covered by the documentation or for further information about the bot, or to simply engage with like-minded individuals, we encourage you to join the Freqtrade discord server.

If you discover a bug in the bot, please search the issue tracker first. If it hasn't been reported, please create a new issue and ensure you follow the template guide so that the team can assist you as quickly as possible.

For every issue created, kindly follow up and mark satisfaction or reminder to close issue when equilibrium ground is reached.

--Maintain github's community policy--

Have you a great idea to improve the bot you want to share? Please, first search if this feature was not already discussed. If it hasn't been requested, please create a new request and ensure you follow the template guide so that it does not get lost in the bug reports.

Feel like the bot is missing a feature? We welcome your pull requests!

Please read the Contributing document to understand the requirements before sending your pull-requests.

Coding is not a necessity to contribute - maybe start with improving the documentation? Issues labeled good first issue can be good first contributions, and will help get you familiar with the codebase.

Note before starting any major new feature work, please open an issue describing what you are planning to do or talk to us on discord (please use the #dev channel for this). This will ensure that interested parties can give valuable feedback on the feature, and let others know that you are working on it.

Important: Always create your PR against the develop branch, not stable.

Requirements

Up-to-date clock

The clock must be accurate, synchronized to a NTP server very frequently to avoid problems with communication to the exchanges.

Minimum hardware required

To run this bot we recommend you a cloud instance with a minimum of:

  • Minimal (advised) system requirements: 2GB RAM, 1GB disk space, 2vCPU

Software requirements

freqtrade's People

Contributors

axel-ch avatar creslinux avatar dependabot-preview[bot] avatar dependabot[bot] avatar enenn avatar eser1805 avatar fredrik81 avatar froggleston avatar gcarq avatar glonlas avatar hippocritical avatar hroff-1902 avatar italodamato avatar iuvbio avatar jblestang avatar kevinjulian avatar mishaker avatar pyup-bot avatar robcaulk avatar rokups avatar samgermain avatar shusso avatar stash86 avatar thejoeschr avatar vertti avatar wagnercosta avatar xataxxx avatar xmatthias avatar yazeed avatar yinon-polak avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

freqtrade's Issues

Forcesell is not working

Forcesell command executes the sell correctly but then the trade handling loop continues like the sell never happened:

2017-09-08 18:59:47,133 - rpc.telegram - INFO - Executing handler: _forcesell for chat_id: --removed--
2017-09-08 18:59:48,989 - rpc.telegram - INFO - *BITTREX:* Selling [BTC/NXS](https://bittrex.com/Market/Index?MarketName=BTC-NXS) at rate `0.000716 (profit: -0.44%)`
2017-09-08 18:59:54,339 - main - DEBUG - Handling open trade Trade(id=1, pair=BTC_NXS, amount=4.169098640873843, open_rate=0.00071958, open_since=225.63) ...
2017-09-08 18:59:55,134 - main - DEBUG - Threshold not reached. (cur_profit: -0.44%)

Checking Bittrex, the sell went through but that last line (Handling open trade) keeps appearing. As the forcesell operation does nothing else than call bittrex and update the persistence, I have a feeling that #10 might have broken it.

MACD buy signal

Opening this for discussion:

Currently we use buy signal condition MACD > MACDS. According to for example this: http://www.onlinetradingconcepts.com/TechnicalAnalysis/MACD2.html the buy signal is when the crossover happens from MACD < MACDS to MACD > MACDS.

How about changing it to something like "if currently MACD > MACDS and the previous sample (one minute earlier) is MACD < MACDS" to give the buy signal? The current rule gives the signal all the way to the point when the sell already should happen.

Unable to create trade error

I've recently updated with the develop branch (about two hours ago), as a number of the issues I found last night have already been fixed. Everything has been running smoothly, including a full trade. This is all in with "dry_run": true set in my config.

After identifying a trade of BTC-XRP, I'm seeing an error repeated twice in the console:

2017-11-15 21:24:28,211 - freqtrade - INFO - Checking buy signals to create a new trade with stake_amount: 0.050000 ...
2017-11-15 21:26:16,135 - freqtrade - ERROR - Unable to create trade
Traceback (most recent call last):
  File "./freqtrade/main.py", line 70, in _process
    trade = create_trade(float(_CONF['stake_amount']))
  File "./freqtrade/main.py", line 223, in create_trade
    if get_buy_signal(_pair):
  File "/Users/sgrimm/dev/cryptos/bots/freqtrade/freqtrade/analyze.py", line 99, in get_buy_signal
    dataframe = analyze_ticker(pair)
  File "/Users/sgrimm/dev/cryptos/bots/freqtrade/freqtrade/analyze.py", line 82, in analyze_ticker
    ticker_hist = get_ticker_history(pair)
  File "/Users/sgrimm/dev/cryptos/bots/freqtrade/.env/lib/python3.6/site-packages/cachetools/__init__.py", line 46, in wrapper
    v = func(*args, **kwargs)
  File "/Users/sgrimm/dev/cryptos/bots/freqtrade/freqtrade/exchange/__init__.py", line 133, in get_ticker_history
    return _API.get_ticker_history(pair, tick_interval)
  File "/Users/sgrimm/dev/cryptos/bots/freqtrade/freqtrade/exchange/bittrex.py", line 103, in get_ticker_history
    data = _API_V2.get_candles(pair.replace('_', '-'), interval)
  File "/Users/sgrimm/dev/cryptos/bots/freqtrade/.env/src/python-bittrex/bittrex/bittrex.py", line 794, in get_candles
    }, protection=PROTECTION_PUB)
  File "/Users/sgrimm/dev/cryptos/bots/freqtrade/.env/src/python-bittrex/bittrex/bittrex.py", line 154, in _api_query
    return self.dispatch(request_url, apisign)
  File "/Users/sgrimm/dev/cryptos/bots/freqtrade/.env/src/python-bittrex/bittrex/bittrex.py", line 77, in using_requests
    headers={"apisign": apisign}
  File "/Users/sgrimm/dev/cryptos/bots/freqtrade/.env/lib/python3.6/site-packages/requests/models.py", line 892, in json
    return complexjson.loads(self.text, **kwargs)
  File "/usr/local/Cellar/python3/3.6.3/Frameworks/Python.framework/Versions/3.6/lib/python3.6/json/__init__.py", line 354, in loads
    return _default_decoder.decode(s)
  File "/usr/local/Cellar/python3/3.6.3/Frameworks/Python.framework/Versions/3.6/lib/python3.6/json/decoder.py", line 339, in decode
    obj, end = self.raw_decode(s, idx=_w(s, 0).end())
  File "/usr/local/Cellar/python3/3.6.3/Frameworks/Python.framework/Versions/3.6/lib/python3.6/json/decoder.py", line 357, in raw_decode
    raise JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)
2017-11-15 21:26:16,346 - freqtrade - INFO - Checking buy signals to create a new trade with stake_amount: 0.050000 ...
2017-11-15 21:26:23,034 - freqtrade - INFO - *BITTREX:* Buying [BTC/XRP](https://www.bittrex.com/Market/Index?MarketName=BTC-XRP) with limit `0.00002919`
2017-11-15 21:26:26,300 - freqtrade - INFO - Checking buy signals to create a new trade with stake_amount: 0.050000 ...
2017-11-15 21:26:35,587 - freqtrade - INFO - Checked all whitelisted currencies. Found no suitable entry positions for buying. Will keep looking ...
2017-11-15 21:26:35,588 - freqtrade - INFO - Got open order for Trade(id=2, pair=BTC_XRP, amount=1708.63309352518, open_rate=2.919e-05, open_since=seconds ago)
2017-11-15 21:26:36,344 - freqtrade - INFO - Checking buy signals to create a new trade with stake_amount: 0.050000 ...
2017-11-15 21:26:36,974 - freqtrade - INFO - Checked all whitelisted currencies. Found no suitable entry positions for buying. Will keep looking ...
2017-11-15 21:26:39,015 - freqtrade.rpc.telegram - INFO - Executing handler: _status for chat_id: 497298357
2017-11-15 21:26:46,314 - freqtrade - INFO - Checking buy signals to create a new trade with stake_amount: 0.050000 ...
2017-11-15 21:26:46,969 - freqtrade - INFO - Checked all whitelisted currencies. Found no suitable entry positions for buying. Will keep looking ...
2017-11-15 21:26:56,392 - freqtrade - INFO - Checking buy signals to create a new trade with stake_amount: 0.050000 ...
2017-11-15 21:27:12,990 - freqtrade - ERROR - Unable to create trade
Traceback (most recent call last):
  File "./freqtrade/main.py", line 70, in _process
    trade = create_trade(float(_CONF['stake_amount']))
  File "./freqtrade/main.py", line 223, in create_trade
    if get_buy_signal(_pair):
  File "/Users/sgrimm/dev/cryptos/bots/freqtrade/freqtrade/analyze.py", line 99, in get_buy_signal
    dataframe = analyze_ticker(pair)
  File "/Users/sgrimm/dev/cryptos/bots/freqtrade/freqtrade/analyze.py", line 82, in analyze_ticker
    ticker_hist = get_ticker_history(pair)
  File "/Users/sgrimm/dev/cryptos/bots/freqtrade/.env/lib/python3.6/site-packages/cachetools/__init__.py", line 46, in wrapper
    v = func(*args, **kwargs)
  File "/Users/sgrimm/dev/cryptos/bots/freqtrade/freqtrade/exchange/__init__.py", line 133, in get_ticker_history
    return _API.get_ticker_history(pair, tick_interval)
  File "/Users/sgrimm/dev/cryptos/bots/freqtrade/freqtrade/exchange/bittrex.py", line 103, in get_ticker_history
    data = _API_V2.get_candles(pair.replace('_', '-'), interval)
  File "/Users/sgrimm/dev/cryptos/bots/freqtrade/.env/src/python-bittrex/bittrex/bittrex.py", line 794, in get_candles
    }, protection=PROTECTION_PUB)
  File "/Users/sgrimm/dev/cryptos/bots/freqtrade/.env/src/python-bittrex/bittrex/bittrex.py", line 154, in _api_query
    return self.dispatch(request_url, apisign)
  File "/Users/sgrimm/dev/cryptos/bots/freqtrade/.env/src/python-bittrex/bittrex/bittrex.py", line 77, in using_requests
    headers={"apisign": apisign}
  File "/Users/sgrimm/dev/cryptos/bots/freqtrade/.env/lib/python3.6/site-packages/requests/models.py", line 892, in json
    return complexjson.loads(self.text, **kwargs)
  File "/usr/local/Cellar/python3/3.6.3/Frameworks/Python.framework/Versions/3.6/lib/python3.6/json/__init__.py", line 354, in loads
    return _default_decoder.decode(s)
  File "/usr/local/Cellar/python3/3.6.3/Frameworks/Python.framework/Versions/3.6/lib/python3.6/json/decoder.py", line 339, in decode
    obj, end = self.raw_decode(s, idx=_w(s, 0).end())
  File "/usr/local/Cellar/python3/3.6.3/Frameworks/Python.framework/Versions/3.6/lib/python3.6/json/decoder.py", line 357, in raw_decode
    raise JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)
2017-11-15 21:27:14,055 - freqtrade - INFO - Checking buy signals to create a new trade with stake_amount: 0.050000 ...

The app seems to think that the trade went through... and, since I'm running a dry run, I can't confirm that it actually has. This may just be another API inconsistency.

So far, this is the only error I've seen in the latest develop branch.

TypeError: 'NoneType' object is not iterable

This all just occurred on the latest version of the develop branch, which I pulled within the last two hours.

I've been running the bot with "dry_run": true to check if it's stable, and I've hit an error that kills the loop altogether, crashing the python script.

Just FYI - I don't have any BTC balance in my bittrex account at the moment, so I'm not sure if that's causing the problem, though I assume not, since it's a dry run. Also, here are the pairs I'm whitelisting:

"pair_whitelist": [
            "BTC_VTC",
            "BTC_LTC",
            "BTC_OK",
            "BTC_WAVES",
            "BTC_XRP",
            "BTC_SALT",
            "BTC_RLC",
            "BTC_ETH",
            "BTC_BCC",
            "BTC_PIVX",
            "BTC_STRAT",
            "BTC_XZC",
            "BTC_LUN"
        ]

And here's the error I'm seeing:

2017-11-15 00:48:38,788 - freqtrade - INFO - Checked all whitelisted currencies. Found no suitable entry positions for buying. Will keep looking ...
2017-11-15 00:48:48,267 - freqtrade - INFO - Checking buy signals to create a new trade with stake_amount: 0.050000 ...
Traceback (most recent call last):
  File "./freqtrade/main.py", line 361, in <module>
    main()
  File "./freqtrade/main.py", line 355, in main
    dynamic_whitelist=args.dynamic_whitelist,
  File "/Users/sgrimm/dev/cryptos/bots/freqtrade/freqtrade/misc.py", line 52, in throttle
    result = func(*args, **kwargs)
  File "./freqtrade/main.py", line 70, in _process
    trade = create_trade(float(_CONF['stake_amount']))
  File "./freqtrade/main.py", line 223, in create_trade
    if get_buy_signal(_pair):
  File "/Users/sgrimm/dev/cryptos/bots/freqtrade/freqtrade/analyze.py", line 99, in get_buy_signal
    dataframe = analyze_ticker(pair)
  File "/Users/sgrimm/dev/cryptos/bots/freqtrade/freqtrade/analyze.py", line 82, in analyze_ticker
    ticker_hist = get_ticker_history(pair)
  File "/Users/sgrimm/dev/cryptos/bots/freqtrade/.env/lib/python3.6/site-packages/cachetools/__init__.py", line 46, in wrapper
    v = func(*args, **kwargs)
  File "/Users/sgrimm/dev/cryptos/bots/freqtrade/freqtrade/exchange/__init__.py", line 133, in get_ticker_history
    return _API.get_ticker_history(pair, tick_interval)
  File "/Users/sgrimm/dev/cryptos/bots/freqtrade/freqtrade/exchange/bittrex.py", line 106, in get_ticker_history
    for tick in data['result']:
TypeError: 'NoneType' object is not iterable

/forcesellall feature

Hey guys,

This is a really neat project. Thanks for all your work. I've been tinkering around with the code, although I have literally no knowledge of python previous to writing some small changes to this repo.

I parsed some of the logic together and created my own fork for a /forcesellall feature. This is something that I thought would be useful to get everything back to bitcoin (for example, when you reach a certain ROI of profit)

This could be expanded further through the config as a "sell all" once a certain ROI has been achieved, or when a certain number of trades have completed.

For now, this is just the manual telegram command. Here it is on a feature branch on my fork:
https://github.com/freshfunkee/freqtrade/blob/feature/forcesellall/rpc/telegram.py

I'm posting it here as I would love some input into creating a test for this function in the existing test_telegram.py before submitting a pull request. As I've mentioned, I have little to no knowledge of python. I'll be poking around in the meantime, but if someone could explain one or two of the existing tests and what's going on there, I would be able to give this a stab.

Improve unittests

  • fix tests that require internet access (some more mocks needed
  • check coverage and implement missing tests
  • convert to using Pytest with less nesting

SyntaxError: invalid syntax

Hi,
Hope someone can help me to move this forward. I'm trying to get this going on an ARM box.
I followed the install requirements and installed all correct versions and pip install -r requirements.txt runs without any errors.

When I start main.py

localhost:/freqtrade # ./main.py
File "./main.py", line 30
def _process() -> None:
^
SyntaxError: invalid syntax

Looks like I'm still missing something ;-(
Any suggestion on howto troubleshoot this?

Thanks,
M

ERROR - Unable to create trade

There's an issue with some of the market not being able to create a trade throwing below error.

2017-11-12 20:29:51,553 - main - ERROR - Unable to create trade
Traceback (most recent call last):
File "./freqtrade/main.py", line 40, in _process
trade = create_trade(float(_CONF['stake_amount']))
File "./freqtrade/main.py", line 184, in create_trade
if get_buy_signal(_pair):
File "/Users/arvin/dev/freqtrade/freqtrade/analyze.py", line 102, in get_buy_signal
dataframe = analyze_ticker(pair)
File "/Users/arvin/dev/freqtrade/freqtrade/analyze.py", line 85, in analyze_ticker
dataframe = parse_ticker_dataframe(data)
File "/Users/arvin/dev/freqtrade/freqtrade/analyze.py", line 25, in parse_ticker_dataframe
.drop('BV', 1)
File "/Users/arvin/anaconda/envs/cryptobot/lib/python3.6/site-packages/pandas/core/generic.py", line 2161, in drop
new_axis = axis.drop(labels, errors=errors)
File "/Users/arvin/anaconda/envs/cryptobot/lib/python3.6/site-packages/pandas/core/indexes/base.py", line 3624, in drop
labels[mask])
ValueError: labels ['BV'] not contained in axis

Buy resulting in crash of loop

This is in the develop branch, which I've had running overnight with "dry_run": true.

A number of buy/sell orders were placed overnight, but one of them caused an error that killed the loop. Note that the pair BTC-LUN was successfully bought and sold overnight, so it's not like this is unique to this coin pairing. Anyway, here is the error I'm seeing in the console:

2017-11-15 12:14:48,532 - freqtrade - INFO - Checking buy signals to create a new trade with stake_amount: 0.050000 ...
2017-11-15 12:14:58,986 - freqtrade - INFO - *BITTREX:* Buying [BTC/LUN](https://www.bittrex.com/Market/Index?MarketName=BTC-LUN) with limit `0.00065566`
2017-11-15 12:15:00,378 - freqtrade - INFO - Got open order for Trade(id=5, pair=BTC_LUN, amount=76.06838910410885, open_rate=0.00065566, open_since=just now)
Traceback (most recent call last):
  File "./freqtrade/main.py", line 361, in <module>
    main()
  File "./freqtrade/main.py", line 355, in main
    dynamic_whitelist=args.dynamic_whitelist,
  File "/Users/sgrimm/dev/cryptos/bots/freqtrade/freqtrade/misc.py", line 52, in throttle
    result = func(*args, **kwargs)
  File "./freqtrade/main.py", line 91, in _process
    state_changed = handle_trade(trade) or state_changed
  File "./freqtrade/main.py", line 181, in handle_trade
    current_rate = exchange.get_ticker(trade.pair)['bid']
  File "/Users/sgrimm/dev/cryptos/bots/freqtrade/freqtrade/exchange/__init__.py", line 128, in get_ticker
    return _API.get_ticker(pair)
  File "/Users/sgrimm/dev/cryptos/bots/freqtrade/freqtrade/exchange/bittrex.py", line 85, in get_ticker
    if not data['result']['Bid'] or not data['result']['Ask'] or not data['result']['Last']:
TypeError: 'NoneType' object is not subscriptable
2

Handling SIGINT is broken

Seems that in latest develop shutdown is b0rked

2017-11-16 10:21:05,446 - freqtrade - INFO - Checking buy signals to create a new trade with stake_amount: 0.010000 ...
^C2017-11-16 10:21:06,059 - freqtrade - INFO - Stopping trader and cleaning up modules...
^C2017-11-16 10:21:18,309 - freqtrade - INFO - Stopping trader and cleaning up modules...
^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C

only way to circumvent this is to Ctrl-z and kill the pid

Value Error

Hi,
I have this problem.

How i can resolve this ?

2017-09-01 18:39:26,956 - main - INFO - Creating new trade with stake_amount: 0.002000 ...
2017-09-01 18:39:29,536 - analyze - DEBUG - buy_trigger: 2017-09-01T16:37:00 (pair=BTC_OMG, signal=False)
2017-09-01 18:39:29,536 - main - ERROR - ValueError during trade creation
Traceback (most recent call last):
File "/home/startup/Bureau/freqtrade-master/main.py", line 86, in _process
Session.add(create_trade(float(CONFIG['stake_amount']), api_wrapper.exchange))
File "/home/startup/Bureau/freqtrade-master/main.py", line 205, in create_trade
raise ValueError('No buy signal from pairs: {}'.format(', '.join(whitelist)))

/balance command failing

This is all in the develop branch, which I left running overnight with "dry_run": true.

When I issue a /balance command from telegram, it doesn't return anything. The console shows this error:

2017-11-15 12:08:12,043 - freqtrade.rpc.telegram - INFO - Executing handler: _balance for chat_id: 497298357
2017-11-15 12:08:12,144 - freqtrade.rpc.telegram - WARNING - Got Telegram NetworkError: Message text is empty! Trying one more time.
2017-11-15 12:08:12,288 - freqtrade.rpc.telegram - ERROR - Exception occurred within Telegram module
Traceback (most recent call last):
  File "/Users/sgrimm/dev/cryptos/bots/freqtrade/freqtrade/rpc/telegram.py", line 476, in send_msg
    bot.send_message(_CONF['telegram']['chat_id'], msg, parse_mode=parse_mode)
  File "/Users/sgrimm/dev/cryptos/bots/freqtrade/.env/lib/python3.6/site-packages/telegram/bot.py", line 57, in decorator
    result = func(self, *args, **kwargs)
  File "/Users/sgrimm/dev/cryptos/bots/freqtrade/.env/lib/python3.6/site-packages/telegram/bot.py", line 82, in decorator
    result = self._request.post(url, data, timeout=kwargs.get('timeout'))
  File "/Users/sgrimm/dev/cryptos/bots/freqtrade/.env/lib/python3.6/site-packages/telegram/utils/request.py", line 272, in post
    **urlopen_kwargs)
  File "/Users/sgrimm/dev/cryptos/bots/freqtrade/.env/lib/python3.6/site-packages/telegram/utils/request.py", line 210, in _request_wrapper
    raise BadRequest(message)
telegram.error.BadRequest: Message text is empty

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/Users/sgrimm/dev/cryptos/bots/freqtrade/freqtrade/rpc/telegram.py", line 104, in wrapper
    return command_handler(*args, **kwargs)
  File "/Users/sgrimm/dev/cryptos/bots/freqtrade/freqtrade/rpc/telegram.py", line 288, in _balance
    send_msg(output)
  File "/Users/sgrimm/dev/cryptos/bots/freqtrade/freqtrade/rpc/telegram.py", line 484, in send_msg
    bot.send_message(_CONF['telegram']['chat_id'], msg, parse_mode=parse_mode)
  File "/Users/sgrimm/dev/cryptos/bots/freqtrade/.env/lib/python3.6/site-packages/telegram/bot.py", line 57, in decorator
    result = func(self, *args, **kwargs)
  File "/Users/sgrimm/dev/cryptos/bots/freqtrade/.env/lib/python3.6/site-packages/telegram/bot.py", line 82, in decorator
    result = self._request.post(url, data, timeout=kwargs.get('timeout'))
  File "/Users/sgrimm/dev/cryptos/bots/freqtrade/.env/lib/python3.6/site-packages/telegram/utils/request.py", line 272, in post
    **urlopen_kwargs)
  File "/Users/sgrimm/dev/cryptos/bots/freqtrade/.env/lib/python3.6/site-packages/telegram/utils/request.py", line 210, in _request_wrapper
    raise BadRequest(message)
telegram.error.BadRequest: Message text is empty

Interpolate missing data

  • Make Pandas do the conversion from string to datetime for the ticker data
  • If there is missing timestamps, Pandas should interpolate the missing data because TA-lib does not know about the missing data as it ignores the date field

Runtime Error , argument error

Show the exception message:

2017-11-10 09:39:41,088 - main - INFO - Starting freqtrade 0.14.1
2017-11-10 09:39:41,091 - main - INFO - Validating configuration ...
2017-11-10 09:39:41,112 - JobQueue - DEBUG - JobQueue thread started
2017-11-10 09:39:41,116 - freqtrade.rpc.telegram - INFO - rpc.telegram is listening for following commands: [['status'], ['profit'], ['balance'], ['start'], ['stop'], ['forcesell'], ['performance'], ['count'], ['help'], ['version']]
Traceback (most recent call last):
File "freqtrade/main.py", line 288, in
main()
File "freqtrade/main.py", line 267, in main
init(_CONF)
File "freqtrade/main.py", line 226, in init
exchange.init(config)
File "/home/tt/freqtrade/freqtrade/exchange/init.py", line 52, in init
_API = exchange_class(exchange_config)
File "/home/tt/freqtrade/freqtrade/exchange/bittrex.py", line 36, in init
calls_per_second=5,
TypeError: init() got an unexpected keyword argument 'calls_per_second'

^CException ignored in: <module 'threading' from '/usr/lib/python3.6/threading.py'>
Traceback (most recent call last):
File "/usr/lib/python3.6/threading.py", line 1294, in _shutdown
t.join()
File "/usr/lib/python3.6/threading.py", line 1056, in join
self._wait_for_tstate_lock()
File "/usr/lib/python3.6/threading.py", line 1072, in _wait_for_tstate_lock
elif lock.acquire(block, timeout):
KeyboardInterrupt

Can't Add cryptocurrency of Bittrex because of Poloniex

Hello !
I am Happy to meet you and your bot :) !
I use it since 3 days and I make profit, thank you for that.
I have some Idea and one issue for you if you permit :

  • I can't trade money present on Bittrex and not on Poloniex (with Poloniex disable)
  • I read the last issues. I compare the hour if buying with the actual chart and effectively, we have 1/2min of delay to make better profit. It is due to the refresh of 1min ?
    -Do you think use 2 strategies is better than one ? (For example we study the trend of the chart and if it is down, we use one and if it is up another one ?)

I am developer engineer but newbie of trading, i think, i can help you to implement new strategies or API if you are some Idea but you have lack of time.

Thank you for Reading.

Exceeding bittrex requests

It seems Bittrex does not allow ' too many' API requests. Any way to get around this?

Traceback (most recent call last):
File "/home/amg/Downloads/freqtrade4/freqtrade-develop/.env/lib/python3.5/site-packages/urllib3/connectionpool.py", line 601, in urlopen
chunked=chunked)
File "/home/amg/Downloads/freqtrade4/freqtrade-develop/.env/lib/python3.5/site-packages/urllib3/connectionpool.py", line 346, in _make_request
self._validate_conn(conn)
File "/home/amg/Downloads/freqtrade4/freqtrade-develop/.env/lib/python3.5/site-packages/urllib3/connectionpool.py", line 850, in validate_conn
conn.connect()
File "/home/amg/Downloads/freqtrade4/freqtrade-develop/.env/lib/python3.5/site-packages/urllib3/connection.py", line 326, in connect
ssl_context=context)
File "/home/amg/Downloads/freqtrade4/freqtrade-develop/.env/lib/python3.5/site-packages/urllib3/util/ssl
.py", line 329, in ssl_wrap_socket
return context.wrap_socket(sock, server_hostname=server_hostname)
File "/usr/lib/python3.5/ssl.py", line 377, in wrap_socket
_context=self)
File "/usr/lib/python3.5/ssl.py", line 752, in init
self.do_handshake()
File "/usr/lib/python3.5/ssl.py", line 988, in do_handshake
self._sslobj.do_handshake()
File "/usr/lib/python3.5/ssl.py", line 633, in do_handshake
self._sslobj.do_handshake()
ssl.SSLEOFError: EOF occurred in violation of protocol (_ssl.c:645)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/home/amg/Downloads/freqtrade4/freqtrade-develop/.env/lib/python3.5/site-packages/requests/adapters.py", line 440, in send
timeout=timeout
File "/home/amg/Downloads/freqtrade4/freqtrade-develop/.env/lib/python3.5/site-packages/urllib3/connectionpool.py", line 639, in urlopen
_stacktrace=sys.exc_info()[2])
File "/home/amg/Downloads/freqtrade4/freqtrade-develop/.env/lib/python3.5/site-packages/urllib3/util/retry.py", line 388, in increment
raise MaxRetryError(_pool, url, error or ResponseError(cause))
urllib3.exceptions.MaxRetryError: HTTPSConnectionPool(host='bittrex.com', port=443): Max retries exceeded with url: /api/v1.1/public/getticker?market=BTC-SYNX (Caused by SSLError(SSLEOFError(8, 'EOF occurred in violation of protocol (_ssl.c:645)'),))

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/home/amg/Downloads/freqtrade4/freqtrade-develop/.env/bin/freqtrade", line 6, in
exec(compile(open(file).read(), file, 'exec'))
File "/home/amg/Downloads/freqtrade4/freqtrade-develop/bin/freqtrade", line 4, in
main()
File "/home/amg/Downloads/freqtrade4/freqtrade-develop/freqtrade/main.py", line 269, in main
app(_CONF)
File "/home/amg/Downloads/freqtrade4/freqtrade-develop/freqtrade/main.py", line 249, in app
_process()
File "/home/amg/Downloads/freqtrade4/freqtrade-develop/freqtrade/main.py", line 57, in _process
handle_trade(trade)
File "/home/amg/Downloads/freqtrade4/freqtrade-develop/freqtrade/main.py", line 137, in handle_trade
current_rate = exchange.get_ticker(trade.pair)['bid']
File "/home/amg/Downloads/freqtrade4/freqtrade-develop/freqtrade/exchange.py", line 105, in get_ticker
data = API.get_ticker(pair.replace('', '-'))
File "/home/amg/Downloads/freqtrade4/freqtrade-develop/.env/src/python-bittrex/bittrex/bittrex.py", line 186, in get_ticker
return self.api_query('getticker', {'market': market})
File "/home/amg/Downloads/freqtrade4/freqtrade-develop/.env/src/python-bittrex/bittrex/bittrex.py", line 131, in api_query
return self.dispatch(request_url, apisign)
File "/home/amg/Downloads/freqtrade4/freqtrade-develop/.env/src/python-bittrex/bittrex/bittrex.py", line 70, in using_requests
headers={"apisign": apisign}
File "/home/amg/Downloads/freqtrade4/freqtrade-develop/.env/lib/python3.5/site-packages/requests/api.py", line 72, in get
return request('get', url, params=params, **kwargs)
File "/home/amg/Downloads/freqtrade4/freqtrade-develop/.env/lib/python3.5/site-packages/requests/api.py", line 58, in request
return session.request(method=method, url=url, **kwargs)
File "/home/amg/Downloads/freqtrade4/freqtrade-develop/.env/lib/python3.5/site-packages/requests/sessions.py", line 508, in request
resp = self.send(prep, **send_kwargs)
File "/home/amg/Downloads/freqtrade4/freqtrade-develop/.env/lib/python3.5/site-packages/requests/sessions.py", line 618, in send
r = adapter.send(request, **kwargs)
File "/home/amg/Downloads/freqtrade4/freqtrade-develop/.env/lib/python3.5/site-packages/requests/adapters.py", line 506, in send
raise SSLError(e, request=request)
requests.exceptions.SSLError: HTTPSConnectionPool(host='bittrex.com', port=443): Max retries exceeded with url: /api/v1.1/public/getticker?market=BTC-SYNX (Caused by SSLError(SSLEOFError(8, 'EOF occurred in violation of protocol (_ssl.c:645)'),))
2017-10-04 14:27:43,612 - telegram.ext.updater - ERROR - Error while getting Updates: Timed out
^CException ignored in: <module 'threading' from '/usr/lib/python3.5/threading.py'>
Traceback (most recent call last):
File "/usr/lib/python3.5/threading.py", line 1288, in _shutdown
t.join()
File "/usr/lib/python3.5/threading.py", line 1054, in join
self._wait_for_tstate_lock()
File "/usr/lib/python3.5/threading.py", line 1070, in _wait_for_tstate_lock
elif lock.acquire(block, timeout):
KeyboardInterrupt

Use Bittrex v2.0 API

Version 0.2.0 was released recently and supports the get_candles method accessing the API endpoint /pub/market/GetTicks.
freqtrade currently uses a custom method accessing the same endpoint to gather history data for analysis. It can be simplified after the update.

Additionally a default but adjustable sleep time of 1 second is introduced between all API calls. It might be better to disable it and rely on freqtrade to handle sleeping for a better compatibility to other possible exchanges.

Race Condition: Buy Order Not Complete Before Sell Order

If you make a buy and the order is not complete before you have a race condition and the bot stops.

2 options to resolve:
1 Check the wallet to make sure that sufficient coins are available. This makes other problem scenarios: buy never completes, price changes drastically before the buy is complete, etc. Maybe can do something like cancel the pending order, and sell what coins are available.
2 check order status and cancel a buy after a certain time if it's not fulfilled. If the order is partial, then update the order table with the appropriate quantity. This can also be used with a wallet check to make sure there is sufficient coins available.

Traceback (most recent call last):
File "/home/rybolov/freqtrade/freqtrade/main.py", line 91, in _process
state_changed = handle_trade(trade) or state_changed
File "/home/rybolov/freqtrade/freqtrade/main.py", line 183, in handle_trade
execute_sell(trade, current_rate)
File "/home/rybolov/freqtrade/freqtrade/main.py", line 137, in execute_sell
order_id = exchange.sell(str(trade.pair), limit, trade.amount)
File "/home/rybolov/freqtrade/freqtrade/exchange/init.py", line 110, in sell
return _API.sell(pair, rate, amount)
File "/home/rybolov/freqtrade/freqtrade/exchange/bittrex.py", line 62, in sell
amount=amount))
RuntimeError: INSUFFICIENT_FUNDS params=(BTC_EMC2, 1.508e-05, 1345.4275694631779)

INSUFFICIENT_FUNDS

Step 1: bot "BITTREX: Buying BTC/LUN at rate 0.001101"
Step 2: Status: Got RuntimeError:
Traceback (most recent call last):
File "main.py", line 261, in app
_process()
File "main.py", line 42, in _process
trade = create_trade(float(_CONF['stake_amount']), exchange.EXCHANGE)
File "main.py", line 198, in create_trade
order_id = exchange.buy(pair, open_rate, amount)
File "/app/exchange.py", line 62, in buy
raise RuntimeError('BITTREX: {}'.format(data['message']))
RuntimeError: BITTREX: INSUFFICIENT_FUNDS

Nothing happened between step 1 and step 2. My bot is launched from the master branch.

Possibly related to this bug,
/status
=> Trade ID: 1
Current Pair: BTC_LUN
Open Since: 5 hours ago
Amount: 72.66055712
Open Rate: 0.00110101
Close Rate: None
Current Rate: 0.00110001
Close Profit: None
Current Profit: -0.09%
Open Order: None

/forcesell 1

BITTREX: Selling BTC/LUN at rate 0.001093 (profit: -0.74%)

Sell is done (I have checked on bittrex), but /status still gives the Trade ID as an open order.

Exception on wallet in maintenance mode

A wallet in maintenance mode caused an exception resulting in a stopped bot (dev branch).

Traceback (most recent call last):
  File "/usr/bin/freqtrade", line 4, in <module>
    main()
  File "/usr/lib/python3.6/site-packages/freqtrade/main.py", line 269, in main
    app(_CONF)
  File "/usr/lib/python3.6/site-packages/freqtrade/main.py", line 249, in app
    _process()
  File "/usr/lib/python3.6/site-packages/freqtrade/main.py", line 57, in _process
    handle_trade(trade)
  File "/usr/lib/python3.6/site-packages/freqtrade/main.py", line 137, in handle_trade
    current_rate = exchange.get_ticker(trade.pair)['bid']
  File "/usr/lib/python3.6/site-packages/freqtrade/exchange.py", line 118, in get_ticker
    'bid': float(data['result']['Bid']),
TypeError: float() argument must be a string or a number, not 'NoneType'
2017-10-07 03:55:46,165 - telegram.ext.updater - ERROR - Error while getting Updates: Timed out

Currently it is still offline and I logged the API resonse:

{'success': True, 'message': '', 'result': {'Bid': None, 'Ask': None, 'Last': None}}

New functionality (alert messages, /buy)

Hi !

It's new Idea i would like to implement myself so i Share it here :
-create new thread which will check all money with the algo choosen and it send you alert when he think the money will grow up
-Create alert with slack of several money (update, bug fix etc..)
-Create command /buy /askBuy /askSell with the name of money and the amount in BTC for the parameters

(This functionality add the part of manual trader with lot of indications to make the good decision in addition to the bot)

For the bot :
Add a latency between the start of trader and the buy decision (10min for example) because i notice, it make Bad decision on the start of bot.

What do you think about it ?

Enhancement: Auto Reload Configuration

Reload configuration files itself periodically without restarting would be a very interesting feature.

I'm running on an ARM Cubox and it takes quite some time to reload the complete Python stack.

Rewriting some modules to make it testable

@vertti @shusso I'm currently in the process to rewrite some modules to reduce complexity and remove unneeded wrapper classes. The main motivation was to make the code more testable. I've also included some unit tests. I will push it to develop branch this evening. Please look over it if it's fine for you and I would also like to create future PR against develop instead of master.

EDIT: I'll update this issue when it's pushed

Pair not available

Running 0.14.2 as docker image results in these logs after starting up:

2017-11-20 09:33:48,057 - freqtrade - INFO - Starting freqtrade 0.14.2 (loglevel=INFO)
2017-11-20 09:33:48,058 - freqtrade - INFO - Validating configuration ...
2017-11-20 09:33:48,065 - freqtrade.rpc.telegram - INFO - rpc.telegram is listening for following commands: [['status'], ['profit'], ['balance'], ['start'], ['stop'], ['forcesell'], ['performance'], ['count'], ['help'], ['version']]

Then it idles. When executing /status:

Traceback (most recent call last):
  File "/usr/local/bin/freqtrade", line 6, in <module>
    exec(compile(open(__file__).read(), __file__, 'exec'))
  File "/freqtrade/bin/freqtrade", line 4, in <module>
    main()
  File "/freqtrade/freqtrade/main.py", line 340, in main
    init(_CONF)
  File "/freqtrade/freqtrade/main.py", line 265, in init
    exchange.init(config)
  File "/freqtrade/freqtrade/exchange/__init__.py", line 56, in init
    validate_pairs(config['exchange']['pair_whitelist'])
  File "/freqtrade/freqtrade/exchange/__init__.py", line 74, in validate_pairs
    raise RuntimeError('Pair {} is not available at {}'.format(pair, _API.name.lower()))
RuntimeError: Pair BTC-ADX is not available at bittrex
2017-11-20 09:34:00,377 - freqtrade.rpc.telegram - INFO - Executing handler: _status for chat_id:

This is for every coin I set in the config.

Refactoring analyze

@gcarq i'd like to get my new buy strategy into develop, but I think I'll start by writing bunch of tests for analyze.py and refactoring it a little. Is that ok or have you started on analyze.py already?

Drop me an email at janne dot sinivirta at gmail dot com and I'll invite you to our Slack, the Github issue tracker is probably not the best way to talk about ideas :)

That idiomatic Python

Turns out the extra parentheses were needed, without them Python throws:

  File "/Users/vertti/dev/freqtrade/main.py", line 172, in handle_trade
    if 'stoploss' in CONFIG & current_profit < float(CONFIG['stoploss'])*100:
TypeError: unsupported operand type(s) for &: 'dict' and 'float'

Commit 69bfc2d should be reverted.

Sell amount equal to amount purchased

At the moment, the bot sells whatever the balance is for the given pair on the exchange. It would be nice to have an option to sell only the amount of coin previously purchased by the bot. This way, freqtrade won't accidentally mess with whatever trades I am doing manually on the side.

Sell signal

I have test the new buy signal with the combo ADX/SAR and i found a good signal to sell :
Cross of +DI and -DI
dataframe['dih'] = ta.TA_PLUS_DI(dataframe)
dataframe['dil'] = ta.TA_MINUS_DI(dataframe)

and add other buy signal :
+DI > -DI

i started to put a pull request but i am a little difficulty with the main.py for this new function

`def populate_sell_trend(dataframe: DataFrame) -> DataFrame:

# wait for stable turn from bearish to bullish market
dataframe.loc[
    (dataframe['dih'] <= dataframe['dil']),
    'swap'
] = 1

dataframe.loc[
    (dataframe['swap'] == 1), 
    'sell'] = 1
dataframe.loc[dataframe['sell'] == 1, 'sell_price'] = dataframe['close']

return dataframe

def analyze_ticker_sell(pair: str) -> DataFrame:

minimum_date = arrow.utcnow().shift(hours=-6)
data = get_ticker(pair, minimum_date)
dataframe = parse_ticker_dataframe(data['result'], minimum_date)
dataframe = populate_indicators(dataframe)
dataframe = populate_sell_trend(dataframe)
return dataframe`

what do you think about this ?

Problem installing freqtrade - Command "python setup.py egg_info" failed with error code 1

Hi, I am trying to set up a VPS to run some tests but did not manage to install the bot. I am using CentOS 6. I already searched for a solution online but did not manage to solve this by myself. Does anyone know how to solve this? Thanks

I followed the installation instructions but the following command

pip3.6 install -e .

returns:

Obtaining file:///XXXXX/freqtrade-develop
Complete output from command python setup.py egg_info:
Traceback (most recent call last):
File "", line 1, in
File "/XXXXXX/freqtrade-develop/setup.py", line 3, in
from freqtrade import version
File "/XXXXX/freqtrade-develop/freqtrade/init.py", line 3, in
from . import main
File "/XXXXX/freqtrade-develop/freqtrade/main.py", line 10, in
from jsonschema import validate
ModuleNotFoundError: No module named 'jsonschema'

----------------------------------------

Command "python setup.py egg_info" failed with error code 1 in /XXXXX/freqtrade-develop/

Whitelist pair after sale

Currently, the purchased pair is still removed from the whitelist even after it's sold. In my mind it would make sense if it is whitelisted again once sold. Would make a pull request on this, but my limited python skills keep me from seeing how to ideally get the whitelist object into execute_sell.

INSUFFICIENT_FUNDS after /forcesell all

Disclose: bot was stoped but killed afterward, after selling all. Sell was completed.

Traceback (most recent call last): File "./freqtrade/main.py", line 91, in _process state_changed = handle_trade(trade) or state_changed File "./freqtrade/main.py", line 183, in handle_trade execute_sell(trade, current_rate) File "./freqtrade/main.py", line 137, in execute_sell order_id = exchange.sell(str(trade.pair), limit, trade.amount) File "/var/local/user/freqtrade/freqtrade/exchange/__init__.py", line 110, in sell return _API.sell(pair, rate, amount) File "/var/local/user/freqtrade/freqtrade/exchange/bittrex.py", line 62, in sell amount=amount)) RuntimeError: INSUFFICIENT_FUNDS params=(BTC_DASH, 0.0626001, 0.09763458)

Telegram NetworkError eventually killing loop

I've had develop running for approximately the past day in dry_run mode. It's been pretty stable until about an hour ago, where it appears Telegram was having networking issues. A series of errors occurred, which eventually caused the app to stop checking for buy opportunities. Sorry for the length of the errors but I figured I might as well include it in case it helps.

2017-11-17 10:22:05,893 - freqtrade - INFO - Checking buy signals to create a new trade with stake_amount: 0.050000 ...
2017-11-17 10:22:11,311 - freqtrade - INFO - *BITTREX:* Buying [BTC/RLC](https://www.bittrex.com/Market/Index?MarketName=BTC-RLC) with limit `0.00006956`
2017-11-17 10:22:16,619 - freqtrade.rpc.telegram - WARNING - Got Telegram NetworkError: Timed out! Trying one more time.
Traceback (most recent call last):
  File "/Users/sgrimm/dev/cryptos/bots/freqtrade/.env/lib/python3.6/site-packages/telegram/vendor/ptb_urllib3/urllib3/connectionpool.py", line 402, in _make_request
    six.raise_from(e, None)
  File "<string>", line 2, in raise_from
  File "/Users/sgrimm/dev/cryptos/bots/freqtrade/.env/lib/python3.6/site-packages/telegram/vendor/ptb_urllib3/urllib3/connectionpool.py", line 398, in _make_request
    httplib_response = conn.getresponse()
  File "/usr/local/Cellar/python3/3.6.3/Frameworks/Python.framework/Versions/3.6/lib/python3.6/http/client.py", line 1331, in getresponse
    response.begin()
  File "/usr/local/Cellar/python3/3.6.3/Frameworks/Python.framework/Versions/3.6/lib/python3.6/http/client.py", line 297, in begin
    version, status, reason = self._read_status()
  File "/usr/local/Cellar/python3/3.6.3/Frameworks/Python.framework/Versions/3.6/lib/python3.6/http/client.py", line 258, in _read_status
    line = str(self.fp.readline(_MAXLINE + 1), "iso-8859-1")
  File "/usr/local/Cellar/python3/3.6.3/Frameworks/Python.framework/Versions/3.6/lib/python3.6/socket.py", line 586, in readinto
    return self._sock.recv_into(b)
  File "/usr/local/Cellar/python3/3.6.3/Frameworks/Python.framework/Versions/3.6/lib/python3.6/ssl.py", line 1009, in recv_into
    return self.read(nbytes, buffer)
  File "/usr/local/Cellar/python3/3.6.3/Frameworks/Python.framework/Versions/3.6/lib/python3.6/ssl.py", line 871, in read
    return self._sslobj.read(len, buffer)
  File "/usr/local/Cellar/python3/3.6.3/Frameworks/Python.framework/Versions/3.6/lib/python3.6/ssl.py", line 631, in read
    v = self._sslobj.read(len, buffer)
socket.timeout: The read operation timed out

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/Users/sgrimm/dev/cryptos/bots/freqtrade/.env/lib/python3.6/site-packages/telegram/utils/request.py", line 190, in _request_wrapper
    resp = self._con_pool.request(*args, **kwargs)
  File "/Users/sgrimm/dev/cryptos/bots/freqtrade/.env/lib/python3.6/site-packages/telegram/vendor/ptb_urllib3/urllib3/request.py", line 70, in request
    **urlopen_kw)
  File "/Users/sgrimm/dev/cryptos/bots/freqtrade/.env/lib/python3.6/site-packages/telegram/vendor/ptb_urllib3/urllib3/request.py", line 148, in request_encode_body
    return self.urlopen(method, url, **extra_kw)
  File "/Users/sgrimm/dev/cryptos/bots/freqtrade/.env/lib/python3.6/site-packages/telegram/vendor/ptb_urllib3/urllib3/poolmanager.py", line 244, in urlopen
    response = conn.urlopen(method, u.request_uri, **kw)
  File "/Users/sgrimm/dev/cryptos/bots/freqtrade/.env/lib/python3.6/site-packages/telegram/vendor/ptb_urllib3/urllib3/connectionpool.py", line 666, in urlopen
    _stacktrace=sys.exc_info()[2])
  File "/Users/sgrimm/dev/cryptos/bots/freqtrade/.env/lib/python3.6/site-packages/telegram/vendor/ptb_urllib3/urllib3/util/retry.py", line 347, in increment
    raise six.reraise(type(error), error, _stacktrace)
  File "/Users/sgrimm/dev/cryptos/bots/freqtrade/.env/lib/python3.6/site-packages/telegram/vendor/ptb_urllib3/urllib3/packages/six.py", line 686, in reraise
    raise value
  File "/Users/sgrimm/dev/cryptos/bots/freqtrade/.env/lib/python3.6/site-packages/telegram/vendor/ptb_urllib3/urllib3/connectionpool.py", line 617, in urlopen
    chunked=chunked)
  File "/Users/sgrimm/dev/cryptos/bots/freqtrade/.env/lib/python3.6/site-packages/telegram/vendor/ptb_urllib3/urllib3/connectionpool.py", line 405, in _make_request
    exc_cls=ReadTimeoutError)
  File "/Users/sgrimm/dev/cryptos/bots/freqtrade/.env/lib/python3.6/site-packages/telegram/vendor/ptb_urllib3/urllib3/connectionpool.py", line 321, in _raise_timeout
    raise exc_cls(*args)
telegram.vendor.ptb_urllib3.urllib3.exceptions.ReadTimeoutError: HTTPSConnectionPool(host='api.telegram.org', port=443): Read timed out. (read timeout=5.0)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "./freqtrade/main.py", line 361, in <module>
    main()
  File "./freqtrade/main.py", line 355, in main
    dynamic_whitelist=args.dynamic_whitelist,
  File "/Users/sgrimm/dev/cryptos/bots/freqtrade/freqtrade/misc.py", line 52, in throttle
    result = func(*args, **kwargs)
  File "./freqtrade/main.py", line 70, in _process
    trade = create_trade(float(_CONF['stake_amount']))
  File "./freqtrade/main.py", line 243, in create_trade
    telegram.send_msg(message)
  File "/Users/sgrimm/dev/cryptos/bots/freqtrade/freqtrade/rpc/telegram.py", line 487, in send_msg
    bot.send_message(_CONF['telegram']['chat_id'], msg, parse_mode=parse_mode)
  File "/Users/sgrimm/dev/cryptos/bots/freqtrade/.env/lib/python3.6/site-packages/telegram/bot.py", line 57, in decorator
    result = func(self, *args, **kwargs)
  File "/Users/sgrimm/dev/cryptos/bots/freqtrade/.env/lib/python3.6/site-packages/telegram/bot.py", line 82, in decorator
    result = self._request.post(url, data, timeout=kwargs.get('timeout'))
  File "/Users/sgrimm/dev/cryptos/bots/freqtrade/.env/lib/python3.6/site-packages/telegram/utils/request.py", line 272, in post
    **urlopen_kwargs)
  File "/Users/sgrimm/dev/cryptos/bots/freqtrade/.env/lib/python3.6/site-packages/telegram/utils/request.py", line 192, in _request_wrapper
    raise TimedOut()
telegram.error.TimedOut: Timed out
2017-11-17 11:15:03,507 - freqtrade.rpc.telegram - INFO - Executing handler: _status for chat_id: 497298357
2017-11-17 11:15:08,839 - freqtrade.rpc.telegram - WARNING - Got Telegram NetworkError: Timed out! Trying one more time.
2017-11-17 11:15:14,141 - freqtrade.rpc.telegram - ERROR - Exception occurred within Telegram module
Traceback (most recent call last):
  File "/Users/sgrimm/dev/cryptos/bots/freqtrade/.env/lib/python3.6/site-packages/telegram/vendor/ptb_urllib3/urllib3/connectionpool.py", line 402, in _make_request
    six.raise_from(e, None)
  File "<string>", line 2, in raise_from
  File "/Users/sgrimm/dev/cryptos/bots/freqtrade/.env/lib/python3.6/site-packages/telegram/vendor/ptb_urllib3/urllib3/connectionpool.py", line 398, in _make_request
    httplib_response = conn.getresponse()
  File "/usr/local/Cellar/python3/3.6.3/Frameworks/Python.framework/Versions/3.6/lib/python3.6/http/client.py", line 1331, in getresponse
    response.begin()
  File "/usr/local/Cellar/python3/3.6.3/Frameworks/Python.framework/Versions/3.6/lib/python3.6/http/client.py", line 297, in begin
    version, status, reason = self._read_status()
  File "/usr/local/Cellar/python3/3.6.3/Frameworks/Python.framework/Versions/3.6/lib/python3.6/http/client.py", line 258, in _read_status
    line = str(self.fp.readline(_MAXLINE + 1), "iso-8859-1")
  File "/usr/local/Cellar/python3/3.6.3/Frameworks/Python.framework/Versions/3.6/lib/python3.6/socket.py", line 586, in readinto
    return self._sock.recv_into(b)
  File "/usr/local/Cellar/python3/3.6.3/Frameworks/Python.framework/Versions/3.6/lib/python3.6/ssl.py", line 1009, in recv_into
    return self.read(nbytes, buffer)
  File "/usr/local/Cellar/python3/3.6.3/Frameworks/Python.framework/Versions/3.6/lib/python3.6/ssl.py", line 871, in read
    return self._sslobj.read(len, buffer)
  File "/usr/local/Cellar/python3/3.6.3/Frameworks/Python.framework/Versions/3.6/lib/python3.6/ssl.py", line 631, in read
    v = self._sslobj.read(len, buffer)
socket.timeout: The read operation timed out

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/Users/sgrimm/dev/cryptos/bots/freqtrade/.env/lib/python3.6/site-packages/telegram/utils/request.py", line 190, in _request_wrapper
    resp = self._con_pool.request(*args, **kwargs)
  File "/Users/sgrimm/dev/cryptos/bots/freqtrade/.env/lib/python3.6/site-packages/telegram/vendor/ptb_urllib3/urllib3/request.py", line 70, in request
    **urlopen_kw)
  File "/Users/sgrimm/dev/cryptos/bots/freqtrade/.env/lib/python3.6/site-packages/telegram/vendor/ptb_urllib3/urllib3/request.py", line 148, in request_encode_body
    return self.urlopen(method, url, **extra_kw)
  File "/Users/sgrimm/dev/cryptos/bots/freqtrade/.env/lib/python3.6/site-packages/telegram/vendor/ptb_urllib3/urllib3/poolmanager.py", line 244, in urlopen
    response = conn.urlopen(method, u.request_uri, **kw)
  File "/Users/sgrimm/dev/cryptos/bots/freqtrade/.env/lib/python3.6/site-packages/telegram/vendor/ptb_urllib3/urllib3/connectionpool.py", line 666, in urlopen
    _stacktrace=sys.exc_info()[2])
  File "/Users/sgrimm/dev/cryptos/bots/freqtrade/.env/lib/python3.6/site-packages/telegram/vendor/ptb_urllib3/urllib3/util/retry.py", line 347, in increment
    raise six.reraise(type(error), error, _stacktrace)
  File "/Users/sgrimm/dev/cryptos/bots/freqtrade/.env/lib/python3.6/site-packages/telegram/vendor/ptb_urllib3/urllib3/packages/six.py", line 686, in reraise
    raise value
  File "/Users/sgrimm/dev/cryptos/bots/freqtrade/.env/lib/python3.6/site-packages/telegram/vendor/ptb_urllib3/urllib3/connectionpool.py", line 617, in urlopen
    chunked=chunked)
  File "/Users/sgrimm/dev/cryptos/bots/freqtrade/.env/lib/python3.6/site-packages/telegram/vendor/ptb_urllib3/urllib3/connectionpool.py", line 405, in _make_request
    exc_cls=ReadTimeoutError)
  File "/Users/sgrimm/dev/cryptos/bots/freqtrade/.env/lib/python3.6/site-packages/telegram/vendor/ptb_urllib3/urllib3/connectionpool.py", line 321, in _raise_timeout
    raise exc_cls(*args)
telegram.vendor.ptb_urllib3.urllib3.exceptions.ReadTimeoutError: HTTPSConnectionPool(host='api.telegram.org', port=443): Read timed out. (read timeout=5.0)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/Users/sgrimm/dev/cryptos/bots/freqtrade/freqtrade/rpc/telegram.py", line 104, in wrapper
    return command_handler(*args, **kwargs)
  File "/Users/sgrimm/dev/cryptos/bots/freqtrade/freqtrade/rpc/telegram.py", line 132, in _status
    send_msg('*Status:* `no active trade`', bot=bot)
  File "/Users/sgrimm/dev/cryptos/bots/freqtrade/freqtrade/rpc/telegram.py", line 487, in send_msg
    bot.send_message(_CONF['telegram']['chat_id'], msg, parse_mode=parse_mode)
  File "/Users/sgrimm/dev/cryptos/bots/freqtrade/.env/lib/python3.6/site-packages/telegram/bot.py", line 57, in decorator
    result = func(self, *args, **kwargs)
  File "/Users/sgrimm/dev/cryptos/bots/freqtrade/.env/lib/python3.6/site-packages/telegram/bot.py", line 82, in decorator
    result = self._request.post(url, data, timeout=kwargs.get('timeout'))
  File "/Users/sgrimm/dev/cryptos/bots/freqtrade/.env/lib/python3.6/site-packages/telegram/utils/request.py", line 272, in post
    **urlopen_kwargs)
  File "/Users/sgrimm/dev/cryptos/bots/freqtrade/.env/lib/python3.6/site-packages/telegram/utils/request.py", line 192, in _request_wrapper
    raise TimedOut()
telegram.error.TimedOut: Timed out
2017-11-17 11:15:22,760 - freqtrade.rpc.telegram - INFO - Executing handler: _profit for chat_id: 497298357
2017-11-17 11:15:28,551 - freqtrade.rpc.telegram - WARNING - Got Telegram NetworkError: Timed out! Trying one more time.
2017-11-17 11:15:33,857 - freqtrade.rpc.telegram - ERROR - Exception occurred within Telegram module
Traceback (most recent call last):
  File "/Users/sgrimm/dev/cryptos/bots/freqtrade/.env/lib/python3.6/site-packages/telegram/vendor/ptb_urllib3/urllib3/connectionpool.py", line 402, in _make_request
    six.raise_from(e, None)
  File "<string>", line 2, in raise_from
  File "/Users/sgrimm/dev/cryptos/bots/freqtrade/.env/lib/python3.6/site-packages/telegram/vendor/ptb_urllib3/urllib3/connectionpool.py", line 398, in _make_request
    httplib_response = conn.getresponse()
  File "/usr/local/Cellar/python3/3.6.3/Frameworks/Python.framework/Versions/3.6/lib/python3.6/http/client.py", line 1331, in getresponse
    response.begin()
  File "/usr/local/Cellar/python3/3.6.3/Frameworks/Python.framework/Versions/3.6/lib/python3.6/http/client.py", line 297, in begin
    version, status, reason = self._read_status()
  File "/usr/local/Cellar/python3/3.6.3/Frameworks/Python.framework/Versions/3.6/lib/python3.6/http/client.py", line 258, in _read_status
    line = str(self.fp.readline(_MAXLINE + 1), "iso-8859-1")
  File "/usr/local/Cellar/python3/3.6.3/Frameworks/Python.framework/Versions/3.6/lib/python3.6/socket.py", line 586, in readinto
    return self._sock.recv_into(b)
  File "/usr/local/Cellar/python3/3.6.3/Frameworks/Python.framework/Versions/3.6/lib/python3.6/ssl.py", line 1009, in recv_into
    return self.read(nbytes, buffer)
  File "/usr/local/Cellar/python3/3.6.3/Frameworks/Python.framework/Versions/3.6/lib/python3.6/ssl.py", line 871, in read
    return self._sslobj.read(len, buffer)
  File "/usr/local/Cellar/python3/3.6.3/Frameworks/Python.framework/Versions/3.6/lib/python3.6/ssl.py", line 631, in read
    v = self._sslobj.read(len, buffer)
socket.timeout: The read operation timed out

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/Users/sgrimm/dev/cryptos/bots/freqtrade/.env/lib/python3.6/site-packages/telegram/utils/request.py", line 190, in _request_wrapper
    resp = self._con_pool.request(*args, **kwargs)
  File "/Users/sgrimm/dev/cryptos/bots/freqtrade/.env/lib/python3.6/site-packages/telegram/vendor/ptb_urllib3/urllib3/request.py", line 70, in request
    **urlopen_kw)
  File "/Users/sgrimm/dev/cryptos/bots/freqtrade/.env/lib/python3.6/site-packages/telegram/vendor/ptb_urllib3/urllib3/request.py", line 148, in request_encode_body
    return self.urlopen(method, url, **extra_kw)
  File "/Users/sgrimm/dev/cryptos/bots/freqtrade/.env/lib/python3.6/site-packages/telegram/vendor/ptb_urllib3/urllib3/poolmanager.py", line 244, in urlopen
    response = conn.urlopen(method, u.request_uri, **kw)
  File "/Users/sgrimm/dev/cryptos/bots/freqtrade/.env/lib/python3.6/site-packages/telegram/vendor/ptb_urllib3/urllib3/connectionpool.py", line 666, in urlopen
    _stacktrace=sys.exc_info()[2])
  File "/Users/sgrimm/dev/cryptos/bots/freqtrade/.env/lib/python3.6/site-packages/telegram/vendor/ptb_urllib3/urllib3/util/retry.py", line 347, in increment
    raise six.reraise(type(error), error, _stacktrace)
  File "/Users/sgrimm/dev/cryptos/bots/freqtrade/.env/lib/python3.6/site-packages/telegram/vendor/ptb_urllib3/urllib3/packages/six.py", line 686, in reraise
    raise value
  File "/Users/sgrimm/dev/cryptos/bots/freqtrade/.env/lib/python3.6/site-packages/telegram/vendor/ptb_urllib3/urllib3/connectionpool.py", line 617, in urlopen
    chunked=chunked)
  File "/Users/sgrimm/dev/cryptos/bots/freqtrade/.env/lib/python3.6/site-packages/telegram/vendor/ptb_urllib3/urllib3/connectionpool.py", line 405, in _make_request
    exc_cls=ReadTimeoutError)
  File "/Users/sgrimm/dev/cryptos/bots/freqtrade/.env/lib/python3.6/site-packages/telegram/vendor/ptb_urllib3/urllib3/connectionpool.py", line 321, in _raise_timeout
    raise exc_cls(*args)
telegram.vendor.ptb_urllib3.urllib3.exceptions.ReadTimeoutError: HTTPSConnectionPool(host='api.telegram.org', port=443): Read timed out. (read timeout=5.0)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/Users/sgrimm/dev/cryptos/bots/freqtrade/freqtrade/rpc/telegram.py", line 104, in wrapper
    return command_handler(*args, **kwargs)
  File "/Users/sgrimm/dev/cryptos/bots/freqtrade/freqtrade/rpc/telegram.py", line 267, in _profit
    send_msg(markdown_msg, bot=bot)
  File "/Users/sgrimm/dev/cryptos/bots/freqtrade/freqtrade/rpc/telegram.py", line 487, in send_msg
    bot.send_message(_CONF['telegram']['chat_id'], msg, parse_mode=parse_mode)
  File "/Users/sgrimm/dev/cryptos/bots/freqtrade/.env/lib/python3.6/site-packages/telegram/bot.py", line 57, in decorator
    result = func(self, *args, **kwargs)
  File "/Users/sgrimm/dev/cryptos/bots/freqtrade/.env/lib/python3.6/site-packages/telegram/bot.py", line 82, in decorator
    result = self._request.post(url, data, timeout=kwargs.get('timeout'))
  File "/Users/sgrimm/dev/cryptos/bots/freqtrade/.env/lib/python3.6/site-packages/telegram/utils/request.py", line 272, in post
    **urlopen_kwargs)
  File "/Users/sgrimm/dev/cryptos/bots/freqtrade/.env/lib/python3.6/site-packages/telegram/utils/request.py", line 192, in _request_wrapper
    raise TimedOut()
telegram.error.TimedOut: Timed out
2017-11-17 11:15:36,685 - freqtrade.rpc.telegram - INFO - Executing handler: _performance for chat_id: 497298357
2017-11-17 11:15:41,984 - freqtrade.rpc.telegram - WARNING - Got Telegram NetworkError: Timed out! Trying one more time.
2017-11-17 11:15:47,300 - freqtrade.rpc.telegram - ERROR - Exception occurred within Telegram module
Traceback (most recent call last):
  File "/Users/sgrimm/dev/cryptos/bots/freqtrade/.env/lib/python3.6/site-packages/telegram/vendor/ptb_urllib3/urllib3/connectionpool.py", line 402, in _make_request
    six.raise_from(e, None)
  File "<string>", line 2, in raise_from
  File "/Users/sgrimm/dev/cryptos/bots/freqtrade/.env/lib/python3.6/site-packages/telegram/vendor/ptb_urllib3/urllib3/connectionpool.py", line 398, in _make_request
    httplib_response = conn.getresponse()
  File "/usr/local/Cellar/python3/3.6.3/Frameworks/Python.framework/Versions/3.6/lib/python3.6/http/client.py", line 1331, in getresponse
    response.begin()
  File "/usr/local/Cellar/python3/3.6.3/Frameworks/Python.framework/Versions/3.6/lib/python3.6/http/client.py", line 297, in begin
    version, status, reason = self._read_status()
  File "/usr/local/Cellar/python3/3.6.3/Frameworks/Python.framework/Versions/3.6/lib/python3.6/http/client.py", line 258, in _read_status
    line = str(self.fp.readline(_MAXLINE + 1), "iso-8859-1")
  File "/usr/local/Cellar/python3/3.6.3/Frameworks/Python.framework/Versions/3.6/lib/python3.6/socket.py", line 586, in readinto
    return self._sock.recv_into(b)
  File "/usr/local/Cellar/python3/3.6.3/Frameworks/Python.framework/Versions/3.6/lib/python3.6/ssl.py", line 1009, in recv_into
    return self.read(nbytes, buffer)
  File "/usr/local/Cellar/python3/3.6.3/Frameworks/Python.framework/Versions/3.6/lib/python3.6/ssl.py", line 871, in read
    return self._sslobj.read(len, buffer)
  File "/usr/local/Cellar/python3/3.6.3/Frameworks/Python.framework/Versions/3.6/lib/python3.6/ssl.py", line 631, in read
    v = self._sslobj.read(len, buffer)
socket.timeout: The read operation timed out

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/Users/sgrimm/dev/cryptos/bots/freqtrade/.env/lib/python3.6/site-packages/telegram/utils/request.py", line 190, in _request_wrapper
    resp = self._con_pool.request(*args, **kwargs)
  File "/Users/sgrimm/dev/cryptos/bots/freqtrade/.env/lib/python3.6/site-packages/telegram/vendor/ptb_urllib3/urllib3/request.py", line 70, in request
    **urlopen_kw)
  File "/Users/sgrimm/dev/cryptos/bots/freqtrade/.env/lib/python3.6/site-packages/telegram/vendor/ptb_urllib3/urllib3/request.py", line 148, in request_encode_body
    return self.urlopen(method, url, **extra_kw)
  File "/Users/sgrimm/dev/cryptos/bots/freqtrade/.env/lib/python3.6/site-packages/telegram/vendor/ptb_urllib3/urllib3/poolmanager.py", line 244, in urlopen
    response = conn.urlopen(method, u.request_uri, **kw)
  File "/Users/sgrimm/dev/cryptos/bots/freqtrade/.env/lib/python3.6/site-packages/telegram/vendor/ptb_urllib3/urllib3/connectionpool.py", line 666, in urlopen
    _stacktrace=sys.exc_info()[2])
  File "/Users/sgrimm/dev/cryptos/bots/freqtrade/.env/lib/python3.6/site-packages/telegram/vendor/ptb_urllib3/urllib3/util/retry.py", line 347, in increment
    raise six.reraise(type(error), error, _stacktrace)
  File "/Users/sgrimm/dev/cryptos/bots/freqtrade/.env/lib/python3.6/site-packages/telegram/vendor/ptb_urllib3/urllib3/packages/six.py", line 686, in reraise
    raise value
  File "/Users/sgrimm/dev/cryptos/bots/freqtrade/.env/lib/python3.6/site-packages/telegram/vendor/ptb_urllib3/urllib3/connectionpool.py", line 617, in urlopen
    chunked=chunked)
  File "/Users/sgrimm/dev/cryptos/bots/freqtrade/.env/lib/python3.6/site-packages/telegram/vendor/ptb_urllib3/urllib3/connectionpool.py", line 405, in _make_request
    exc_cls=ReadTimeoutError)
  File "/Users/sgrimm/dev/cryptos/bots/freqtrade/.env/lib/python3.6/site-packages/telegram/vendor/ptb_urllib3/urllib3/connectionpool.py", line 321, in _raise_timeout
    raise exc_cls(*args)
telegram.vendor.ptb_urllib3.urllib3.exceptions.ReadTimeoutError: HTTPSConnectionPool(host='api.telegram.org', port=443): Read timed out. (read timeout=5.0)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/Users/sgrimm/dev/cryptos/bots/freqtrade/freqtrade/rpc/telegram.py", line 104, in wrapper
    return command_handler(*args, **kwargs)
  File "/Users/sgrimm/dev/cryptos/bots/freqtrade/freqtrade/rpc/telegram.py", line 390, in _performance
    send_msg(message, parse_mode=ParseMode.HTML)
  File "/Users/sgrimm/dev/cryptos/bots/freqtrade/freqtrade/rpc/telegram.py", line 487, in send_msg
    bot.send_message(_CONF['telegram']['chat_id'], msg, parse_mode=parse_mode)
  File "/Users/sgrimm/dev/cryptos/bots/freqtrade/.env/lib/python3.6/site-packages/telegram/bot.py", line 57, in decorator
    result = func(self, *args, **kwargs)
  File "/Users/sgrimm/dev/cryptos/bots/freqtrade/.env/lib/python3.6/site-packages/telegram/bot.py", line 82, in decorator
    result = self._request.post(url, data, timeout=kwargs.get('timeout'))
  File "/Users/sgrimm/dev/cryptos/bots/freqtrade/.env/lib/python3.6/site-packages/telegram/utils/request.py", line 272, in post
    **urlopen_kwargs)
  File "/Users/sgrimm/dev/cryptos/bots/freqtrade/.env/lib/python3.6/site-packages/telegram/utils/request.py", line 192, in _request_wrapper
    raise TimedOut()
telegram.error.TimedOut: Timed out
2017-11-17 11:35:05,494 - freqtrade.rpc.telegram - INFO - Executing handler: _status for chat_id: 497298357
2017-11-17 11:35:10,811 - freqtrade.rpc.telegram - WARNING - Got Telegram NetworkError: Timed out! Trying one more time.
2017-11-17 11:35:16,109 - freqtrade.rpc.telegram - ERROR - Exception occurred within Telegram module
Traceback (most recent call last):
  File "/Users/sgrimm/dev/cryptos/bots/freqtrade/.env/lib/python3.6/site-packages/telegram/vendor/ptb_urllib3/urllib3/connectionpool.py", line 402, in _make_request
    six.raise_from(e, None)
  File "<string>", line 2, in raise_from
  File "/Users/sgrimm/dev/cryptos/bots/freqtrade/.env/lib/python3.6/site-packages/telegram/vendor/ptb_urllib3/urllib3/connectionpool.py", line 398, in _make_request
    httplib_response = conn.getresponse()
  File "/usr/local/Cellar/python3/3.6.3/Frameworks/Python.framework/Versions/3.6/lib/python3.6/http/client.py", line 1331, in getresponse
    response.begin()
  File "/usr/local/Cellar/python3/3.6.3/Frameworks/Python.framework/Versions/3.6/lib/python3.6/http/client.py", line 297, in begin
    version, status, reason = self._read_status()
  File "/usr/local/Cellar/python3/3.6.3/Frameworks/Python.framework/Versions/3.6/lib/python3.6/http/client.py", line 258, in _read_status
    line = str(self.fp.readline(_MAXLINE + 1), "iso-8859-1")
  File "/usr/local/Cellar/python3/3.6.3/Frameworks/Python.framework/Versions/3.6/lib/python3.6/socket.py", line 586, in readinto
    return self._sock.recv_into(b)
  File "/usr/local/Cellar/python3/3.6.3/Frameworks/Python.framework/Versions/3.6/lib/python3.6/ssl.py", line 1009, in recv_into
    return self.read(nbytes, buffer)
  File "/usr/local/Cellar/python3/3.6.3/Frameworks/Python.framework/Versions/3.6/lib/python3.6/ssl.py", line 871, in read
    return self._sslobj.read(len, buffer)
  File "/usr/local/Cellar/python3/3.6.3/Frameworks/Python.framework/Versions/3.6/lib/python3.6/ssl.py", line 631, in read
    v = self._sslobj.read(len, buffer)
socket.timeout: The read operation timed out

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/Users/sgrimm/dev/cryptos/bots/freqtrade/.env/lib/python3.6/site-packages/telegram/utils/request.py", line 190, in _request_wrapper
    resp = self._con_pool.request(*args, **kwargs)
  File "/Users/sgrimm/dev/cryptos/bots/freqtrade/.env/lib/python3.6/site-packages/telegram/vendor/ptb_urllib3/urllib3/request.py", line 70, in request
    **urlopen_kw)
  File "/Users/sgrimm/dev/cryptos/bots/freqtrade/.env/lib/python3.6/site-packages/telegram/vendor/ptb_urllib3/urllib3/request.py", line 148, in request_encode_body
    return self.urlopen(method, url, **extra_kw)
  File "/Users/sgrimm/dev/cryptos/bots/freqtrade/.env/lib/python3.6/site-packages/telegram/vendor/ptb_urllib3/urllib3/poolmanager.py", line 244, in urlopen
    response = conn.urlopen(method, u.request_uri, **kw)
  File "/Users/sgrimm/dev/cryptos/bots/freqtrade/.env/lib/python3.6/site-packages/telegram/vendor/ptb_urllib3/urllib3/connectionpool.py", line 666, in urlopen
    _stacktrace=sys.exc_info()[2])
  File "/Users/sgrimm/dev/cryptos/bots/freqtrade/.env/lib/python3.6/site-packages/telegram/vendor/ptb_urllib3/urllib3/util/retry.py", line 347, in increment
    raise six.reraise(type(error), error, _stacktrace)
  File "/Users/sgrimm/dev/cryptos/bots/freqtrade/.env/lib/python3.6/site-packages/telegram/vendor/ptb_urllib3/urllib3/packages/six.py", line 686, in reraise
    raise value
  File "/Users/sgrimm/dev/cryptos/bots/freqtrade/.env/lib/python3.6/site-packages/telegram/vendor/ptb_urllib3/urllib3/connectionpool.py", line 617, in urlopen
    chunked=chunked)
  File "/Users/sgrimm/dev/cryptos/bots/freqtrade/.env/lib/python3.6/site-packages/telegram/vendor/ptb_urllib3/urllib3/connectionpool.py", line 405, in _make_request
    exc_cls=ReadTimeoutError)
  File "/Users/sgrimm/dev/cryptos/bots/freqtrade/.env/lib/python3.6/site-packages/telegram/vendor/ptb_urllib3/urllib3/connectionpool.py", line 321, in _raise_timeout
    raise exc_cls(*args)
telegram.vendor.ptb_urllib3.urllib3.exceptions.ReadTimeoutError: HTTPSConnectionPool(host='api.telegram.org', port=443): Read timed out. (read timeout=5.0)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/Users/sgrimm/dev/cryptos/bots/freqtrade/freqtrade/rpc/telegram.py", line 104, in wrapper
    return command_handler(*args, **kwargs)
  File "/Users/sgrimm/dev/cryptos/bots/freqtrade/freqtrade/rpc/telegram.py", line 132, in _status
    send_msg('*Status:* `no active trade`', bot=bot)
  File "/Users/sgrimm/dev/cryptos/bots/freqtrade/freqtrade/rpc/telegram.py", line 487, in send_msg
    bot.send_message(_CONF['telegram']['chat_id'], msg, parse_mode=parse_mode)
  File "/Users/sgrimm/dev/cryptos/bots/freqtrade/.env/lib/python3.6/site-packages/telegram/bot.py", line 57, in decorator
    result = func(self, *args, **kwargs)
  File "/Users/sgrimm/dev/cryptos/bots/freqtrade/.env/lib/python3.6/site-packages/telegram/bot.py", line 82, in decorator
    result = self._request.post(url, data, timeout=kwargs.get('timeout'))
  File "/Users/sgrimm/dev/cryptos/bots/freqtrade/.env/lib/python3.6/site-packages/telegram/utils/request.py", line 272, in post
    **urlopen_kwargs)
  File "/Users/sgrimm/dev/cryptos/bots/freqtrade/.env/lib/python3.6/site-packages/telegram/utils/request.py", line 192, in _request_wrapper
    raise TimedOut()
telegram.error.TimedOut: Timed out
2017-11-17 11:35:17,780 - freqtrade.rpc.telegram - INFO - Executing handler: _profit for chat_id: 497298357
2017-11-17 11:35:23,091 - freqtrade.rpc.telegram - WARNING - Got Telegram NetworkError: Timed out! Trying one more time.
2017-11-17 11:35:28,421 - freqtrade.rpc.telegram - ERROR - Exception occurred within Telegram module
Traceback (most recent call last):
  File "/Users/sgrimm/dev/cryptos/bots/freqtrade/.env/lib/python3.6/site-packages/telegram/vendor/ptb_urllib3/urllib3/connectionpool.py", line 402, in _make_request
    six.raise_from(e, None)
  File "<string>", line 2, in raise_from
  File "/Users/sgrimm/dev/cryptos/bots/freqtrade/.env/lib/python3.6/site-packages/telegram/vendor/ptb_urllib3/urllib3/connectionpool.py", line 398, in _make_request
    httplib_response = conn.getresponse()
  File "/usr/local/Cellar/python3/3.6.3/Frameworks/Python.framework/Versions/3.6/lib/python3.6/http/client.py", line 1331, in getresponse
    response.begin()
  File "/usr/local/Cellar/python3/3.6.3/Frameworks/Python.framework/Versions/3.6/lib/python3.6/http/client.py", line 297, in begin
    version, status, reason = self._read_status()
  File "/usr/local/Cellar/python3/3.6.3/Frameworks/Python.framework/Versions/3.6/lib/python3.6/http/client.py", line 258, in _read_status
    line = str(self.fp.readline(_MAXLINE + 1), "iso-8859-1")
  File "/usr/local/Cellar/python3/3.6.3/Frameworks/Python.framework/Versions/3.6/lib/python3.6/socket.py", line 586, in readinto
    return self._sock.recv_into(b)
  File "/usr/local/Cellar/python3/3.6.3/Frameworks/Python.framework/Versions/3.6/lib/python3.6/ssl.py", line 1009, in recv_into
    return self.read(nbytes, buffer)
  File "/usr/local/Cellar/python3/3.6.3/Frameworks/Python.framework/Versions/3.6/lib/python3.6/ssl.py", line 871, in read
    return self._sslobj.read(len, buffer)
  File "/usr/local/Cellar/python3/3.6.3/Frameworks/Python.framework/Versions/3.6/lib/python3.6/ssl.py", line 631, in read
    v = self._sslobj.read(len, buffer)
socket.timeout: The read operation timed out

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/Users/sgrimm/dev/cryptos/bots/freqtrade/.env/lib/python3.6/site-packages/telegram/utils/request.py", line 190, in _request_wrapper
    resp = self._con_pool.request(*args, **kwargs)
  File "/Users/sgrimm/dev/cryptos/bots/freqtrade/.env/lib/python3.6/site-packages/telegram/vendor/ptb_urllib3/urllib3/request.py", line 70, in request
    **urlopen_kw)
  File "/Users/sgrimm/dev/cryptos/bots/freqtrade/.env/lib/python3.6/site-packages/telegram/vendor/ptb_urllib3/urllib3/request.py", line 148, in request_encode_body
    return self.urlopen(method, url, **extra_kw)
  File "/Users/sgrimm/dev/cryptos/bots/freqtrade/.env/lib/python3.6/site-packages/telegram/vendor/ptb_urllib3/urllib3/poolmanager.py", line 244, in urlopen
    response = conn.urlopen(method, u.request_uri, **kw)
  File "/Users/sgrimm/dev/cryptos/bots/freqtrade/.env/lib/python3.6/site-packages/telegram/vendor/ptb_urllib3/urllib3/connectionpool.py", line 666, in urlopen
    _stacktrace=sys.exc_info()[2])
  File "/Users/sgrimm/dev/cryptos/bots/freqtrade/.env/lib/python3.6/site-packages/telegram/vendor/ptb_urllib3/urllib3/util/retry.py", line 347, in increment
    raise six.reraise(type(error), error, _stacktrace)
  File "/Users/sgrimm/dev/cryptos/bots/freqtrade/.env/lib/python3.6/site-packages/telegram/vendor/ptb_urllib3/urllib3/packages/six.py", line 686, in reraise
    raise value
  File "/Users/sgrimm/dev/cryptos/bots/freqtrade/.env/lib/python3.6/site-packages/telegram/vendor/ptb_urllib3/urllib3/connectionpool.py", line 617, in urlopen
    chunked=chunked)
  File "/Users/sgrimm/dev/cryptos/bots/freqtrade/.env/lib/python3.6/site-packages/telegram/vendor/ptb_urllib3/urllib3/connectionpool.py", line 405, in _make_request
    exc_cls=ReadTimeoutError)
  File "/Users/sgrimm/dev/cryptos/bots/freqtrade/.env/lib/python3.6/site-packages/telegram/vendor/ptb_urllib3/urllib3/connectionpool.py", line 321, in _raise_timeout
    raise exc_cls(*args)
telegram.vendor.ptb_urllib3.urllib3.exceptions.ReadTimeoutError: HTTPSConnectionPool(host='api.telegram.org', port=443): Read timed out. (read timeout=5.0)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/Users/sgrimm/dev/cryptos/bots/freqtrade/freqtrade/rpc/telegram.py", line 104, in wrapper
    return command_handler(*args, **kwargs)
  File "/Users/sgrimm/dev/cryptos/bots/freqtrade/freqtrade/rpc/telegram.py", line 267, in _profit
    send_msg(markdown_msg, bot=bot)
  File "/Users/sgrimm/dev/cryptos/bots/freqtrade/freqtrade/rpc/telegram.py", line 487, in send_msg
    bot.send_message(_CONF['telegram']['chat_id'], msg, parse_mode=parse_mode)
  File "/Users/sgrimm/dev/cryptos/bots/freqtrade/.env/lib/python3.6/site-packages/telegram/bot.py", line 57, in decorator
    result = func(self, *args, **kwargs)
  File "/Users/sgrimm/dev/cryptos/bots/freqtrade/.env/lib/python3.6/site-packages/telegram/bot.py", line 82, in decorator
    result = self._request.post(url, data, timeout=kwargs.get('timeout'))
  File "/Users/sgrimm/dev/cryptos/bots/freqtrade/.env/lib/python3.6/site-packages/telegram/utils/request.py", line 272, in post
    **urlopen_kwargs)
  File "/Users/sgrimm/dev/cryptos/bots/freqtrade/.env/lib/python3.6/site-packages/telegram/utils/request.py", line 192, in _request_wrapper
    raise TimedOut()
telegram.error.TimedOut: Timed out

Missed Sell Order

Hi Guys, I recently noticed this issue when the bot made this trade.

Trade ID: 2
Current Pair: BTC_IOP
Open Since: 10 hours ago
Amount: 12.49968751
Open Rate: 0.00080002
Close Rate: 0.00080037
Current Rate: 0.00072
Close Profit: 0.04%
Current Profit: -10.00%
Open Order: 9.89177032 (LIMIT_SELL)

Since the market moved too quickly the bot's sell order for the BTC_IOP pair missed.
After that, the sell order just stuck around until I manually canceled it from bittrex.
Perhaps a /cancel_order command from the telegram input could work to partially solve this issue?

Account exchange fees

Right now the bot doesn't account trading fees, that means every trade with profit < 0.5% makes no real profit. There should be some hardcoded value for each exchange provider, so that this is accounted properly

Sell due to loss, bot buys the same currency

I set up loss limit to 5%, bot bought NEO, after a little while loss was 5.24% so bot sold NEO and right after that (few seconds later) bot bought NEO again. Does that make sense? If so - can we block that somehow? If not - can we block that somehow?

Bittrex : Dust Trade disallowed

Hi,

I gave a try to your bot this night, but I wanted to play with so little values than I faced the Bittrex anti micro trades thing :)

Traceback (most recent call last): File "./main.py", line 261, in app _process() File "./main.py", line 62, in _process handle_trade(trade) File "./main.py", line 147, in handle_trade execute_sell(trade, current_rate) File "./main.py", line 99, in execute_sell profit = trade.exec_sell_order(current_rate, balance) File "/home/johan/freqtrade/persistence.py", line 81, in exec_sell_order order_id = exchange.sell(str(self.pair), rate, amount) File "/home/johan/freqtrade/exchange.py", line 79, in sell raise RuntimeError('BITTREX: {}'.format(data['message'])) RuntimeError: BITTREX: DUST_TRADE_DISALLOWED_MIN_VALUE_50K_SAT

Maybe the bot should wait (or handle this error) to avoid it to stop.

By the way, I don't know why there was no problem with this limit when he bought...

Add commands helper in the bot

Okay it's not an issue, but I don't know how to make a pull request and link my changes, and I don't want to push badly, even in develop branch.

Just wanted to add the bot's commands... In a /help command !
Maybe useful for other people.

Hopefully, changes are very simple.

Add line 49 of telegram.py:

CommandHandler('help', _help),

Then, add after performance definition command (for example):

@authorized_only
def _help(bot: Bot, update: Update) -> None:
"""
Handler for /help.
Show commands of the bot
:param bot: telegram bot
:param update: message update
:return: None
"""
message = """
/start: Starts the trader
/stop: Stops the trader
/status: Lists all open trades
/profit: Lists cumulative profit from all finished trades
/forcesell <trade_id>: Instantly sells the given trade (Ignoring minimum_roi).
/performance: Show performance of each finished trade grouped by pair
"""
send_msg(message, bot=bot)

When you send /help in your Telegram bot, you receive all available commands.

And because I suck with markdown formatting, I add the modified telegram.py (renamed with .txt extension).

telegram.txt

Bot suddenly stops watching (and trading)

Hi again :)

I was wondering why this morning the bot stopped to answering to Telegram commands. So I let a terminal opened, and I just seen that after only 40 minutes, log output just stopped:

2017-09-29 16:26:45,327 - analyze - DEBUG - buy_trigger: 2017-09-29T14:20:00 (pair=BTC_GUP, signal=False)
2017-09-29 16:26:45,328 - root - INFO - Got no buy signal...
2017-09-29 16:26:50,901 - main - DEBUG - Handling open trade Trade(id=1, pair=BTC_MUE, amount=20.655822359927708, open_rate=3.873e-05, open_since=closed) ...
2017-09-29 16:44:12,936 - telegram.ext.updater - ERROR - Error while getting Updates: Timed out
2017-09-29 16:45:52,386 - rpc.telegram - INFO - Executing handler: _status for chat_id: 414727740

As you can see, line 3 is at 16h26, then line 4 at 16h44.
Last line is a successful attempt to send a command in Telegram. So the script is not terminated as I got answer in Telegram, but it just stop trading.

For info, I have only 7 coins in config.json, and I interrupted and started again with no problem.

Telegram conflict

Hi again,

After #42 , I killed the background process and started again the bot. All seems to work well, but I can see this error several times:

2017-09-29 08:13:10,167 - telegram.ext.updater - ERROR - Error while getting Updates: Conflict: terminated by other long poll or webhook (409)

But the Telegram bot works well. So I don't know what it refers to.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.