{"id":19245760,"url":"https://github.com/silently9527/exchange-sdk","last_synced_at":"2025-06-11T13:08:10.913Z","repository":{"id":253347768,"uuid":"690037492","full_name":"silently9527/exchange-sdk","owner":"silently9527","description":"作为长期混迹在合约市场的老韭菜来说，已不能满足与手动下单来亏钱，必须得通过脚本来加速，为了达到这个目的就产生了项目。目前封装的主要是合约的API接口，不支持现货交易。","archived":false,"fork":false,"pushed_at":"2025-05-13T10:01:11.000Z","size":352,"stargazers_count":8,"open_issues_count":0,"forks_count":4,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-05-13T11:21:46.317Z","etag":null,"topics":["binance","btc","kucoin","okex"],"latest_commit_sha":null,"homepage":"https://herman7z.site","language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/silently9527.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"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,"zenodo":null}},"created_at":"2023-09-11T12:13:53.000Z","updated_at":"2025-05-13T10:01:15.000Z","dependencies_parsed_at":null,"dependency_job_id":"432cc0de-daa9-4610-a60d-e58b6e0b517f","html_url":"https://github.com/silently9527/exchange-sdk","commit_stats":null,"previous_names":["silently9527/exchange-sdk"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/silently9527%2Fexchange-sdk","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/silently9527%2Fexchange-sdk/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/silently9527%2Fexchange-sdk/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/silently9527%2Fexchange-sdk/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/silently9527","download_url":"https://codeload.github.com/silently9527/exchange-sdk/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/silently9527%2Fexchange-sdk/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":259270865,"owners_count":22832086,"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","btc","kucoin","okex"],"created_at":"2024-11-09T17:29:17.582Z","updated_at":"2025-06-11T13:08:10.862Z","avatar_url":"https://github.com/silently9527.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003cp align=\"center\"\u003e\n  \u003ca href=\"https://t.zsxq.com/h2EIR\" target=\"_blank\"\u003e\u003cimg alt=\"\" src=\"https://img.shields.io/badge/知识星球-Herman's Notes-red\u0026logoColor=FC5531\" /\u003e\u003c/a\u003e\n  \u003ca\u003e\u003cimg src=\"https://img.shields.io/badge/公众号-贝塔学JAVA-blue.svg\" alt=\"公众号\"\u003e\u003c/a\u003e\n  \u003ca href=\"https://juejin.cn/user/2779199782521693\"\u003e\u003cimg src=\"https://img.shields.io/badge/juejin-掘金-yellow.svg\" alt=\"掘金\"\u003e\u003c/a\u003e\n  \u003ca href=\"https://blog.csdn.net/asdewq380303318\"\u003e\u003cimg src=\"https://img.shields.io/badge/csdn-CSDN-red.svg\" alt=\"CSDN\"\u003e\u003c/a\u003e\n  \u003ca href=\"https://my.oschina.net/u/3230120\"\u003e\u003cimg src=\"https://img.shields.io/badge/oschina-开源中国-green\" alt=\"开源中国\"\u003e\u003c/a\u003e\n  \u003ca href=\"https://www.zhihu.com/people/huaan9527-57/posts\"\u003e\u003cimg src=\"https://img.shields.io/badge/zhihu-知乎-purple\" alt=\"知乎\"\u003e\u003c/a\u003e\n\u003c/p\u003e\n\n# ExchangeSdk\n作为长期混迹在合约市场的老韭菜来说，已不能满足与手动下单来亏钱，必须得通过脚本来加速，为了达到这个目的就产生了项目。目前封装的主要是合约的API接口，不支持现货交易。\n\n\n## 知识星球: [Herman's Notes](https://t.zsxq.com/h2EIR)\n加微信silently9527, 加入技术交流群；欢迎加入进来一起交流使用脚本快速亏钱秘诀\n\n## Features\n1. 抽象出了交易所合约的通用接口\n2. 支持的交易所：binance, okex, kucoin\n3. 支持 Rest接口 和 WebSocket\n\n## How to install\n\n1. 克隆下仓库代码执行`mvn install`\n2. maven依赖添加到自己的项目\n\n```xml\n\u003cdependency\u003e\n    \u003cgroupId\u003eorg.herman\u003c/groupId\u003e\n    \u003cartifactId\u003eexchange-sdk\u003c/artifactId\u003e\n    \u003cversion\u003e1.0-SNAPSHOT\u003c/version\u003e\n\u003c/dependency\u003e\n```\n\n## How to use\n\n- `FutureRestApiClient`: 主要抽象出了合约的RestApi接口\n- `FutureSubscriptionClient`: 主要抽象出了合约的WebSocket接口\n- `FutureApiInternalFactory`: 封装了创建各个交易所FutureRestApiClient和FutureSubscriptionClient的工具类\n\n#### Examples\n1. 使用rest接口查询出Binance的标记价格\n\n```java\nfinal FutureRestApiClient restApiClient = FutureApiInternalFactory\n        .getInstance()\n        .createBinanceFutureRestApiClient(Constants.Future.BINANCE_REST_API_BASE_URL, \"xxx\", \"xxx\");\nfinal List\u003cMarkPrice\u003e markPrice = restApiClient.getMarkPrice(\"BTCUSDT\");\nSystem.out.println(markPrice);\n```\n\n输出：\n```\n[MarkPrice[symbol=BTCUSDT,markPrice=57738.69215152,time=1723775413000]]\n```\n\n\n2. 使用WebSocket监听Binance的标记价格\n\n```java\nfinal FutureSubscriptionClient subscriptionClient = FutureApiInternalFactory\n        .getInstance()\n        .createBinanceFutureSubscriptionClient(Constants.Future.BINANCE_WS_API_BASE_URL, \"xxx\", \"xxx\");\nsubscriptionClient.subscribeMarkPriceEvent(\"BTCUSDT\",\n        markPriceEvent -\u003e {\n            //订阅成功后的回调\n            System.out.println(markPriceEvent);\n        },\n        e -\u003e {\n            //异常后的执行逻辑\n            e.printStackTrace();\n        }\n);\n```\n\n## 博客地址\n[https://herman7z.site](https://herman7z.site)\n\n![知识星球](https://raw.githubusercontent.com/silently9527/images/main/202408151725390.png)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsilently9527%2Fexchange-sdk","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsilently9527%2Fexchange-sdk","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsilently9527%2Fexchange-sdk/lists"}