{"id":18895661,"url":"https://github.com/binance/binance-sbe-java-sample-app","last_synced_at":"2025-09-11T23:44:48.153Z","repository":{"id":211391594,"uuid":"724050496","full_name":"binance/binance-sbe-java-sample-app","owner":"binance","description":"Sample app in Java that decodes Binance \"exchangeInfo\" endpoint's SBE response to YAML.","archived":false,"fork":false,"pushed_at":"2024-10-03T06:47:25.000Z","size":90,"stargazers_count":5,"open_issues_count":1,"forks_count":3,"subscribers_count":4,"default_branch":"master","last_synced_at":"2024-11-08T08:38:21.990Z","etag":null,"topics":["binance-api","crypto","java","sample","sbe"],"latest_commit_sha":null,"homepage":"","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/binance.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","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":"2023-11-27T09:46:42.000Z","updated_at":"2024-10-10T04:38:05.000Z","dependencies_parsed_at":null,"dependency_job_id":"c8ee089d-7491-405c-9a66-a1e4c7dea0ec","html_url":"https://github.com/binance/binance-sbe-java-sample-app","commit_stats":null,"previous_names":["binance/binance-sbe-java-sample-app"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/binance%2Fbinance-sbe-java-sample-app","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/binance%2Fbinance-sbe-java-sample-app/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/binance%2Fbinance-sbe-java-sample-app/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/binance%2Fbinance-sbe-java-sample-app/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/binance","download_url":"https://codeload.github.com/binance/binance-sbe-java-sample-app/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":231959691,"owners_count":18452118,"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":["binance-api","crypto","java","sample","sbe"],"created_at":"2024-11-08T08:29:16.469Z","updated_at":"2024-12-31T07:44:26.322Z","avatar_url":"https://github.com/binance.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"# SBE Java Sample Application\n\nThis sample application is designed to decode `exchangeInfo` endpoint's response to YAML, when using the [Binance Spot API Simple Binary Encoding (SBE)](https://github.com/binance/binance-spot-api-docs/blob/master/faqs/sbe_faq.md).\n\nMoreover, there are additional decoder classes that can be useful for decoding SBE responses from other endpoints in the Binance Spot API.\n\n## Getting Started\n\n1. Clone the source code to your local end.\n```shell\ngit clone git@github.com:binance/binance-sbe-java-sample-app\n```\n\n2. Navigate to the directory where `pom.xml` file is located and build the project with `Maven` to generate `./target/sbe-sample-app-1.0-SNAPSHOT.jar`.\n\n```shell\nmvn clean install\n```\n\n## Usage\n\nThe following commands use `./target/sbe-sample-app-1.0-SNAPSHOT.jar` to output on STDOUT the `exchangeInfo` SBE response in YAML.\n\n### Via reading SBE-encoded HTTP response from STDIN\n\n```shell\ncurl -X GET -H 'Accept: application/sbe' -H 'X-MBX-SBE: 1:0' 'https://api.binance.com/api/v3/exchangeInfo' | java -jar ./target/sbe-sample-app-1.0-SNAPSHOT.jar -\n```\n\n### Via reading SBE-encoded WebSocket response from STDIN\n\n```shell\necho '{\"id\":\"93fb61ef-89f8-4d6e-b022-4f035a3fadad\",\"method\":\"exchangeInfo\",\"params\":{}}' | ./tools/websocket_send.py  'wss://ws-api.binance.com:443/ws-api/v3?responseFormat=sbe\u0026sbeSchemaId=1\u0026sbeSchemaVersion=0' | java -jar ./target/sbe-sample-app-1.0-SNAPSHOT.jar -\n```\n\nNote: To run `websocket_send.py`, your Python 3 environment should include the `websocket-client` package with the integrated `create_connection` function.\n\n### Via downloading SBE-encoded HTTP response within the app\n\n```shell\njava -jar ./target/sbe-sample-app-1.0-SNAPSHOT.jar 'https://api.binance.com/api/v3/exchangeInfo'\n```\n\nThe `spot_sbe` directory contains the decoder classes, which you can consult to explore other endpoints.\n\n### Testnet \nTo use the Spot Testnet API, you only need to replace:\n- `api.binance.com` with `testnet.binance.vision` for the REST API\n- `ws-api.binance.com` with `testnet.binance.vision` for the WebSocket API\n\n## Update\n\n### Java decoders\n\nThe `src/main/java/spot_sbe` directory contains code generated by [simple-binary-encoding](https://github.com/real-logic/simple-binary-encoding), which you will likely want to reuse verbatim. However, if you would like to update it, please navigate to the root of this project and follow these steps:\n\n1) Download the [spot_prod_latest.xml](https://github.com/binance/binance-spot-api-docs/blob/master/sbe/schemas/spot_prod_latest.xml) schema file to `src/main/resources`:\n```shell\nmkdir -p src/main/resources\ncd src/main/resources\ncurl -o spot_latest.xml https://raw.githubusercontent.com/binance/binance-spot-api-docs/master/sbe/schemas/$(curl -s https://raw.githubusercontent.com/binance/binance-spot-api-docs/master/sbe/schemas/spot_prod_latest.xml)\ncd -\n```\n\n**Note:** If you are using the Spot Testnet API, replace `spot_prod_latest.xml` with `spot_testnet_latest.xml` in the above `curl ` command.\n\n2) Clone \u0026 build [simple-binary-encoding](https://github.com/real-logic/simple-binary-encoding):\n```shell\ngit clone https://github.com/real-logic/simple-binary-encoding.git --branch '1.30.0'\ncd simple-binary-encoding\n./gradlew\ncd ..\n```\n\n3) Run the SBE tool code generator built in the previous step:\n```shell\njava \\\n  -Dsbe.output.dir=src/main/java/ \\\n  -Dsbe.target.language=Java \\\n  -jar simple-binary-encoding/sbe-all/build/libs/sbe-all-1.30.0.jar \\\n  src/main/resources/spot_latest.xml\n```\n\n4) Remove unneeded encoder files:\n```shell\nfind src/main/java/spot_sbe -type f -name '*Encoder.java' -exec rm '{}' \\;\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbinance%2Fbinance-sbe-java-sample-app","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbinance%2Fbinance-sbe-java-sample-app","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbinance%2Fbinance-sbe-java-sample-app/lists"}