{"id":26932947,"url":"https://github.com/openxapi/openxapi","last_synced_at":"2025-04-02T09:16:59.182Z","repository":{"id":285580352,"uuid":"947266913","full_name":"openxapi/openxapi","owner":"openxapi","description":"OpenAPI and AsyncAPI specifications for cryptocurrency exchanges and DeFi protocols","archived":false,"fork":false,"pushed_at":"2025-04-01T14:11:34.000Z","size":1701,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-04-01T15:30:57.976Z","etag":null,"topics":["asyncapi","binance","bitget","bybit","coinbase","cryptocurrency","exchange","golang","okx","openapi","sdk","typescript"],"latest_commit_sha":null,"homepage":"https://openxapi.com","language":"Go","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/openxapi.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":"2025-03-12T12:21:27.000Z","updated_at":"2025-04-01T14:34:49.000Z","dependencies_parsed_at":"2025-04-01T15:42:00.575Z","dependency_job_id":null,"html_url":"https://github.com/openxapi/openxapi","commit_stats":null,"previous_names":["openxapi/openxapi"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/openxapi%2Fopenxapi","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/openxapi%2Fopenxapi/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/openxapi%2Fopenxapi/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/openxapi%2Fopenxapi/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/openxapi","download_url":"https://codeload.github.com/openxapi/openxapi/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246785485,"owners_count":20833497,"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":["asyncapi","binance","bitget","bybit","coinbase","cryptocurrency","exchange","golang","okx","openapi","sdk","typescript"],"created_at":"2025-04-02T09:16:58.694Z","updated_at":"2025-04-02T09:16:59.175Z","avatar_url":"https://github.com/openxapi.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# OpenXAPI - Open eXchange API\n\n![OpenXAPI Logo](images/logo.svg)\n\n### Write APIs in Specification.\n\n### One Spec. All Exchanges. Any Language.\n\nOpenXAPI provides standardized OpenAPI and AsyncAPI specifications for cryptocurrency exchanges and DeFi protocols, enabling seamless integration and SDK generation across multiple programming languages.\n\n## Specifications\n\n### REST API - OpenAPI Specification\n\nOpenXAPI is a Go program that automatically generates OpenAPI Specifications from various cryptocurrency exchange API documentation. It enables automatic SDK generation for multiple programming languages using the generated OpenAPI Specs.\n\n### WebSocket API - AsyncAPI Specification\n\nOpenXAPI also maintains AsyncAPI Specifications for cryptocurrency exchanges and DeFi protocols.\nSo that you can use the same specification to generate websocket client SDKs for multiple programming languages.\n\n## Features\n\n### Everything in one place\n\n- Automatic OpenAPI 3.0 specification generation from exchange API docs\n- AsyncAPI specification for exchanges and DeFi protocols\n- Multi-language SDK generation support\n\n### Full coverage\n\n- Support for multiple cryptocurrency exchanges and DeFi protocols\n- Configurable API documentation URL management\n- Change detection and automatic spec regeneration\n- Version history tracking\n- Sample file support for offline development and testing\n\n## Supported Exchanges\n\n| Exchange | Product | Module | Supported | REST API | Websocket API | SDKs |\n|:--------:|:-------:|:------:|:----------:|:----------:|:------------:|:----:|\n| Binance | Spot Trading | | ✅ | [Spec](./specs/binance/openapi/spot.yaml) [Swagger](https://swagger.openxapi.com?url=https://raw.githubusercontent.com/openxapi/openxapi/main/specs/binance/openapi/spot.yaml)| | [Go](https://github.com/openxapi/binance-go) |\n| | Derivatives Trading | USDS-M Futures | ✅ | [Spec](./specs/binance/openapi/umfutures.yaml) [Swagger](https://swagger.openxapi.com?url=https://raw.githubusercontent.com/openxapi/openxapi/main/specs/binance/openapi/umfutures.yaml) | | [Go](https://github.com/openxapi/binance-go) |\n| | | COIN-M Futures | ✅ | [Spec](./specs/binance/openapi/cmfutures.yaml) [Swagger](https://swagger.openxapi.com?url=https://raw.githubusercontent.com/openxapi/openxapi/main/specs/binance/openapi/cmfutures.yaml) | | [Go](https://github.com/openxapi/binance-go) |\n| | | Options | ✅ | [Spec](./specs/binance/openapi/options.yaml) [Swagger](https://swagger.openxapi.com?url=https://raw.githubusercontent.com/openxapi/openxapi/main/specs/binance/openapi/options.yaml) | | [Go](https://github.com/openxapi/binance-go) |\n| | | Portfolio Margin | ✅ | [Spec](./specs/binance/openapi/pmargin.yaml) [Swagger](https://swagger.openxapi.com?url=https://raw.githubusercontent.com/openxapi/openxapi/main/specs/binance/openapi/pmargin.yaml) | | [Go](https://github.com/openxapi/binance-go) |\n| | | Portfolio Margin Pro | ✅ | [Spec](./specs/binance/openapi/pmarginpro.yaml) [Swagger](https://swagger.openxapi.com?url=https://raw.githubusercontent.com/openxapi/openxapi/main/specs/binance/openapi/pmarginpro.yaml) | | [Go](https://github.com/openxapi/binance-go) |\n| | | Futures Data | ✅ | [Spec](./specs/binance/openapi/futuresdata.yaml) [Swagger](https://swagger.openxapi.com?url=https://raw.githubusercontent.com/openxapi/openxapi/main/specs/binance/openapi/futuresdata.yaml) | | [Go](https://github.com/openxapi/binance-go) |\n| | Margin Trading | | ✅ | [Spec](./specs/binance/openapi/margin.yaml) [Swagger](https://swagger.openxapi.com?url=https://raw.githubusercontent.com/openxapi/openxapi/main/specs/binance/openapi/margin.yaml) | | [Go](https://github.com/openxapi/binance-go) |\n| | Algo Trading | | ✅ | [Spec](./specs/binance/openapi/algo.yaml) [Swagger](https://swagger.openxapi.com?url=https://raw.githubusercontent.com/openxapi/openxapi/main/specs/binance/openapi/algo.yaml) | | [Go](https://github.com/openxapi/binance-go) |\n| | Wallet | | ✅ | [Spec](./specs/binance/openapi/wallet.yaml) [Swagger](https://swagger.openxapi.com?url=https://raw.githubusercontent.com/openxapi/openxapi/main/specs/binance/openapi/wallet.yaml) | | [Go](https://github.com/openxapi/binance-go) |\n| | Copy Trading | | ✅ | [Spec](./specs/binance/openapi/copytrading.yaml) [Swagger](https://swagger.openxapi.com?url=https://raw.githubusercontent.com/openxapi/openxapi/main/specs/binance/openapi/copytrading.yaml) | | [Go](https://github.com/openxapi/binance-go) |\n| | Convert | | ✅ | [Spec](./specs/binance/openapi/convert.yaml) [Swagger](https://swagger.openxapi.com?url=https://raw.githubusercontent.com/openxapi/openxapi/main/specs/binance/openapi/convert.yaml) | | [Go](https://github.com/openxapi/binance-go) |\n| | Sub Account | | ✅ | [Spec](./specs/binance/openapi/subaccount.yaml) [Swagger](https://swagger.openxapi.com?url=https://raw.githubusercontent.com/openxapi/openxapi/main/specs/binance/openapi/subaccount.yaml) | | [Go](https://github.com/openxapi/binance-go) |\n\n## Project Structure\n\n```\n.\n├── bin/                    # Compiled binaries\n├── cmd/                    # Command-line applications\n│   └── openxapi/           # Main application entry point\n├── configs/                # Configuration files\n│   └── config.yaml         # Exchange API documentation URLs and settings\n├── generator-configs/      # OpenAPI Generator-specific configurations\n├── history/                # Version history of generated specs\n├── internal/               # Private application code\n│   ├── config/             # Configuration management\n│   ├── exchange/           # Exchange-specific implementations\n│   ├── generator/          # OpenAPI spec generation logic\n│   └── parser/             # API documentation parsers\n├── samples/                # Sample API documentation files\n│   └── binance/            # HTML samples of binance exchange documentation\n├── specs/                  # Generated OpenAPI specifications\n├── templates/              # Template files for spec generation\n├── go.mod                  # Go module definition\n├── go.sum                  # Go module dependencies checksum\n└── Makefile                # Build and development commands\n```\n\nKey directories and their purposes:\n\n- `cmd/`: Contains the main application entry points\n- `internal/`: Houses the core application logic\n  - `config/`: Manages application configuration\n  - `exchange/`: Exchange-specific implementations and parsers\n  - `generator/`: OpenAPI specification generation logic\n  - `parser/`: Documentation parsing and extraction\n- `configs/`: Configuration files for exchange URLs and settings\n- `generator-configs/`: OpenAPI Generator-specific configurations\n- `history/`: Tracks version history of generated specifications\n- `samples/`: Contains webpage samples of exchange documentation\n- `specs/`: Stores generated OpenAPI specifications\n- `templates/`: Template files used in SDK generation\n\n## Getting Started\n\n### Prerequisites\n\n- Go 1.21 or higher\n- Git\n\n### Installation\n\n1. Clone the repository:\n```bash\ngit clone https://github.com/openxapi/openxapi.git\ncd openxapi\n```\n\n2. Install dependencies:\n```bash\ngo mod download\n```\n\n3. Build the project:\n```bash\nmake build\n```\n\n## Generate OpenAPI Specification\n\n### For the first time\n\n1. Configure exchange API documentation URLs in `configs/config.yaml`\n2. Run the OpenAPI specification generator:\n```bash\n./openxapi\n```\n\n\u003e NOTE: This command will scrape the exchange's website and parse the API documentation from the website, so it may take a while to complete. Only run this command when you want to use the latest API documentation instead of the sample files.\n\nThe generated OpenAPI specification will be saved in `specs/` directory.\n\n### For the subsequent generations - Use sample files\n\nThe program can save API documentation to sample files and use them for regenerate the OpenAPI specification offline, that said, you don't need to access the HTTP API documentation online, this is the recommended way to generate the OpenAPI specification after the first generation:\n\n```bash\n./openxapi --use-samples\n```\n\nSpecify a custom directory for sample files:\n```bash\n./openxapi --use-samples --samples-dir=/path/to/samples\n```\n\n### Mannual maintenance on OpenAPI Specification\n\nIf you find there are some issues on the generated OpenAPI specification, please check with the exchange's official API documentation, because we try to parse the API documentation from the exchange's website automatically, there are some API documentation that is not structured well, so we need to maintain the OpenAPI specification manually.\n\nPlease follow the steps below to mannually update the OpenAPI specification:\n\n1. Find the OpenAPI specification for an exchange in `specs/` directory, for example, `specs/binance/spot/delete_api_v3_openOrders.yaml`.\n2. Add the endpoint to the `protected_endpoints` section in `configs/exchanges/binance.yaml`, this will make sure the endpoint will be ignored by the automatic generation.\n3. Update the OpenAPI specification in `specs/binance/spot/delete_api_v3_openOrders.yaml`.\n4. Regenerate the OpenAPI specification by the steps in [Generate OpenAPI Specification](#generate-openapi-specification) section.\n\n## Generate SDKs for OpenAPI Specification\n\nWe use [OpenAPI Generator](https://openapi-generator.tech/) to generate SDKs for OpenAPI Specification.\n\nFollowing is an example of generating Go SDK for Binance Spot REST API:\n\n```bash\nopenapi-generator-cli generate \\\n  -g go \\\n  -c generator-configs/binance/go/spot.yaml \\\n  -o ../binance-go/spot\n```\n\n### Update the SDK code\n\nIf you need to update the genereated SDK code, do not edit the generated code directly. Instead, update the templates in `templates/` and regenerate the SDK code.\n\nAfter updating the templates, you can regenerate the SDK code by the steps in [Generate SDKs for OpenAPI Specification](#generate-sdks-for-openapi-specification) section.\n\n## Contributing\n\n1. Fork the repository\n2. Create your feature branch (`git checkout -b feature/amazing-feature`)\n3. Commit your changes (`git commit -m 'Add some amazing feature'`)\n4. Push to the branch (`git push origin feature/amazing-feature`)\n5. Open a Pull Request\n\nMake sure to `make format \u0026\u0026 make test` before committing your changes.\n\n## License\n\nThis project is licensed under the MIT License - see the LICENSE file for details. \n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fopenxapi%2Fopenxapi","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fopenxapi%2Fopenxapi","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fopenxapi%2Fopenxapi/lists"}