INNER CODE UNIT · Python

to_snake_case

GuntharDeNiro/gunbot-quant · gunbot_quant/cli/main.py:20

def to_snake_case(name: str) -> str:
    s1 = re.sub('(.)([A-Z][a-z]+)', r'\1_\2', name)
    return re.sub('([a-z0-9])([A-Z])', r'\1_\2', s1).lower()

@gunbot_app.command("add-pair")
def add_pair_to_gunbot(
    exchange: Annotated[str, typer.Argument(help="The exchange name as it is configured in your Gunbot (e.g., 'binance').")],
    strategy_name: Annotated[str, typer.Argument(help="The name of the GQ strategy to use (e.g., 'RSI_Reversion').")],
    pairs: Annotated[List[str], typer.Argument(help="A list of pairs in standard format (e.g., BTCUSDT ETHUSDT).")],
    quote_asset: Annotated[str, typer.Option(help="The quote asset for all pairs (e.g., USDT).")] = "USDT"
):
    """
    Adds one or more pairs to a connected Gunbot instance with a specified strategy.
    """
    print("--- Connecting to Gunbot ---")
    api = gunbot_client.get_gunbot_api()
    if not api:
        print("❌ Error: Gunbot not connected. Please connect via the UI first or ensure gunbot_creds.json exists.")

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…