Beispiel #1
0
def create_config():
    # Create new config
    config = {"limit_only": True}
    while True:
        filename = input("Config file name? ")

        if os.path.isfile("./" + filename):
            print("Config already exists.")
            continue

        exchange = get_exchange()

        if exchange == 'tux':
            config['exchange'] = 'tux'

            update_config_with_credentials(config)
            write_to_file(filename, config)
            return config

        elif exchange == 'polo':
            print("Currently Unsupported")
            continue

        elif exchange == 'bit':
            print("Currently Unsupported")
            continue

        else:
            print("Unrecognized Selection")
            continue
Beispiel #2
0
def create_config():
    # Create new config
    config = {"limit_only": True}
    url = "https://tuxexchange.com/api"

    while True:
        exchange = get_exchange()
        config[EXCHANGE] = exchange

        if exchange == 'tux':
            update_config_with_credentials(config)
            credentials_are_valid = validate_credentials(config, url)
            print('credentials_are_valid', credentials_are_valid)

            while not credentials_are_valid:
                update_config_with_credentials(config)
                credentials_are_valid = validate_credentials(config, url)

            encrypt_keys(config)
            insert_config_into_exchanges(config)
            decrypt_keys(config)
            return config

        elif exchange == 'test':
            config[EXCHANGE] = 'test'
            update_config_with_credentials(config)
            encrypt_keys(config)
            insert_config_into_exchanges(config)
            return config

        elif exchange == 'polo':
            print("Currently Unsupported")
            continue

        elif exchange == 'bit':
            print("Currently Unsupported")
            continue

        elif exchange == 'bina':
            update_config_with_credentials(config)
            credentials_are_valid = validate_keys(config, url)
            print('credentials_are_valid', credentials_are_valid)

            while not credentials_are_valid:
                update_config_with_credentials(config)
                credentials_are_valid = validate_keys(config, url)

            encrypt_keys(config)
            insert_config_into_exchanges(config)
            decrypt_keys(config)
            return config

        else:
            print("Unrecognized Selection")
            continue