-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Design Notes
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 implementation happens to use the BTC currency due to market demand.
XChange is still under rapid development so some of this information will change.
Two approaches were considered: fully self-contained, or extensible. Existing APIs addressing similar problems (such as JDBC for relational databases) demonstrated that the extensible approach is the better choice. This implied that XChange should provide a collection of interfaces that someone will need to implement for their exchange. Clearly, XChange will initially create early versions of these providers, but eventually it is hoped that exchange owners themselves will contribute them. This is actively encouraged.
Our initial thoughts were to provide WADL documents to assist in the creation of the underlying exchange provider implementations. However, repsonses to this question on StackExchange, indicated that it was probably a non-starter.
Another method for interacting with exchanges is the widely-used FIX protocol. This is a text-field based protocol that operates over HTTP and is rather complex to implement and work with. The role of XChange is to simplify access to the main operations of an exchange and so XChange offers it's own abstractions, but does support FIX under the covers.
The following are the main components that developers will interact with, typically in the order presented below.
This provides all the configuration for the Exchange including the implementor class name, authentication credentials, API secret keys and so on. Passing this to the ExchangeFactory will result in a suitable configured Exchange to work with.
Is responsible for creating Exchange implementations based on details provided in the ExchangeSpecification.
The main point of interaction. Consuming applications will use this to access the various services supported by the exchange by calling one of the supporting getters.
What follows is still a work in progress so expect it to change
The entry point to an exchange service (e.g. listing market prices against a particular symbol etc). could be synchronous (blocking) or asynchronous (non-blocking) depending on the requirement.
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, but this may be limiting.
div
{
color: white;
background-color: 009900;
margin: 2px;
font-size: 25px;
}
span
{
color: black;
background-color: gray;
margin: 5px;
font-size: 25px;
}
</style>
<div> div tag </div>
<div> div tag </div>
<div> div tag </div>
<div> div tag </div>
<span>span-tag</span>
<span>span-tag</span>
<span>span-tag</span>
<span>span-tag</span>