I apologize for not providing the code in my previous response. Here's a basic example of how to access Phemex's REST API, get historic Bitcoin data, and a simple harmonic trading algorithm using Python. This example uses Tkinter for the GUI.

First, make sure to install the necessary libraries:
```bash
pip install requests pandas numpy matplotlib
```

Next, create a Python script with the following code:

```python
import requests
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
from tkinter import *

# Replace with your own API key
phemex_api_key = 'your_phemex_api_key'

# Function to get historic Bitcoin data from CryptoCompare API
def get_historic_data():
    url = "https://min-api.cryptocompare.com/data/v2/histoday"
    params = {
        "fsym": "BTC",
        "tsym": "USD",
        "limit": 2000,
        "api_key": "your_cryptocompare_api_key",
    }

    response = requests.get(url, params=params)
    data = response.json()
    data = data["Data"]["Data"]
    df = pd.DataFrame(data)
    df['time'] = pd.to_datetime(df['time'], unit='s')
    return df

# Function to detect Gartley pattern in Bitcoin data
def detect_gartley_pattern(df):
    # Your code to detect Gartley pattern goes here
    # This is just a placeholder
    detected_pattern = False
    return detected_pattern

# Function to plot the Bitcoin data
def plot_data(df):
    plt.figure(figsize=(12, 6))
    plt.plot(df['time'], df['close'])
    plt.xlabel("Date")
    plt.ylabel("Close Price")
    plt.title("Bitcoin Price History")
    plt.show()

# Function to execute the harmonic trading algorithm
def execute_algorithm():
    df = get_historic_data()
    detected_pattern = detect_gartley_pattern(df)

    if detected_pattern:
        print("Gartley pattern detected")
    else:
        print("No Gartley pattern detected")

    plot_data(df)

# GUI using Tkinter
root = Tk()
root.title("Harmonic Trading Algorithm")
root.geometry("300x200")

label = Label(root, text="Harmonic Trading Algorithm for Bitcoin")
label.pack()

button = Button(root, text="Execute Algorithm", command=execute_algorithm)
button.pack()

root.mainloop()
```

Please note that this code is just a starting point for your harmonic trading algorithm. You'll need to replace the API keys with your own, implement the actual logic to detect Gartley or other harmonic patterns in the detect_gartley_pattern function, and refine the algorithm to suit your specific trading strategy.

Also, keep in mind that this code does not cover any interaction with Phemex's REST API for placing orders or fetching account information. You'll need to refer to Phemex's API documentation for specific API endpoints and implement those as needed.
spam fails_task lang_mismatch pii not_appropriate hate_speech sexual_content quality toxicity humor helpfulness creativity violence