A script to parse and display buy_tag and sell_reason for freqtrade backtesting trades

Overview

freqtrade-buyreasons

A script to parse and display buy_tag and sell_reason for freqtrade backtesting trades

Usage

Copy the buy_reasons.py script into your freqtrade/scripts folder. You then need to backtest with the --export options enabled in freqtrade so that this script has the right data to work with:

freqtrade backtesting -c --timeframe 5m --strategy --timerange= --export=trades --export-filename=user_data/backtest_results/ -

Then you can run:

buy_reasons.py -c -s -t -g<[0,1,2,3,4]> [-l ]

The -l option is the same as the --datadir option in freqtrade, in case you have your downloaded historic data in a different folder to user_data/data/

Example:

buy_reasons.py -c my_config.json -s DoNothingStrategy -t 20211001- -g0,1,2

Comments
  • No trades to show

    No trades to show

    I don't seem to get through this error. Even though I have checked the backtest_results dir. It has three files one meta, json backtest results and the pickled signals. But when I run the script it seems to process the pairs but then throw the message 'no trades to show'.

    Processing 71 pairs...
    Strategy258btc
    \_ No trades to show
    

    Could it be a special case not covered by the if conditions under the following sections?

    for sname in stratnames:
            bigdf = pd.DataFrame()
    
            print(f"{sname}")
            for tpair, trades in analysed_trades_dict[sname].items():
                bigdf = pd.concat([bigdf, trades], ignore_index=True)
    
            if outfile:
                outfile.write(bigdf.to_csv())
            else:
                bigdf.to_csv(f'{sname}_all_trade_buys.csv')
    
            if (start_date is not None):
                bigdf = bigdf.loc[(bigdf['date'] > start_date)]
    
            if (end_date is not None):
                bigdf = bigdf.loc[(bigdf['date'] < end_date)]
    
            if bigdf.shape[0] > 0 and ('enter_reason' in bigdf.columns):
                if group is not None: .......................
    

    Would it have been better to use try & except somewhere?

    opened by moinonin 1
  • pickled_signal_candles' referenced before assignment

    pickled_signal_candles' referenced before assignment

    I got the following error when running the buy_reasons script

    Loading backtest trades data for Strategy258btc ...
    Loading all candle data: 20220101- [/home/defi/Desktop/portfolio/projects/python/crypto/freqtrade/user_data/data/binance]
    Traceback (most recent call last):
      File "/home/defi/Desktop/portfolio/projects/python/crypto/freqtrade/scripts/buy_reasons.py", line 585, in <module>
        main()
      File "/home/defi/Desktop/portfolio/projects/python/crypto/freqtrade/scripts/buy_reasons.py", line 479, in main
        parallel=parallel, pickled_signal_candles=pickled_signal_candles)
    UnboundLocalError: local variable 'pickled_signal_candles' referenced before assignment
    

    Any workaround is appreciated!

    opened by moinonin 1
  • Update buy_reasons.py

    Update buy_reasons.py

    Multiple tweaks:

    • clean up use of --no-parallel
    • add --timeframe parameter
    • get data format from config instead of a parameter
    • get pairlist from trades dataframe if pairlist is empty
    opened by rokups 1
  • error with Namespace object

    error with Namespace object

    (.env) [email protected]:~/ft# python3 scripts/buy_reasons.py -c user_data/configbt.json -s Tester -g0,1,2
    Traceback (most recent call last):
      File "scripts/buy_reasons.py", line 424, in <module>
        main()
      File "scripts/buy_reasons.py", line 270, in main
        if args.group is not None and args.indicators is not None:
    AttributeError: 'Namespace' object has no attribute 'indicators'
    

    I experienced this error

    opened by txtr99 0
  • tab spacing error

    tab spacing error

    (.env) [email protected]:~/ft# python3 scripts/buy_reasons.py -c user_data/configbt.json -s Tester -g0,1,2
      File "scripts/buy_reasons.py", line 275
        parallel = False
                       ^
    TabError: inconsistent use of tabs and spaces in indentation
    

    This error is coming up although I don't see anything wrong with line 275..

    opened by txtr99 1
Releases(v1.0)
Owner
Robert Davey
Robert Davey
Napari plugin for loading Bitplane Imaris files .ims

napari-imaris-loader Napari plugin for loading Bitplane Imaris files '.ims'. Notes: For this plugin to work "File/Preferences/Experimental/Render Imag

Alan Watson 4 Dec 01, 2022
MongoDB utility to inflate the contents of small collection to a new larger collection

MongoDB Data Inflater ("data-inflater") The data-inflater tool is a MongoDB utility to automate the creation of a new large database collection using

Paul Done 3 Nov 28, 2021
Adding two matrix from scratch using python.

Adding-two-matrix-from-scratch-using-python. Here, I have take two matrix from user and add it without using any library. I made this program from scr

Sachin Vinayak Dabhade 4 Sep 24, 2021
A simple API that will return a key-value pair of randomly generated UUID

A simple API that will return a key-value pair of randomly generated UUID. Key will be a timestamp and value will be UUID. While the server is running, whenever the API is called, it should return al

Pius Lucky 2 Jan 18, 2022
a demo show how to dump lldb info to ida.

用一个demo来聊聊动态trace 这个仓库能做什么? 帮助理解动态trace的思想。仓库内的demo,可操作,可实践。 动态trace核心思想: 动态记录一个函数内每一条指令的执行中产生的信息,并导入IDA,用来弥补IDA等静态分析工具的不足。 反编译看一下 先clone仓库,把hellolldb

25 Nov 28, 2022
A simple tool to extract python code from a Jupyter notebook, and then run pylint on it for static analysis.

Jupyter Pylinter A simple tool to extract python code from a Jupyter notebook, and then run pylint on it for static analysis. If you find this tool us

Edmund Goodman 10 Oct 13, 2022
Quickly edit your slack posts.

Lightning Edit Quickly edit your Slack posts. Heavily inspired by @KhushrajRathod's LightningDelete. Usage: Note: Before anything, be sure to head ove

14 Nov 19, 2021
Check username

Checker-Oukee Check username It checks the available usernames and creates a new account for them Doesn't need proxies Create a file with usernames an

4 Jun 05, 2022
Retrying is an Apache 2.0 licensed general-purpose retrying library, written in Python, to simplify the task of adding retry behavior to just about anything.

Retrying Retrying is an Apache 2.0 licensed general-purpose retrying library, written in Python, to simplify the task of adding retry behavior to just

Ray Holder 1.9k Dec 29, 2022
A collection of tools for biomedical research assay analysis in Python.

waltlabtools A collection of tools for biomedical research assay analysis in Python. Key Features Analysis for assays such as digital ELISA, including

Tyler Dougan 1 Apr 18, 2022
More routines for operating on iterables, beyond itertools

More Itertools Python's itertools library is a gem - you can compose elegant solutions for a variety of problems with the functions it provides. In mo

2.9k Jan 06, 2023
Script to decrypt / import chromium (edge/chrome) cookies

Cloonie Script to decrypt / import chromium (edge/chrome) cookies. Requirements Install the python dependencies via pip: pip install -r requirements.t

Lorenzo Bernardi 5 Sep 13, 2022
Casefy (/keɪsfaɪ/) is a lightweight Python package to convert the casing of strings

Casefy (/keɪsfaɪ/) is a lightweight Python package to convert the casing of strings. It has no third-party dependencies and supports Unicode.

Diego Miguel Lozano 12 Jan 08, 2023
✨ Un générateur de lien raccourcis en fonction d'un lien totalement fait en Python par moi, et en français.

Shorter Link ❗ Un générateur de lien raccourcis en fonction d'un lien totalement fait en Python par moi, et en français. Dépendences : pip install pys

MrGabin 3 Jun 06, 2021
A simple and easy to use Spam Bot made in Python!

This is a simple spam bot made in python. You can use to to spam anyone with anything on any platform.

7 Sep 08, 2022
Program to extract signatures from documents.

Extracting Signatures from Bank Checks Introduction Ahmed et al. [1] suggest a connected components-based method for segmenting signatures in document

Muhammad Saif Ullah Khan 9 Jan 26, 2022
A simple toolchain for moving Remarkable highlights to Readwise

A simple toolchain for moving Remarkable highlights to Readwise

zach wick 20 Dec 20, 2022
Brainfuck rollup scaling experiment for fun

Optimistic Brainfuck Ever wanted to run Brainfuck on ethereum? Don't ask, now you can! And at a fraction of the cost, thanks to optimistic rollup tech

Diederik Loerakker 48 Dec 28, 2022
Simple script to export contacts from telegram into vCard file

Telegram Contacts Exporter Simple script to export contacts from telegram into vCard file Getting Started Prerequisites You must to put your Telegram

Pere Antoni 1 Oct 17, 2021
A python script to generate wallpaper

wallpaper eits Warning You need to set the path to Robot Mono font in the source code. (Settings are in the main function) Usage A script that given a

Henrique Tsuyoshi Yara 5 Dec 02, 2021