Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor informative_indicators #450

Open
Canx opened this issue Dec 8, 2024 · 2 comments
Open

Refactor informative_indicators #450

Canx opened this issue Dec 8, 2024 · 2 comments

Comments

@Canx
Copy link
Contributor

Canx commented Dec 8, 2024

Hi, apparently informative_X_indicators() are practically identical and could be refactored to a unique informative_indicators().

Then only changing info_switcher could be enough:

def info_switcher(self, metadata: dict, info_timeframe) -> DataFrame:
    if info_timeframe == "1d":
      return self.informative_1d_indicators(metadata, info_timeframe)
    elif info_timeframe == "4h":
      return self.informative_4h_indicators(metadata, info_timeframe)
    elif info_timeframe == "1h":
      return self.informative_1h_indicators(metadata, info_timeframe)
    elif info_timeframe == "15m":
      return self.informative_15m_indicators(metadata, info_timeframe)
    else:
      raise RuntimeError(f"{info_timeframe} not supported as informative timeframe for BTC pair.")

to

def info_switcher(self, metadata: dict, info_timeframe) -> DataFrame:
        if info_timeframe in ["1d", "4h", "1h", "15m"]:
            return self.informative_indicators(metadata, info_timeframe)
        else:
            raise RuntimeError(f"{info_timeframe} not supported as informative timeframe for BTC pair.")
@Canx
Copy link
Contributor Author

Canx commented Dec 10, 2024

If you think it's ok I can do a PR

@iterativv
Copy link
Owner

Hi, sure thing, thanks !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants