diff --git a/README.md b/README.md index fa90cf4..3c9c0b0 100644 --- a/README.md +++ b/README.md @@ -1,18 +1,25 @@ -# Go API client for swagger - -## REST API for the BitMEX Trading Platform [View Changelog](/app/apiChangelog) #### Getting Started Base URI: [https://www.bitmex.com/api/v1](/api/v1) ##### Fetching Data All REST endpoints are documented below. You can try out any query right from this interface. Most table queries accept `count`, `start`, and `reverse` params. Set `reverse=true` to get rows newest-first. Additional documentation regarding filters, timestamps, and authentication is available in [the main API documentation](/app/restAPI). *All* table data is available via the [Websocket](/app/wsAPI). We highly recommend using the socket if you want to have the quickest possible data without being subject to ratelimits. ##### Return Types By default, all data is returned as JSON. Send `?_format=csv` to get CSV data or `?_format=xml` to get XML data. ##### Trade Data Queries *This is only a small subset of what is available, to get you started.* Fill in the parameters and click the `Try it out!` button to try any of these queries. * [Pricing Data](#!/Quote/Quote_get) * [Trade Data](#!/Trade/Trade_get) * [OrderBook Data](#!/OrderBook/OrderBook_getL2) * [Settlement Data](#!/Settlement/Settlement_get) * [Exchange Statistics](#!/Stats/Stats_history) Every function of the BitMEX.com platform is exposed here and documented. Many more functions are available. ##### Swagger Specification [⇩ Download Swagger JSON](swagger.json) ## All API Endpoints Click to expand a section. +# Bitmex REST APIs for Go ## Overview -This API client was generated by the [swagger-codegen](https://github.com/swagger-api/swagger-codegen) project. By using the [swagger-spec](https://github.com/swagger-api/swagger-spec) from a remote server, you can easily generate an API client. +This bitmexgo package enables golang clients to call [REST APIs](https://www.bitmex.com/app/restAPI) for the Bitmex crypto trading platform. +It fixes critical bugs in the [swagger-generated code](https://github.com/BitMEX/api-connectors/tree/master/auto-generated/go) and enhances its usability. + +Notable changes: +- Fixed the authentication logic and API endpoint +- Fixed form data encoding +- Renamed the package from `swagger` to `bitmexgo` +- Removed all external dependencies (`golang.org/x/oauth2` and `github.com/antihax/optional`) +- Added a local `optional` package with mutable states to simplify parameter assignment +- Fixed many type issues and removed the obsolete XAny type -- API version: 1.2.0 -- Package version: 1.0.0 -- Build package: io.swagger.codegen.languages.GoClientCodegen +This package also differs from an alternative library at https://github.com/qct/bitmex-go in the following ways: +- `bitmexgo` employs strongly-typed structs for API parameters instead of `map[string]interface{}`. +- `bitmexgo` is forked from a more recent version of the swagger code. ## Installation -Put the package under your project folder and add the following in import: +Run `go get github.com/zmxv/bitmexgo` then import it as follows: ```golang -import "./swagger" +import "github.com/zmxv/bitmexgo" ``` ## Documentation for API Endpoints @@ -138,7 +145,7 @@ Class | Method | HTTP request | Description ## Documentation For Authorization ## apiKey -- **Type**: API key +- **Type**: API key Example ```golang @@ -149,7 +156,7 @@ auth := context.WithValue(context.Background(), sw.ContextAPIKey, sw.APIKey{ r, err := client.Service.Operation(auth, args) ``` ## apiNonce -- **Type**: API key +- **Type**: API key Example ```golang @@ -160,7 +167,7 @@ auth := context.WithValue(context.Background(), sw.ContextAPIKey, sw.APIKey{ r, err := client.Service.Operation(auth, args) ``` ## apiSignature -- **Type**: API key +- **Type**: API key Example ```golang