Exemplo n.º 1
0
 def __register_account(strategy_id):
     manager = AccountManager()
     randomid = str(uuid.uuid4())
     account_id = "test" + randomid[:6]
     manager.register_new_account(account_id, "ToneyTesting", 500000,
                                  strategy_id)
     return account_id
Exemplo n.º 2
0
    def update_account_test():
        print("Staring update_account_test.")
        account_id = BVTTests.__register_account("EightImmortals_Classic")

        manager = AccountManager()
        account = manager.get_account_data(account_id)
        account.change_strategy("EightImmortals_Nine")
        account.save_to_file()

        BVTTests.__decommission_account(account_id)
        print("Passed.")
Exemplo n.º 3
0
    def __strategy_test(strategy_id):
        account_id = BVTTests.__register_account(strategy_id)

        manager = AccountManager()
        account = manager.get_account_data(account_id)
        transactions, portfolio, portfolio_percentage = account.make_decision()
        if (transactions != None):
            print(
                "New transactions count:{}. Portfolio:[{} Cash={}]. Percentage:{}"
                .format(len(transactions), portfolio.get_coin_positions(),
                        portfolio.get_cash_balance(), portfolio_percentage))
        else:
            print("Empty transactions. Portfolio:[{} Cash={}]. Percentage:{}".
                  format(portfolio.get_coin_positions(),
                         portfolio.get_cash_balance(), portfolio_percentage))

        BVTTests.__decommission_account(account_id)
Exemplo n.º 4
0
def account_loop(client):
    AM = AccountManager()
    while True:
        print(f"\nCurrently logged user: {client.login}")
        choice = input("-- [L]ist accounts, "
                       "[C]reate new account, "
                       "[A]rchive or [D]earchive existing account, "
                       "Logout[x]: ")

        if choice.lower().strip() not in ACCOUNT_CHOICES:
            print(f"I do not recognize '{choice}' command.")

        elif choice.lower().strip() == ACCOUNT_CHOICES[0]:
            client.account_list()

        elif choice.lower().strip() == ACCOUNT_CHOICES[1]:
            ac = Account(client.login, AM)
            print(
                f"Successfully created new {ac.mode} with ID '{ac.account_id}'."
            )
            client.append_created_account(ac.account_id)
            if AM.ensure_client_existence(client.login):
                AM.save_account(client.login, ac)

        elif choice.lower().strip() == ACCOUNT_CHOICES[2]:
            client.account_list()
            w = int(
                input("Which of the following accounts you want to archive? ")
            ) - 1
            AM.archive(client.login, w)

        elif choice.lower().strip() == ACCOUNT_CHOICES[3]:
            client.account_list()
            w = int(
                input("Which of the following accounts you want to dearchive? "
                      )) - 1
            AM.dearchive(client, w)

        elif choice.lower().strip() == ACCOUNT_CHOICES[4]:
            print(f"\n'{client.login}' has log out\n")
            break

        AM.save_file()
Exemplo n.º 5
0
    def account_make_decision_test():
        print("Staring account_make_decision_test.")
        account_id = BVTTests.__register_account("EightImmortals_Classic")

        manager = AccountManager()
        account = manager.get_account_data(account_id)
        transactions, portfolio, portfolio_percentage = account.make_decision()
        if (transactions != None):
            print(
                "New transactions count:{}. Portfolio:[{} Cash={}]. Percentage:{}"
                .format(len(transactions), portfolio.get_coin_positions(),
                        portfolio.get_cash_balance(), portfolio_percentage))
        else:
            print("Empty transactions. Portfolio:[{} Cash={}]. Percentage:{}".
                  format(portfolio.get_coin_positions(),
                         portfolio.get_cash_balance(), portfolio_percentage))

        BVTTests.__decommission_account(account_id)
        print("Passed.")
Exemplo n.º 6
0
def trigger_all_strategies():

    manager = AccountManager()
    #user_eight_classic
    #user_eight_nine
    #user_wheeling_btceth
    #user_wheeling_btcusdt
    #user_wheeling_btcusdtltcxrpzec
    #user_gridding_btc
    #user_gridding_btceth
    #user_gridding_btcethltcxrpzec

    stras = {}
    stras["user_eight_classic"] = 532
    stras["user_eight_nine"] = 533
    stras["user_wheeling_btceth"] = 534
    stras["user_wheeling_btcusdt"] = 535
    stras["user_wheeling_btcusdtltcxrpzec"] = 536
    stras["user_gridding_btc"] = 537
    stras["user_gridding_btceth"] = 538
    stras["user_gridding_btcethltcxrpzec"] = 539
    #manager.register_new_account(account_id, "ccscreener_stras", 500000, "EightImmortals_Classic")

    for k in stras:
        stra_id = stras[k]
        print("## ", stra_id)
        account = manager.get_account_data(k)
        _, portfolio, portfolio_percentage = account.make_decision()
        print("## ", portfolio_percentage)
        tmp = portfolio_percentage
        for k in tmp:
            tmp[k] = tmp[k] * 100
        if (portfolio != None):
            args = {}
            args["id"] = stra_id
            args["detail"] = tmp
            try:
                requests.post(url, json=args)
            except:
                traceback.print_exc()
Exemplo n.º 7
0
 def __init__(self):
     self.account_mgr = AccountManager()
     self.board = Board()
     self.task_mgr = TaskManager()
     self.pixels = []