Exemple #1
0
def menu2(account):
    # account is a list of account info
    # account[0] id
    # account[1] name
    # account[2] password
    # account[3] balance

    print("\n---------Hello, {0}--------- ".format(account[1]))
    ch = int(input("\n1) show info \n2) show process history\n3) deposit\n4) withdraw\n"
                   "5) change password \n6) logout\n\nchoice>> "))

    clear_screen()
    if ch == 1:
        print("ID: {}\nName: {}\nBalance: {}\n".format(account[0], account[1], account[3]))
    elif ch == 2:
        show_history.show_history(account)
    elif ch == 3:
        deposit.deposit(account)
    elif ch == 4:
        withdraw.withdraw(account)
    elif ch == 5:
        change_password.change_password(account)
    elif ch == 6:
        return
        # logout - go back to menu1
    else:
        print("ERROR: Wrong choice\n")

    menu2(account)
class main():
    print("$$$$$ Bank Management System $$$$$")
    a = login.login()
    b = deposit.deposit()
    c = balance.check_balance()
    d = withdraw.withdraw()
    e = add_acc.add_account()
    f = remove_acc.remove_acc()
    g = all_account.all_account()

    while (1):
        print("$$$$LOGIN WINDOW$$$$")
        print("1.login 2.set password")
        a1 = int(input("enter your choice:>"))

        if (a1 == 1):
            a.login1()
            break
        if (a1 == 2):
            a.setpassword()
            continue
        else:
            print("try again")

    while (1):
        print("*****************")
        print("1.deposit amount")
        print("2.check balance")
        print("3.withdraw amount")
        print("4.add account")
        print("5.remove account")
        print("6.all account details")
        print("7.exit")
        print("******************")

        a2 = int(input("enter the option:>"))
        if (a2 == 1):
            b.deposit()
            continue
        if (a2 == 2):
            c.check_balance()
            continue
        if (a2 == 3):
            d.withdraw()
            continue
        if (a2 == 4):
            e.add_account()
            continue
        if (a2 == 5):
            f.remove_acc()
            continue
        if (a2 == 6):
            g.all_account()
            continue
        if (a2 == 7):
            quit()
        else:
            print("try again")
Exemple #3
0
def menu(apikey, apisecret, pushover_user, pushover_app, pushbullet_token,
         redis_password):

    import sys
    import time
    import threading
    import os
    from buy import buy
    from sell import sell
    from buysell import buysell
    from balances import balances
    from orderbook import orderbook
    from watch import watch
    from withdraw import withdraw
    from arbitrage import arbitrage
    from trailing import trailing
    from takeprofit import takeprofit
    from stoplosstakeprofit import stoplosstakeprofit
    from trailingtakeprofit import trailingtakeprofit
    from colorama import Fore, Back, Style, init
    init(autoreset=True)

    while True:
        print(30 * '-')
        print(Fore.GREEN + 'P O N T S T R A D E R . C O M')
        print(30 * '-')
        print(Fore.YELLOW + '1. Buy')
        print(Fore.YELLOW + '2. Sell')
        print(Fore.YELLOW + '3. Buy and Sell')
        print(Fore.YELLOW + '4. Balances')
        print(Fore.YELLOW + '5. Orderbook')
        print(Fore.YELLOW + '6. Watch coin')
        print(Fore.YELLOW + '7. Withdraw')
        print(Fore.YELLOW + '8. Arbitrage')
        print(Fore.YELLOW + '9. Trailing Stop Loss (24/7)')
        print(Fore.YELLOW + '10. Take Profit (BETA + 24/7)')
        print(Fore.YELLOW + '11. Stop Loss + Take Profit (BETA + 24/7)')
        print(Fore.YELLOW + '12. Trailing + Take Profit (BETA + 24/7)')
        print(Fore.RED + '13. Exit')
        print(30 * '-')

        try:
            choice = raw_input('Enter your choice [1-13] : ')
            choice = int(choice)
        except:
            print 'Invalid number. Try again...'

        # BUY
        if choice == 1:
            buy(apikey, apisecret, redis_password)

        # SELL
        elif choice == 2:
            sell(apikey, apisecret, redis_password)

        # BUY AND SELL
        elif choice == 3:
            buysell(apikey, apisecret, redis_password)

        # SHOW WALLETS
        elif choice == 4:
            balances(apikey, apisecret, redis_password)

        # OPEN ORDERS
        elif choice == 5:
            orderbook(apikey, apisecret, redis_password)

        # WATCH
        elif choice == 6:
            watch(apikey, apisecret, redis_password)

        # WITHDRAW
        elif choice == 7:
            withdraw(apikey, apisecret)

        # ARBITRAGE
        elif choice == 8:
            arbitrage(redis_password)

        # TRAILING
        elif choice == 9:
            trailing(apikey, apisecret, pushover_user, pushover_app,
                     pushbullet_token, redis_password)

        # TAKE PROFIT
        elif choice == 10:
            takeprofit(apikey, apisecret, pushover_user, pushover_app,
                       pushbullet_token, redis_password)

        # STOP LOSS TAKE PROFIT
        elif choice == 11:
            stoplosstakeprofit(apikey, apisecret, pushover_user, pushover_app,
                               pushbullet_token, redis_password)

        # TRAILING TAKE PROFIT
        elif choice == 12:
            trailingtakeprofit(apikey, apisecret, pushover_user, pushover_app,
                               pushbullet_token, redis_password)

        # EXIT
        elif choice == 13:
            count = threading.activeCount()
            if count > 1:
                threads = threading.enumerate()
                thread_counter = 0
                for t in threading.enumerate():
                    if 'arbitrage' in t.name:
                        pass
                    elif 'Main' in t.name:
                        pass
                    else:
                        thread_counter += 1
                if thread_counter > 0:
                    print(
                        Fore.YELLOW +
                        'WARNING: There are currently {0} active trade(s), are you sure you want to exit?'
                        .format(thread_counter))
                    print(Fore.GREEN + '1. yes')
                    print(Fore.RED + '2. no')
                    try:
                        yes_no = raw_input('Enter your choice [1-2] : ')
                        yes_no = int(yes_no)
                    except:
                        print 'Invalid number... going back to Main Menu'
                    if yes_no == 1:
                        print 'Exiting...'
                        sys.exit()
                    elif yes_no == 2:
                        print 'Good... going back to Main Menu'
                    else:
                        print 'Invalid number... going back to Main Menu'
                else:
                    print 'Exiting...'
                    sys.exit()
            else:
                print 'Exiting...'
                sys.exit()

        # ELSE EXIT
        else:
            print 'Invalid number. Try again...'