Пример #1
0
    def _build(cls, lean_config: Dict[str, Any],
               logger: Logger) -> LocalBrokerage:
        api_client = container.api_client()

        organizations = api_client.organizations.get_all()
        options = [
            Option(id=organization.id, label=organization.name)
            for organization in organizations
        ]

        organization_id = logger.prompt_list(
            "Select the organization with the {} module subscription".format(
                cls.get_name()), options)

        exchange_name = click.prompt(
            "FTX Exchange [FTX|FTXUS]",
            cls._get_default(lean_config, "ftx-exchange-name"))
        exchange = FTXExchange() if exchange_name.casefold() == "FTX".casefold(
        ) else FTXUSExchange()

        logger.info("""
Create an API key by logging in and accessing the {} Profile page (https://{}/profile).
        """.format(exchange.get_name(), exchange.get_domain()).strip())

        prefix = exchange.prefix()
        api_key = click.prompt(
            "API key", cls._get_default(lean_config, f'{prefix}-api-key'))
        api_secret = logger.prompt_password(
            "API secret", cls._get_default(lean_config,
                                           f'{prefix}-api-secret'))

        account_tier = logger.prompt_list(
            "Select the Account Tier", exchange.account_tier_options(),
            cls._get_default(lean_config, f'{prefix}-account-tier'))

        return FTXBrokerage(organization_id, api_key, api_secret, account_tier,
                            exchange_name)
Пример #2
0
    def _build(cls, lean_config: Dict[str, Any], logger: Logger) -> LocalBrokerage:
        api_client = container.api_client()

        organizations = api_client.organizations.get_all()
        options = [Option(id=organization.id, label=organization.name) for organization in organizations]

        organization_id = logger.prompt_list(
            "Select the organization with the Kraken module subscription",
            options
        )

        logger.info("""
Create an API key by logging in and accessing the Kraken API Management page (https://www.kraken.com/u/security/api).
        """.strip())

        api_key = click.prompt("API key", cls._get_default(lean_config, "kraken-api-key"))
        api_secret = logger.prompt_password("API secret", cls._get_default(lean_config, "kraken-api-secret"))

        verification_tier = logger.prompt_list("Select the Verification Tier",
            [Option(id="Starter", label="Starter"), Option(id="Intermediate", label="Intermediate"), Option(id="Pro", label="Pro")],
            cls._get_default(lean_config, "kraken-verification-tier")
        )

        return KrakenBrokerage(organization_id, api_key, api_secret, verification_tier)
Пример #3
0
    def _get_settings(self, logger: Logger) -> Dict[str, str]:
        api_key = click.prompt("API key")
        secret_key = logger.prompt_password("Secret key")

        return {"key": api_key, "secret": secret_key, "environment": "live"}
Пример #4
0
    def _build(cls, lean_config: Dict[str, Any],
               logger: Logger) -> LocalBrokerage:
        api_client = container.api_client()

        organizations = api_client.organizations.get_all()
        options = [
            Option(id=organization.id, label=organization.name)
            for organization in organizations
        ]

        organization_id = logger.prompt_list(
            "Select the organization with the Trading Technologies module subscription",
            options)

        user_name = click.prompt("User name",
                                 cls._get_default(lean_config, "tt-user-name"))
        session_password = logger.prompt_password(
            "Session password",
            cls._get_default(lean_config, "tt-session-password"))
        account_name = click.prompt(
            "Account name", cls._get_default(lean_config, "tt-account-name"))

        rest_app_key = click.prompt(
            "REST app key", cls._get_default(lean_config, "tt-rest-app-key"))
        rest_app_secret = logger.prompt_password(
            "REST app secret",
            cls._get_default(lean_config, "tt-rest-app-secret"))
        rest_environment = click.prompt(
            "REST environment",
            cls._get_default(lean_config, "tt-rest-environment"))

        market_data_sender_comp_id = click.prompt(
            "Market data sender comp id",
            cls._get_default(lean_config, "tt-market-data-sender-comp-id"))
        market_data_target_comp_id = click.prompt(
            "Market data target comp id",
            cls._get_default(lean_config, "tt-market-data-target-comp-id"))
        market_data_host = click.prompt(
            "Market data host",
            cls._get_default(lean_config, "tt-market-data-host"))
        market_data_port = click.prompt(
            "Market data port",
            cls._get_default(lean_config, "tt-market-data-port"))

        order_routing_sender_comp_id = click.prompt(
            "Order routing sender comp id",
            cls._get_default(lean_config, "tt-order-routing-sender-comp-id"))
        order_routing_target_comp_id = click.prompt(
            "Order routing target comp id",
            cls._get_default(lean_config, "tt-order-routing-target-comp-id"))
        order_routing_host = click.prompt(
            "Order routing host",
            cls._get_default(lean_config, "tt-order-routing-host"))
        order_routing_port = click.prompt(
            "Order routing port",
            cls._get_default(lean_config, "tt-order-routing-port"))

        log_fix_messages = click.prompt("Log FIX messages (yes/no)",
                                        cls._get_default(
                                            lean_config,
                                            "tt-log-fix-messages"),
                                        type=bool)

        return TradingTechnologiesBrokerage(
            organization_id, user_name, session_password, account_name,
            rest_app_key, rest_app_secret, rest_environment,
            market_data_sender_comp_id, market_data_target_comp_id,
            market_data_host, market_data_port, order_routing_sender_comp_id,
            order_routing_target_comp_id, order_routing_host,
            order_routing_port, log_fix_messages)