Skip to content
gary-rowe edited this page Feb 2, 2012 · 20 revisions

General overview

The intention to is allow clients to connect to a wide range of exchanges offering trade opportunities. This is not limited to Bitcoin, although the first exchange happens to use the BTC currency.

High level overview of architecture

There are 2 main approaches: fully self-contained, or extensible. Existing APIs addressing similar problems (such as JDBC for relational databases) prefer the extensible approach. This implies that XChange will provide a collection of interfaces that an upstream provider will implement for their exchange. Clearly, XChange will initially create basic versions of these providers, but eventually it is hoped that exchange owners will contribute them.

High level overview of components

Session

The entry point to the overall API Requires various options (authentication, token support etc) so consider SessionOptions parameter object. Has a transport type (asynchronous, synchronous, streaming). Has a lifecycle (start, stop). Runs in own thread pool. Supports multiple services from the exchange.

Service

The entry point to an exchange service (e.g. listing prices against a particular index etc). Has a lifecycle (start, stop). Sends/receives messages to exchange/listeners.

Message

The DTO for encoding a message to and from the exchange. Probably defined internally as a Map<String,String> for field and resource with appropriate getEntryAsXXX() methods to support different expected internal representations (e.g. JSON, double, text, etc). Treat as immutable. Could consider providing an Enum for standard key lookup.