{"id":13516742,"url":"https://github.com/knowm/XChange","last_synced_at":"2025-03-31T07:30:33.288Z","repository":{"id":2369644,"uuid":"3333998","full_name":"knowm/XChange","owner":"knowm","description":"XChange is a Java library providing a streamlined API for interacting with 60+ Bitcoin and Altcoin exchanges providing a consistent interface for trading and accessing market data.","archived":false,"fork":false,"pushed_at":"2024-12-03T07:18:03.000Z","size":49734,"stargazers_count":3885,"open_issues_count":350,"forks_count":1944,"subscribers_count":252,"default_branch":"develop","last_synced_at":"2024-12-04T09:18:12.756Z","etag":null,"topics":["bitcoin"],"latest_commit_sha":null,"homepage":"http://knowm.org/open-source/xchange/","language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/knowm.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2012-02-02T10:48:28.000Z","updated_at":"2024-12-03T07:18:09.000Z","dependencies_parsed_at":"2023-07-06T10:16:31.347Z","dependency_job_id":"a76f4515-a6a0-4fbb-9d55-2204164a5b57","html_url":"https://github.com/knowm/XChange","commit_stats":{"total_commits":9199,"total_committers":558,"mean_commits":"16.485663082437277","dds":0.877269268398739,"last_synced_commit":"c20907ccaf24123375bdc1cb34610b03c7e3e0dc"},"previous_names":["timmolter/xchange"],"tags_count":62,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/knowm%2FXChange","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/knowm%2FXChange/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/knowm%2FXChange/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/knowm%2FXChange/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/knowm","download_url":"https://codeload.github.com/knowm/XChange/tar.gz/refs/heads/develop","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246432778,"owners_count":20776461,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["bitcoin"],"created_at":"2024-08-01T05:01:25.404Z","updated_at":"2025-03-31T07:30:28.271Z","avatar_url":"https://github.com/knowm.png","language":"Java","readme":"## [![XChange](https://raw.githubusercontent.com/knowm/XChange/develop/etc/XChange_64_64.png)](http://knowm.org/open-source/xchange) XChange\n\n[![Discord](https://img.shields.io/discord/778301671302365256?logo=Discord)](https://discord.gg/n27zjVTbDz)\n[![Java CI with Maven on Push](https://github.com/knowm/XChange/actions/workflows/maven.yml/badge.svg?event=status)](https://github.com/knowm/XChange/actions/workflows/maven.yml)\n\nXChange 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.\n\n## Important!\n\nThe world of Bitcoin changes quickly and XChange is no exception. For the latest bugfixes and features you should use the [snapshot jars](https://oss.sonatype.org/content/groups/public/org/knowm/xchange/) 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](https://github.com/knowm/XChange/issues).\n\n## Description\n\nXChange is a Java based library providing a simple and consistent API for interacting with a diverse set of crypto currency exchanges.\n\nBasic usage is very simple: Create an `Exchange` instance, get the appropriate service, and request data. More complex usages are progressively detailed below.\n\n## REST API\n#### Public Market Data\n\nTo use public APIs which do not require authentication:\n\n```java\nExchange bitstamp = ExchangeFactory.INSTANCE.createExchange(BitstampExchange.class);\nMarketDataService marketDataService = bitstamp.getMarketDataService();\nTicker ticker = marketDataService.getTicker(CurrencyPair.BTC_USD);\nSystem.out.println(ticker.toString());\n```\n\n#### Private Account Info\n\nTo use APIs which require authentication, create an `ExchangeSpecification` with your API credentials and pass this to `createExchange()`:\n\n```java\nExchangeSpecification exSpec = new BitstampExchange().getDefaultExchangeSpecification();\nexSpec.setUserName(\"34387\");\nexSpec.setApiKey(\"a4SDmpl9s6xWJS5fkKRT6yn41vXuY0AM\");\nexSpec.setSecretKey(\"sisJixU6Xd0d1yr6w02EHCb9UwYzTNuj\");\nExchange bitstamp = ExchangeFactory.INSTANCE.createExchange(exSpec);\n```\n\n*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](https://github.com/knowm/XChange/wiki/Frequently-Asked-Questions).\n\nOnce you have an authenticated `Exchange`, the private API services, `AccountService` and `TradeService`, can be used to access private data:\n\n```java\n// Get the account information\nAccountService accountService = bitstamp.getAccountService();\nAccountInfo accountInfo = accountService.getAccountInfo();\nSystem.out.println(accountInfo.toString());\n```\n\nAll exchange implementations expose the same API, but you can also directly access the underlying \"raw\" data from the individual exchanges if you need to.\n\n## Websocket API\n\nThe 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.\n\nFor a smaller number of exchanges, the websocket-based `StreamingExchange` API is also available. This uses [Reactive streams](http://reactivex.io/) to allow you to efficiently subscribe to changes relating to thousands of coin pairs without requiring large numbers of threads.\n\nYou will need to import an additional dependency for the exchange you are using (see below), then example usage is as follows:\n\n```java\n// Use StreamingExchangeFactory instead of ExchangeFactory\nStreamingExchange exchange = StreamingExchangeFactory.INSTANCE.createExchange(BitstampStreamingExchange.class);\n\n// Connect to the Exchange WebSocket API. Here we use a blocking wait.\nexchange.connect().blockingAwait();\n\n// Subscribe to live trades update.\nDisposable subscription1 = exchange.getStreamingMarketDataService()\n    .getTrades(CurrencyPair.BTC_USD)\n    .subscribe(\n        trade -\u003e LOG.info(\"Trade: {}\", trade),\n        throwable -\u003e LOG.error(\"Error in trade subscription\", throwable));\n\n// Subscribe order book data with the reference to the subscription.\nDisposable subscription2 = exchange.getStreamingMarketDataService()\n    .getOrderBook(CurrencyPair.BTC_USD)\n    .subscribe(orderBook -\u003e LOG.info(\"Order book: {}\", orderBook));\n\n// Wait for a while to see some results arrive\nThread.sleep(20000);\n\n// Unsubscribe\nsubscription1.dispose();\nsubscription2.dispose();\n\n// Disconnect from exchange (blocking again)\nexchange.disconnect().blockingAwait();\n```\n\nAuthentication, 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.\n\n## More information\n\nNow go ahead and [study some more examples](http://knowm.org/open-source/xchange/xchange-example-code), [download the thing](http://knowm.org/open-source/xchange/xchange-change-log/) and [provide feedback](https://github.com/knowm/XChange/issues).\n\nMore information about reactive streams can be found at the [RxJava wiki](https://github.com/ReactiveX/RxJava/wiki).\n\n## Features\n\n- [x] MIT license\n- [x] consistent API across all implemented exchanges\n- [x] active development\n- [x] very minimal 3rd party dependencies\n- [x] modular components\n\n## More Info\n\nProject Site: \u003chttp://knowm.org/open-source/xchange\u003e  \nExample Code: \u003chttp://knowm.org/open-source/xchange/xchange-example-code\u003e  \nChange Log: \u003chttp://knowm.org/open-source/xchange/xchange-change-log/\u003e  \nJava Docs: \u003chttp://knowm.org/javadocs/xchange/index.html\u003e\n\nTalk to us on discord: [![Discord](https://img.shields.io/discord/778301671302365256?logo=Discord)](https://discord.gg/n27zjVTbDz)\n\n## Wiki\n\n- [Home](https://github.com/knowm/XChange/wiki)\n- [FAQ](https://github.com/knowm/XChange/wiki/Frequently-Asked-Questions)\n- [Design Notes](https://github.com/knowm/XChange/wiki/Design-Notes)\n- [Milestones](https://github.com/knowm/XChange/wiki/Milestones)\n- [Exchange Support](https://github.com/knowm/XChange/wiki/Exchange-support)\n- [New Implementation Best Practices](https://github.com/knowm/XChange/wiki/New-Implementation-Best-Practices)\n- [Installing SSL Certificates into TrustStore](https://github.com/knowm/XChange/wiki/Installing-SSL-Certificates-into-TrustStore)\n- [Getting Started with XChange for Noobies](https://github.com/knowm/XChange/wiki/Getting-Started-with-XChange-for-Noobies)\n- [Code Style](https://github.com/knowm/XChange/wiki/Code-Style)\n\n## Continuous Integration\n\n[![Java CI with Maven](https://github.com/knowm/XChange/actions/workflows/maven.yml/badge.svg?branch=develop\u0026event=status)](https://github.com/knowm/XChange/actions/workflows/maven.yml)\n\n## Getting Started\n\n### Non-Maven\n\n- [XChange Release Jars](http://search.maven.org/#search%7Cga%7C1%7Cknowm%20xchange)\n- [XChange Snapshot Jars](https://oss.sonatype.org/content/groups/public/org/knowm/xchange/)\n\n### Maven\n\nThe XChange release artifacts are hosted on Maven Central: [org.knowm.xchange](https://mvnrepository.com/artifact/org.knowm.xchange)\n\nAdd 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.\n\n```xml\n\u003cdependency\u003e\n  \u003cgroupId\u003eorg.knowm.xchange\u003c/groupId\u003e\n  \u003cartifactId\u003exchange-core\u003c/artifactId\u003e\n  \u003cversion\u003e5.2.0\u003c/version\u003e\n\u003c/dependency\u003e\n\u003cdependency\u003e\n  \u003cgroupId\u003eorg.knowm.xchange\u003c/groupId\u003e\n  \u003cartifactId\u003exchange-XYZ\u003c/artifactId\u003e\n  \u003cversion\u003e5.2.0\u003c/version\u003e\n\u003c/dependency\u003e\n```\n\nIf it is available for your exchange, you may also want to use the streaming API:\n\n```xml\n\u003cdependency\u003e\n  \u003cgroupId\u003eorg.knowm.xchange\u003c/groupId\u003e\n  \u003cartifactId\u003exchange-stream-XYZ\u003c/artifactId\u003e\n  \u003cversion\u003e5.2.0\u003c/version\u003e\n\u003c/dependency\u003e\n```\n\nFor snapshots, add the following repository to your pom.xml file.\n\n```xml\n\u003crepository\u003e\n  \u003cid\u003esonatype-oss-snapshot\u003c/id\u003e\n  \u003csnapshots/\u003e\n  \u003curl\u003ehttps://oss.sonatype.org/content/repositories/snapshots\u003c/url\u003e\n\u003c/repository\u003e\n```\n\nThe current snapshot version is:\n\n    5.2.1-SNAPSHOT\n\n## Building with Maven\n\nInstruction                 | Command\n--------------------------------- | ------------------------ \nrun unit tests                    | `mvn clean test`\nrun unit and integration tests    | `mvn clean verify -DskipIntegrationTests=false`    \ninstall in local Maven repo       | `mvn clean install`\ncreate project javadocs           | `mvn javadoc:aggregate`\ngenerate dependency tree          | `mvn dependency:tree`\ncheck for dependency updates      | `mvn versions:display-dependency-updates`\ncheck for plugin updates          | `mvn versions:display-plugin-updates`\ncode format                       | `mvn com.spotify.fmt:fmt-maven-plugin:format`\npom format/organize               | `mvn com.github.ekryd.sortpom:sortpom-maven-plugin:sort`\n\n## Bugs\n\nPlease report any bugs or submit feature requests to [XChange's Github issue tracker](https://github.com/knowm/XChange/issues).\n\n## Contributing\n\nIf you'd like to submit a new implementation for another exchange, please take a look at [New Implementation Best Practices](https://github.com/knowm/XChange/wiki/New-Implementation-Best-Practices) first, as there are lots of time-saving tips!\n\nFor more information such as a contributor list and a list of known projects depending on XChange, visit the [Main Project Wiki](https://github.com/knowm/XChange/wiki).\n","funding_links":[],"categories":["Java","Java Libraries","Other"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fknowm%2FXChange","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fknowm%2FXChange","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fknowm%2FXChange/lists"}