Code Monkey home page Code Monkey logo

xchange's Introduction

XChange XChange

Discord Java CI with Maven on Push

XChange is a Java library providing a simple and consistent API for interacting with 60+ Bitcoin and other crypto currency exchanges, providing a consistent interface for trading and accessing market data.

Important!

The world of Bitcoin changes quickly and XChange is no exception. For the latest bugfixes and features you should use the snapshot jars or build yourself from the develop branch. See below for more details about building with Maven. To report bugs and see what issues people are currently working on see the issues page.

Description

XChange is a Java based library providing a simple and consistent API for interacting with a diverse set of crypto currency exchanges.

Basic usage is very simple: Create an Exchange instance, get the appropriate service, and request data. More complex usages are progressively detailed below.

REST API

Public Market Data

To use public APIs which do not require authentication:

Exchange bitstamp = ExchangeFactory.INSTANCE.createExchange(BitstampExchange.class);
MarketDataService marketDataService = bitstamp.getMarketDataService();
Ticker ticker = marketDataService.getTicker(CurrencyPair.BTC_USD);
System.out.println(ticker.toString());

Private Account Info

To use APIs which require authentication, create an ExchangeSpecification with your API credentials and pass this to createExchange():

ExchangeSpecification exSpec = new BitstampExchange().getDefaultExchangeSpecification();
exSpec.setUserName("34387");
exSpec.setApiKey("a4SDmpl9s6xWJS5fkKRT6yn41vXuY0AM");
exSpec.setSecretKey("sisJixU6Xd0d1yr6w02EHCb9UwYzTNuj");
Exchange bitstamp = ExchangeFactory.INSTANCE.createExchange(exSpec);

Please Note: while most exchanges use just an API key and secret key, others (such as username on Bitstamp or passphrase on Coinbase Pro) are exchange-specific. For more examples of adding the keys to the ExchangeSpecification, including storing them in a configuration file, see Frequently Asked Questions.

Once you have an authenticated Exchange, the private API services, AccountService and TradeService, can be used to access private data:

// Get the account information
AccountService accountService = bitstamp.getAccountService();
AccountInfo accountInfo = accountService.getAccountInfo();
System.out.println(accountInfo.toString());

All exchange implementations expose the same API, but you can also directly access the underlying "raw" data from the individual exchanges if you need to.

Websocket API

The above API is usually fully supported on all exchanges and is best used for occasional requests and polling on relatively long intervals. Many exchanges, however, heavily limit the frequency that these requests can be made, and advise instead that you use their websocket API if you need streaming or real-time data.

For a smaller number of exchanges, the websocket-based StreamingExchange API is also available. This uses Reactive streams to allow you to efficiently subscribe to changes relating to thousands of coin pairs without requiring large numbers of threads.

You will need to import an additional dependency for the exchange you are using (see below), then example usage is as follows:

// Use StreamingExchangeFactory instead of ExchangeFactory
StreamingExchange exchange = StreamingExchangeFactory.INSTANCE.createExchange(BitstampStreamingExchange.class);

// Connect to the Exchange WebSocket API. Here we use a blocking wait.
exchange.connect().blockingAwait();

// Subscribe to live trades update.
Disposable subscription1 = exchange.getStreamingMarketDataService()
    .getTrades(CurrencyPair.BTC_USD)
    .subscribe(
        trade -> LOG.info("Trade: {}", trade),
        throwable -> LOG.error("Error in trade subscription", throwable));

// Subscribe order book data with the reference to the subscription.
Disposable subscription2 = exchange.getStreamingMarketDataService()
    .getOrderBook(CurrencyPair.BTC_USD)
    .subscribe(orderBook -> LOG.info("Order book: {}", orderBook));

// Wait for a while to see some results arrive
Thread.sleep(20000);

// Unsubscribe
subscription1.dispose();
subscription2.dispose();

// Disconnect from exchange (blocking again)
exchange.disconnect().blockingAwait();

Authentication, if supported for the exchange, works the same way as for the main API, via an ExchangeSpecification. For more information on what is supported, see the Wiki.

More information

Now go ahead and study some more examples, download the thing and provide feedback.

More information about reactive streams can be found at the RxJava wiki.

Features

  • MIT license
  • consistent API across all implemented exchanges
  • active development
  • very minimal 3rd party dependencies
  • modular components

More Info

Project Site: http://knowm.org/open-source/xchange
Example Code: http://knowm.org/open-source/xchange/xchange-example-code
Change Log: http://knowm.org/open-source/xchange/xchange-change-log/
Java Docs: http://knowm.org/javadocs/xchange/index.html

Talk to us on discord: Discord

Wiki

Continuous Integration

Java CI with Maven

Getting Started

Non-Maven

Maven

The XChange release artifacts are hosted on Maven Central: org.knowm.xchange

Add the following dependencies in your pom.xml file. You will need at least xchange-core. Add the additional dependencies for the exchange modules you are interested in (XYZ shown only for a placeholder). There is example code for all the modules in xchange-examples.

<dependency>
  <groupId>org.knowm.xchange</groupId>
  <artifactId>xchange-core</artifactId>
  <version>5.2.0</version>
</dependency>
<dependency>
  <groupId>org.knowm.xchange</groupId>
  <artifactId>xchange-XYZ</artifactId>
  <version>5.2.0</version>
</dependency>

If it is available for your exchange, you may also want to use the streaming API:

<dependency>
  <groupId>org.knowm.xchange</groupId>
  <artifactId>xchange-stream-XYZ</artifactId>
  <version>5.2.0</version>
</dependency>

For snapshots, add the following repository to your pom.xml file.

<repository>
  <id>sonatype-oss-snapshot</id>
  <snapshots/>
  <url>https://oss.sonatype.org/content/repositories/snapshots</url>
</repository>

The current snapshot version is:

5.2.1-SNAPSHOT

Building with Maven

Instruction Command
run unit tests mvn clean test
run unit and integration tests mvn clean verify -DskipIntegrationTests=false
install in local Maven repo mvn clean install
create project javadocs mvn javadoc:aggregate
generate dependency tree mvn dependency:tree
check for dependency updates mvn versions:display-dependency-updates
check for plugin updates mvn versions:display-plugin-updates
code format mvn com.spotify.fmt:fmt-maven-plugin:format
pom format/organize mvn com.github.ekryd.sortpom:sortpom-maven-plugin:sort

Bugs

Please report any bugs or submit feature requests to XChange's Github issue tracker.

Contributing

If you'd like to submit a new implementation for another exchange, please take a look at New Implementation Best Practices first, as there are lots of time-saving tips!

For more information such as a contributor list and a list of known projects depending on XChange, visit the Main Project Wiki.

xchange's People

Contributors

achterhoeker avatar andre77 avatar badgerwithagun avatar bigscoop avatar cymp avatar declan94 avatar dependabot-preview[bot] avatar dependabot[bot] avatar dozd avatar earce avatar gary-rowe avatar jheusser avatar jkolobok avatar jpe42 avatar makarid avatar mdvx avatar mikelle avatar mmazi avatar nielsdraaisma avatar npomfret avatar panchen avatar rafalkrupinski avatar roeiba avatar stachon avatar sutra avatar theo1985 avatar timmolter avatar walec51 avatar ww3456 avatar zholmes1 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

xchange's Issues

Unknown currency 'BTC' reported to me via email

Hi, I'm having a problem using the example code (#2, account info) for interfacing with Mt. Gox:

Exception in thread "main" org.joda.money.IllegalCurrencyException: Unknown currency 'BTC'
at org.joda.money.CurrencyUnit.of(CurrencyUnit.java:213)
at org.joda.money.BigMoney.parse(BigMoney.java:373)
at com.xeiam.xchange.utils.MoneyUtils.parseFiat(MoneyUtils.java:58)
at com.xeiam.xchange.mtgox.v1.MtGoxAdapters.adaptWallet(MtGoxAdapters.java:141)
at com.xeiam.xchange.mtgox.v1.MtGoxAdapters.adaptWallets(MtGoxAdapters.java:158)
at com.xeiam.xchange.mtgox.v1.MtGoxAdapters.adaptAccountInfo(MtGoxAdapters.java:71)
at com.xeiam.xchange.mtgox.v1.service.account.MtGoxPollingAccountService.getAccountInfo(MtGoxPollingAccountService.java:54)
at main.Main.main(Main.java:33)

It appears to have grabbed my wallet info correctly, but it's calling parseFiat() on my Bitcoin wallet (I guess that should be parseBitcoin()?). I grabbed the repository this morning so I should be up-to-date.

P.S. You should add a section to the example page that explains how to create an ExchangeSpecification with an API-key, I really had to search to find it.

Ability to fetch only required range of values

For the implementation of XChange used in Bitcoinium, I don't need the whole Orderbook. It wastes time, bandwidth and memory to fetch the whole thing only to use a small part of it (mainly a problem with MtGox's massive Orderbook).

Would it be possible to fetch only part of it? For example, fetch only the top 100 bids/asks

BitcoinCentralAccountInfo.getCad() method seems to return NULL

Hi,

I get a NullPointerException when using BitcoinCentralPollingAccountService class:

java.lang.NullPointerException: Amount must not be null
    at org.joda.money.MoneyUtils.checkNotNull(MoneyUtils.java:33)
    at org.joda.money.BigMoney.of(BigMoney.java:79)
    at com.xeiam.xchange.bitcoincentral.BitcoinCentralAdapters.adaptAccountInfo(BitcoinCentralAdapters.java:70)
    at com.xeiam.xchange.bitcoincentral.service.account.polling.BitcoinCentralPollingAccountService.getAccountInfo(BitcoinCentralPollingAccountService.java:63)
    at org.aido.atp.AccountManager.<init>(AccountManager.java:71)
    at org.aido.atp.AccountManager.getInstance(AccountManager.java:57)
    at org.aido.atp.ExchangeManager.getAccount(ExchangeManager.java:97)
    at org.aido.atp.ExchangeManager.run(ExchangeManager.java:72)
    at java.lang.Thread.run(Thread.java:722)

The error seems to stem from the getCad() method in BitcoinCentralAccountInfo class.

Also, while investigating this error I saw a small non-issue at line 70 of BitcoinCentralAdapters class which may cause confusion. Although, it seems to work OK, the usdWallet variable would make more sense to be called cadWallet.

i.e.

Wallet usdWallet = new Wallet("CAD", BigMoney.of(CurrencyUnit.CAD, accountInfo.getCad()));
.
.
return new AccountInfo(userName, Arrays.asList(btcWallet, usdWallet, eurWallet, inrWallet));

would look better as:

Wallet cadWallet = new Wallet("CAD", BigMoney.of(CurrencyUnit.CAD, accountInfo.getCad()));
.
.
return new AccountInfo(userName, Arrays.asList(btcWallet, cadWallet, eurWallet, inrWallet));

Factor out the Rest client code into a separate project

The Rest client code (package com.xeiam.xchange.rest) should be separated into its own project as it is a general-purpuse (though still a bit limited) lightweight Json Rest client development library, not specific to the purpose of XChange.

We've had a discussion about this with @timmolter and we agree this should be done. This will enable other Java projects that need light-weight Json Rest clients (Android comes to mind) to use it without depending on XChange (or more heavy-weight libraries like RestEasy, Jersey etc.), and it will enable XChange to focus on its own mission.

Use of ${currentVersion} in pom.xml may be causing URISyntaxException in Maven

Hi,

I can 'git clone' XChange and use 'mvn clean compile' to compile without problems:

git clone git://github.com/timmolter/XChange.git
cd XChange
git checkout develop
cd xchange-core
mvn clean compile

Works fine!

However, when compiling my project I use xchange-core as one of the dependencies in my pom.xml file. So maven tries to download http://nexus.xeiam.com/content/repositories/snapshots/com/xeiam/xchange/xchange-parent/${currentVersion}/xchange-parent-${currentVersion}.pom which throws a URISyntaxException caused by the $ sign in '${currentVersion}'.

Here's the log output from 'mvn clean compile' command, character 88 of the URI is causing an exception ($ sign):

[INFO] Scanning for projects...
[WARNING]
[WARNING] Some problems were encountered while building the effective model for org.open.payment.alliance:isis-atp:jar:0.4.1
[WARNING] 'version' contains an expression but should be a constant. @ org.open.payment.alliance:isis-atp:${currentVersion}, /home/aido/IsisATP/pom.xml, line 10, column 11
[WARNING]
[WARNING] It is highly recommended to fix these problems because they threaten the stability of your build.
[WARNING]
[WARNING] For this reason, future Maven versions might no longer support building such malformed projects.
[WARNING]
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building Isis ATP 0.4.1
[INFO] ------------------------------------------------------------------------
Downloading: http://nexus.xeiam.com/content/repositories/snapshots/com/xeiam/xchange/xchange-parent/${currentVersion}/xchange-parent-${currentVersion}.pom
Downloading: http://repo.maven.apache.org/maven2/com/xeiam/xchange/xchange-parent/${currentVersion}/xchange-parent-${currentVersion}.pom
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 4.207s
[INFO] Finished at: Tue Jan 01 22:11:31 GMT 2013
[INFO] Final Memory: 9M/87M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal on project isis-atp: Could not resolve dependencies for project org.open.payment.alliance:isis-atp:jar:0.4.1: Failed to collect dependencies for [com.xeiam.xchange:xchange-core:jar:1.3.0-SNAPSHOT (compile), org.joda:joda-money:jar:0.6 (compile), joda-time:joda-time:jar:1.6.2 (compile)]: Failed to read artifact descriptor for com.xeiam.xchange:xchange-core:jar:1.3.0-SNAPSHOT: Could not transfer artifact com.xeiam.xchange:xchange-parent:pom:${currentVersion} from/to xchange-snapshot (http://nexus.xeiam.com/content/repositories/snapshots): Illegal character in path at index 88: http://nexus.xeiam.com/content/repositories/snapshots/com/xeiam/xchange/xchange-parent/${currentVersion}/xchange-parent-${currentVersion}.pom -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/DependencyResolutionException

Upgrade Jackson to 2.1.1

In order to accommodate external applications using the latest Jackson modules, we need to upgrade Jackson to 2.1.1. This constitutes a move away from the old Codehaus version and on to their FasterXml version.

Streaming ticker infinite loop

Hi,

The MtGox streaming ticker example code uses an infinite loop that is CPU intensive.

Would it instead be possible to place an event in the EventQueue when a ticker is received and then do a tickerQueue.take()?

e.g.

while (true) {
    ExchangeEvent exchangeEvent = eventQueue.take();
    System.out.println("Exchange event: " + exchangeEvent.getEventType().name() + ", " + exchangeEvent.getData());

    if (exchangeEvent.getEventType().name().equals("TICKER")) {
        // Check for Tickers
        while (!tickerQueue.isEmpty()) {
            doSomething(tickerQueue.take());
        }
    }
}

This would be less CPU hungry.

enable updates to a dynamic orderbook

i am currently trying to get a very accurate picture of the orderbooks in near-real-time.
i was hoping i could connect to a number of websockets and be able to create new Orderbook instances/modify them.

i noticed that the connection is very unstable and i need to reconnect agressively to even get a connection.. and i only get "ticker" data. i would be interested in getting depth update data. is this even possible right now?

Improve Ticker DTO

Add high and low to the Ticker DTO and change volume to a
BigDecimal.

Unsupported Exchanges

(I wanted to write this down somewhere so I'm putting it here. If it should be somewhere else, eg. in wiki, let me know and I'll move it.)

I've been looking at the large exchanges (just went through the list at Bitcoincharts) that XChange doesn't support yet and wanted to compile the findings in one place briefly.

MtGox, Bitstamp, BTC-E, VirtEx, CampBX

already supported (no trading support yet for CampBX though).

VirWox

They have an API: https://www.virwox.com/developers.php
The JAX-RS framework in XChange doesn't currently support JSON-serialized parameters that are required to access this API (but it can be hand-coded of course). It's not too much work to add this though.

btcde, btc24, btcchina

these don't seem to provide any kind of REST api.

Bitcoin central

https://bitcoin-central.net/s/api?locale=en -- looks like a nice and rich REST API. Requires HTTP Basic authentication (not supported yet in our REST framework, but should be easy to add elegantly).

This seems like a good candidate for next exchange to be implemented.

bitfloor

https://bitfloor.com/docs/api (REST + streaming)

Intersango

https://intersango.com/api.php -- REST + streaming
Seems straightforward to implement at first glance.

Kapiton (SEK, Sweden)

https://kapiton.se/api
REST. Seems very straightforward to implement.

MtGoxCancelOrder DTO could not be unmarshalled for large BTC amounts

So I'm using:
xchange-core-1.4.1-20130201.080228-3.jar
xchange-mtgox-1.4.1-20130201.080228-3.jar

I'm still getting the exception, it seems to be a problem when cancelling an order when another order for > 26.00000000 BTC exists?

Feb 01, 2013 9:51:12 AM com.xeiam.xchange.rest.JSONUtils getJsonObject
SEVERE: Error unmarshalling from json: {"usds":"4331.95789","btcs":"121.05479663","new_usds":{"value":"4331.95789","value_int":"433195789","display":"$4,331.95789","display_short":"$4,331.96","currency":"USD"},"new_btcs":{"value":"121.05479663","value_int":"12105479663","display":"121.05479663\u00a0BTC","display_short":"121.05\u00a0BTC","currency":"BTC"},"orders":[{"oid":"130528dd-a301-4be9-bd33-7ebcc96d4b52","currency":"USD","item":"BTC","type":2,"amount":"5.07547072","amount_int":"507547072","price":"19.70261","price_int":"1970261","status":1,"real_status":"open","dark":0,"date":1359671224,"priority":"1359671224573841"},{"oid":"14b8cdc9-8dba-44d2-a4ec-a19320467b63","currency":"USD","item":"BTC","type":2,"amount":"4.97546498","amount_int":"497546498","price":"20.09862","price_int":"2009862","status":1,"real_status":"open","dark":0,"date":1359727300,"priority":"1359727300826453"},{"oid":"343f2273-68fa-455a-ac64-59e7d98d9ba7","currency":"USD","item":"BTC","type":2,"amount":"5.22926356","amount_int":"522926356","price":"19.12315","price_int":"1912315","status":1,"real_status":"open","dark":0,"date":1359679276,"priority":"1359679276028632"},{"oid":"34507d1f-d5b8-4458-bf61-e07a23dd6f50","currency":"USD","item":"BTC","type":2,"amount":"5.17748979","amount_int":"517748979","price":"19.31438","price_int":"1931438","status":1,"real_status":"open","dark":0,"date":1359678479,"priority":"1359678479812580"},{"oid":"3b57f2cb-e9e0-4cb6-ad71-d4a0cffd555d","currency":"USD","item":"BTC","type":2,"amount":"5.12622635","amount_int":"512622635","price":"19.50753","price_int":"1950753","status":1,"real_status":"open","dark":0,"date":1359674931,"priority":"1359674931007869"},{"oid":"58f7a824-a3e6-43e4-82f5-3e355af0e75f","currency":"USD","item":"BTC","type":2,"amount":"5.44159353","amount_int":"544159353","price":"18.37697","price_int":"1837697","status":1,"real_status":"open","dark":0,"date":1359698271,"priority":"1359698271512623"},{"oid":"6afef4f3-c117-4eb8-917e-5baae306f13b","currency":"USD","item":"BTC","type":2,"amount":"5.66254500","amount_int":"566254500","price":"17.65990","price_int":"1765990","status":1,"real_status":"open","dark":0,"date":1359716442,"priority":"1359716442141831"},{"oid":"70af2670-c194-4ec8-acc2-f802fc806eb0","currency":"USD","item":"BTC","type":2,"amount":"5.55096996","amount_int":"555096996","price":"18.01487","price_int":"1801487","status":1,"real_status":"open","dark":0,"date":1359709152,"priority":"1359709152950843"},{"oid":"966c75a9-306a-41b7-a6b7-2cca8761015b","currency":"USD","item":"BTC","type":2,"amount":"5.49600844","amount_int":"549600844","price":"18.19502","price_int":"1819502","status":1,"real_status":"open","dark":0,"date":1359701902,"priority":"1359701902639323"},{"oid":"981d19e7-68d1-4cee-9157-c665a7cc98d7","currency":"USD","item":"BTC","type":2,"amount":"4.84852710","amount_int":"484852710","price":"20.62482","price_int":"2062482","status":1,"real_status":"open","dark":0,"date":1359723895,"priority":"1359723895841758"},{"oid":"a69d3f56-8a78-4df5-abc2-eed3d0538232","currency":"USD","item":"BTC","type":2,"amount":"5.28155560","amount_int":"528155560","price":"18.93382","price_int":"1893382","status":1,"real_status":"open","dark":0,"date":1359682856,"priority":"1359682856769172"},{"oid":"a925484e-395b-4213-8717-ab3271c97ebd","currency":"USD","item":"BTC","type":2,"amount":"5.02522027","amount_int":"502522027","price":"19.89963","price_int":"1989963","status":1,"real_status":"open","dark":0,"date":1359671076,"priority":"1359671076340198"},{"oid":"bd9de7e2-51f8-43bb-baf5-a6d02ac4bab0","currency":"USD","item":"BTC","type":2,"amount":"5.71916759","amount_int":"571916759","price":"17.48506","price_int":"1748506","status":1,"real_status":"open","dark":0,"date":1359720089,"priority":"1359720089850415"},{"oid":"e6b5a689-7019-4660-bc84-7a222899608e","currency":"USD","item":"BTC","type":2,"amount":"5.38771639","amount_int":"538771639","price":"18.56074","price_int":"1856074","status":1,"real_status":"open","dark":0,"date":1359691017,"priority":"1359691017667972"},{"oid":"ec966e4d-9097-498f-920b-9ede55a827c8","currency":"USD","item":"BTC","type":2,"amount":"20.80961423","amount_int":"2080961423","price":"19.01000","price_int":"1901000","status":1,"real_status":"open","dark":0,"date":1359508271,"priority":"1359508271919860"},{"oid":"f1875fe7-7bae-4677-980b-9fe76daa0630","currency":"USD","item":"BTC","type":2,"amount":"5.60647807","amount_int":"560647807","price":"17.83651","price_int":"1783651","status":1,"real_status":"open","dark":0,"date":1359712797,"priority":"1359712797879655"},{"oid":"f9d9a967-23ba-4521-a688-2d16b74dc1f7","currency":"USD","item":"BTC","type":2,"amount":"5.33437136","amount_int":"533437136","price":"18.74635","price_int":"1874635","status":1,"real_status":"open","dark":0,"date":1359686471,"priority":"1359686471932216"},{"oid":"039bc3fd-3f5b-4d27-8dbf-1e441097ed85","currency":"USD","item":"BTC","type":1,"amount":"4.50286157","amount_int":"450286157","price":"22.20810","price_int":"2220810","status":1,"real_status":"open","dark":0,"date":1359649074,"priority":"1359649074891268"},{"oid":"145c9f21-8493-4e72-9ecb-32e4cde1645f","currency":"USD","item":"BTC","type":1,"amount":"4.54788973","amount_int":"454788973","price":"21.98822","price_int":"2198822","status":1,"real_status":"open","dark":0,"date":1359645450,"priority":"1359645450992277"},{"oid":"242d413c-f81b-448d-9377-833135a0a560","currency":"USD","item":"BTC","type":1,"amount":"4.45827898","amount_int":"445827898","price":"22.43018","price_int":"2243018","status":1,"real_status":"open","dark":0,"date":1359652689,"priority":"1359652689265099"},{"oid":"24a3a943-5683-493c-bd7d-540790a0c995","currency":"USD","item":"BTC","type":1,"amount":"4.59336965","amount_int":"459336965","price":"21.77051","price_int":"2177051","status":1,"real_status":"open","dark":0,"date":1359630882,"priority":"1359630882158579"},{"oid":"5a164407-d8db-4cac-86be-3f3f41ed5bd0","currency":"USD","item":"BTC","type":1,"amount":"4.77987938","amount_int":"477987938","price":"20.92103","price_int":"2092103","status":1,"real_status":"open","dark":0,"date":1359704035,"priority":"1359704035882517"},{"oid":"a7856aaa-33f6-46ee-9eb9-6232c1b01d2d","currency":"USD","item":"BTC","type":1,"amount":"4.63930344","amount_int":"463930344","price":"21.55496","price_int":"2155496","status":1,"real_status":"open","dark":0,"date":1359627257,"priority":"1359627257531531"},{"oid":"bd9e7f63-678c-4ebf-bd4c-88f66e5a5cbb","currency":"USD","item":"BTC","type":1,"amount":"26.00000000","amount_int":"2600000000","price":"22.93000","price_int":"2293000","status":1,"real_status":"open","dark":0,"date":1359651032,"priority":"1359651032395813"},{"oid":"dced8e3c-0c59-4b18-baef-ea9ebb95cc27","currency":"USD","item":"BTC","type":1,"amount":"4.73255391","amount_int":"473255391","price":"21.13024","price_int":"2113024","status":1,"real_status":"open","dark":0,"date":1359666851,"priority":"1359666851166686"},{"oid":"e68e5f42-b694-48d2-9de7-4b158797954d","currency":"USD","item":"BTC","type":1,"amount":"4.68569747","amount_int":"468569747","price":"21.34154","price_int":"2134154","status":1,"real_status":"open","dark":0,"date":1359653737,"priority":"1359653737178308"}]}
cancelOrder threw exception
com.xeiam.xchange.ExchangeException: Problem getting JSON object
at com.xeiam.xchange.rest.JSONUtils.getJsonObject(JSONUtils.java:69)
at com.xeiam.xchange.rest.HttpTemplate.executeRequest(HttpTemplate.java:99)
at com.xeiam.xchange.rest.RestInvocationHandler.invokeHttp(RestInvocationHandler.java:61)
at com.xeiam.xchange.rest.RestInvocationHandler.invoke(RestInvocationHandler.java:56)
at $Proxy13.cancelOrder(Unknown Source)
at com.xeiam.xchange.mtgox.v1.service.trade.polling.MtGoxPollingTradeService.cancelOrder(MtGoxPollingTradeService.java:110)
at main.Main.updateBidPrices(Main.java:486)
at main.Main.main(Main.java:118)
Caused by: org.codehaus.jackson.map.JsonMappingException: Can not construct instance of int from String value '2600000000': Overflow: numeric value (2600000000) out of range of Integer (-2147483648 - 2147483647)
at [Source: java.io.StringReader@12c17ce; line: 1, column: 6487]

Introduce Guava (and maybe Joda Time)?

Guava is a Google support library that provides a vast array of fixes to common programming problems.

Although we have a general requirement to be a minimally invasive to downstream clients I think that the addition of Guava would make the internal code more robust, and we may want to consider supporting some of it's constructs in our client-facing APIs.

To get a flavour of what it can do have a look at Optional to remove the need for checking for null all the time. This alone is a compelling reason to adopt it.

WebSocketClient threads start to use too much CPU after running for about an hour.

I have written an application that starts 3 streaming ticker threads (3 different currencies). Usually after about an hour (sometimes only a few minutes) the application freezes with very high CPU usage. Analysis using the top and jstack commands shows the following.

Thread view of top command shows three java thread processes 31562, 31563 and 31564 using very high CPU:

top - 01:28:28 up  7:23,  3 users,  load average: 2.07, 1.51, 1.77
Threads: 298 total,   4 running, 294 sleeping,   0 stopped,   0 zombie
%Cpu(s): 53.6 us, 46.4 sy,  0.0 ni,  0.0 id,  0.0 wa,  0.0 hi,  0.0 si,  0.0 st
KiB Mem:    514800 total,   424060 used,    90740 free,    33532 buffers
KiB Swap:   498680 total,    12196 used,   486484 free,   230464 cached

  PID USER      PR  NI  VIRT  RES  SHR S  %CPU %MEM    TIME+  COMMAND                                                                                 
31562 root      20   0  418m  42m  13m R  32.1  8.4   0:16.05 java
31563 root      20   0  418m  42m  13m R  31.9  8.4   0:15.90 java
31564 root      20   0  418m  42m  13m R  31.9  8.4   0:15.51 java
 2202 root      20   0 54428  16m 3628 S   1.1  3.3   7:15.26 Xorg
31537 root      20   0  418m  42m  13m S   0.9  8.4   0:03.48 java
.
.
.

Process IDs 31562, 31563 and 31564 in HEX equate to native thread ids 0x7B4A, 0x7B4B and 0x7B4C in jstack. These are three WebSocketClient threads:

2013-01-24 01:28:50
Full thread dump OpenJDK Client VM (22.0-b10 mixed mode, sharing):

"Attach Listener" daemon prio=10 tid=0x09f84800 nid=0x7b67 waiting on condition [0x00000000]
   java.lang.Thread.State: RUNNABLE

   Locked ownable synchronizers:
    - None

"Thread-14" prio=10 tid=0x09ee0000 nid=0x7b4c runnable [0xb3888000]
   java.lang.Thread.State: RUNNABLE
    at sun.nio.ch.EPollArrayWrapper.epollWait(Native Method)
    at sun.nio.ch.EPollArrayWrapper.poll(EPollArrayWrapper.java:228)
    at sun.nio.ch.EPollSelectorImpl.doSelect(EPollSelectorImpl.java:81)
    at sun.nio.ch.SelectorImpl.lockAndDoSelect(SelectorImpl.java:87)
    - locked <0x8472fa38> (a sun.nio.ch.Util$2)
    - locked <0x8472fa48> (a java.util.Collections$UnmodifiableSet)
    - locked <0x8472f9f8> (a sun.nio.ch.EPollSelectorImpl)
    at sun.nio.ch.SelectorImpl.select(SelectorImpl.java:98)
    at sun.nio.ch.SelectorImpl.select(SelectorImpl.java:102)
    at com.xeiam.xchange.streaming.websocket.WebSocketClient.interruptableRun(WebSocketClient.java:155)
    at com.xeiam.xchange.streaming.websocket.WebSocketClient.run(WebSocketClient.java:129)
    at java.lang.Thread.run(Thread.java:722)

   Locked ownable synchronizers:
    - None

"Thread-13" prio=10 tid=0x09bfe000 nid=0x7b4b runnable [0xb3cac000]
   java.lang.Thread.State: RUNNABLE
    at java.util.HashMap$HashIterator.nextEntry(HashMap.java:814)
    at java.util.HashMap$KeyIterator.next(HashMap.java:841)
    at com.xeiam.xchange.streaming.websocket.WebSocketClient.interruptableRun(WebSocketClient.java:159)
    at com.xeiam.xchange.streaming.websocket.WebSocketClient.run(WebSocketClient.java:129)
    at java.lang.Thread.run(Thread.java:722)

   Locked ownable synchronizers:
    - None

"Thread-12" prio=10 tid=0x09bfd800 nid=0x7b4a runnable [0xb341a000]
   java.lang.Thread.State: RUNNABLE
    at sun.nio.ch.FileDispatcherImpl.read0(Native Method)
    at sun.nio.ch.SocketDispatcher.read(SocketDispatcher.java:39)
    at sun.nio.ch.IOUtil.readIntoNativeBuffer(IOUtil.java:218)
    at sun.nio.ch.IOUtil.read(IOUtil.java:191)
    at sun.nio.ch.SocketChannelImpl.read(SocketChannelImpl.java:359)
    - locked <0x84740ec8> (a java.lang.Object)
    at com.xeiam.xchange.streaming.websocket.WebSocket.handleRead(WebSocket.java:136)
    at com.xeiam.xchange.streaming.websocket.WebSocketClient.interruptableRun(WebSocketClient.java:162)
    at com.xeiam.xchange.streaming.websocket.WebSocketClient.run(WebSocketClient.java:129)
    at java.lang.Thread.run(Thread.java:722)

   Locked ownable synchronizers:
    - None
.
.
.

These are the only three WebSocketClient threads in the jstack.

java.lang.String.isEmpty not available on older Android devices

Was in the process of testing a new build of Bitcoinium with XChange 1.3.0 and everything was fine until I booted up the emulator to test with Android 2.2. Turns out java.lang.String.isEmpty is not available in older versions of android (Android 2.2, API Level 8 and lower) since it was only added in API Level 9 and causing the app to crash. Not a big deal but we'll need to use another way to check for null strings.

Here's the stack trace:

01-20 02:42:17.054: E/AndroidRuntime(380): java.lang.NoSuchMethodError: java.lang.String.isEmpty
01-20 02:42:17.054: E/AndroidRuntime(380): at com.xeiam.xchange.rest.RestRequestData.appendIfNotNull(RestRequestData.java:80)
01-20 02:42:17.054: E/AndroidRuntime(380): at com.xeiam.xchange.rest.RestRequestData.getUrl(RestRequestData.java:72)
01-20 02:42:17.054: E/AndroidRuntime(380): at com.xeiam.xchange.rest.RestRequestData.create(RestRequestData.java:64)
01-20 02:42:17.054: E/AndroidRuntime(380): at com.xeiam.xchange.rest.RestInvocationHandler.invoke(RestInvocationHandler.java:55)
01-20 02:42:17.054: E/AndroidRuntime(380): at $Proxy3.getFullDepth(Native Method)
01-20 02:42:17.054: E/AndroidRuntime(380): at com.xeiam.xchange.mtgox.v1.service.marketdata.polling.MtGoxPollingMarketDataService.getFullOrderBook(MtGoxPollingMarketDataService.java:98)

RUR Currency org.joda.money.IllegalCurrencyException

I've tested things with Bitcoinium and things seem to be working very will except for a slight issue with unsupported currencies. Seems the joda-money library doesn't like BTC-E's "RUR" (Old Russian Ruble) currency and it is throwing an IllegalCurrencyException when attempting to parse it. Here is the stack trace:

12-31 01:14:50.468: W/System.err(27716): org.joda.money.IllegalCurrencyException: Unknown currency 'RUR'
12-31 01:14:50.468: W/System.err(27716): at org.joda.money.CurrencyUnit.of(CurrencyUnit.java:215)
12-31 01:14:50.468: W/System.err(27716): at org.joda.money.BigMoney.parse(BigMoney.java:373)
12-31 01:14:50.468: W/System.err(27716): at com.xeiam.xchange.utils.MoneyUtils.parseFiat(MoneyUtils.java:51)

I have temporarily fixed the issue by catching the exception in BTCEExchange.adapterOrder() and forcing it to an arbitrary currency (USD) so that it parses. I'm sure there is a more elegant solution that can also handle other unsupported currencies such as BTC, NMC (namecoin) and LTC (litecoin). It seems "RUR" was added in joda-money in version 0.6.1 but I can't find a jar beyond version 0.6 (JodaOrg/joda-money@6b4db00)

Trade history and transaction history for account

PollingAccountService should probably be extended with methods (and common DTOs) for accessing the accounts trade history (past orders) and transaction history (executed orders, withdrawals, deposits).

Maven Build Fails for CampBX

It doesn't like the import com.sun.istack.internal.NotNull; in CampBX.java.

I think it has to do with Java 6 compiler level, which I think we want to keep.

[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:2.5.1:compile (default-compile) on project xchange-campbx: Compilation failure: Compilation failure:
[ERROR] bootstrap class path not set in conjunction with -source 1.6
[ERROR] /Users/timmolter/workspaces/workspace_xeiam_oss/xchange-parent/xchange-campbx/src/main/java/com/xeiam/xchange/campbx/CampBX.java:[32,30] error: package com.sun.istack.internal does not exist
[ERROR] /Users/timmolter/workspaces/workspace_xeiam_oss/xchange-parent/xchange-campbx/src/main/java/com/xeiam/xchange/campbx/CampBX.java:[115,44] error: cannot find symbol
[ERROR] symbol: class NotNull
[ERROR] location: interface CampBX
[ERROR] /Users/timmolter/workspaces/workspace_xeiam_oss/xchange-parent/xchange-campbx/src/main/java/com/xeiam/xchange/campbx/CampBX.java:[115,85] error: cannot find symbol

...

Problem with the connect()/disconnect() lifecycle in the Streaming API

In the MtGox streaming market data (and probably other implementations) additional configuration is passed in through getEventQueue(). In turn calling this method causes the connect() method to be called and starts the event process. The API consumer does not (and actually cannot) use just the connect() method to achieve this.

Passing in the extra configuration in this manner makes the API messy, and implies that it is possible to make repeat calls to the queue to configure addition streams against other currency pairs which is not currently supported.

While it is still workable, I think some extra design work on the API and implementation is required to clean it up.

Add inspection of HTTP return codes in REST proxy

The REST proxy uses practically unchanged (just a bit simplified) HttpTemplate, which uses URLConnection that is really a HttpURLConnection, which has a getResponseCode() method. But HttpTemplate doesn't currently check the response code or provide means to access it through the rest framework.

Re-instate the Intersango exchange support?

Some work needs to be carried out to bring the Intersango exchange (which deals mainly with EUR and GBP) back into the mix.

I'm changing this to a question because I'm not so sure that Intersango is going to remain as a viable exchange. They are having support issues and no longer allow GBP bank transfer (this has been for some time and shows no sign of ever getting reinstated).

Should we just remove the module?

Finish Bitcoin Central integration

I think this should be quite straightforward: create DTOs, add annotated methods to BitcoinCentral, create adapters. The stubs and a few implementations are already there.

And add some tests, probably.

I won't be finishing this, at least not in the near future, but I'd be glad to help if someone else decides to.

https://bitcoin-central.net/s/api

javax.net.ssl.SSLHandshakeException: sun.security.validator.ValidatorException: PKIX path building failed:

I received the following Email:

I thought I would try out the Canadian VirtEx exchange ticker so I could setup some auto arbitrage alerts as well, however I'm getting the following exceptions (xchange-cavirtex-1.4.1-20130201.151127-4.jar):

Exchange virtEx = ExchangeFactory.INSTANCE.createExchange(VirtExExchange.class.getName());
mMarketDataVirtEx = virtEx.getPollingMarketDataService();
Ticker ticker = mMarketDataVirtEx.getTicker(Currencies.BTC, Currencies.CAD);

com.xeiam.xchange.rest.HttpException: Problem GETing (IO)
at com.xeiam.xchange.rest.HttpTemplate.executeRequest(HttpTemplate.java:197)
at com.xeiam.xchange.rest.HttpTemplate.executeRequest(HttpTemplate.java:97)
at com.xeiam.xchange.rest.RestInvocationHandler.invokeHttp(RestInvocationHandler.java:61)
at com.xeiam.xchange.rest.RestInvocationHandler.invoke(RestInvocationHandler.java:56)
at sun.proxy.$Proxy13.getTicker(Unknown Source)
at com.xeiam.xchange.virtex.service.marketdata.polling.VirtExPollingMarketDataService.getTicker(VirtExPollingMarketDataService.java:73)
at main.Main.main(Main.java:147)
Caused by: javax.net.ssl.SSLHandshakeException: sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
at java.lang.reflect.Constructor.newInstance(Unknown Source)
at sun.net.www.protocol.http.HttpURLConnection$6.run(Unknown Source)
at sun.net.www.protocol.http.HttpURLConnection$6.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at sun.net.www.protocol.http.HttpURLConnection.getChainedException(Unknown Source)
at sun.net.www.protocol.http.HttpURLConnection.getInputStream(Unknown Source)
at sun.net.www.protocol.https.HttpsURLConnectionImpl.getInputStream(Unknown Source)
at com.xeiam.xchange.rest.HttpTemplate.executeRequest(HttpTemplate.java:186)
... 6 more
Caused by: javax.net.ssl.SSLHandshakeException: sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
at sun.security.ssl.Alerts.getSSLException(Unknown Source)
at sun.security.ssl.SSLSocketImpl.fatal(Unknown Source)
at sun.security.ssl.Handshaker.fatalSE(Unknown Source)
at sun.security.ssl.Handshaker.fatalSE(Unknown Source)
at sun.security.ssl.ClientHandshaker.serverCertificate(Unknown Source)
at sun.security.ssl.ClientHandshaker.processMessage(Unknown Source)
at sun.security.ssl.Handshaker.processLoop(Unknown Source)
at sun.security.ssl.Handshaker.process_record(Unknown Source)
at sun.security.ssl.SSLSocketImpl.readRecord(Unknown Source)
at sun.security.ssl.SSLSocketImpl.performInitialHandshake(Unknown Source)
at sun.security.ssl.SSLSocketImpl.startHandshake(Unknown Source)
at sun.security.ssl.SSLSocketImpl.startHandshake(Unknown Source)
at sun.net.www.protocol.https.HttpsClient.afterConnect(Unknown Source)
at sun.net.www.protocol.https.AbstractDelegateHttpsURLConnection.connect(Unknown Source)
at sun.net.www.protocol.http.HttpURLConnection.getInputStream(Unknown Source)
at sun.net.www.protocol.http.HttpURLConnection.getHeaderField(Unknown Source)
at sun.net.www.protocol.https.HttpsURLConnectionImpl.getHeaderField(Unknown Source)
at com.xeiam.xchange.rest.HttpTemplate.getResponseEncoding(HttpTemplate.java:264)
at com.xeiam.xchange.rest.HttpTemplate.executeRequest(HttpTemplate.java:185)
... 6 more
Caused by: sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
at sun.security.validator.PKIXValidator.doBuild(Unknown Source)
at sun.security.validator.PKIXValidator.engineValidate(Unknown Source)
at sun.security.validator.Validator.validate(Unknown Source)
at sun.security.ssl.X509TrustManagerImpl.validate(Unknown Source)
at sun.security.ssl.X509TrustManagerImpl.checkTrusted(Unknown Source)
at sun.security.ssl.X509TrustManagerImpl.checkServerTrusted(Unknown Source)
... 21 more
Caused by: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
at sun.security.provider.certpath.SunCertPathBuilder.engineBuild(Unknown Source)
at java.security.cert.CertPathBuilder.build(Unknown Source)
... 27 more

Bitstamp Polling Ticker - Function arguments transposed

Sorry for the lack of details, but I fixed this and moved on before submitting.

In the latest update, I think the function arguments for "tradableIdentifier" and "currency" may be transposed in the Bitstamp functions (compared to the typical definition for the other exchanges).

I had to reverse the two parameters in one or two places in the Bitstamp source and test files. (Sorry I cannot remember which at this time...)

NullPointerException in getFullOrderBook() in Android 2.2

This issue happens in Android 2.2 (my phone is running 4.2.1 and is not affected). MtGox and CampBX don't seem to be affected but it might just be matter of running more tests.

I catch the exception and display an error message to enable the user to try again so this isn't a problem for me anymore. It seems to always work on the second try and does not happen very often. Here are the stack traces if anyone wants to look into it:

Bitstamp:
01-20 18:28:24.303: W/System.err(333): java.lang.NullPointerException
01-20 18:28:24.303: W/System.err(333): at com.xeiam.xchange.bitstamp.BitstampAdapters.adaptOrders(BitstampAdapters.java:85)
01-20 18:28:24.303: W/System.err(333): at com.xeiam.xchange.bitstamp.service.marketdata.polling.BitstampPollingMarketDataService.getFullOrderBook(BitstampPollingMarketDataService.java:92)

BTC-E:
01-20 18:17:43.353: W/System.err(312): java.lang.NullPointerException
01-20 18:17:43.363: W/System.err(312): at com.xeiam.xchange.btce.service.marketdata.polling.BTCEPollingMarketDataService.getFullOrderBook(BTCEPollingMarketDataService.java:88)

VirtEx:
01-20 19:36:02.204: W/System.err(782): java.lang.NullPointerException
01-20 19:36:02.204: W/System.err(782): at com.xeiam.xchange.virtex.service.marketdata.polling.VirtExPollingMarketDataService.getFullOrderBook(VirtExPollingMarketDataService.java:94)
01-20 19:36:02.212: W/System.err(782): at com.veken0m.bitcoinium.OrderbookActivity.getOrderBook(OrderbookActivity.java:141)

Implement additional methods for streaming market data service

Need to add support for methods found in PollingMarketDataService.

After reviewing the options and the polling code, the best way forward is similar to the original proposal by skipster555. Essentially the following is required:

Rename getEventQueue() to getTickerEventQueue();
Add getTradeEventQueue();
Add getDepthEventQueue();

Each queue is maintained on a separate thread. The tradeable identifier and currency code remain with the configuration of the service. The polling service can be used to get other information to build the configuration (supported currencies etc) and does not need to be duplicated.

REST client: support for json-encoded post body

Needed for Bitcoin Central and VirVox, the next two largest exchanges that provide REST APIs and are not yet implemented in XChange.

The support for json body should probably be implemented as support for @consumes("application/json").

Introduce an arbitrage API

Now that we have a bunch of exchanges offering different prices for BTC it is probably worth looking into offering an arbitrage API. This would allow XChange to facilitate a merchant locating the most favourable exchange to offload or purchase their bitcoins. It would need to take into account:

  • exchange fees
  • market depth on the exchange
  • ease of access

Standardized order for Orderbook and Trades List

Would it be possible to standardize the order of values found in the Orderbook and Trades list across every exchange?

I ask this because, for example, when I fetch an Orderbook and obtain a List representing a list of Bids or Asks I like to simply reading every value and print it to the screen in proper order. The problem is each exchange's list is ordered differently. For example some exchanges list values ascending by price, descending by date, etc and needs additional sorting so that it is displayed in a way that is consistently intuitive to the user.

Here is the order of the lists I think would be optimal:
OrderBook:
- Bids -> List Descending by Price
- Asks -> List Ascending by Price
Trades -> List Ascending by Date

I propose 2 options for doing this:

Option 1:
Have the adapters of each exchange sort the lists in a way to respect the proposed ordering. I have currently been doing this with VirtEx and BTC-E so that they are consistent with the way MtGox's lists are ordered. Bitstamp and CampBX will need to be modified to comply with this.

Option 2:
Sorting is done in xchange-core so that all additional exchanges are sorted appropriately without additional work by the developers adding the exchanges. I have been experimenting with this method and it seems to be working very well. I thought sorting all the lists would have a noticeable performance impact but it is not noticeable when tested in Bitcoinium.

Implement Withdrawals and Cancel Orders for MtGox

The problem here is that MtGox doesn't offer this functionality for their V1 API, but do for their V0 API. Here is an email exchange I had with them:

Me: "I noticed the V1 API is missing the ability to withdraw and cancel orders, although V0 offers it. Do you plan on adding those two capabilities to V1 any time soon?"

MtGox: "Sorry for the delay and thank you for your email. We will pass it to the developer for consideration, and if they become available on v1, we will put it in the documentation."

We can either wait until they update V1 or we can implement it using the old V0. If someone feels like implementing the V0 version, it should all be done under a new com.xeiam.xchange.mtgox.v0 package, separate from com.xeiam.xchange.mtgox.v1.

Any volunteers? If MtGox updates their V1 API, I'll implement it, as it will be quite simple. To implement it in V0 will be more work.

Bitcoin Central trades returning HTTP 404

Just a heads up that fetching latest trades from Bitcoin Central isn't working. Seems like they may have changed their API.

03-07 09:30:39.147: D/c_.x_.x_.ExchangeFacto_(20685): Creating default exchange from class name
03-07 09:30:39.147: D/c_.x_.x_.r_.HttpTempla_(20685): Executing GET request at https://bitcoin-central.net/trades?currency=EUR&per_page=5
03-07 09:30:39.147: V/c_.x_.x_.r_.HttpTempla_(20685): Request body = null
03-07 09:30:39.147: V/c_.x_.x_.r_.HttpTempla_(20685): Request headers = {Accept=application/json, Content-Type=application/json}
03-07 09:30:39.147: V/c_.x_.x_.r_.HttpTempla_(20685): Header request property: key='User-Agent', value='XChange/develop-SNAPSHOT JDK/6 AppleWebKit/535.7 Chrome/16.0.912.36 Safari/535.7'
03-07 09:30:39.147: V/c_.x_.x_.r_.HttpTempla_(20685): Header request property: key='Content-Type', value='application/json'
03-07 09:30:39.157: V/c_.x_.x_.r_.HttpTempla_(20685): Header request property: key='Accept', value='application/json'
03-07 09:30:39.157: V/c_.x_.x_.r_.HttpTempla_(20685): Header request property: key='Accept-Charset', value='UTF-8'
03-07 09:30:39.297: D/c_.x_.x_.r_.HttpTempla_(20685): Request http status = 404
03-07 09:30:39.297: W/System.err(20685): com.xeiam.xchange.rest.HttpException: Status code 404; first body line:
03-07 09:30:39.297: W/System.err(20685): at com.xeiam.xchange.rest.HttpTemplate.checkHttpStatusCode(HttpTemplate.java:221)

Add extra properties to ExchangeSpecification

ExchangeSpecification could do with some extra information to assist consumers of the API. Having

  • name (set in default)
  • description (set in default)
  • trade fee percentage (external provision)

would ease the configuration burden.

Demos as tests

Have you considered refactoring the demos into tests? I mean moving them into src/test/java (in the corresponding modules) and changing main methods into test methods. It's just as easy for a developer to check out some test code (if the documentation says they should) as some (public-static-main-)executable code. And it just as easy to run it (at least in Intellij Idea). Making it test code, though, makes it very easy to run all the tests at once to see if something is broken. Some assertions could (and should) also be added then.

(Of course these tests would have to be excluded from the regular mvn test and only run on demand, but that's easily done with test groups.)

The demo code is meant only to be run, and never to be packaged anyway. If it is in production code than it can be packaged in a jar (and, as a matter of fact, is packaged in mvn install) which doesn't make much sense.

But I do agree it probably does feel a bit more natural for people that want to use XChange to have a look at a main method as opposed to test methods.

Anyway, just thinking aloud. I think this would make the demo code more valuable for XChange developers, but maybe a bit harder to find for the users.

Is 1.3.0 officially out?

If so, the "Milestones" wiki page is out-of-date, if not, sorry for the trouble... I'm quite new in the Git world...

Thanks,
Gil

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.