Skip to main content
Glama
nadavgb-atom

ib-async-mcp

by nadavgb-atom

create_contract

Create trading contracts for stocks, options, futures, forex, indices, CFDs, cryptocurrencies, and bonds by specifying contract type and symbol.

Instructions

Create a contract for trading. Types: stock, option, future, forex, index, cfd, crypto, bond.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
contract_typeYesContract type
symbolYesSymbol (e.g., AAPL, EURUSD)
exchangeNoExchangeSMART
currencyNoCurrencyUSD
expiryNoExpiry date for options/futures (YYYYMMDD)
strikeNoStrike price for options
rightNoOption right: C (call) or P (put)
multiplierNoContract multiplier

Implementation Reference

  • The create_contract function acts as a factory method to instantiate appropriate Contract objects based on the provided contract_type.
    def create_contract(contract_type: str, **kwargs) -> Contract:
        """Create a contract based on type."""
        contract_map = {
            'stock': Stock,
            'option': Option,
            'future': Future,
            'forex': Forex,
            'index': Index,
            'cfd': CFD,
            'crypto': Crypto,
            'bond': Bond,
        }
        contract_class = contract_map.get(contract_type.lower(), Contract)
        return contract_class(**kwargs)
  • The tool 'create_contract' is registered in the list_tools() function, providing its schema and description.
    Tool(
        name="create_contract",
        description="Create a contract for trading. Types: stock, option, future, forex, index, cfd, crypto, bond.",
        inputSchema={
            "type": "object",
            "properties": {
                "contract_type": {"type": "string", "description": "Contract type"},
                "symbol": {"type": "string", "description": "Symbol (e.g., AAPL, EURUSD)"},
                "exchange": {"type": "string", "default": "SMART", "description": "Exchange"},

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/nadavgb-atom/ib-async-mcp'

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