[go: up one dir, main page]

Skip to content

Commit

Permalink
add spot cross margin API
Browse files Browse the repository at this point in the history
  • Loading branch information
revilwang committed Jun 11, 2021
1 parent 097f0e2 commit 9334aa2
Show file tree
Hide file tree
Showing 45 changed files with 2,040 additions and 160 deletions.
23 changes: 19 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ APIv4 provides spot, margin and futures trading operations. There are public API
## Overview
This API client was generated by the [OpenAPI Generator](https://openapi-generator.tech) project. By using the [OpenAPI-spec](https://www.openapis.org/) from a remote server, you can easily generate an API client.

- API version: 4.20.2
- Package version: 5.20.2
- API version: 4.21.2
- Package version: 6.21.2
- Build package: org.openapitools.codegen.languages.GoClientCodegen
For more information, please visit [https://www.gate.io/page/contacts](https://www.gate.io/page/contacts)

Expand Down Expand Up @@ -39,7 +39,7 @@ page
## Installation

```shell
go get github.com/gateio/gateapi-go/v5
go get github.com/gateio/gateapi-go/v6
```

## Getting Started
Expand All @@ -54,7 +54,7 @@ import (
"context"
"fmt"

"github.com/gateio/gateapi-go/v5"
"github.com/gateio/gateapi-go/v6"
)

func main() {
Expand Down Expand Up @@ -169,6 +169,14 @@ Class | Method | HTTP request | Description
*MarginApi* | [**UpdateLoanRecord**](docs/MarginApi.md#updateloanrecord) | **Patch** /margin/loan_records/{loan_record_id} | Modify a loan record
*MarginApi* | [**GetAutoRepayStatus**](docs/MarginApi.md#getautorepaystatus) | **Get** /margin/auto_repay | Retrieve user auto repayment setting
*MarginApi* | [**SetAutoRepay**](docs/MarginApi.md#setautorepay) | **Post** /margin/auto_repay | Update user's auto repayment setting
*MarginApi* | [**ListCrossMarginCurrencies**](docs/MarginApi.md#listcrossmargincurrencies) | **Get** /margin/cross/currencies | Currencies supported by cross margin.
*MarginApi* | [**GetCrossMarginCurrency**](docs/MarginApi.md#getcrossmargincurrency) | **Get** /margin/cross/currencies/{currency} | Retrieve detail of one single currency supported by cross margin
*MarginApi* | [**GetCrossMarginAccount**](docs/MarginApi.md#getcrossmarginaccount) | **Get** /margin/cross/accounts | Retrieve cross margin account
*MarginApi* | [**ListCrossMarginLoans**](docs/MarginApi.md#listcrossmarginloans) | **Get** /margin/cross/loans | List cross margin borrow history
*MarginApi* | [**CreateCrossMarginLoan**](docs/MarginApi.md#createcrossmarginloan) | **Post** /margin/cross/loans | Create a cross margin borrow loan
*MarginApi* | [**GetCrossMarginLoan**](docs/MarginApi.md#getcrossmarginloan) | **Get** /margin/cross/loans/{loan_id} | Retrieve single borrow loan detail
*MarginApi* | [**ListCrossMarginRepayments**](docs/MarginApi.md#listcrossmarginrepayments) | **Get** /margin/cross/repayments | Retrieve cross margin repayments
*MarginApi* | [**RepayCrossMarginLoan**](docs/MarginApi.md#repaycrossmarginloan) | **Post** /margin/cross/repayments | Repay cross margin loan
*SpotApi* | [**ListCurrencies**](docs/SpotApi.md#listcurrencies) | **Get** /spot/currencies | List all currencies' detail
*SpotApi* | [**GetCurrency**](docs/SpotApi.md#getcurrency) | **Get** /spot/currencies/{currency} | Get detail of one particular currency
*SpotApi* | [**ListCurrencyPairs**](docs/SpotApi.md#listcurrencypairs) | **Get** /spot/currency_pairs | List all currency pairs supported
Expand Down Expand Up @@ -203,6 +211,7 @@ Class | Method | HTTP request | Description
*WalletApi* | [**ListSubAccountBalances**](docs/WalletApi.md#listsubaccountbalances) | **Get** /wallet/sub_account_balances | Retrieve sub account balances
*WalletApi* | [**GetTradeFee**](docs/WalletApi.md#gettradefee) | **Get** /wallet/fee | Retrieve personal trading fee
*WithdrawalApi* | [**Withdraw**](docs/WithdrawalApi.md#withdraw) | **Post** /withdrawals | Withdraw
*WithdrawalApi* | [**CancelWithdrawal**](docs/WithdrawalApi.md#cancelwithdrawal) | **Delete** /withdrawals/{withdrawal_id} | Cancel withdrawal with specified ID


## Documentation For Models
Expand All @@ -213,6 +222,12 @@ Class | Method | HTTP request | Description
- [CancelOrderResult](docs/CancelOrderResult.md)
- [Contract](docs/Contract.md)
- [ContractStat](docs/ContractStat.md)
- [CrossMarginAccount](docs/CrossMarginAccount.md)
- [CrossMarginBalance](docs/CrossMarginBalance.md)
- [CrossMarginCurrency](docs/CrossMarginCurrency.md)
- [CrossMarginLoan](docs/CrossMarginLoan.md)
- [CrossMarginRepayRequest](docs/CrossMarginRepayRequest.md)
- [CrossMarginRepayment](docs/CrossMarginRepayment.md)
- [Currency](docs/Currency.md)
- [CurrencyPair](docs/CurrencyPair.md)
- [DeliveryContract](docs/DeliveryContract.md)
Expand Down
16 changes: 14 additions & 2 deletions api_futures.go
Original file line number Diff line number Diff line change
Expand Up @@ -1540,15 +1540,22 @@ func (a *FuturesApiService) UpdatePositionMargin(ctx context.Context, settle str
return localVarReturnValue, localVarHTTPResponse, nil
}

// UpdatePositionLeverageOpts Optional parameters for the method 'UpdatePositionLeverage'
type UpdatePositionLeverageOpts struct {
CrossLeverageLimit optional.String
}

/*
UpdatePositionLeverage Update position leverage
* @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
* @param settle Settle currency
* @param contract Futures contract
* @param leverage New position leverage
* @param optional nil or *UpdatePositionLeverageOpts - Optional Parameters:
* @param "CrossLeverageLimit" (optional.String) - Cross margin leverage(valid only when `leverage` is 0)
@return Position
*/
func (a *FuturesApiService) UpdatePositionLeverage(ctx context.Context, settle string, contract string, leverage string) (Position, *http.Response, error) {
func (a *FuturesApiService) UpdatePositionLeverage(ctx context.Context, settle string, contract string, leverage string, localVarOptionals *UpdatePositionLeverageOpts) (Position, *http.Response, error) {
var (
localVarHTTPMethod = http.MethodPost
localVarPostBody interface{}
Expand All @@ -1569,6 +1576,9 @@ func (a *FuturesApiService) UpdatePositionLeverage(ctx context.Context, settle s
localVarFormParams := url.Values{}

localVarQueryParams.Add("leverage", parameterToString(leverage, ""))
if localVarOptionals != nil && localVarOptionals.CrossLeverageLimit.IsSet() {
localVarQueryParams.Add("cross_leverage_limit", parameterToString(localVarOptionals.CrossLeverageLimit.Value(), ""))
}
// to determine the Content-Type header
localVarHTTPContentTypes := []string{}

Expand Down Expand Up @@ -1930,9 +1940,10 @@ UpdateDualModePositionMargin Update position margin in dual mode
* @param settle Settle currency
* @param contract Futures contract
* @param change Margin change. Use positive number to increase margin, negative number otherwise.
* @param dualSide Long or short position
@return []Position
*/
func (a *FuturesApiService) UpdateDualModePositionMargin(ctx context.Context, settle string, contract string, change string) ([]Position, *http.Response, error) {
func (a *FuturesApiService) UpdateDualModePositionMargin(ctx context.Context, settle string, contract string, change string, dualSide string) ([]Position, *http.Response, error) {
var (
localVarHTTPMethod = http.MethodPost
localVarPostBody interface{}
Expand All @@ -1953,6 +1964,7 @@ func (a *FuturesApiService) UpdateDualModePositionMargin(ctx context.Context, se
localVarFormParams := url.Values{}

localVarQueryParams.Add("change", parameterToString(change, ""))
localVarQueryParams.Add("dual_side", parameterToString(dualSide, ""))
// to determine the Content-Type header
localVarHTTPContentTypes := []string{}

Expand Down

0 comments on commit 9334aa2

Please sign in to comment.