amor71/LiuAlgoTrader

Rename this here and in `setup_samples`

github-actions opened this issue · 1 comments

Rename this here and in setup_samples

# TODO Rename this here and in `setup_samples`

        exit(0)


# TODO Rename this here and in `setup_samples`
def _extracted_from_setup_samples_5(samples_location, user, passwd, db):
    print()
    print("+--------------------+")
    print("| setting up samples |")
    print("+--------------------+")

    p = pathlib.Path(samples_location)
    if not p.exists():
        p.mkdir()
    if samples_location[-1] != "/":
        samples_location += "/"

    base_url = "https://raw.github.com/amor71/LiuAlgoTrader/master/examples/quickstart/"
    files = [
        "tradeplan.toml",
        "vwap_short.py",
        "momentum_long_simplified.py",
    ]

    for file in files:
        print(f"Downloading {base_url}{file} to {samples_location}...")
        r = requests.get(f"{base_url}{file}")
        with open(f"{samples_location}{file}", "w") as f:
            f.write(r.text)
            f.write("")

    print()
    print("creating environment variables script")

    if os.name == "nt":
        with open(f"{samples_location}env_vars.bat", "w") as f:
            f.write(
                f"set DSN=postgresql://{user}:{passwd}@localhost:5400/{db}\n"
            )
    else:
        with open(f"{samples_location}env_vars.sh", "w") as f:
            f.write(f"export DSN=postgresql://{user}@localhost:5400/{db}\n")


def quickstart():
    print(f"Welcome to Lig Algo Trading Framework v{config.build_label}!")
    print()

6c68c56db12d87062a2579316b769877a0207b17

Stale issue message