Giter Club home page Giter Club logo

Comments (8)

xmatthias avatar xmatthias commented on May 28, 2024 1

You don't have to calculate RSI in it if you don't need it. I was taking your example and fixing it.

funding_rate will be in the merged open column - so in this case - open_8h.

the documentation (mainly the box "Fast and easy way to define informative pairs") will include several samples on how you can adjust the name of the merged columns.

from freqtrade-strategies.

xmatthias avatar xmatthias commented on May 28, 2024

@informative('8h', candle_type= "funding_rate") should work just fine - but not on populate_indicators - but on a separate function (that's not called populate_indicators - so it's then available in populate_indicators). (documented here.

It'll also only work if you're in futures markets (not in spot markets) - at least in dry-run.

default funding rates (default 8h, can vary between exchanges) are also downloaded automatically when you download regular futures data, so the explicit step will be unnecessary.

from freqtrade-strategies.

dekacypher avatar dekacypher commented on May 28, 2024

The separate function i added the informative pairs in is as such:

@informative(candle_type='funding_rate')
    def populate_indicators_(self, dataframe: DataFrame, metadata: dict) -> DataFrame:
        dataframe['rsi'] = ta.RSI(dataframe)
        return dataframe

Including the timeframe is necessary as it hinders the arising of this error code:

ftuser@dfb252944e06:/freqtrade$ freqtrade backtesting --strategy PLTStrategy
2022-12-23 13:48:12,553 - freqtrade - INFO - freqtrade docker-2022.12.dev-cb81613a
2022-12-23 13:48:12,592 - freqtrade.configuration.load_config - INFO - Using config: user_data/config.json ...
2022-12-23 13:48:12,606 - freqtrade.loggers - INFO - Verbosity set to 0
2022-12-23 13:48:12,609 - freqtrade.configuration.configuration - INFO - Using max_open_trades: 10 ...
2022-12-23 13:48:13,279 - freqtrade.configuration.configuration - INFO - Using user-data directory: /freqtrade/user_data ...
2022-12-23 13:48:13,280 - freqtrade.configuration.configuration - INFO - Using data directory: /freqtrade/user_data/data/binance ...
2022-12-23 13:48:13,280 - freqtrade.configuration.configuration - INFO - Parameter --cache=day detected ...
2022-12-23 13:48:13,282 - freqtrade.exchange.check_exchange - INFO - Checking exchange...
2022-12-23 13:48:13,315 - freqtrade.exchange.check_exchange - INFO - Exchange "binance" is officially supported by the Freqtrade development team.
2022-12-23 13:48:13,315 - freqtrade.configuration.configuration - INFO - Using pairlist from configuration.
2022-12-23 13:48:13,315 - freqtrade.configuration.config_validation - INFO - Validating configuration ...
2022-12-23 13:48:13,325 - freqtrade.commands.optimize_commands - INFO - Starting freqtrade in Backtesting mode
2022-12-23 13:48:13,328 - freqtrade.exchange.exchange - INFO - Instance is running with dry_run enabled
2022-12-23 13:48:13,328 - freqtrade.exchange.exchange - INFO - Using CCXT 2.2.92
2022-12-23 13:48:13,330 - freqtrade.exchange.exchange - INFO - Applying additional ccxt config: {'options': {'defaultType': 'future'}}
2022-12-23 13:48:13,429 - freqtrade.exchange.exchange - INFO - Applying additional ccxt config: {'options': {'defaultType': 'future'}}
2022-12-23 13:48:13,453 - freqtrade.exchange.exchange - INFO - Using Exchange "Binance"
2022-12-23 13:48:14,600 - freqtrade.resolvers.exchange_resolver - INFO - Using resolved exchange 'Binance'...
2022-12-23 13:48:14,742 - freqtrade - ERROR - Fatal exception!
Traceback (most recent call last):
  File "/freqtrade/freqtrade/main.py", line 42, in main
    return_code = args['func'](args)
  File "/freqtrade/freqtrade/commands/optimize_commands.py", line 57, in start_backtesting
    backtesting = Backtesting(config)
  File "/freqtrade/freqtrade/optimize/backtesting.py", line 104, in __init__
    self.strategylist.append(StrategyResolver.load_strategy(self.config))
  File "/freqtrade/freqtrade/resolvers/strategy_resolver.py", line 48, in load_strategy
    strategy: IStrategy = StrategyResolver._load_strategy(
  File "/freqtrade/freqtrade/resolvers/strategy_resolver.py", line 256, in _load_strategy
    strategy = StrategyResolver._load_object(
  File "/freqtrade/freqtrade/resolvers/iresolver.py", line 148, in _load_object
    (module, module_path) = cls._search_object(directory=_path,
  File "/freqtrade/freqtrade/resolvers/iresolver.py", line 130, in _search_object
    obj = next(cls._get_valid_object(module_path, object_name), None)
  File "/freqtrade/freqtrade/resolvers/iresolver.py", line 91, in _get_valid_object
    spec.loader.exec_module(module)  # type: ignore # importlib does not use typehints
  File "<frozen importlib._bootstrap_external>", line 883, in exec_module
  File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
  File "/freqtrade/user_data/strategies/PLTStrategy.py", line 21, in <module>
    class PLTStrategy(IStrategy):
  File "/freqtrade/user_data/strategies/PLTStrategy.py", line 145, in PLTStrategy
    @informative(candle_type='funding_rate')
TypeError: informative() missing 1 required positional argument: 'timeframe'

from freqtrade-strategies.

xmatthias avatar xmatthias commented on May 28, 2024

well nobody said otherwise :)

from freqtrade-strategies.

aishamh avatar aishamh commented on May 28, 2024

Your suggestion doesn't work.

from freqtrade-strategies.

xmatthias avatar xmatthias commented on May 28, 2024

well what you tried after my comment is NOT what i suggested - but something else (close, but different).

something around this should work - assuming you are on futures markets - and the exchange really uses 8h as funding rate.

    @informative('8h', candle_type='funding_rate')
    def populate_indicators_funding(self, dataframe: DataFrame, metadata: dict) -> DataFrame:
        dataframe['rsi'] = ta.RSI(dataframe)
        return dataframe

from freqtrade-strategies.

aishamh avatar aishamh commented on May 28, 2024

Alright, I'll update you

from freqtrade-strategies.

aishamh avatar aishamh commented on May 28, 2024

The timeframe is 8h, but my intention is to include funding rate as a olumn in the dataframe, in order to use it as an indicator. The dataframe that is returned includes, when i add populate_indicators_funding function:

date              True
open              True
high              True
low               True
close             True
volume            True
date_8h           True
open_8h           True
high_8h          False
low_8h           False
close_8h         False
volume_8h        False
rsi_8h           False
adx               True
rsi               True
fastd             True
fastk             True
macd              True
macdsignal        True
macdhist          True
mfi               True
bb_lowerband      True
bb_middleband     True
bb_upperband      True
bb_percent        True
bb_width          True
sar               True
tema              True
htsine            True
htleadsine        True
enter_long        True
enter_short       True

But it doesn't include funding rate as a column, which is a negative or positive float value that indicates whether the market is bearish and the short traders pay a funding fee to the long traders, or the opposite. I'm not sure if you misunderstood my question as something else, but are we on the same page?

from freqtrade-strategies.

Related Issues (20)

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.