Skip to main content
Glama
armorwallet
by armorwallet

create_dca_order

Automate recurring crypto investments by setting up Dollar-Cost Averaging (DCA) orders. Specify tokens, amounts, frequency, and conditions for targeted trading strategies.

Instructions

Create a DCA order.

Expects a DCAOrderRequestContainer, returns a list of DCAOrderResponse.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
dca_order_requestsYes

Implementation Reference

  • MCP tool handler for 'create_dca_order', decorated with @mcp.tool(), handles authentication check and proxies the request to the ArmorWalletAPIClient.
    @mcp.tool()
    async def create_dca_order(dca_order_requests: DCAOrderRequestContainer) -> List[DCAOrderResponse]:
        """
        Create a DCA order.
        
        Expects a DCAOrderRequestContainer, returns a list of DCAOrderResponse.
        """
        if not armor_client:
            return [{"error": "Not logged in"}]
        try:
            result: List[DCAOrderResponse] = await armor_client.create_dca_order(dca_order_requests)
            return result
        except Exception as e:
            return [{"error": str(e)}]
  • Helper method in ArmorWalletAPIClient that constructs the API payload and makes the POST request to the '/transactions/dca-order/create/' endpoint to create the DCA order.
    async def create_dca_order(self, data: DCAOrderRequestContainer) -> List[DCAOrderResponse]:
        """Create a DCA order."""
        # payload = [v.model_dump() for v in data.dca_order_requests]
        payload = data.model_dump(exclude_none=True)['dca_order_requests']
        return await self._api_call("POST", "transactions/dca-order/create/", payload)
  • Pydantic schema for individual DCAOrderRequest used within DCAOrderRequestContainer for input validation.
    class DCAOrderRequest(BaseModel):
        wallet: str = Field(description="name of the wallet")
        input_token: str = Field(description="public address of the input token. To get the address from a token symbol use `get_token_details`")
        output_token: str = Field(description="public address of the output token. To get the address from a token symbol use `get_token_details`")
        amount: float = Field(description="total amount of input token to invest")
        cron_expression: str = Field(description="cron expression for the DCA worker execution frequency")
        strategy_duration_unit: Literal["MINUTE", "HOUR", "DAY", "WEEK", "MONTH", "YEAR"] = Field(description="unit of the duration of the DCA order")
        strategy_duration: int = Field(description="Total running time of the DCA order given in strategy duration units, should be more than 0")
        execution_type: Literal["MULTIPLE", "SINGLE"] = Field(description="set to SINGLE only if the user is asking for a single scheduled order, MULTIPLE if it is a true DCA")
        token_address_watcher: Optional[str] = Field(description="If the DCA is conditional, public address of the token to watch.")
        watch_field: Optional[Literal["liquidity", "marketCap", "price"]] = Field(description="If the DCA is conditional, field to watch for the condition")
        delta_type: Optional[Literal["INCREASE", "DECREASE", "MOVE", "MOVE_DAILY", "AVERAGE_MOVE"]] = Field(description="If the DCA is conditional, the operator of the watch field in the conditional statement")
        delta_percentage: Optional[float] = Field(description="If the DCA is conditional, percentage of the change to watch for given the delta_type")
        time_zone: Optional[str] = Field(description="user's time zone. Defaults to UTC")
  • Pydantic container schema for the tool input, wrapping a list of DCAOrderRequest objects.
    class DCAOrderRequestContainer(BaseModel):
        dca_order_requests: List[DCAOrderRequest]
  • Pydantic schema for DCAOrderResponse, representing the output structure of a created DCA order.
    class DCAOrderResponse(BaseModel):
        id: str = Field(description="id of the DCA order")
        amount: float = Field(description="amount of tokens to invest")
        investment_per_cycle: float = Field(description="amount of tokens to invest per cycle")
        cycles_completed: int = Field(description="number of cycles completed")
        total_cycles: int = Field(description="total number of cycles")
        human_readable_expiry: str = Field(description="human readable expiry date of the DCA order")
        status: str = Field(description="status of the DCA order")
        input_token_data: TokenData = Field(description="details of the input token")
        output_token_data: TokenData = Field(description="details of the output token")
        wallet_name: str = Field(description="name of the wallet")
        watchers: List[DCAWatcher] = Field(description="list of watchers for the DCA order")
        dca_transactions: List[dict] = Field(description="list of DCA transactions")  # Can be further typed if structure is known
        created: str = Field(description="Linux timestamp of the creation of the order")

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/armorwallet/armor-crypto-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server