from kucoin.client import Client
import json
import websocket
import math
import sys
import paramiko
import datetime
import subprocess
import time



api_key = "61960b3be96b310001b76e7f"
api_secret = "ba563519-f84c-48dc-b793-8248dd18c396"
api_passphrase ="lachiebruh"
client = Client(api_key, api_secret, api_passphrase)

def run(cmd):
    subprocess.call(cmd, shell=True) 

def cls():
    run('cls')

black = "\u001b[30m"
red = "\u001b[31m"
green = "\u001b[32m"
yellow = "\u001b[33m"
blue = "\u001b[34m"
purple = "\u001b[35m"
cyan = "\u001b[36m"
white = "\u001b[37m"

cls()

#accounts = client.get_accounts('SHIB', 'trade')
#mybalance = accounts[0]["balance"]
#mybalance = float(mybalance)
#mybalance = math.floor(mybalance)
#print(mybalance)
#order = client.create_limit_order('SHIB-USDT', Client.SIDE_SELL, '0.01', str(mybalance))
#balance = accounts[0]["balance"]
#order = client.create_market_order('SHIB-USDT', Client.SIDE_BUY, funds=37)


print(""+red+"""
████████╗██████╗  █████╗ ██████╗ ███████╗ 
╚══██╔══╝██╔══██╗██╔══██╗██╔══██╗██╔════╝ 
   ██║   ██████╔╝███████║██║  ██║█████╗   
   ██║   ██╔══██╗██╔══██║██║  ██║██╔══╝   
   ██║   ██║  ██║██║  ██║██████╔╝███████╗ 
   ╚═╝   ╚═╝  ╚═╝╚═╝  ╚═╝╚═════╝ ╚══════╝ 
                                          
                ██████╗  ██████╗ ████████╗
                ██╔══██╗██╔═══██╗╚══██╔══╝
                ██████╔╝██║   ██║   ██║   
                ██╔══██╗██║   ██║   ██║   
                ██████╔╝╚██████╔╝   ██║   
                ╚═════╝  ╚═════╝    ╚═╝
        by xertz
        dont try share your login you will be ban :)
""")
now = datetime.datetime.now()
now = now.strftime("%d-%m-%Y")
print("todays date: " +now)
buser = input(purple+"username ->")
bpass = input(purple+"password ->")
print("\nplease wait while i check your account")

ssh = paramiko.SSHClient()
ssh.set_missing_host_key_policy(paramiko.AutoAddPolicy())
ssh.connect("giant-anatomy.bnr.la", port=22, username="root", password="lachie192819")
sftp = ssh.open_sftp()
f = sftp.open("/root/DB" + '/' + "xertz.txt", 'rb')
content = str(f.read())
content = content.split("'")[1]
user = content.split(",")[0]
userpass = content.split(",")[1]
planfinish = content.split(",")[2]
f.close()
if bpass != userpass:
    print("password incorrect")
    sys.exit()

plandone = planfinish.split("-")
now = datetime.datetime.now()
now = now.strftime("%d-%m-%Y")
now = now.split("-")
d1 = datetime.date(int(plandone[2]), int(plandone[1]), int(plandone[0]))
d2 = datetime.date(int(now[2]), int(now[1]), int(now[0]))
isexpired = d1 > d2
isexpired = str(isexpired)

if isexpired == "False":
    print(red+"PLAN EXPIRED Please contact xertz on discord")
    sys.exit()
while True:
    cls()
    print(""+red+"""
    ████████╗██████╗  █████╗ ██████╗ ███████╗ 
    ╚══██╔══╝██╔══██╗██╔══██╗██╔══██╗██╔════╝ 
       ██║   ██████╔╝███████║██║  ██║█████╗   
       ██║   ██╔══██╗██╔══██║██║  ██║██╔══╝   
       ██║   ██║  ██║██║  ██║██████╔╝███████╗ 
       ╚═╝   ╚═╝  ╚═╝╚═╝  ╚═╝╚═════╝ ╚══════╝ 

                    ██████╗  ██████╗ ████████╗
                    ██╔══██╗██╔═══██╗╚══██╔══╝
                    ██████╔╝██║   ██║   ██║   
                    ██╔══██╗██║   ██║   ██║   
                    ██████╔╝╚██████╔╝   ██║   
                    ╚═════╝  ╚═════╝    ╚═╝
            by xertz
            dont try share your login you will be ban :)

            1). get bot in buy mode
            2). configure bot settings
    """)
    choice = input(purple+"godly bot ->")
    if choice == "2":
        cls()
        print(""+red+"""
    ████████╗██████╗  █████╗ ██████╗ ███████╗ 
    ╚══██╔══╝██╔══██╗██╔══██╗██╔══██╗██╔════╝ 
       ██║   ██████╔╝███████║██║  ██║█████╗   
       ██║   ██╔══██╗██╔══██║██║  ██║██╔══╝   
       ██║   ██║  ██║██║  ██║██████╔╝███████╗ 
       ╚═╝   ╚═╝  ╚═╝╚═╝  ╚═╝╚═════╝ ╚══════╝ 

                    ██████╗  ██████╗ ████████╗
                    ██╔══██╗██╔═══██╗╚══██╔══╝
                    ██████╔╝██║   ██║   ██║   
                    ██╔══██╗██║   ██║   ██║   
                    ██████╔╝╚██████╔╝   ██║   
                    ╚═════╝  ╚═════╝    ╚═╝
            by xertz
            dont try share your login you will be ban :)

            1). edit buy price
            2). edit sell % 
        """)
        choice = input(purple+"godly bot ->")
        if choice == "2":
            cls()
            print(""+red+"""
    ████████╗██████╗  █████╗ ██████╗ ███████╗ 
    ╚══██╔══╝██╔══██╗██╔══██╗██╔══██╗██╔════╝ 
       ██║   ██████╔╝███████║██║  ██║█████╗   
       ██║   ██╔══██╗██╔══██║██║  ██║██╔══╝   
       ██║   ██║  ██║██║  ██║██████╔╝███████╗ 
       ╚═╝   ╚═╝  ╚═╝╚═╝  ╚═╝╚═════╝ ╚══════╝ 

                    ██████╗  ██████╗ ████████╗
                    ██╔══██╗██╔═══██╗╚══██╔══╝
                    ██████╔╝██║   ██║   ██║   
                    ██╔══██╗██║   ██║   ██║   
                    ██████╔╝╚██████╔╝   ██║   
                    ╚═════╝  ╚═════╝    ╚═╝
            by xertz
            dont try share your login you will be ban :)

            the sell percentage is how much profit you want the bot to sell at. 
            So if you want to see a 75 percent return put 75.

            for good profit put between 75 to 100. if you want to be risky 100-500

            """)
            sellprice = input(purple+"percent return ->")
            sftp = ssh.open_sftp()
            f = sftp.open("/root/DB" + '/' + "xertz.txt", 'rb')
            content = str(f.read())
            content = content.split("'")[1]
            content = content.split(",")
            f.close()
            f2 = sftp.open("/root/DB" + '/' + "xertz.txt", 'w')
            f2.write(content[0]+","+content[1]+","+content[2]+","+content[3]+","+sellprice)
            print("success")
            time.sleep(3)


        if choice == "1":
            cls()
            print(""+red+"""
    ████████╗██████╗  █████╗ ██████╗ ███████╗ 
    ╚══██╔══╝██╔══██╗██╔══██╗██╔══██╗██╔════╝ 
       ██║   ██████╔╝███████║██║  ██║█████╗   
       ██║   ██╔══██╗██╔══██║██║  ██║██╔══╝   
       ██║   ██║  ██║██║  ██║██████╔╝███████╗ 
       ╚═╝   ╚═╝  ╚═╝╚═╝  ╚═╝╚═════╝ ╚══════╝ 

                    ██████╗  ██████╗ ████████╗
                    ██╔══██╗██╔═══██╗╚══██╔══╝
                    ██████╔╝██║   ██║   ██║   
                    ██╔══██╗██║   ██║   ██║   
                    ██████╔╝╚██████╔╝   ██║   
                    ╚═════╝  ╚═════╝    ╚═╝
            by xertz
            dont try share your login you will be ban :)

            the buy price is how much you want to spend. example the pairing 
            coin(what your gonna buy with) is 
            USDT and you only want to spend 30 of them put in 30

            dont add symbols like $ just a number other wise when it 
            comes to buy time the bot will just not let you buy

            """)
            buyprice = input(purple+"buy price ->")
            sftp = ssh.open_sftp()
            f = sftp.open("/root/DB" + '/' + "xertz.txt", 'rb')
            content = str(f.read())
            content = content.split("'")[1]
            content = content.split(",")
            f.close()
            f2 = sftp.open("/root/DB" + '/' + "xertz.txt", 'w')
            f2.write(content[0]+","+content[1]+","+content[2]+","+buyprice+","+content[4])
            print("success")
            time.sleep(3)

    if choice == "1":
        while True:
            try:
                def send_json_request(ws, request):
                    ws.send(json.dumps(request))

                def receive_json_response(ws):
                    response = ws.recv()
                    if response:
                        return json.loads(response)


                ws = websocket.WebSocket()
                ws.settimeout(20)
                ws.connect("wss://gateway.discord.gg/?v=6&encording=json")
                heartbeat_interval = receive_json_response(ws)["d"]["heartbeat_interval"]

                token = "ODI5NDc0NTA3NjA4Njg2Njg0.YQ_VHA.Lq-8whlWMb6SgHrJHz1xaFRlREE"
                payload = {
                    "op": 2,
                    "d": {
                        "token": token,
                        "intents": 513,
                        "properties": {
                            "$os": "linux",
                            "$browser": "chrome",
                            "device": "pc"
                        }
                    }
                }

                send_json_request(ws, payload)
                while True:
                    event = receive_json_response(ws)
                    try:
                        content = event["d"]["content"]
                        channelid = event["d"]["channel_id"]
                        if channelid == "872223192838705242":
                            if "Coin is" in content:
                                now = datetime.datetime.now()
                                now = now.strftime("%Y-%m-%d %H:%M:%S")
                                print(content + "    time captured: "+now)
                                print("\n\n")
                                test = content.split("\n")
                                thecoin = test[2].split("/")[3]
                                coinsymbol = thecoin.split("-")[0]
                                cpair = thecoin.split("-")[1]
                                accounts = client.get_accounts(cpair, 'trade')
                                mybalance = accounts[0]["balance"]
                                mybalance = float(mybalance)
                                mybalance = math.floor(mybalance)
                                order = client.create_market_order(thecoin, Client.SIDE_BUY, funds=mybalance)
                                now = datetime.datetime.now()
                                now = now.strftime("%Y-%m-%d %H:%M:%S")
                                print("bought stock "+ "    time captured: "+now)
                                ticker = client.get_ticker(thecoin)
                                ticker = ticker['price']
                                now = datetime.datetime.now()
                                now = now.strftime("%Y-%m-%d %H:%M:%S")
                                print("price buying at: "+ticker+ "    time captured: "+now)
                                ticker = float(ticker)
                                sellon = ticker * (1+(125/100))
                                sellon = f"{sellon:.8f}"
                                now = datetime.datetime.now()
                                now = now.strftime("%Y-%m-%d %H:%M:%S")
                                print("price selling at: "+sellon+ "    time captured: "+now)
                                accounts = client.get_accounts(coinsymbol, 'trade')
                                mybalance = accounts[0]["balance"]
                                mybalance = float(mybalance)
                                mybalance = math.floor(mybalance)
                                now = datetime.datetime.now()
                                now = now.strftime("%Y-%m-%d %H:%M:%S")
                                print("you have: "+str(mybalance)+" "+coinsymbol)
                                order = client.create_limit_order(thecoin, Client.SIDE_SELL, sellon, mybalance)
                    except:
                        pass
            except:
                pass 

Python Online Compiler

Write, Run & Share Python code online using OneCompiler's Python online compiler for free. It's one of the robust, feature-rich online compilers for python language, supporting both the versions which are Python 3 and Python 2.7. Getting started with the OneCompiler's Python editor is easy and fast. The editor shows sample boilerplate code when you choose language as Python or Python2 and start coding.

Taking inputs (stdin)

OneCompiler's python online editor supports stdin and users can give inputs to programs using the STDIN textbox under the I/O tab. Following is a sample python program which takes name as input and print your name with hello.

import sys
name = sys.stdin.readline()
print("Hello "+ name)

About Python

Python is a very popular general-purpose programming language which was created by Guido van Rossum, and released in 1991. It is very popular for web development and you can build almost anything like mobile apps, web apps, tools, data analytics, machine learning etc. It is designed to be simple and easy like english language. It's is highly productive and efficient making it a very popular language.

Tutorial & Syntax help

Loops

1. If-Else:

When ever you want to perform a set of operations based on a condition IF-ELSE is used.

if conditional-expression
    #code
elif conditional-expression
    #code
else:
    #code

Note:

Indentation is very important in Python, make sure the indentation is followed correctly

2. For:

For loop is used to iterate over arrays(list, tuple, set, dictionary) or strings.

Example:

mylist=("Iphone","Pixel","Samsung")
for i in mylist:
    print(i)

3. While:

While is also used to iterate a set of statements based on a condition. Usually while is preferred when number of iterations are not known in advance.

while condition  
    #code 

Collections

There are four types of collections in Python.

1. List:

List is a collection which is ordered and can be changed. Lists are specified in square brackets.

Example:

mylist=["iPhone","Pixel","Samsung"]
print(mylist)

2. Tuple:

Tuple is a collection which is ordered and can not be changed. Tuples are specified in round brackets.

Example:

myTuple=("iPhone","Pixel","Samsung")
print(myTuple)

Below throws an error if you assign another value to tuple again.

myTuple=("iPhone","Pixel","Samsung")
print(myTuple)
myTuple[1]="onePlus"
print(myTuple)

3. Set:

Set is a collection which is unordered and unindexed. Sets are specified in curly brackets.

Example:

myset = {"iPhone","Pixel","Samsung"}
print(myset)

4. Dictionary:

Dictionary is a collection of key value pairs which is unordered, can be changed, and indexed. They are written in curly brackets with key - value pairs.

Example:

mydict = {
    "brand" :"iPhone",
    "model": "iPhone 11"
}
print(mydict)

Supported Libraries

Following are the libraries supported by OneCompiler's Python compiler

NameDescription
NumPyNumPy python library helps users to work on arrays with ease
SciPySciPy is a scientific computation library which depends on NumPy for convenient and fast N-dimensional array manipulation
SKLearn/Scikit-learnScikit-learn or Scikit-learn is the most useful library for machine learning in Python
PandasPandas is the most efficient Python library for data manipulation and analysis
DOcplexDOcplex is IBM Decision Optimization CPLEX Modeling for Python, is a library composed of Mathematical Programming Modeling and Constraint Programming Modeling