Mayson Monorepo Documentation
    Preparing search index...

    Class CoinbaseExchange

    Coinbase exchange implementation using the official Coinbase SDK

    Hierarchy (View Summary)

    Index

    Constructors

    Properties

    name: "coinbase" = ...

    The name of the exchange

    testnet: false

    Whether the exchange is connected to testnet

    Methods

    • Format an asset to a trading symbol

      Parameters

      • asset: string

        The base asset (e.g., "ETH")

      • quoteAsset: string = "USDT"

        The quote asset (default: "USDT")

      Returns string

      Formatted symbol (e.g., "ETHUSDT")

    • Parse a symbol into base and quote assets

      Parameters

      • symbol: string

        The trading pair symbol

      Returns { base: string; quote: string }

      Object with base and quote assets

    • Verify that the API credentials are valid

      Returns Promise<boolean>

      True if credentials are valid

    • Get account balances

      Parameters

      • Optionalasset: string

        Optional specific asset to filter

      Returns Promise<ExchangeBalance[]>

      Array of balances

    • Get current price for a trading pair Note: Coinbase SDK doesn't have a direct price endpoint, we simulate it

      Parameters

      • _symbol: string

        Trading pair symbol (e.g., "BTCUSD")

      Returns Promise<ExchangePrice>

      Current price information

    • Get all available trading pairs

      Returns Promise<string[]>

      Array of trading pair symbols

    • Place a market buy order using Coinbase trade feature

      Parameters

      • symbol: string

        Trading pair symbol

      • quantity: number

        Amount to buy

      • _quantityIsQuote: boolean = false

        If true, quantity is in quote currency

      Returns Promise<ExchangeOrder>

      The created order

    • Place a market sell order

      Parameters

      • symbol: string

        Trading pair symbol

      • quantity: number

        Amount to sell

      Returns Promise<ExchangeOrder>

      The created order

    • Place a limit buy order Note: Coinbase SDK doesn't support limit orders directly

      Parameters

      • _symbol: string
      • _quantity: number
      • _price: number

      Returns Promise<ExchangeOrder>

    • Place a limit sell order Note: Coinbase SDK doesn't support limit orders directly

      Parameters

      • _symbol: string
      • _quantity: number
      • _price: number

      Returns Promise<ExchangeOrder>

    • Place a stop loss order Note: Coinbase SDK doesn't support stop orders directly

      Parameters

      • _symbol: string
      • _quantity: number
      • _stopPrice: number
      • Optional_limitPrice: number

      Returns Promise<ExchangeOrder>

    • Place a take profit order Note: Coinbase SDK doesn't support take profit orders directly

      Parameters

      • _symbol: string
      • _quantity: number
      • _price: number
      • Optional_limitPrice: number

      Returns Promise<ExchangeOrder>

    • Cancel an existing order Note: Coinbase SDK trades are immediate

      Parameters

      • _orderId: string
      • _symbol: string

      Returns Promise<boolean>

    • Get order status Note: Coinbase SDK trades are immediate

      Parameters

      • orderId: string
      • symbol: string

      Returns Promise<ExchangeOrder>

    • Get open orders Note: Coinbase SDK doesn't maintain open orders

      Parameters

      • Optional_symbol: string

      Returns Promise<ExchangeOrder[]>