Skip to main content
Version: latest

Coinbase International

Coinbase International crypto exchange integration adapter.

This subpackage provides an instrument provider, data and execution clients, configurations, data types and constants for connecting to and interacting with Coinbase International’s API.

For convenience, the most commonly used symbols are re-exported at the subpackage’s top level, so downstream code can simply import from posei_trader.adapters.coinbase_intx.

class CoinbaseIntxDataClientConfig

Bases: LiveDataClientConfig

Configuration for CoinbaseIntxDataClient instances.

  • Parameters:
    • venue (Venue , default COINBASE_INTX_VENUE) – The venue for the client.
    • api_key (str , optional) – The Coinbase International API public key. If None then will source the COINBASE_INTX_API_KEY or COINBASE_INTX_TESTNET_API_KEY environment variables.
    • api_secret (str , optional) – The Coinbase International API private key. If None then will source the COINBASE_INTX_API_SECRET or COINBASE_INTX_TESTNET_API_SECRET environment variables.
    • api_passphrase (str , optional) – The Coinbase International API public key. If None then will source the COINBASE_INTX_API_PASSPHRASE or COINBASE_INTX_TESTNET_API_PASSPHRASE environment variables.
    • base_url_http (str , optional) – The HTTP client custom endpoint override.
    • base_url_ws (str , optional) – The WebSocket client custom endpoint override.
    • http_timeout_secs (PositiveInt or None , default 60) – The default timeout (seconds) for HTTP requests.

api_key : str | None

api_passphrase : str | None

api_secret : str | None

base_url_http : str | None

base_url_ws : str | None

http_timeout_secs : Annotated[int, msgspec.Meta(gt=0)] | None

venue : Venue

dict() → dict[str, Any]

Return a dictionary representation of the configuration.

  • Return type: dict[str, Any]

classmethod fully_qualified_name() → str

Return the fully qualified name for the PoseiConfig class.

  • Return type: str

handle_revised_bars : bool

property id : str

Return the hashed identifier for the configuration.

  • Return type: str

instrument_provider : InstrumentProviderConfig

json() → bytes

Return serialized JSON encoded bytes.

  • Return type: bytes

json_primitives() → dict[str, Any]

Return a dictionary representation of the configuration with JSON primitive types as values.

  • Return type: dict[str, Any]

classmethod json_schema() → dict[str, Any]

Generate a JSON schema for this configuration class.

  • Return type: dict[str, Any]

classmethod parse(raw: bytes | str) → Any

Return a decoded object of the given cls.

  • Parameters:
    • cls (type) – The type to decode to.
    • raw (bytes or str) – The raw bytes or JSON string to decode.
  • Return type: Any

routing : RoutingConfig

validate() → bool

Return whether the configuration can be represented as valid JSON.

  • Return type: bool

class CoinbaseIntxExecClientConfig

Bases: LiveExecClientConfig

Configuration for CoinbaseIntxExecClient instances.

  • Parameters:
    • venue (Venue , default COINBASE_INTX_VENUE) – The venue for the client.
    • api_key (str , optional) – The Coinbase International API public key. If None then will source the COINBASE_INTX_API_KEY or COINBASE_INTX_TESTNET_API_KEY environment variables.
    • api_secret (str , optional) – The Coinbase International API private key. If None then will source the COINBASE_INTX_API_SECRET or COINBASE_INTX_TESTNET_API_SECRET environment variables.
    • api_passphrase (str , optional) – The Coinbase International API public key. If None then will source the COINBASE_INTX_API_PASSPHRASE or COINBASE_INTX_TESTNET_API_PASSPHRASE environment variables.
    • portfolio_id (str , optional) – The Coinbase International portfolio to be traded. If None then will source the COINBASE_INTX_PORTFOLIO_ID environment variable.
    • base_url_http (str , optional) – The HTTP client custom endpoint override.
    • base_url_ws (str , optional) – The WebSocket client custom endpoint override.
    • http_timeout_secs (PositiveInt or None , default 60) – The default timeout (seconds) for HTTP requests.

api_key : str | None

api_passphrase : str | None

api_secret : str | None

base_url_http : str | None

base_url_ws : str | None

http_timeout_secs : Annotated[int, msgspec.Meta(gt=0)] | None

portfolio_id : str | None

venue : Venue

dict() → dict[str, Any]

Return a dictionary representation of the configuration.

  • Return type: dict[str, Any]

classmethod fully_qualified_name() → str

Return the fully qualified name for the PoseiConfig class.

  • Return type: str

property id : str

Return the hashed identifier for the configuration.

  • Return type: str

instrument_provider : InstrumentProviderConfig

json() → bytes

Return serialized JSON encoded bytes.

  • Return type: bytes

json_primitives() → dict[str, Any]

Return a dictionary representation of the configuration with JSON primitive types as values.

  • Return type: dict[str, Any]

classmethod json_schema() → dict[str, Any]

Generate a JSON schema for this configuration class.

  • Return type: dict[str, Any]

classmethod parse(raw: bytes | str) → Any

Return a decoded object of the given cls.

  • Parameters:
    • cls (type) – The type to decode to.
    • raw (bytes or str) – The raw bytes or JSON string to decode.
  • Return type: Any

routing : RoutingConfig

validate() → bool

Return whether the configuration can be represented as valid JSON.

  • Return type: bool

class CoinbaseIntxInstrumentProvider

Bases: InstrumentProvider

Provides Posei instrument definitions from Coinbase International.

  • Parameters:
    • client (CoinbaseIntxHttpClient) – The Coinbase International HTTP client.
    • config (InstrumentProviderConfig , optional) – The instrument provider configuration, by default None.

add(instrument: Instrument) → None

Add the given instrument to the provider.

  • Parameters: instrument (Instrument) – The instrument to add.

add_bulk(instruments: list[Instrument]) → None

Add the given instruments bulk to the provider.

  • Parameters: instruments (list [Instrument ]) – The instruments to add.

add_currency(currency: Currency) → None

Add the given currency to the provider.

  • Parameters: currency (Currency) – The currency to add.

property count : int

Return the count of instruments held by the provider.

  • Return type: int

currencies() → dict[str, Currency]

Return all currencies held by the instrument provider.

currency(code: str) → Currency | None

Return the currency with the given code (if found).

  • Parameters: code (str) – The currency code.
  • Return type: Currency or None
  • Raises: ValueError – If code is not a valid string.

find(instrument_id: InstrumentId) → Instrument | None

Return the instrument for the given instrument ID (if found).

  • Parameters: instrument_id (InstrumentId) – The ID for the instrument
  • Return type: Instrument or None

get_all() → dict[InstrumentId, Instrument]

Return all loaded instruments as a map keyed by instrument ID.

If no instruments loaded, will return an empty dict.

async initialize(reload: bool = False) → None

Initialize the instrument provider.

  • Parameters: reload (bool , default False) – If True, then will always reload instruments. If False, then will immediately return if already loaded.

instruments_pyo3() → list[Any]

list_all() → list[Instrument]

Return all loaded instruments.

load(instrument_id: InstrumentId, filters: dict | None = None) → None

Load the instrument for the given ID into the provider, optionally applying the given filters.

  • Parameters:
    • instrument_id (InstrumentId) – The instrument ID to load.
    • filters (frozendict *[*str , Any ] or dict *[*str , Any ] , optional) – The venue specific instrument loading filters to apply.

load_all(filters: dict | None = None) → None

Load the latest instruments into the provider, optionally applying the given filters.

  • Parameters: filters (frozendict *[*str , Any ] or dict *[*str , Any ] , optional) – The venue specific instrument loading filters to apply.

async load_all_async(filters: dict | None = None) → None

Load the latest instruments into the provider asynchronously, optionally applying the given filters.

async load_async(instrument_id: InstrumentId, filters: dict | None = None) → None

Load the instrument for the given ID into the provider asynchronously, optionally applying the given filters.

  • Parameters:
    • instrument_id (InstrumentId) – The instrument ID to load.
    • filters (frozendict *[*str , Any ] or dict *[*str , Any ] , optional) – The venue specific instrument loading filters to apply.
  • Raises: ValueError – If instrument_id.venue is not equal to self.venue.

load_ids(instrument_ids: list[InstrumentId], filters: dict | None = None) → None

Load the instruments for the given IDs into the provider, optionally applying the given filters.

  • Parameters:
    • instrument_ids (list [InstrumentId ]) – The instrument IDs to load.
    • filters (frozendict *[*str , Any ] or dict *[*str , Any ] , optional) – The venue specific instrument loading filters to apply.

async load_ids_async(instrument_ids: list[InstrumentId], filters: dict | None = None) → None

Load the instruments for the given IDs into the provider, optionally applying the given filters.

  • Parameters:
    • instrument_ids (list [InstrumentId ]) – The instrument IDs to load.
    • filters (frozendict *[*str , Any ] or dict *[*str , Any ] , optional) – The venue specific instrument loading filters to apply.
  • Raises: ValueError – If any instrument_id.venue is not equal to self.venue.

class CoinbaseIntxLiveDataClientFactory

Bases: LiveDataClientFactory

Provides a Coinbase International live data client factory.

static create(loop: AbstractEventLoop, name: str, config: CoinbaseIntxDataClientConfig, msgbus: MessageBus, cache: Cache, clock: LiveClock) → CoinbaseIntxDataClient

Create a new Coinbase International data client.

  • Parameters:
    • loop (asyncio.AbstractEventLoop) – The event loop for the client.
    • name (str) – The custom client ID.
    • config (CoinbaseIntxDataClientConfig) – The client configuration.
    • msgbus (MessageBus) – The message bus for the client.
    • cache (Cache) – The cache for the client.
    • clock (LiveClock) – The clock for the instrument provider.
  • Return type: CoinbaseIntxHttpClient

class CoinbaseIntxLiveExecClientFactory

Bases: LiveExecClientFactory

Provides a Coinbase International live execution client factory.

static create(loop: AbstractEventLoop, name: str, config: CoinbaseIntxExecClientConfig, msgbus: MessageBus, cache: Cache, clock: LiveClock) → CoinbaseIntxExecutionClient

Create a new Coinbase International execution client.

get_coinbase_intx_http_client(api_key: str | None = None, api_secret: str | None = None, api_passphrase: str | None = None, base_url: str | None = None, timeout_secs: int = 60) → CoinbaseIntxHttpClient

Cache and return a Coinbase International HTTP client with the given key and secret.

If a cached client with matching key and secret already exists, then that cached client will be returned.

  • Parameters:
    • api_key (str , optional) – The Coinbase International API key for the client.
    • api_secret (str , optional) – The Coinbase International API secret for the client.
    • api_passphrase (str , optional) – The Coinbase International API passphrase for the client.
    • base_url (str , optional) – The base URL for the API endpoints.
    • timeout_secs (int , default 60) – The timeout (seconds) for HTTP requests to Coinbase Intx.
  • Return type: CoinbaseIntxHttpClient

get_coinbase_intx_instrument_provider(client: CoinbaseIntxHttpClient, config: InstrumentProviderConfig) → CoinbaseIntxInstrumentProvider

Cache and return a Coinbase International instrument provider.

If a cached provider already exists, then that provider will be returned.

Config

class CoinbaseIntxDataClientConfig

Bases: LiveDataClientConfig

Configuration for CoinbaseIntxDataClient instances.

  • Parameters:
    • venue (Venue , default COINBASE_INTX_VENUE) – The venue for the client.
    • api_key (str , optional) – The Coinbase International API public key. If None then will source the COINBASE_INTX_API_KEY or COINBASE_INTX_TESTNET_API_KEY environment variables.
    • api_secret (str , optional) – The Coinbase International API private key. If None then will source the COINBASE_INTX_API_SECRET or COINBASE_INTX_TESTNET_API_SECRET environment variables.
    • api_passphrase (str , optional) – The Coinbase International API public key. If None then will source the COINBASE_INTX_API_PASSPHRASE or COINBASE_INTX_TESTNET_API_PASSPHRASE environment variables.
    • base_url_http (str , optional) – The HTTP client custom endpoint override.
    • base_url_ws (str , optional) – The WebSocket client custom endpoint override.
    • http_timeout_secs (PositiveInt or None , default 60) – The default timeout (seconds) for HTTP requests.

venue : Venue

api_key : str | None

api_secret : str | None

api_passphrase : str | None

base_url_http : str | None

base_url_ws : str | None

http_timeout_secs : Annotated[int, msgspec.Meta(gt=0)] | None

dict() → dict[str, Any]

Return a dictionary representation of the configuration.

  • Return type: dict[str, Any]

classmethod fully_qualified_name() → str

Return the fully qualified name for the PoseiConfig class.

  • Return type: str

handle_revised_bars : bool

property id : str

Return the hashed identifier for the configuration.

  • Return type: str

instrument_provider : InstrumentProviderConfig

json() → bytes

Return serialized JSON encoded bytes.

  • Return type: bytes

json_primitives() → dict[str, Any]

Return a dictionary representation of the configuration with JSON primitive types as values.

  • Return type: dict[str, Any]

classmethod json_schema() → dict[str, Any]

Generate a JSON schema for this configuration class.

  • Return type: dict[str, Any]

classmethod parse(raw: bytes | str) → Any

Return a decoded object of the given cls.

  • Parameters:
    • cls (type) – The type to decode to.
    • raw (bytes or str) – The raw bytes or JSON string to decode.
  • Return type: Any

routing : RoutingConfig

validate() → bool

Return whether the configuration can be represented as valid JSON.

  • Return type: bool

class CoinbaseIntxExecClientConfig

Bases: LiveExecClientConfig

Configuration for CoinbaseIntxExecClient instances.

  • Parameters:
    • venue (Venue , default COINBASE_INTX_VENUE) – The venue for the client.
    • api_key (str , optional) – The Coinbase International API public key. If None then will source the COINBASE_INTX_API_KEY or COINBASE_INTX_TESTNET_API_KEY environment variables.
    • api_secret (str , optional) – The Coinbase International API private key. If None then will source the COINBASE_INTX_API_SECRET or COINBASE_INTX_TESTNET_API_SECRET environment variables.
    • api_passphrase (str , optional) – The Coinbase International API public key. If None then will source the COINBASE_INTX_API_PASSPHRASE or COINBASE_INTX_TESTNET_API_PASSPHRASE environment variables.
    • portfolio_id (str , optional) – The Coinbase International portfolio to be traded. If None then will source the COINBASE_INTX_PORTFOLIO_ID environment variable.
    • base_url_http (str , optional) – The HTTP client custom endpoint override.
    • base_url_ws (str , optional) – The WebSocket client custom endpoint override.
    • http_timeout_secs (PositiveInt or None , default 60) – The default timeout (seconds) for HTTP requests.

venue : Venue

api_key : str | None

api_secret : str | None

api_passphrase : str | None

portfolio_id : str | None

base_url_http : str | None

base_url_ws : str | None

http_timeout_secs : Annotated[int, msgspec.Meta(gt=0)] | None

dict() → dict[str, Any]

Return a dictionary representation of the configuration.

  • Return type: dict[str, Any]

classmethod fully_qualified_name() → str

Return the fully qualified name for the PoseiConfig class.

  • Return type: str

property id : str

Return the hashed identifier for the configuration.

  • Return type: str

instrument_provider : InstrumentProviderConfig

json() → bytes

Return serialized JSON encoded bytes.

  • Return type: bytes

json_primitives() → dict[str, Any]

Return a dictionary representation of the configuration with JSON primitive types as values.

  • Return type: dict[str, Any]

classmethod json_schema() → dict[str, Any]

Generate a JSON schema for this configuration class.

  • Return type: dict[str, Any]

classmethod parse(raw: bytes | str) → Any

Return a decoded object of the given cls.

  • Parameters:
    • cls (type) – The type to decode to.
    • raw (bytes or str) – The raw bytes or JSON string to decode.
  • Return type: Any

routing : RoutingConfig

validate() → bool

Return whether the configuration can be represented as valid JSON.

  • Return type: bool

Constants

Factories

get_coinbase_intx_http_client(api_key: str | None = None, api_secret: str | None = None, api_passphrase: str | None = None, base_url: str | None = None, timeout_secs: int = 60) → CoinbaseIntxHttpClient

Cache and return a Coinbase International HTTP client with the given key and secret.

If a cached client with matching key and secret already exists, then that cached client will be returned.

  • Parameters:
    • api_key (str , optional) – The Coinbase International API key for the client.
    • api_secret (str , optional) – The Coinbase International API secret for the client.
    • api_passphrase (str , optional) – The Coinbase International API passphrase for the client.
    • base_url (str , optional) – The base URL for the API endpoints.
    • timeout_secs (int , default 60) – The timeout (seconds) for HTTP requests to Coinbase Intx.
  • Return type: CoinbaseIntxHttpClient

get_coinbase_intx_instrument_provider(client: CoinbaseIntxHttpClient, config: InstrumentProviderConfig) → CoinbaseIntxInstrumentProvider

Cache and return a Coinbase International instrument provider.

If a cached provider already exists, then that provider will be returned.

class CoinbaseIntxLiveDataClientFactory

Bases: LiveDataClientFactory

Provides a Coinbase International live data client factory.

static create(loop: AbstractEventLoop, name: str, config: CoinbaseIntxDataClientConfig, msgbus: MessageBus, cache: Cache, clock: LiveClock) → CoinbaseIntxDataClient

Create a new Coinbase International data client.

  • Parameters:
    • loop (asyncio.AbstractEventLoop) – The event loop for the client.
    • name (str) – The custom client ID.
    • config (CoinbaseIntxDataClientConfig) – The client configuration.
    • msgbus (MessageBus) – The message bus for the client.
    • cache (Cache) – The cache for the client.
    • clock (LiveClock) – The clock for the instrument provider.
  • Return type: CoinbaseIntxHttpClient

class CoinbaseIntxLiveExecClientFactory

Bases: LiveExecClientFactory

Provides a Coinbase International live execution client factory.

static create(loop: AbstractEventLoop, name: str, config: CoinbaseIntxExecClientConfig, msgbus: MessageBus, cache: Cache, clock: LiveClock) → CoinbaseIntxExecutionClient

Create a new Coinbase International execution client.

Providers

class CoinbaseIntxInstrumentProvider

Bases: InstrumentProvider

Provides Posei instrument definitions from Coinbase International.

  • Parameters:
    • client (CoinbaseIntxHttpClient) – The Coinbase International HTTP client.
    • config (InstrumentProviderConfig , optional) – The instrument provider configuration, by default None.

instruments_pyo3() → list[Any]

async load_all_async(filters: dict | None = None) → None