diff --git a/README.md b/README.md index 51475f1..18349db 100644 --- a/README.md +++ b/README.md @@ -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.60.1 -- Package version: 6.60.1 +- API version: 4.67.0 +- Package version: 6.67.0 - Build package: org.openapitools.codegen.languages.GoClientCodegen For more information, please visit [https://www.gate.io/page/contacts](https://www.gate.io/page/contacts) @@ -140,7 +140,6 @@ Class | Method | HTTP request | Description *EarnApi* | [**ListDualInvestmentPlans**](docs/EarnApi.md#listdualinvestmentplans) | **Get** /earn/dual/investment_plan | Dual Investment product list *EarnApi* | [**ListDualOrders**](docs/EarnApi.md#listdualorders) | **Get** /earn/dual/orders | Dual Investment order list *EarnApi* | [**PlaceDualOrder**](docs/EarnApi.md#placedualorder) | **Post** /earn/dual/orders | Place Dual Investment order -*EarnApi* | [**CancelDualOrder**](docs/EarnApi.md#canceldualorder) | **Delete** /earn/dual/orders/{order_id} | Cancel Dual Investment order *EarnApi* | [**ListStructuredProducts**](docs/EarnApi.md#liststructuredproducts) | **Get** /earn/structured/products | Structured Product List *EarnApi* | [**ListStructuredOrders**](docs/EarnApi.md#liststructuredorders) | **Get** /earn/structured/orders | Structured Product Order List *EarnApi* | [**PlaceStructuredOrder**](docs/EarnApi.md#placestructuredorder) | **Post** /earn/structured/orders | Place Structured Product Order @@ -199,6 +198,8 @@ Class | Method | HTTP request | Description *FuturesApi* | [**ListAutoDeleverages**](docs/FuturesApi.md#listautodeleverages) | **Get** /futures/{settle}/auto_deleverages | List Auto-Deleveraging History *FuturesApi* | [**CountdownCancelAllFutures**](docs/FuturesApi.md#countdowncancelallfutures) | **Post** /futures/{settle}/countdown_cancel_all | Countdown cancel orders *FuturesApi* | [**GetFuturesFee**](docs/FuturesApi.md#getfuturesfee) | **Get** /futures/{settle}/fee | Query user trading fee rates +*FuturesApi* | [**ListRiskLimitTiers**](docs/FuturesApi.md#listrisklimittiers) | **Get** /futures/{settle}/risk_limit_tiers | List risk limit tiers +*FuturesApi* | [**CancelBatchFutureOrders**](docs/FuturesApi.md#cancelbatchfutureorders) | **Post** /futures/{settle}/batch_cancel_orders | Cancel a batch of orders with an ID list *FuturesApi* | [**ListPriceTriggeredOrders**](docs/FuturesApi.md#listpricetriggeredorders) | **Get** /futures/{settle}/price_orders | List all auto orders *FuturesApi* | [**CreatePriceTriggeredOrder**](docs/FuturesApi.md#createpricetriggeredorder) | **Post** /futures/{settle}/price_orders | Create a price-triggered order *FuturesApi* | [**CancelPriceTriggeredOrderList**](docs/FuturesApi.md#cancelpricetriggeredorderlist) | **Delete** /futures/{settle}/price_orders | Cancel all open orders @@ -246,6 +247,17 @@ Class | Method | HTTP request | Description *MarginUniApi* | [**ListUniLoanRecords**](docs/MarginUniApi.md#listuniloanrecords) | **Get** /margin/uni/loan_records | Get load records *MarginUniApi* | [**ListUniLoanInterestRecords**](docs/MarginUniApi.md#listuniloaninterestrecords) | **Get** /margin/uni/interest_records | List interest records *MarginUniApi* | [**GetUniBorrowable**](docs/MarginUniApi.md#getuniborrowable) | **Get** /margin/uni/borrowable | Get maximum borrowable +*MultiCollateralLoanApi* | [**ListMultiCollateralOrders**](docs/MultiCollateralLoanApi.md#listmulticollateralorders) | **Get** /loan/multi_collateral/orders | List Multi-Collateral Orders +*MultiCollateralLoanApi* | [**CreateMultiCollateral**](docs/MultiCollateralLoanApi.md#createmulticollateral) | **Post** /loan/multi_collateral/orders | Create Multi-Collateral Order +*MultiCollateralLoanApi* | [**GetMultiCollateralOrderDetail**](docs/MultiCollateralLoanApi.md#getmulticollateralorderdetail) | **Get** /loan/multi_collateral/orders/{order_id} | Get Multi-Collateral Order Detail +*MultiCollateralLoanApi* | [**ListMultiRepayRecords**](docs/MultiCollateralLoanApi.md#listmultirepayrecords) | **Get** /loan/multi_collateral/repay | List Multi-Collateral Repay Records +*MultiCollateralLoanApi* | [**RepayMultiCollateralLoan**](docs/MultiCollateralLoanApi.md#repaymulticollateralloan) | **Post** /loan/multi_collateral/repay | Repay Multi-Collateral Loan +*MultiCollateralLoanApi* | [**ListMultiCollateralRecords**](docs/MultiCollateralLoanApi.md#listmulticollateralrecords) | **Get** /loan/multi_collateral/mortgage | Query collateral adjustment records +*MultiCollateralLoanApi* | [**OperateMultiCollateral**](docs/MultiCollateralLoanApi.md#operatemulticollateral) | **Post** /loan/multi_collateral/mortgage | Operate Multi-Collateral +*MultiCollateralLoanApi* | [**ListUserCurrencyQuota**](docs/MultiCollateralLoanApi.md#listusercurrencyquota) | **Get** /loan/multi_collateral/currency_quota | List User Currency Quota +*MultiCollateralLoanApi* | [**ListMultiCollateralCurrencies**](docs/MultiCollateralLoanApi.md#listmulticollateralcurrencies) | **Get** /loan/multi_collateral/currencies | Query supported borrowing and collateral currencies in Multi-Collateral +*MultiCollateralLoanApi* | [**GetMultiCollateralLtv**](docs/MultiCollateralLoanApi.md#getmulticollateralltv) | **Get** /loan/multi_collateral/ltv | Get Multi-Collateral ratio +*MultiCollateralLoanApi* | [**GetMultiCollateralFixRate**](docs/MultiCollateralLoanApi.md#getmulticollateralfixrate) | **Get** /loan/multi_collateral/fixed_rate | Query fixed interest rates for the currency for 7 days and 30 days *OptionsApi* | [**ListOptionsUnderlyings**](docs/OptionsApi.md#listoptionsunderlyings) | **Get** /options/underlyings | List all underlyings *OptionsApi* | [**ListOptionsExpirations**](docs/OptionsApi.md#listoptionsexpirations) | **Get** /options/expirations | List all expiration times *OptionsApi* | [**ListOptionsContracts**](docs/OptionsApi.md#listoptionscontracts) | **Get** /options/contracts | List all the contracts with specified underlying and expiration time @@ -270,8 +282,10 @@ Class | Method | HTTP request | Description *OptionsApi* | [**GetOptionsOrder**](docs/OptionsApi.md#getoptionsorder) | **Get** /options/orders/{order_id} | Get a single order *OptionsApi* | [**CancelOptionsOrder**](docs/OptionsApi.md#canceloptionsorder) | **Delete** /options/orders/{order_id} | Cancel a single order *OptionsApi* | [**ListMyOptionsTrades**](docs/OptionsApi.md#listmyoptionstrades) | **Get** /options/my_trades | List personal trading history -*RebateApi* | [**AgencyTransactionHistory**](docs/RebateApi.md#agencytransactionhistory) | **Get** /rebate/agency/transaction_history | The broker obtains the transaction history of the recommended user -*RebateApi* | [**AgencyCommissionsHistory**](docs/RebateApi.md#agencycommissionshistory) | **Get** /rebate/agency/commission_history | The broker obtains the commission history of the recommended user +*RebateApi* | [**AgencyTransactionHistory**](docs/RebateApi.md#agencytransactionhistory) | **Get** /rebate/agency/transaction_history | The agency obtains the transaction history of the recommended user +*RebateApi* | [**AgencyCommissionsHistory**](docs/RebateApi.md#agencycommissionshistory) | **Get** /rebate/agency/commission_history | The agency obtains the commission history of the recommended user +*RebateApi* | [**RebateBrokerCommissionHistory**](docs/RebateApi.md#rebatebrokercommissionhistory) | **Get** /rebate/broker/commission_history | The broker obtains the user's commission rebate records +*RebateApi* | [**RebateBrokerTransactionHistory**](docs/RebateApi.md#rebatebrokertransactionhistory) | **Get** /rebate/broker/transaction_history | The broker obtains the user's trading history *SpotApi* | [**ListCurrencies**](docs/SpotApi.md#listcurrencies) | **Get** /spot/currencies | List all currencies' details *SpotApi* | [**GetCurrency**](docs/SpotApi.md#getcurrency) | **Get** /spot/currencies/{currency} | Get details of a specific currency *SpotApi* | [**ListCurrencyPairs**](docs/SpotApi.md#listcurrencypairs) | **Get** /spot/currency_pairs | List all currency pairs supported @@ -322,6 +336,7 @@ Class | Method | HTTP request | Description *UnifiedApi* | [**CreateUnifiedLoan**](docs/UnifiedApi.md#createunifiedloan) | **Post** /unified/loans | Borrow or repay *UnifiedApi* | [**ListUnifiedLoanRecords**](docs/UnifiedApi.md#listunifiedloanrecords) | **Get** /unified/loan_records | Get load records *UnifiedApi* | [**ListUnifiedLoanInterestRecords**](docs/UnifiedApi.md#listunifiedloaninterestrecords) | **Get** /unified/interest_records | List interest records +*UnifiedApi* | [**GetUnifiedEstimateRate**](docs/UnifiedApi.md#getunifiedestimaterate) | **Get** /unified/estimate_rate | Get unified estimate rate *WalletApi* | [**ListCurrencyChains**](docs/WalletApi.md#listcurrencychains) | **Get** /wallet/currency_chains | List chains supported for specified currency *WalletApi* | [**GetDepositAddress**](docs/WalletApi.md#getdepositaddress) | **Get** /wallet/deposit_address | Generate currency deposit address *WalletApi* | [**ListWithdrawals**](docs/WalletApi.md#listwithdrawals) | **Get** /wallet/withdrawals | Retrieve withdrawal records @@ -338,6 +353,9 @@ Class | Method | HTTP request | Description *WalletApi* | [**ListSavedAddress**](docs/WalletApi.md#listsavedaddress) | **Get** /wallet/saved_address | Query saved address *WalletApi* | [**GetTradeFee**](docs/WalletApi.md#gettradefee) | **Get** /wallet/fee | Retrieve personal trading fee *WalletApi* | [**GetTotalBalance**](docs/WalletApi.md#gettotalbalance) | **Get** /wallet/total_balance | Retrieve user's total balances +*WalletApi* | [**ListSmallBalance**](docs/WalletApi.md#listsmallbalance) | **Get** /wallet/small_balance | List small balance +*WalletApi* | [**ConvertSmallBalance**](docs/WalletApi.md#convertsmallbalance) | **Post** /wallet/small_balance | Convert small balance +*WalletApi* | [**ListSmallBalanceHistory**](docs/WalletApi.md#listsmallbalancehistory) | **Get** /wallet/small_balance_history | List small balance history *WithdrawalApi* | [**Withdraw**](docs/WithdrawalApi.md#withdraw) | **Post** /withdrawals | Withdraw *WithdrawalApi* | [**CancelWithdrawal**](docs/WithdrawalApi.md#cancelwithdrawal) | **Delete** /withdrawals/{withdrawal_id} | Cancel withdrawal with specified ID @@ -351,23 +369,36 @@ Class | Method | HTTP request | Description - [AgencyCommissionHistory](docs/AgencyCommissionHistory.md) - [AgencyTransaction](docs/AgencyTransaction.md) - [AgencyTransactionHistory](docs/AgencyTransactionHistory.md) - - [AmendOrderResult](docs/AmendOrderResult.md) - [ApiV4KeyPerm](docs/ApiV4KeyPerm.md) - [AutoRepaySetting](docs/AutoRepaySetting.md) - [BatchAmendItem](docs/BatchAmendItem.md) - [BatchFuturesOrder](docs/BatchFuturesOrder.md) - [BatchOrder](docs/BatchOrder.md) + - [BorrowCurrencyInfo](docs/BorrowCurrencyInfo.md) + - [BrokerCommission](docs/BrokerCommission.md) + - [BrokerCommission1](docs/BrokerCommission1.md) + - [BrokerTransaction](docs/BrokerTransaction.md) + - [BrokerTransaction1](docs/BrokerTransaction1.md) - [CancelBatchOrder](docs/CancelBatchOrder.md) - [CancelOrderResult](docs/CancelOrderResult.md) + - [CollateralAdjust](docs/CollateralAdjust.md) + - [CollateralAdjustRes](docs/CollateralAdjustRes.md) - [CollateralAlign](docs/CollateralAlign.md) + - [CollateralCurrency](docs/CollateralCurrency.md) + - [CollateralCurrencyInfo](docs/CollateralCurrencyInfo.md) + - [CollateralCurrencyRes](docs/CollateralCurrencyRes.md) + - [CollateralFixRate](docs/CollateralFixRate.md) - [CollateralLoanCurrency](docs/CollateralLoanCurrency.md) + - [CollateralLtv](docs/CollateralLtv.md) - [CollateralOrder](docs/CollateralOrder.md) - [CollateralRecord](docs/CollateralRecord.md) - [Contract](docs/Contract.md) - [ContractStat](docs/ContractStat.md) + - [ConvertSmallBalance](docs/ConvertSmallBalance.md) - [CountdownCancelAllFuturesTask](docs/CountdownCancelAllFuturesTask.md) - [CountdownCancelAllSpotTask](docs/CountdownCancelAllSpotTask.md) - [CreateCollateralOrder](docs/CreateCollateralOrder.md) + - [CreateMultiCollateralOrder](docs/CreateMultiCollateralOrder.md) - [CreateUniLend](docs/CreateUniLend.md) - [CreateUniLoan](docs/CreateUniLoan.md) - [CrossMarginAccount](docs/CrossMarginAccount.md) @@ -382,6 +413,7 @@ Class | Method | HTTP request | Description - [Currency](docs/Currency.md) - [CurrencyChain](docs/CurrencyChain.md) - [CurrencyPair](docs/CurrencyPair.md) + - [CurrencyQuota](docs/CurrencyQuota.md) - [DeliveryCandlestick](docs/DeliveryCandlestick.md) - [DeliveryContract](docs/DeliveryContract.md) - [DeliverySettlement](docs/DeliverySettlement.md) @@ -398,6 +430,7 @@ Class | Method | HTTP request | Description - [FundingAccount](docs/FundingAccount.md) - [FundingBookItem](docs/FundingBookItem.md) - [FundingRateRecord](docs/FundingRateRecord.md) + - [FutureCancelOrderResult](docs/FutureCancelOrderResult.md) - [FuturesAccount](docs/FuturesAccount.md) - [FuturesAccountBook](docs/FuturesAccountBook.md) - [FuturesAccountHistory](docs/FuturesAccountHistory.md) @@ -406,6 +439,7 @@ Class | Method | HTTP request | Description - [FuturesFee](docs/FuturesFee.md) - [FuturesIndexConstituents](docs/FuturesIndexConstituents.md) - [FuturesInitialOrder](docs/FuturesInitialOrder.md) + - [FuturesLimitRiskTiers](docs/FuturesLimitRiskTiers.md) - [FuturesLiqOrder](docs/FuturesLiqOrder.md) - [FuturesLiquidate](docs/FuturesLiquidate.md) - [FuturesOrder](docs/FuturesOrder.md) @@ -432,6 +466,15 @@ Class | Method | HTTP request | Description - [MarginTransferable](docs/MarginTransferable.md) - [MaxUniBorrowable](docs/MaxUniBorrowable.md) - [MultiChainAddressItem](docs/MultiChainAddressItem.md) + - [MultiCollateralCurrency](docs/MultiCollateralCurrency.md) + - [MultiCollateralItem](docs/MultiCollateralItem.md) + - [MultiCollateralOrder](docs/MultiCollateralOrder.md) + - [MultiCollateralRecord](docs/MultiCollateralRecord.md) + - [MultiCollateralRecordCurrency](docs/MultiCollateralRecordCurrency.md) + - [MultiLoanItem](docs/MultiLoanItem.md) + - [MultiLoanRepayItem](docs/MultiLoanRepayItem.md) + - [MultiRepayRecord](docs/MultiRepayRecord.md) + - [MultiRepayResp](docs/MultiRepayResp.md) - [MyFuturesTrade](docs/MyFuturesTrade.md) - [MyFuturesTradeTimeRange](docs/MyFuturesTradeTimeRange.md) - [OpenOrders](docs/OpenOrders.md) @@ -458,12 +501,20 @@ Class | Method | HTTP request | Description - [Position](docs/Position.md) - [PositionClose](docs/PositionClose.md) - [PositionCloseOrder](docs/PositionCloseOrder.md) + - [RepayCurrencyRes](docs/RepayCurrencyRes.md) - [RepayLoan](docs/RepayLoan.md) + - [RepayMultiLoan](docs/RepayMultiLoan.md) - [RepayRecord](docs/RepayRecord.md) + - [RepayRecordCurrency](docs/RepayRecordCurrency.md) + - [RepayRecordLeftInterest](docs/RepayRecordLeftInterest.md) + - [RepayRecordRepaidCurrency](docs/RepayRecordRepaidCurrency.md) + - [RepayRecordTotalInterest](docs/RepayRecordTotalInterest.md) - [RepayRequest](docs/RepayRequest.md) - [RepayResp](docs/RepayResp.md) - [Repayment](docs/Repayment.md) - [SavedAddress](docs/SavedAddress.md) + - [SmallBalance](docs/SmallBalance.md) + - [SmallBalanceHistory](docs/SmallBalanceHistory.md) - [SpotAccount](docs/SpotAccount.md) - [SpotAccountBook](docs/SpotAccountBook.md) - [SpotFee](docs/SpotFee.md) @@ -474,9 +525,7 @@ Class | Method | HTTP request | Description - [StpGroupUser](docs/StpGroupUser.md) - [StructuredBuy](docs/StructuredBuy.md) - [StructuredGetProjectList](docs/StructuredGetProjectList.md) - - [StructuredGetProjectListRequest](docs/StructuredGetProjectListRequest.md) - [StructuredOrderList](docs/StructuredOrderList.md) - - [StructuredOrderListRequest](docs/StructuredOrderListRequest.md) - [SubAccount](docs/SubAccount.md) - [SubAccountBalance](docs/SubAccountBalance.md) - [SubAccountCrossMarginBalance](docs/SubAccountCrossMarginBalance.md) diff --git a/api_account.go b/api_account.go index 3fc4d2a..5c807d4 100644 --- a/api_account.go +++ b/api_account.go @@ -507,11 +507,11 @@ DeleteSTPGroupUsers Delete the user in the STP group - Only the main account that created this STP group is allowed to delete users from the STP user group - Deletion is limited to accounts under the current main account; cross-account deletion is not permitted - @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - @param stpId STP Group ID - - @param requestBody User ID + - @param userId STP user ID, multiple can be separated by commas @return []StpGroupUser */ -func (a *AccountApiService) DeleteSTPGroupUsers(ctx context.Context, stpId int64, requestBody []int64) ([]StpGroupUser, *http.Response, error) { +func (a *AccountApiService) DeleteSTPGroupUsers(ctx context.Context, stpId int64, userId int64) ([]StpGroupUser, *http.Response, error) { var ( localVarHTTPMethod = http.MethodDelete localVarPostBody interface{} @@ -529,8 +529,9 @@ func (a *AccountApiService) DeleteSTPGroupUsers(ctx context.Context, stpId int64 localVarQueryParams := url.Values{} localVarFormParams := url.Values{} + localVarQueryParams.Add("user_id", parameterToString(userId, "")) // to determine the Content-Type header - localVarHTTPContentTypes := []string{"application/json"} + localVarHTTPContentTypes := []string{} // set Content-Type header localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) @@ -546,8 +547,6 @@ func (a *AccountApiService) DeleteSTPGroupUsers(ctx context.Context, stpId int64 if localVarHTTPHeaderAccept != "" { localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept } - // body params - localVarPostBody = &requestBody if ctx == nil { ctx = context.Background() } diff --git a/api_earn.go b/api_earn.go index e0d3237..9b28f74 100644 --- a/api_earn.go +++ b/api_earn.go @@ -11,10 +11,10 @@ package gateapi import ( "context" + "github.com/antihax/optional" "io/ioutil" "net/http" "net/url" - "strings" ) // Linger please @@ -361,95 +361,25 @@ func (a *EarnApiService) PlaceDualOrder(ctx context.Context, placeDualInvestment return localVarHTTPResponse, nil } -/* -CancelDualOrder Cancel Dual Investment order - - @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - - @param orderId Order ID -*/ -func (a *EarnApiService) CancelDualOrder(ctx context.Context, orderId int32) (*http.Response, error) { - var ( - localVarHTTPMethod = http.MethodDelete - localVarPostBody interface{} - localVarFormFileName string - localVarFileName string - localVarFileBytes []byte - ) - - // create path and map variables - localVarPath := a.client.cfg.BasePath + "/earn/dual/orders/{order_id}" - localVarPath = strings.Replace(localVarPath, "{"+"order_id"+"}", url.QueryEscape(parameterToString(orderId, "")), -1) - - localVarHeaderParams := make(map[string]string) - localVarQueryParams := url.Values{} - localVarFormParams := url.Values{} - - // to determine the Content-Type header - localVarHTTPContentTypes := []string{} - - // set Content-Type header - localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) - if localVarHTTPContentType != "" { - localVarHeaderParams["Content-Type"] = localVarHTTPContentType - } - - // to determine the Accept header - localVarHTTPHeaderAccepts := []string{} - - // set Accept header - localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) - if localVarHTTPHeaderAccept != "" { - localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept - } - if ctx == nil { - ctx = context.Background() - } - if ctx.Value(ContextGateAPIV4) == nil { - // for compatibility, set configuration key and secret to context if ContextGateAPIV4 value is not present - ctx = context.WithValue(ctx, ContextGateAPIV4, GateAPIV4{ - Key: a.client.cfg.Key, - Secret: a.client.cfg.Secret, - }) - } - r, err := a.client.prepareRequest(ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) - if err != nil { - return nil, err - } - - localVarHTTPResponse, err := a.client.callAPI(r) - if err != nil || localVarHTTPResponse == nil { - return localVarHTTPResponse, err - } - - localVarBody, err := ioutil.ReadAll(localVarHTTPResponse.Body) - localVarHTTPResponse.Body.Close() - if err != nil { - return localVarHTTPResponse, err - } - - if localVarHTTPResponse.StatusCode >= 300 { - newErr := GenericOpenAPIError{ - body: localVarBody, - error: localVarHTTPResponse.Status + ", " + string(localVarBody), - } - var gateErr GateAPIError - if e := a.client.decode(&gateErr, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")); e == nil && gateErr.Label != "" { - gateErr.APIError = newErr - return localVarHTTPResponse, gateErr - } - return localVarHTTPResponse, newErr - } - - return localVarHTTPResponse, nil +// ListStructuredProductsOpts Optional parameters for the method 'ListStructuredProducts' +type ListStructuredProductsOpts struct { + Type_ optional.String + Page optional.Int32 + Limit optional.Int32 } /* ListStructuredProducts Structured Product List - @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - - @param structuredGetProjectListRequest + - @param status Status (default: all) `in_process`-processing `will_begin`-unstarted `wait_settlement`-unsettled `done`-finish + - @param optional nil or *ListStructuredProductsOpts - Optional Parameters: + - @param "Type_" (optional.String) - Product Type (default all) `SharkFin2.0`-SharkFin `BullishSharkFin`-BullishSharkFin `BearishSharkFin`-BearishSharkFin `DoubleNoTouch`-DoubleNoTouch `RangeAccrual`-RangeAccrual `SnowBall`-SnowBall + - @param "Page" (optional.Int32) - Page number + - @param "Limit" (optional.Int32) - Maximum number of records to be returned in a single list @return []StructuredGetProjectList */ -func (a *EarnApiService) ListStructuredProducts(ctx context.Context, structuredGetProjectListRequest StructuredGetProjectListRequest) ([]StructuredGetProjectList, *http.Response, error) { +func (a *EarnApiService) ListStructuredProducts(ctx context.Context, status string, localVarOptionals *ListStructuredProductsOpts) ([]StructuredGetProjectList, *http.Response, error) { var ( localVarHTTPMethod = http.MethodGet localVarPostBody interface{} @@ -465,8 +395,18 @@ func (a *EarnApiService) ListStructuredProducts(ctx context.Context, structuredG localVarQueryParams := url.Values{} localVarFormParams := url.Values{} + if localVarOptionals != nil && localVarOptionals.Type_.IsSet() { + localVarQueryParams.Add("type", parameterToString(localVarOptionals.Type_.Value(), "")) + } + localVarQueryParams.Add("status", parameterToString(status, "")) + if localVarOptionals != nil && localVarOptionals.Page.IsSet() { + localVarQueryParams.Add("page", parameterToString(localVarOptionals.Page.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.Limit.IsSet() { + localVarQueryParams.Add("limit", parameterToString(localVarOptionals.Limit.Value(), "")) + } // to determine the Content-Type header - localVarHTTPContentTypes := []string{"application/json"} + localVarHTTPContentTypes := []string{} // set Content-Type header localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) @@ -482,8 +422,6 @@ func (a *EarnApiService) ListStructuredProducts(ctx context.Context, structuredG if localVarHTTPHeaderAccept != "" { localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept } - // body params - localVarPostBody = &structuredGetProjectListRequest if ctx == nil { ctx = context.Background() } @@ -529,14 +467,26 @@ func (a *EarnApiService) ListStructuredProducts(ctx context.Context, structuredG return localVarReturnValue, localVarHTTPResponse, nil } +// ListStructuredOrdersOpts Optional parameters for the method 'ListStructuredOrders' +type ListStructuredOrdersOpts struct { + From optional.Int64 + To optional.Int64 + Page optional.Int32 + Limit optional.Int32 +} + /* ListStructuredOrders Structured Product Order List - @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - - @param structuredOrderListRequest + - @param optional nil or *ListStructuredOrdersOpts - Optional Parameters: + - @param "From" (optional.Int64) - Start timestamp + - @param "To" (optional.Int64) - End timestamp + - @param "Page" (optional.Int32) - Page number + - @param "Limit" (optional.Int32) - Maximum number of records to be returned in a single list @return []StructuredOrderList */ -func (a *EarnApiService) ListStructuredOrders(ctx context.Context, structuredOrderListRequest StructuredOrderListRequest) ([]StructuredOrderList, *http.Response, error) { +func (a *EarnApiService) ListStructuredOrders(ctx context.Context, localVarOptionals *ListStructuredOrdersOpts) ([]StructuredOrderList, *http.Response, error) { var ( localVarHTTPMethod = http.MethodGet localVarPostBody interface{} @@ -552,8 +502,20 @@ func (a *EarnApiService) ListStructuredOrders(ctx context.Context, structuredOrd localVarQueryParams := url.Values{} localVarFormParams := url.Values{} + if localVarOptionals != nil && localVarOptionals.From.IsSet() { + localVarQueryParams.Add("from", parameterToString(localVarOptionals.From.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.To.IsSet() { + localVarQueryParams.Add("to", parameterToString(localVarOptionals.To.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.Page.IsSet() { + localVarQueryParams.Add("page", parameterToString(localVarOptionals.Page.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.Limit.IsSet() { + localVarQueryParams.Add("limit", parameterToString(localVarOptionals.Limit.Value(), "")) + } // to determine the Content-Type header - localVarHTTPContentTypes := []string{"application/json"} + localVarHTTPContentTypes := []string{} // set Content-Type header localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) @@ -569,8 +531,6 @@ func (a *EarnApiService) ListStructuredOrders(ctx context.Context, structuredOrd if localVarHTTPHeaderAccept != "" { localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept } - // body params - localVarPostBody = &structuredOrderListRequest if ctx == nil { ctx = context.Background() } diff --git a/api_earn_uni.go b/api_earn_uni.go index ad108d2..11bb6db 100644 --- a/api_earn_uni.go +++ b/api_earn_uni.go @@ -694,6 +694,8 @@ type ListUniInterestRecordsOpts struct { Currency optional.String Page optional.Int32 Limit optional.Int32 + From optional.Int64 + To optional.Int64 } /* @@ -703,6 +705,8 @@ ListUniInterestRecords List interest records - @param "Currency" (optional.String) - Retrieve data of the specified currency - @param "Page" (optional.Int32) - Page number - @param "Limit" (optional.Int32) - Maximum response items. Default: 100, minimum: 1, Maximum: 100 + - @param "From" (optional.Int64) - Start timestamp + - @param "To" (optional.Int64) - End timestamp @return []UniInterestRecord */ @@ -731,6 +735,12 @@ func (a *EarnUniApiService) ListUniInterestRecords(ctx context.Context, localVar if localVarOptionals != nil && localVarOptionals.Limit.IsSet() { localVarQueryParams.Add("limit", parameterToString(localVarOptionals.Limit.Value(), "")) } + if localVarOptionals != nil && localVarOptionals.From.IsSet() { + localVarQueryParams.Add("from", parameterToString(localVarOptionals.From.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.To.IsSet() { + localVarQueryParams.Add("to", parameterToString(localVarOptionals.To.Value(), "")) + } // to determine the Content-Type header localVarHTTPContentTypes := []string{} diff --git a/api_futures.go b/api_futures.go index 9459779..68cb7b9 100644 --- a/api_futures.go +++ b/api_futures.go @@ -26,14 +26,23 @@ var ( // FuturesApiService FuturesApi service type FuturesApiService service +// ListFuturesContractsOpts Optional parameters for the method 'ListFuturesContracts' +type ListFuturesContractsOpts struct { + Limit optional.Int32 + Offset optional.Int32 +} + /* ListFuturesContracts List all futures contracts - @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - @param settle Settle currency + - @param optional nil or *ListFuturesContractsOpts - Optional Parameters: + - @param "Limit" (optional.Int32) - Maximum number of records to be returned in a single list + - @param "Offset" (optional.Int32) - List offset, starting from 0 @return []Contract */ -func (a *FuturesApiService) ListFuturesContracts(ctx context.Context, settle string) ([]Contract, *http.Response, error) { +func (a *FuturesApiService) ListFuturesContracts(ctx context.Context, settle string, localVarOptionals *ListFuturesContractsOpts) ([]Contract, *http.Response, error) { var ( localVarHTTPMethod = http.MethodGet localVarPostBody interface{} @@ -51,6 +60,12 @@ func (a *FuturesApiService) ListFuturesContracts(ctx context.Context, settle str localVarQueryParams := url.Values{} localVarFormParams := url.Values{} + if localVarOptionals != nil && localVarOptionals.Limit.IsSet() { + localVarQueryParams.Add("limit", parameterToString(localVarOptionals.Limit.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.Offset.IsSet() { + localVarQueryParams.Add("offset", parameterToString(localVarOptionals.Offset.Value(), "")) + } // to determine the Content-Type header localVarHTTPContentTypes := []string{} @@ -1364,6 +1379,7 @@ func (a *FuturesApiService) ListFuturesAccounts(ctx context.Context, settle stri type ListFuturesAccountBookOpts struct { Contract optional.String Limit optional.Int32 + Offset optional.Int32 From optional.Int64 To optional.Int64 Type_ optional.String @@ -1377,9 +1393,10 @@ If the `contract` field is provided, it can only filter records that i - @param optional nil or *ListFuturesAccountBookOpts - Optional Parameters: - @param "Contract" (optional.String) - Futures contract, return related data only if specified - @param "Limit" (optional.Int32) - Maximum number of records to be returned in a single list + - @param "Offset" (optional.Int32) - List offset, starting from 0 - @param "From" (optional.Int64) - Start timestamp - @param "To" (optional.Int64) - End timestamp - - @param "Type_" (optional.String) - Changing Type: - dnw: Deposit & Withdraw - pnl: Profit & Loss by reducing position - fee: Trading fee - refr: Referrer rebate - fund: Funding - point_dnw: POINT Deposit & Withdraw - point_fee: POINT Trading fee - point_refr: POINT Referrer rebate + - @param "Type_" (optional.String) - Changing Type: - dnw: Deposit & Withdraw - pnl: Profit & Loss by reducing position - fee: Trading fee - refr: Referrer rebate - fund: Funding - point_dnw: POINT Deposit & Withdraw - point_fee: POINT Trading fee - point_refr: POINT Referrer rebate - bonus_offset: bouns deduction @return []FuturesAccountBook */ @@ -1407,6 +1424,9 @@ func (a *FuturesApiService) ListFuturesAccountBook(ctx context.Context, settle s if localVarOptionals != nil && localVarOptionals.Limit.IsSet() { localVarQueryParams.Add("limit", parameterToString(localVarOptionals.Limit.Value(), "")) } + if localVarOptionals != nil && localVarOptionals.Offset.IsSet() { + localVarQueryParams.Add("offset", parameterToString(localVarOptionals.Offset.Value(), "")) + } if localVarOptionals != nil && localVarOptionals.From.IsSet() { localVarQueryParams.Add("from", parameterToString(localVarOptionals.From.Value(), "")) } @@ -1487,6 +1507,8 @@ func (a *FuturesApiService) ListFuturesAccountBook(ctx context.Context, settle s // ListPositionsOpts Optional parameters for the method 'ListPositions' type ListPositionsOpts struct { Holding optional.Bool + Limit optional.Int32 + Offset optional.Int32 } /* @@ -1495,6 +1517,8 @@ ListPositions List all positions of a user - @param settle Settle currency - @param optional nil or *ListPositionsOpts - Optional Parameters: - @param "Holding" (optional.Bool) - Return only real positions - true, return all - false. + - @param "Limit" (optional.Int32) - Maximum number of records to be returned in a single list + - @param "Offset" (optional.Int32) - List offset, starting from 0 @return []Position */ @@ -1519,6 +1543,12 @@ func (a *FuturesApiService) ListPositions(ctx context.Context, settle string, lo if localVarOptionals != nil && localVarOptionals.Holding.IsSet() { localVarQueryParams.Add("holding", parameterToString(localVarOptionals.Holding.Value(), "")) } + if localVarOptionals != nil && localVarOptionals.Limit.IsSet() { + localVarQueryParams.Add("limit", parameterToString(localVarOptionals.Limit.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.Offset.IsSet() { + localVarQueryParams.Add("offset", parameterToString(localVarOptionals.Offset.Value(), "")) + } // to determine the Content-Type header localVarHTTPContentTypes := []string{} @@ -4132,6 +4162,198 @@ func (a *FuturesApiService) GetFuturesFee(ctx context.Context, settle string, lo return localVarReturnValue, localVarHTTPResponse, nil } +/* +ListRiskLimitTiers List risk limit tiers + - @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 + +@return []FuturesLimitRiskTiers +*/ +func (a *FuturesApiService) ListRiskLimitTiers(ctx context.Context, settle string, contract string) ([]FuturesLimitRiskTiers, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + localVarFormFileName string + localVarFileName string + localVarFileBytes []byte + localVarReturnValue []FuturesLimitRiskTiers + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/futures/{settle}/risk_limit_tiers" + localVarPath = strings.Replace(localVarPath, "{"+"settle"+"}", url.QueryEscape(parameterToString(settle, "")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + localVarQueryParams.Add("contract", parameterToString(contract, "")) + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + if ctx == nil { + ctx = context.Background() + } + if ctx.Value(ContextGateAPIV4) == nil { + // for compatibility, set configuration key and secret to context if ContextGateAPIV4 value is not present + ctx = context.WithValue(ctx, ContextGateAPIV4, GateAPIV4{ + Key: a.client.cfg.Key, + Secret: a.client.cfg.Secret, + }) + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(r) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status + ", " + string(localVarBody), + } + var gateErr GateAPIError + if e := a.client.decode(&gateErr, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")); e == nil && gateErr.Label != "" { + gateErr.APIError = newErr + return localVarReturnValue, localVarHTTPResponse, gateErr + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +/* +CancelBatchFutureOrders Cancel a batch of orders with an ID list +Multiple distinct order ID list can be specified。Each request can cancel a maximum of 20 records. + - @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + - @param settle Settle currency + - @param requestBody + +@return []FutureCancelOrderResult +*/ +func (a *FuturesApiService) CancelBatchFutureOrders(ctx context.Context, settle string, requestBody []string) ([]FutureCancelOrderResult, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodPost + localVarPostBody interface{} + localVarFormFileName string + localVarFileName string + localVarFileBytes []byte + localVarReturnValue []FutureCancelOrderResult + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/futures/{settle}/batch_cancel_orders" + localVarPath = strings.Replace(localVarPath, "{"+"settle"+"}", url.QueryEscape(parameterToString(settle, "")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{"application/json"} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + // body params + localVarPostBody = &requestBody + if ctx == nil { + ctx = context.Background() + } + if ctx.Value(ContextGateAPIV4) == nil { + // for compatibility, set configuration key and secret to context if ContextGateAPIV4 value is not present + ctx = context.WithValue(ctx, ContextGateAPIV4, GateAPIV4{ + Key: a.client.cfg.Key, + Secret: a.client.cfg.Secret, + }) + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(r) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status + ", " + string(localVarBody), + } + var gateErr GateAPIError + if e := a.client.decode(&gateErr, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")); e == nil && gateErr.Label != "" { + gateErr.APIError = newErr + return localVarReturnValue, localVarHTTPResponse, gateErr + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + // ListPriceTriggeredOrdersOpts Optional parameters for the method 'ListPriceTriggeredOrders' type ListPriceTriggeredOrdersOpts struct { Contract optional.String diff --git a/api_margin.go b/api_margin.go index 24c74c2..b387cf1 100644 --- a/api_margin.go +++ b/api_margin.go @@ -3010,6 +3010,8 @@ type GetCrossMarginInterestRecordsOpts struct { Currency optional.String Page optional.Int32 Limit optional.Int32 + From optional.Int64 + To optional.Int64 } /* @@ -3019,6 +3021,8 @@ GetCrossMarginInterestRecords Interest records for the cross margin account - @param "Currency" (optional.String) - Retrieve data of the specified currency - @param "Page" (optional.Int32) - Page number - @param "Limit" (optional.Int32) - Maximum response items. Default: 100, minimum: 1, Maximum: 100 + - @param "From" (optional.Int64) - Start timestamp + - @param "To" (optional.Int64) - End timestamp @return []UniLoanInterestRecord */ @@ -3047,6 +3051,12 @@ func (a *MarginApiService) GetCrossMarginInterestRecords(ctx context.Context, lo if localVarOptionals != nil && localVarOptionals.Limit.IsSet() { localVarQueryParams.Add("limit", parameterToString(localVarOptionals.Limit.Value(), "")) } + if localVarOptionals != nil && localVarOptionals.From.IsSet() { + localVarQueryParams.Add("from", parameterToString(localVarOptionals.From.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.To.IsSet() { + localVarQueryParams.Add("to", parameterToString(localVarOptionals.To.Value(), "")) + } // to determine the Content-Type header localVarHTTPContentTypes := []string{} diff --git a/api_margin_uni.go b/api_margin_uni.go index af63e33..5b3d17b 100644 --- a/api_margin_uni.go +++ b/api_margin_uni.go @@ -629,6 +629,8 @@ type ListUniLoanInterestRecordsOpts struct { Currency optional.String Page optional.Int32 Limit optional.Int32 + From optional.Int64 + To optional.Int64 } /* @@ -638,7 +640,9 @@ ListUniLoanInterestRecords List interest records - @param "CurrencyPair" (optional.String) - Currency pair - @param "Currency" (optional.String) - Retrieve data of the specified currency - @param "Page" (optional.Int32) - Page number - - @param "Limit" (optional.Int32) - Maximum response items. Default: 100, minimum: 1, Maximum: 100 + - @param "Limit" (optional.Int32) - Maximum number of records to be returned in a single list + - @param "From" (optional.Int64) - Start timestamp + - @param "To" (optional.Int64) - End timestamp @return []UniLoanInterestRecord */ @@ -670,6 +674,12 @@ func (a *MarginUniApiService) ListUniLoanInterestRecords(ctx context.Context, lo if localVarOptionals != nil && localVarOptionals.Limit.IsSet() { localVarQueryParams.Add("limit", parameterToString(localVarOptionals.Limit.Value(), "")) } + if localVarOptionals != nil && localVarOptionals.From.IsSet() { + localVarQueryParams.Add("from", parameterToString(localVarOptionals.From.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.To.IsSet() { + localVarQueryParams.Add("to", parameterToString(localVarOptionals.To.Value(), "")) + } // to determine the Content-Type header localVarHTTPContentTypes := []string{} diff --git a/api_multi_collateral_loan.go b/api_multi_collateral_loan.go new file mode 100644 index 0000000..9f67579 --- /dev/null +++ b/api_multi_collateral_loan.go @@ -0,0 +1,1103 @@ +/* + * Gate API v4 + * + * Welcome to Gate.io API APIv4 provides spot, margin and futures trading operations. There are public APIs to retrieve the real-time market statistics, and private APIs which needs authentication to trade on user's behalf. + * + * Contact: support@mail.gate.io + * Generated by: OpenAPI Generator (https://openapi-generator.tech) + */ + +package gateapi + +import ( + "context" + "github.com/antihax/optional" + "io/ioutil" + "net/http" + "net/url" + "strings" +) + +// Linger please +var ( + _ context.Context +) + +// MultiCollateralLoanApiService MultiCollateralLoanApi service +type MultiCollateralLoanApiService service + +// ListMultiCollateralOrdersOpts Optional parameters for the method 'ListMultiCollateralOrders' +type ListMultiCollateralOrdersOpts struct { + Page optional.Int32 + Limit optional.Int32 + Sort optional.String + OrderType optional.String +} + +/* +ListMultiCollateralOrders List Multi-Collateral Orders + - @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + - @param optional nil or *ListMultiCollateralOrdersOpts - Optional Parameters: + - @param "Page" (optional.Int32) - Page number + - @param "Limit" (optional.Int32) - Maximum number of records to be returned in a single list + - @param "Sort" (optional.String) - Sort types: time_desc - default sorting by creation time in descending order, ltv_asc - ascending order of ltv, ltv_desc - descending order of ltv. + - @param "OrderType" (optional.String) - Order type, current - query current orders, fixed - query fixed orders. If not specified, default to querying current orders + +@return []MultiCollateralOrder +*/ +func (a *MultiCollateralLoanApiService) ListMultiCollateralOrders(ctx context.Context, localVarOptionals *ListMultiCollateralOrdersOpts) ([]MultiCollateralOrder, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + localVarFormFileName string + localVarFileName string + localVarFileBytes []byte + localVarReturnValue []MultiCollateralOrder + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/loan/multi_collateral/orders" + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + if localVarOptionals != nil && localVarOptionals.Page.IsSet() { + localVarQueryParams.Add("page", parameterToString(localVarOptionals.Page.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.Limit.IsSet() { + localVarQueryParams.Add("limit", parameterToString(localVarOptionals.Limit.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.Sort.IsSet() { + localVarQueryParams.Add("sort", parameterToString(localVarOptionals.Sort.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.OrderType.IsSet() { + localVarQueryParams.Add("order_type", parameterToString(localVarOptionals.OrderType.Value(), "")) + } + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + if ctx == nil { + ctx = context.Background() + } + if ctx.Value(ContextGateAPIV4) == nil { + // for compatibility, set configuration key and secret to context if ContextGateAPIV4 value is not present + ctx = context.WithValue(ctx, ContextGateAPIV4, GateAPIV4{ + Key: a.client.cfg.Key, + Secret: a.client.cfg.Secret, + }) + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(r) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status + ", " + string(localVarBody), + } + var gateErr GateAPIError + if e := a.client.decode(&gateErr, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")); e == nil && gateErr.Label != "" { + gateErr.APIError = newErr + return localVarReturnValue, localVarHTTPResponse, gateErr + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +/* +CreateMultiCollateral Create Multi-Collateral Order + - @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + - @param createMultiCollateralOrder + +@return OrderResp +*/ +func (a *MultiCollateralLoanApiService) CreateMultiCollateral(ctx context.Context, createMultiCollateralOrder CreateMultiCollateralOrder) (OrderResp, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodPost + localVarPostBody interface{} + localVarFormFileName string + localVarFileName string + localVarFileBytes []byte + localVarReturnValue OrderResp + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/loan/multi_collateral/orders" + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{"application/json"} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + // body params + localVarPostBody = &createMultiCollateralOrder + if ctx == nil { + ctx = context.Background() + } + if ctx.Value(ContextGateAPIV4) == nil { + // for compatibility, set configuration key and secret to context if ContextGateAPIV4 value is not present + ctx = context.WithValue(ctx, ContextGateAPIV4, GateAPIV4{ + Key: a.client.cfg.Key, + Secret: a.client.cfg.Secret, + }) + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(r) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status + ", " + string(localVarBody), + } + var gateErr GateAPIError + if e := a.client.decode(&gateErr, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")); e == nil && gateErr.Label != "" { + gateErr.APIError = newErr + return localVarReturnValue, localVarHTTPResponse, gateErr + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +/* +GetMultiCollateralOrderDetail Get Multi-Collateral Order Detail + - @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + - @param orderId Order ID returned on successful order creation + +@return MultiCollateralOrder +*/ +func (a *MultiCollateralLoanApiService) GetMultiCollateralOrderDetail(ctx context.Context, orderId string) (MultiCollateralOrder, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + localVarFormFileName string + localVarFileName string + localVarFileBytes []byte + localVarReturnValue MultiCollateralOrder + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/loan/multi_collateral/orders/{order_id}" + localVarPath = strings.Replace(localVarPath, "{"+"order_id"+"}", url.QueryEscape(parameterToString(orderId, "")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + if ctx == nil { + ctx = context.Background() + } + if ctx.Value(ContextGateAPIV4) == nil { + // for compatibility, set configuration key and secret to context if ContextGateAPIV4 value is not present + ctx = context.WithValue(ctx, ContextGateAPIV4, GateAPIV4{ + Key: a.client.cfg.Key, + Secret: a.client.cfg.Secret, + }) + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(r) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status + ", " + string(localVarBody), + } + var gateErr GateAPIError + if e := a.client.decode(&gateErr, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")); e == nil && gateErr.Label != "" { + gateErr.APIError = newErr + return localVarReturnValue, localVarHTTPResponse, gateErr + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +// ListMultiRepayRecordsOpts Optional parameters for the method 'ListMultiRepayRecords' +type ListMultiRepayRecordsOpts struct { + BorrowCurrency optional.String + Page optional.Int32 + Limit optional.Int32 + From optional.Int64 + To optional.Int64 +} + +/* +ListMultiRepayRecords List Multi-Collateral Repay Records + - @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + - @param type_ Operation type: repay - Regular repayment, liquidate - Liquidation + - @param optional nil or *ListMultiRepayRecordsOpts - Optional Parameters: + - @param "BorrowCurrency" (optional.String) - Borrowed currency + - @param "Page" (optional.Int32) - Page number + - @param "Limit" (optional.Int32) - Maximum number of records to be returned in a single list + - @param "From" (optional.Int64) - Start timestamp of the query + - @param "To" (optional.Int64) - Time range ending, default to current time + +@return []MultiRepayRecord +*/ +func (a *MultiCollateralLoanApiService) ListMultiRepayRecords(ctx context.Context, type_ string, localVarOptionals *ListMultiRepayRecordsOpts) ([]MultiRepayRecord, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + localVarFormFileName string + localVarFileName string + localVarFileBytes []byte + localVarReturnValue []MultiRepayRecord + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/loan/multi_collateral/repay" + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + localVarQueryParams.Add("type", parameterToString(type_, "")) + if localVarOptionals != nil && localVarOptionals.BorrowCurrency.IsSet() { + localVarQueryParams.Add("borrow_currency", parameterToString(localVarOptionals.BorrowCurrency.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.Page.IsSet() { + localVarQueryParams.Add("page", parameterToString(localVarOptionals.Page.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.Limit.IsSet() { + localVarQueryParams.Add("limit", parameterToString(localVarOptionals.Limit.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.From.IsSet() { + localVarQueryParams.Add("from", parameterToString(localVarOptionals.From.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.To.IsSet() { + localVarQueryParams.Add("to", parameterToString(localVarOptionals.To.Value(), "")) + } + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + if ctx == nil { + ctx = context.Background() + } + if ctx.Value(ContextGateAPIV4) == nil { + // for compatibility, set configuration key and secret to context if ContextGateAPIV4 value is not present + ctx = context.WithValue(ctx, ContextGateAPIV4, GateAPIV4{ + Key: a.client.cfg.Key, + Secret: a.client.cfg.Secret, + }) + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(r) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status + ", " + string(localVarBody), + } + var gateErr GateAPIError + if e := a.client.decode(&gateErr, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")); e == nil && gateErr.Label != "" { + gateErr.APIError = newErr + return localVarReturnValue, localVarHTTPResponse, gateErr + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +/* +RepayMultiCollateralLoan Repay Multi-Collateral Loan + - @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + - @param repayMultiLoan + +@return MultiRepayResp +*/ +func (a *MultiCollateralLoanApiService) RepayMultiCollateralLoan(ctx context.Context, repayMultiLoan RepayMultiLoan) (MultiRepayResp, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodPost + localVarPostBody interface{} + localVarFormFileName string + localVarFileName string + localVarFileBytes []byte + localVarReturnValue MultiRepayResp + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/loan/multi_collateral/repay" + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{"application/json"} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + // body params + localVarPostBody = &repayMultiLoan + if ctx == nil { + ctx = context.Background() + } + if ctx.Value(ContextGateAPIV4) == nil { + // for compatibility, set configuration key and secret to context if ContextGateAPIV4 value is not present + ctx = context.WithValue(ctx, ContextGateAPIV4, GateAPIV4{ + Key: a.client.cfg.Key, + Secret: a.client.cfg.Secret, + }) + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(r) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status + ", " + string(localVarBody), + } + var gateErr GateAPIError + if e := a.client.decode(&gateErr, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")); e == nil && gateErr.Label != "" { + gateErr.APIError = newErr + return localVarReturnValue, localVarHTTPResponse, gateErr + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +// ListMultiCollateralRecordsOpts Optional parameters for the method 'ListMultiCollateralRecords' +type ListMultiCollateralRecordsOpts struct { + Page optional.Int32 + Limit optional.Int32 + From optional.Int64 + To optional.Int64 + CollateralCurrency optional.String +} + +/* +ListMultiCollateralRecords Query collateral adjustment records + - @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + - @param optional nil or *ListMultiCollateralRecordsOpts - Optional Parameters: + - @param "Page" (optional.Int32) - Page number + - @param "Limit" (optional.Int32) - Maximum number of records to be returned in a single list + - @param "From" (optional.Int64) - Start timestamp of the query + - @param "To" (optional.Int64) - Time range ending, default to current time + - @param "CollateralCurrency" (optional.String) - Collateral + +@return []MultiCollateralRecord +*/ +func (a *MultiCollateralLoanApiService) ListMultiCollateralRecords(ctx context.Context, localVarOptionals *ListMultiCollateralRecordsOpts) ([]MultiCollateralRecord, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + localVarFormFileName string + localVarFileName string + localVarFileBytes []byte + localVarReturnValue []MultiCollateralRecord + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/loan/multi_collateral/mortgage" + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + if localVarOptionals != nil && localVarOptionals.Page.IsSet() { + localVarQueryParams.Add("page", parameterToString(localVarOptionals.Page.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.Limit.IsSet() { + localVarQueryParams.Add("limit", parameterToString(localVarOptionals.Limit.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.From.IsSet() { + localVarQueryParams.Add("from", parameterToString(localVarOptionals.From.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.To.IsSet() { + localVarQueryParams.Add("to", parameterToString(localVarOptionals.To.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.CollateralCurrency.IsSet() { + localVarQueryParams.Add("collateral_currency", parameterToString(localVarOptionals.CollateralCurrency.Value(), "")) + } + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + if ctx == nil { + ctx = context.Background() + } + if ctx.Value(ContextGateAPIV4) == nil { + // for compatibility, set configuration key and secret to context if ContextGateAPIV4 value is not present + ctx = context.WithValue(ctx, ContextGateAPIV4, GateAPIV4{ + Key: a.client.cfg.Key, + Secret: a.client.cfg.Secret, + }) + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(r) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status + ", " + string(localVarBody), + } + var gateErr GateAPIError + if e := a.client.decode(&gateErr, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")); e == nil && gateErr.Label != "" { + gateErr.APIError = newErr + return localVarReturnValue, localVarHTTPResponse, gateErr + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +/* +OperateMultiCollateral Operate Multi-Collateral + - @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + - @param collateralAdjust + +@return CollateralAdjustRes +*/ +func (a *MultiCollateralLoanApiService) OperateMultiCollateral(ctx context.Context, collateralAdjust CollateralAdjust) (CollateralAdjustRes, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodPost + localVarPostBody interface{} + localVarFormFileName string + localVarFileName string + localVarFileBytes []byte + localVarReturnValue CollateralAdjustRes + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/loan/multi_collateral/mortgage" + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{"application/json"} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + // body params + localVarPostBody = &collateralAdjust + if ctx == nil { + ctx = context.Background() + } + if ctx.Value(ContextGateAPIV4) == nil { + // for compatibility, set configuration key and secret to context if ContextGateAPIV4 value is not present + ctx = context.WithValue(ctx, ContextGateAPIV4, GateAPIV4{ + Key: a.client.cfg.Key, + Secret: a.client.cfg.Secret, + }) + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(r) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status + ", " + string(localVarBody), + } + var gateErr GateAPIError + if e := a.client.decode(&gateErr, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")); e == nil && gateErr.Label != "" { + gateErr.APIError = newErr + return localVarReturnValue, localVarHTTPResponse, gateErr + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +/* +ListUserCurrencyQuota List User Currency Quota + - @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + - @param type_ Currency types: collateral - collateral currency, borrow - borrowing currency. + - @param currency When specifying collateral currencies, you can use commas to separate multiple currencies; for borrowing currencies, only one currency can be provided. + +@return []CurrencyQuota +*/ +func (a *MultiCollateralLoanApiService) ListUserCurrencyQuota(ctx context.Context, type_ string, currency string) ([]CurrencyQuota, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + localVarFormFileName string + localVarFileName string + localVarFileBytes []byte + localVarReturnValue []CurrencyQuota + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/loan/multi_collateral/currency_quota" + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + localVarQueryParams.Add("type", parameterToString(type_, "")) + localVarQueryParams.Add("currency", parameterToString(currency, "")) + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + if ctx == nil { + ctx = context.Background() + } + if ctx.Value(ContextGateAPIV4) == nil { + // for compatibility, set configuration key and secret to context if ContextGateAPIV4 value is not present + ctx = context.WithValue(ctx, ContextGateAPIV4, GateAPIV4{ + Key: a.client.cfg.Key, + Secret: a.client.cfg.Secret, + }) + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(r) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status + ", " + string(localVarBody), + } + var gateErr GateAPIError + if e := a.client.decode(&gateErr, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")); e == nil && gateErr.Label != "" { + gateErr.APIError = newErr + return localVarReturnValue, localVarHTTPResponse, gateErr + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +/* +ListMultiCollateralCurrencies Query supported borrowing and collateral currencies in Multi-Collateral + - @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + +@return MultiCollateralCurrency +*/ +func (a *MultiCollateralLoanApiService) ListMultiCollateralCurrencies(ctx context.Context) (MultiCollateralCurrency, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + localVarFormFileName string + localVarFileName string + localVarFileBytes []byte + localVarReturnValue MultiCollateralCurrency + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/loan/multi_collateral/currencies" + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + if ctx == nil { + ctx = context.Background() + } + ctx = context.WithValue(ctx, ContextPublic, true) + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(r) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status + ", " + string(localVarBody), + } + var gateErr GateAPIError + if e := a.client.decode(&gateErr, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")); e == nil && gateErr.Label != "" { + gateErr.APIError = newErr + return localVarReturnValue, localVarHTTPResponse, gateErr + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +/* +GetMultiCollateralLtv Get Multi-Collateral ratio +The Multi-Collateral ratio is fixed, irrespective of the currency. + - @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + +@return CollateralLtv +*/ +func (a *MultiCollateralLoanApiService) GetMultiCollateralLtv(ctx context.Context) (CollateralLtv, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + localVarFormFileName string + localVarFileName string + localVarFileBytes []byte + localVarReturnValue CollateralLtv + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/loan/multi_collateral/ltv" + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + if ctx == nil { + ctx = context.Background() + } + ctx = context.WithValue(ctx, ContextPublic, true) + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(r) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status + ", " + string(localVarBody), + } + var gateErr GateAPIError + if e := a.client.decode(&gateErr, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")); e == nil && gateErr.Label != "" { + gateErr.APIError = newErr + return localVarReturnValue, localVarHTTPResponse, gateErr + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +/* +GetMultiCollateralFixRate Query fixed interest rates for the currency for 7 days and 30 days + - @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + +@return []CollateralFixRate +*/ +func (a *MultiCollateralLoanApiService) GetMultiCollateralFixRate(ctx context.Context) ([]CollateralFixRate, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + localVarFormFileName string + localVarFileName string + localVarFileBytes []byte + localVarReturnValue []CollateralFixRate + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/loan/multi_collateral/fixed_rate" + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + if ctx == nil { + ctx = context.Background() + } + ctx = context.WithValue(ctx, ContextPublic, true) + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(r) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status + ", " + string(localVarBody), + } + var gateErr GateAPIError + if e := a.client.decode(&gateErr, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")); e == nil && gateErr.Label != "" { + gateErr.APIError = newErr + return localVarReturnValue, localVarHTTPResponse, gateErr + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} diff --git a/api_rebate.go b/api_rebate.go index 777da71..53f4cba 100644 --- a/api_rebate.go +++ b/api_rebate.go @@ -28,7 +28,7 @@ type RebateApiService service // AgencyTransactionHistoryOpts Optional parameters for the method 'AgencyTransactionHistory' type AgencyTransactionHistoryOpts struct { CurrencyPair optional.String - UserId optional.String + UserId optional.Int64 From optional.Int64 To optional.Int64 Limit optional.Int32 @@ -36,12 +36,12 @@ type AgencyTransactionHistoryOpts struct { } /* -AgencyTransactionHistory The broker obtains the transaction history of the recommended user +AgencyTransactionHistory The agency obtains the transaction history of the recommended user Record time range cannot exceed 30 days - @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - @param optional nil or *AgencyTransactionHistoryOpts - Optional Parameters: - @param "CurrencyPair" (optional.String) - Specify the currency pair, if not specified, return all currency pairs - - @param "UserId" (optional.String) - User ID. If not specified, all user records will be returned + - @param "UserId" (optional.Int64) - User ID. If not specified, all user records will be returned - @param "From" (optional.Int64) - Time range beginning, default to 7 days before current time - @param "To" (optional.Int64) - Time range ending, default to current time - @param "Limit" (optional.Int32) - Maximum number of records to be returned in a single list @@ -154,7 +154,7 @@ func (a *RebateApiService) AgencyTransactionHistory(ctx context.Context, localVa // AgencyCommissionsHistoryOpts Optional parameters for the method 'AgencyCommissionsHistory' type AgencyCommissionsHistoryOpts struct { Currency optional.String - UserId optional.String + UserId optional.Int64 From optional.Int64 To optional.Int64 Limit optional.Int32 @@ -162,12 +162,12 @@ type AgencyCommissionsHistoryOpts struct { } /* -AgencyCommissionsHistory The broker obtains the commission history of the recommended user +AgencyCommissionsHistory The agency obtains the commission history of the recommended user Record time range cannot exceed 30 days - @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - @param optional nil or *AgencyCommissionsHistoryOpts - Optional Parameters: - @param "Currency" (optional.String) - Filter by currency. Return all currency records if not specified - - @param "UserId" (optional.String) - User ID. If not specified, all user records will be returned + - @param "UserId" (optional.Int64) - User ID. If not specified, all user records will be returned - @param "From" (optional.Int64) - Time range beginning, default to 7 days before current time - @param "To" (optional.Int64) - Time range ending, default to current time - @param "Limit" (optional.Int32) - Maximum number of records to be returned in a single list @@ -276,3 +276,225 @@ func (a *RebateApiService) AgencyCommissionsHistory(ctx context.Context, localVa return localVarReturnValue, localVarHTTPResponse, nil } + +// RebateBrokerCommissionHistoryOpts Optional parameters for the method 'RebateBrokerCommissionHistory' +type RebateBrokerCommissionHistoryOpts struct { + Limit optional.Int32 + Offset optional.Int32 + UserId optional.Int64 +} + +/* +RebateBrokerCommissionHistory The broker obtains the user's commission rebate records +Record time range cannot exceed 30 days + - @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + - @param optional nil or *RebateBrokerCommissionHistoryOpts - Optional Parameters: + - @param "Limit" (optional.Int32) - Maximum number of records to be returned in a single list + - @param "Offset" (optional.Int32) - List offset, starting from 0 + - @param "UserId" (optional.Int64) - User ID. If not specified, all user records will be returned + +@return []BrokerCommission +*/ +func (a *RebateApiService) RebateBrokerCommissionHistory(ctx context.Context, localVarOptionals *RebateBrokerCommissionHistoryOpts) ([]BrokerCommission, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + localVarFormFileName string + localVarFileName string + localVarFileBytes []byte + localVarReturnValue []BrokerCommission + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/rebate/broker/commission_history" + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + if localVarOptionals != nil && localVarOptionals.Limit.IsSet() { + localVarQueryParams.Add("limit", parameterToString(localVarOptionals.Limit.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.Offset.IsSet() { + localVarQueryParams.Add("offset", parameterToString(localVarOptionals.Offset.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.UserId.IsSet() { + localVarQueryParams.Add("user_id", parameterToString(localVarOptionals.UserId.Value(), "")) + } + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + if ctx == nil { + ctx = context.Background() + } + if ctx.Value(ContextGateAPIV4) == nil { + // for compatibility, set configuration key and secret to context if ContextGateAPIV4 value is not present + ctx = context.WithValue(ctx, ContextGateAPIV4, GateAPIV4{ + Key: a.client.cfg.Key, + Secret: a.client.cfg.Secret, + }) + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(r) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status + ", " + string(localVarBody), + } + var gateErr GateAPIError + if e := a.client.decode(&gateErr, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")); e == nil && gateErr.Label != "" { + gateErr.APIError = newErr + return localVarReturnValue, localVarHTTPResponse, gateErr + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +// RebateBrokerTransactionHistoryOpts Optional parameters for the method 'RebateBrokerTransactionHistory' +type RebateBrokerTransactionHistoryOpts struct { + Limit optional.Int32 + Offset optional.Int32 + UserId optional.Int64 +} + +/* +RebateBrokerTransactionHistory The broker obtains the user's trading history +Record time range cannot exceed 30 days + - @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + - @param optional nil or *RebateBrokerTransactionHistoryOpts - Optional Parameters: + - @param "Limit" (optional.Int32) - Maximum number of records to be returned in a single list + - @param "Offset" (optional.Int32) - List offset, starting from 0 + - @param "UserId" (optional.Int64) - User ID. If not specified, all user records will be returned + +@return []BrokerTransaction +*/ +func (a *RebateApiService) RebateBrokerTransactionHistory(ctx context.Context, localVarOptionals *RebateBrokerTransactionHistoryOpts) ([]BrokerTransaction, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + localVarFormFileName string + localVarFileName string + localVarFileBytes []byte + localVarReturnValue []BrokerTransaction + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/rebate/broker/transaction_history" + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + if localVarOptionals != nil && localVarOptionals.Limit.IsSet() { + localVarQueryParams.Add("limit", parameterToString(localVarOptionals.Limit.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.Offset.IsSet() { + localVarQueryParams.Add("offset", parameterToString(localVarOptionals.Offset.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.UserId.IsSet() { + localVarQueryParams.Add("user_id", parameterToString(localVarOptionals.UserId.Value(), "")) + } + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + if ctx == nil { + ctx = context.Background() + } + if ctx.Value(ContextGateAPIV4) == nil { + // for compatibility, set configuration key and secret to context if ContextGateAPIV4 value is not present + ctx = context.WithValue(ctx, ContextGateAPIV4, GateAPIV4{ + Key: a.client.cfg.Key, + Secret: a.client.cfg.Secret, + }) + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(r) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status + ", " + string(localVarBody), + } + var gateErr GateAPIError + if e := a.client.decode(&gateErr, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")); e == nil && gateErr.Label != "" { + gateErr.APIError = newErr + return localVarReturnValue, localVarHTTPResponse, gateErr + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} diff --git a/api_spot.go b/api_spot.go index bbbb4c1..a7f3369 100644 --- a/api_spot.go +++ b/api_spot.go @@ -822,16 +822,16 @@ This API is deprecated in favour of new fee retrieving API `/wallet/fee - @param optional nil or *GetFeeOpts - Optional Parameters: - @param "CurrencyPair" (optional.String) - Specify a currency pair to retrieve precise fee rate This field is optional. In most cases, the fee rate is identical among all currency pairs -@return TradeFee +@return SpotFee */ -func (a *SpotApiService) GetFee(ctx context.Context, localVarOptionals *GetFeeOpts) (TradeFee, *http.Response, error) { +func (a *SpotApiService) GetFee(ctx context.Context, localVarOptionals *GetFeeOpts) (SpotFee, *http.Response, error) { var ( localVarHTTPMethod = http.MethodGet localVarPostBody interface{} localVarFormFileName string localVarFileName string localVarFileBytes []byte - localVarReturnValue TradeFee + localVarReturnValue SpotFee ) // create path and map variables @@ -1754,8 +1754,9 @@ func (a *SpotApiService) CreateOrder(ctx context.Context, order Order) (Order, * // CancelOrdersOpts Optional parameters for the method 'CancelOrders' type CancelOrdersOpts struct { - Side optional.String - Account optional.String + Side optional.String + Account optional.String + ActionMode optional.String } /* @@ -1766,6 +1767,7 @@ If `account` is not set, all open orders, including spot, portfolio, m - @param optional nil or *CancelOrdersOpts - Optional Parameters: - @param "Side" (optional.String) - All bids or asks. Both included if not specified - @param "Account" (optional.String) - Specify account type - classic account:Default to all account types being included - portfolio margin account:`cross_margin` only + - @param "ActionMode" (optional.String) - Processing Mode When placing an order, different fields are returned based on the action_mode - ACK: Asynchronous mode, returns only key order fields - RESULT: No clearing information - FULL: Full mode (default) @return []Order */ @@ -1792,6 +1794,9 @@ func (a *SpotApiService) CancelOrders(ctx context.Context, currencyPair string, if localVarOptionals != nil && localVarOptionals.Account.IsSet() { localVarQueryParams.Add("account", parameterToString(localVarOptionals.Account.Value(), "")) } + if localVarOptionals != nil && localVarOptionals.ActionMode.IsSet() { + localVarQueryParams.Add("action_mode", parameterToString(localVarOptionals.ActionMode.Value(), "")) + } // to determine the Content-Type header localVarHTTPContentTypes := []string{} @@ -2062,7 +2067,8 @@ func (a *SpotApiService) GetOrder(ctx context.Context, orderId string, currencyP // CancelOrderOpts Optional parameters for the method 'CancelOrder' type CancelOrderOpts struct { - Account optional.String + Account optional.String + ActionMode optional.String } /* @@ -2073,6 +2079,7 @@ Spot,portfolio and margin orders are cancelled by default. If trying to cancel c - @param currencyPair Currency pair - @param optional nil or *CancelOrderOpts - Optional Parameters: - @param "Account" (optional.String) - Specify operation account. Default to spot ,portfolio and margin account if not specified. Set to `cross_margin` to operate against margin account. Portfolio margin account must set to `cross_margin` only + - @param "ActionMode" (optional.String) - Processing Mode When placing an order, different fields are returned based on the action_mode - ACK: Asynchronous mode, returns only key order fields - RESULT: No clearing information - FULL: Full mode (default) @return Order */ @@ -2098,6 +2105,9 @@ func (a *SpotApiService) CancelOrder(ctx context.Context, orderId string, curren if localVarOptionals != nil && localVarOptionals.Account.IsSet() { localVarQueryParams.Add("account", parameterToString(localVarOptionals.Account.Value(), "")) } + if localVarOptionals != nil && localVarOptionals.ActionMode.IsSet() { + localVarQueryParams.Add("action_mode", parameterToString(localVarOptionals.ActionMode.Value(), "")) + } // to determine the Content-Type header localVarHTTPContentTypes := []string{} @@ -2590,16 +2600,16 @@ Default modification of orders for spot, portfolio, and margin accounts. To modi - @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - @param batchAmendItem -@return []AmendOrderResult +@return []BatchOrder */ -func (a *SpotApiService) AmendBatchOrders(ctx context.Context, batchAmendItem []BatchAmendItem) ([]AmendOrderResult, *http.Response, error) { +func (a *SpotApiService) AmendBatchOrders(ctx context.Context, batchAmendItem []BatchAmendItem) ([]BatchOrder, *http.Response, error) { var ( localVarHTTPMethod = http.MethodPost localVarPostBody interface{} localVarFormFileName string localVarFileName string localVarFileBytes []byte - localVarReturnValue []AmendOrderResult + localVarReturnValue []BatchOrder ) // create path and map variables diff --git a/api_unified.go b/api_unified.go index c596c28..512d822 100644 --- a/api_unified.go +++ b/api_unified.go @@ -15,6 +15,7 @@ import ( "io/ioutil" "net/http" "net/url" + "reflect" ) // Linger please @@ -910,3 +911,112 @@ func (a *UnifiedApiService) ListUnifiedLoanInterestRecords(ctx context.Context, return localVarReturnValue, localVarHTTPResponse, nil } + +/* +GetUnifiedEstimateRate Get unified estimate rate +Due to fluctuations in lending depth, hourly interest rates may vary, and thus, I cannot provide exact rates. When a currency is not supported, the interest rate returned will be an empty string. + - @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + - @param currencies Specify the currency names for querying in an array, separated by commas, with a maximum of 10 currencies. + +@return map[string]string +*/ +func (a *UnifiedApiService) GetUnifiedEstimateRate(ctx context.Context, currencies []string) (map[string]string, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + localVarFormFileName string + localVarFileName string + localVarFileBytes []byte + localVarReturnValue map[string]string + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/unified/estimate_rate" + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if len(currencies) < 1 { + return localVarReturnValue, nil, reportError("currencies must have at least 1 elements") + } + if len(currencies) > 10 { + return localVarReturnValue, nil, reportError("currencies must have less than 10 elements") + } + + { + t := currencies + if reflect.TypeOf(t).Kind() == reflect.Slice { + s := reflect.ValueOf(t) + for i := 0; i < s.Len(); i++ { + localVarQueryParams.Add("currencies", parameterToString(s.Index(i), "multi")) + } + } else { + localVarQueryParams.Add("currencies", parameterToString(t, "multi")) + } + } + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + if ctx == nil { + ctx = context.Background() + } + if ctx.Value(ContextGateAPIV4) == nil { + // for compatibility, set configuration key and secret to context if ContextGateAPIV4 value is not present + ctx = context.WithValue(ctx, ContextGateAPIV4, GateAPIV4{ + Key: a.client.cfg.Key, + Secret: a.client.cfg.Secret, + }) + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(r) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status + ", " + string(localVarBody), + } + var gateErr GateAPIError + if e := a.client.decode(&gateErr, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")); e == nil && gateErr.Label != "" { + gateErr.APIError = newErr + return localVarReturnValue, localVarHTTPResponse, gateErr + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} diff --git a/api_wallet.go b/api_wallet.go index 20622ab..a800b12 100644 --- a/api_wallet.go +++ b/api_wallet.go @@ -1641,3 +1641,284 @@ func (a *WalletApiService) GetTotalBalance(ctx context.Context, localVarOptional return localVarReturnValue, localVarHTTPResponse, nil } + +/* +ListSmallBalance List small balance + - @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + +@return SmallBalance +*/ +func (a *WalletApiService) ListSmallBalance(ctx context.Context) (SmallBalance, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + localVarFormFileName string + localVarFileName string + localVarFileBytes []byte + localVarReturnValue SmallBalance + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/wallet/small_balance" + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + if ctx == nil { + ctx = context.Background() + } + if ctx.Value(ContextGateAPIV4) == nil { + // for compatibility, set configuration key and secret to context if ContextGateAPIV4 value is not present + ctx = context.WithValue(ctx, ContextGateAPIV4, GateAPIV4{ + Key: a.client.cfg.Key, + Secret: a.client.cfg.Secret, + }) + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(r) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status + ", " + string(localVarBody), + } + var gateErr GateAPIError + if e := a.client.decode(&gateErr, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")); e == nil && gateErr.Label != "" { + gateErr.APIError = newErr + return localVarReturnValue, localVarHTTPResponse, gateErr + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +/* +ConvertSmallBalance Convert small balance + - @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + - @param convertSmallBalance +*/ +func (a *WalletApiService) ConvertSmallBalance(ctx context.Context, convertSmallBalance ConvertSmallBalance) (*http.Response, error) { + var ( + localVarHTTPMethod = http.MethodPost + localVarPostBody interface{} + localVarFormFileName string + localVarFileName string + localVarFileBytes []byte + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/wallet/small_balance" + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{"application/json"} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + // body params + localVarPostBody = &convertSmallBalance + if ctx == nil { + ctx = context.Background() + } + if ctx.Value(ContextGateAPIV4) == nil { + // for compatibility, set configuration key and secret to context if ContextGateAPIV4 value is not present + ctx = context.WithValue(ctx, ContextGateAPIV4, GateAPIV4{ + Key: a.client.cfg.Key, + Secret: a.client.cfg.Secret, + }) + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + if err != nil { + return nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(r) + if err != nil || localVarHTTPResponse == nil { + return localVarHTTPResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + if err != nil { + return localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status + ", " + string(localVarBody), + } + var gateErr GateAPIError + if e := a.client.decode(&gateErr, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")); e == nil && gateErr.Label != "" { + gateErr.APIError = newErr + return localVarHTTPResponse, gateErr + } + return localVarHTTPResponse, newErr + } + + return localVarHTTPResponse, nil +} + +// ListSmallBalanceHistoryOpts Optional parameters for the method 'ListSmallBalanceHistory' +type ListSmallBalanceHistoryOpts struct { + Currency optional.String + Page optional.Int32 + Limit optional.Int32 +} + +/* +ListSmallBalanceHistory List small balance history + - @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + - @param optional nil or *ListSmallBalanceHistoryOpts - Optional Parameters: + - @param "Currency" (optional.String) - Currency + - @param "Page" (optional.Int32) - Page number + - @param "Limit" (optional.Int32) - Maximum response items. Default: 100, minimum: 1, Maximum: 100 + +@return SmallBalanceHistory +*/ +func (a *WalletApiService) ListSmallBalanceHistory(ctx context.Context, localVarOptionals *ListSmallBalanceHistoryOpts) (SmallBalanceHistory, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + localVarFormFileName string + localVarFileName string + localVarFileBytes []byte + localVarReturnValue SmallBalanceHistory + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/wallet/small_balance_history" + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + if localVarOptionals != nil && localVarOptionals.Currency.IsSet() { + localVarQueryParams.Add("currency", parameterToString(localVarOptionals.Currency.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.Page.IsSet() { + localVarQueryParams.Add("page", parameterToString(localVarOptionals.Page.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.Limit.IsSet() { + localVarQueryParams.Add("limit", parameterToString(localVarOptionals.Limit.Value(), "")) + } + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + if ctx == nil { + ctx = context.Background() + } + if ctx.Value(ContextGateAPIV4) == nil { + // for compatibility, set configuration key and secret to context if ContextGateAPIV4 value is not present + ctx = context.WithValue(ctx, ContextGateAPIV4, GateAPIV4{ + Key: a.client.cfg.Key, + Secret: a.client.cfg.Secret, + }) + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(r) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status + ", " + string(localVarBody), + } + var gateErr GateAPIError + if e := a.client.decode(&gateErr, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")); e == nil && gateErr.Label != "" { + gateErr.APIError = newErr + return localVarReturnValue, localVarHTTPResponse, gateErr + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} diff --git a/client.go b/client.go index 6c07e6c..bc4ac61 100644 --- a/client.go +++ b/client.go @@ -67,6 +67,8 @@ type APIClient struct { MarginUniApi *MarginUniApiService + MultiCollateralLoanApi *MultiCollateralLoanApiService + OptionsApi *OptionsApiService RebateApi *RebateApiService @@ -107,6 +109,7 @@ func NewAPIClient(cfg *Configuration) *APIClient { c.FuturesApi = (*FuturesApiService)(&c.common) c.MarginApi = (*MarginApiService)(&c.common) c.MarginUniApi = (*MarginUniApiService)(&c.common) + c.MultiCollateralLoanApi = (*MultiCollateralLoanApiService)(&c.common) c.OptionsApi = (*OptionsApiService)(&c.common) c.RebateApi = (*RebateApiService)(&c.common) c.SpotApi = (*SpotApiService)(&c.common) diff --git a/configuration.go b/configuration.go index 63814b5..2055064 100644 --- a/configuration.go +++ b/configuration.go @@ -90,7 +90,7 @@ func NewConfiguration() *Configuration { cfg := &Configuration{ BasePath: "https://api.gateio.ws/api/v4", DefaultHeader: make(map[string]string), - UserAgent: "OpenAPI-Generator/6.60.1/go", + UserAgent: "OpenAPI-Generator/6.67.0/go", Debug: false, Servers: []ServerConfiguration{ { diff --git a/docs/AccountApi.md b/docs/AccountApi.md index 0ca1d72..8aaf43d 100644 --- a/docs/AccountApi.md +++ b/docs/AccountApi.md @@ -371,7 +371,7 @@ func main() { ## DeleteSTPGroupUsers -> []StpGroupUser DeleteSTPGroupUsers(ctx, stpId, requestBody) +> []StpGroupUser DeleteSTPGroupUsers(ctx, stpId, userId) Delete the user in the STP group @@ -383,7 +383,7 @@ Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. **stpId** | **int64**| STP Group ID | -**requestBody** | [**[]int64**](int64.md)| User ID | +**userId** | **int64**| STP user ID, multiple can be separated by commas | ### Example @@ -409,9 +409,9 @@ func main() { } ) stpId := 1 // int64 - STP Group ID - requestBody := []int64{[1,2,3]} // []int64 - User ID + userId := 1 // int64 - STP user ID, multiple can be separated by commas - result, _, err := client.AccountApi.DeleteSTPGroupUsers(ctx, stpId, requestBody) + result, _, err := client.AccountApi.DeleteSTPGroupUsers(ctx, stpId, userId) if err != nil { if e, ok := err.(gateapi.GateAPIError); ok { fmt.Printf("gate api error: %s\n", e.Error()) @@ -435,7 +435,7 @@ func main() { ### HTTP request headers -- **Content-Type**: application/json +- **Content-Type**: Not defined - **Accept**: application/json [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) diff --git a/docs/AccountBalance.md b/docs/AccountBalance.md index 5ea3fd0..0a8145c 100644 --- a/docs/AccountBalance.md +++ b/docs/AccountBalance.md @@ -6,6 +6,8 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **Amount** | **string** | Account total balance amount | [optional] **Currency** | **string** | Currency | [optional] +**UnrealisedPnl** | **string** | Unrealised_pnl, this field will only appear in futures, options, delivery, and total accounts | [optional] +**Borrowed** | **string** | Borrowed,this field will only appear in margin and cross_margin accounts | [optional] [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/docs/BatchOrder.md b/docs/BatchOrder.md index 0cfc39b..e200d1d 100644 --- a/docs/BatchOrder.md +++ b/docs/BatchOrder.md @@ -4,6 +4,8 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- +**OrderId** | **string** | Order ID | [optional] +**AmendText** | **string** | The custom data that the user remarked when amending the order | [optional] **Text** | **string** | User defined information. If not empty, must follow the rules below: 1. prefixed with `t-` 2. no longer than 28 bytes without `t-` prefix 3. can only include 0-9, A-Z, a-z, underscore(_), hyphen(-) or dot(.) | [optional] **Succeeded** | **bool** | Whether the batch of orders succeeded | [optional] **Label** | **string** | Error label, if any, otherwise an empty string | [optional] @@ -25,8 +27,10 @@ Name | Type | Description | Notes **AutoBorrow** | **bool** | Used in margin or cross margin trading to allow automatic loan of insufficient amount if balance is not enough. | [optional] **AutoRepay** | **bool** | Enable or disable automatic repayment for automatic borrow loan generated by cross margin order. Default is disabled. Note that: 1. This field is only effective for cross margin orders. Margin account does not support setting auto repayment for orders. 2. `auto_borrow` and `auto_repay` cannot be both set to true in one order. | [optional] **Left** | **string** | Amount left to fill | [optional] [readonly] +**FilledAmount** | **string** | Amount traded to fill | [optional] [readonly] **FillPrice** | **string** | Total filled in quote currency. Deprecated in favor of `filled_total` | [optional] [readonly] **FilledTotal** | **string** | Total filled in quote currency | [optional] [readonly] +**AvgDealPrice** | **string** | Average fill price | [optional] [readonly] **Fee** | **string** | Fee deducted | [optional] [readonly] **FeeCurrency** | **string** | Fee currency unit | [optional] [readonly] **PointFee** | **string** | Points used to deduct fee | [optional] [readonly] diff --git a/docs/BorrowCurrencyInfo.md b/docs/BorrowCurrencyInfo.md new file mode 100644 index 0000000..652d408 --- /dev/null +++ b/docs/BorrowCurrencyInfo.md @@ -0,0 +1,15 @@ +# BorrowCurrencyInfo + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Currency** | **string** | Currency | [optional] +**IndexPrice** | **string** | Currency Index Price | [optional] +**LeftRepayPrincipal** | **string** | outstanding principal | [optional] +**LeftRepayInterest** | **string** | outstanding interest | [optional] +**LeftRepayUsdt** | **string** | Value of left total repayments amount in USDT | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/BrokerCommission.md b/docs/BrokerCommission.md new file mode 100644 index 0000000..79484b6 --- /dev/null +++ b/docs/BrokerCommission.md @@ -0,0 +1,12 @@ +# BrokerCommission + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Total** | **int64** | Total | [optional] +**List** | [**[]BrokerCommission1**](BrokerCommission_1.md) | List of comission history | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/BrokerCommission1.md b/docs/BrokerCommission1.md new file mode 100644 index 0000000..e2ab53d --- /dev/null +++ b/docs/BrokerCommission1.md @@ -0,0 +1,19 @@ +# BrokerCommission1 + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**CommissionTime** | **int64** | Commission Time. (unix timestamp) | [optional] +**UserId** | **int64** | User ID | [optional] +**GroupName** | **string** | Group name | [optional] +**Amount** | **string** | The amount of commission rebates | [optional] +**Fee** | **string** | Fee | [optional] +**FeeAsset** | **string** | Fee currency | [optional] +**RebateFee** | **string** | The income from rebates, converted to USDT | [optional] +**Source** | **string** | Rebate Type: Spot、Futures、Options | [optional] +**CurrencyPair** | **string** | Currency pair | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/BrokerTransaction.md b/docs/BrokerTransaction.md new file mode 100644 index 0000000..7567937 --- /dev/null +++ b/docs/BrokerTransaction.md @@ -0,0 +1,12 @@ +# BrokerTransaction + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Total** | **int64** | Total | [optional] +**List** | [**[]BrokerTransaction1**](BrokerTransaction_1.md) | List of transaction history | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/BrokerTransaction1.md b/docs/BrokerTransaction1.md new file mode 100644 index 0000000..25a0e95 --- /dev/null +++ b/docs/BrokerTransaction1.md @@ -0,0 +1,18 @@ +# BrokerTransaction1 + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**TransactionTime** | **int64** | Transaction Time. (unix timestamp) | [optional] +**UserId** | **int64** | User ID | [optional] +**GroupName** | **string** | Group name | [optional] +**Fee** | **string** | fee (usdt) | [optional] +**CurrencyPair** | **string** | Currency pair | [optional] +**Amount** | **string** | Commission Amount | [optional] +**FeeAsset** | **string** | Fee currency | [optional] +**Source** | **string** | Rebate Type: Spot、Futures、Options | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/CancelBatchOrder.md b/docs/CancelBatchOrder.md index e75abf5..d27bb91 100644 --- a/docs/CancelBatchOrder.md +++ b/docs/CancelBatchOrder.md @@ -7,6 +7,7 @@ Name | Type | Description | Notes **CurrencyPair** | **string** | Order currency pair | **Id** | **string** | Order ID or user custom ID. Custom ID are accepted only within 30 minutes after order creation | **Account** | **string** | If cancelled order is cross margin order or is portfolio margin account's API key, this field must be set and can only be `cross_margin`If cancelled order is cross margin order, this field must be set and can only be `cross_margin` | [optional] +**ActionMode** | **string** | Processing Mode: When placing an order, different fields are returned based on action_mode. This field is only valid during the request and is not included in the response result ACK: Asynchronous mode, only returns key order fields RESULT: No clearing information FULL: Full mode (default) | [optional] [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/docs/CollateralAdjust.md b/docs/CollateralAdjust.md new file mode 100644 index 0000000..278c266 --- /dev/null +++ b/docs/CollateralAdjust.md @@ -0,0 +1,13 @@ +# CollateralAdjust + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**OrderId** | **int64** | Order ID | +**Type** | **string** | Operation types: append - for adding collateral, redeem - for withdrawing collateral | +**Collaterals** | [**[]CollateralCurrency**](CollateralCurrency.md) | Collateral Currency List | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/CollateralAdjustRes.md b/docs/CollateralAdjustRes.md new file mode 100644 index 0000000..b1338b8 --- /dev/null +++ b/docs/CollateralAdjustRes.md @@ -0,0 +1,12 @@ +# CollateralAdjustRes + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**OrderId** | **int64** | Order ID | [optional] +**CollateralCurrencies** | [**[]CollateralCurrencyRes**](CollateralCurrencyRes.md) | Collateral Currency Information | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/CollateralCurrency.md b/docs/CollateralCurrency.md new file mode 100644 index 0000000..4bf95ef --- /dev/null +++ b/docs/CollateralCurrency.md @@ -0,0 +1,12 @@ +# CollateralCurrency + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Currency** | **string** | Currency | [optional] +**Amount** | **string** | Size | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/CollateralCurrencyInfo.md b/docs/CollateralCurrencyInfo.md new file mode 100644 index 0000000..230cfea --- /dev/null +++ b/docs/CollateralCurrencyInfo.md @@ -0,0 +1,14 @@ +# CollateralCurrencyInfo + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Currency** | **string** | Currency | [optional] +**IndexPrice** | **string** | Currency Index Price | [optional] +**LeftCollateral** | **string** | Left Collateral Amount | [optional] +**LeftCollateralUsdt** | **string** | Value of left collateral amount in USDT | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/CollateralCurrencyRes.md b/docs/CollateralCurrencyRes.md new file mode 100644 index 0000000..5a43ebf --- /dev/null +++ b/docs/CollateralCurrencyRes.md @@ -0,0 +1,15 @@ +# CollateralCurrencyRes + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Succeeded** | **bool** | Update success status | [optional] +**Label** | **string** | Error identifier for unsuccessful operations; empty for successful. | [optional] +**Message** | **string** | Error description in case of operation failure; empty when successful. | [optional] +**Currency** | **string** | Currency | [optional] +**Amount** | **string** | Quantity of successful collateral operation; 0 if the operation fails. | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/CollateralFixRate.md b/docs/CollateralFixRate.md new file mode 100644 index 0000000..7fdbbf8 --- /dev/null +++ b/docs/CollateralFixRate.md @@ -0,0 +1,14 @@ +# CollateralFixRate + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Currency** | **string** | Currency | [optional] +**Rate7d** | **string** | Fixed interest rate for a lending period of 7 days | [optional] +**Rate30d** | **string** | Fixed interest rate for a lending period of 30 days | [optional] +**UpdateTime** | **int64** | Update time, timestamp, unit in seconds | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/CollateralLtv.md b/docs/CollateralLtv.md new file mode 100644 index 0000000..a466de1 --- /dev/null +++ b/docs/CollateralLtv.md @@ -0,0 +1,13 @@ +# CollateralLtv + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**InitLtv** | **string** | The initial collateralization rate | [optional] +**AlertLtv** | **string** | Warning collateralization ratio | [optional] +**LiquidateLtv** | **string** | The liquidation collateralization rate | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/Contract.md b/docs/Contract.md index 59ce846..cf1a8a2 100644 --- a/docs/Contract.md +++ b/docs/Contract.md @@ -21,9 +21,9 @@ Name | Type | Description | Notes **FundingRate** | **string** | Current funding rate | [optional] **FundingInterval** | **int32** | Funding application interval, unit in seconds | [optional] **FundingNextApply** | **float64** | Next funding time | [optional] -**RiskLimitBase** | **string** | Risk limit base | [optional] -**RiskLimitStep** | **string** | Step of adjusting risk limit | [optional] -**RiskLimitMax** | **string** | Maximum risk limit the contract allowed | [optional] +**RiskLimitBase** | **string** | Risk limit base,deprecated | [optional] +**RiskLimitStep** | **string** | Step of adjusting risk limit,deprecated | [optional] +**RiskLimitMax** | **string** | Maximum risk limit the contract allowed,deprecated,It is recommended to use /futures/{settle}/risk_limit_tiers to query risk limits. | [optional] **OrderSizeMin** | **int64** | Minimum order size the contract allowed | [optional] **OrderSizeMax** | **int64** | Maximum order size the contract allowed | [optional] **OrderPriceDeviate** | **string** | deviation between order price and current index price. If price of an order is denoted as order_price, it must meet the following condition: abs(order_price - mark_price) <= mark_price * order_price_deviate | [optional] diff --git a/docs/ConvertSmallBalance.md b/docs/ConvertSmallBalance.md new file mode 100644 index 0000000..858189e --- /dev/null +++ b/docs/ConvertSmallBalance.md @@ -0,0 +1,11 @@ +# ConvertSmallBalance + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Currency** | **[]string** | Currency | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/CreateMultiCollateralOrder.md b/docs/CreateMultiCollateralOrder.md new file mode 100644 index 0000000..3bfede4 --- /dev/null +++ b/docs/CreateMultiCollateralOrder.md @@ -0,0 +1,19 @@ +# CreateMultiCollateralOrder + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**OrderId** | **string** | Order ID | [optional] +**OrderType** | **string** | current - current, fixed - fixed, if not specified, default to current | [optional] +**FixedType** | **string** | Fixed interest rate loan period: 7d - 7 days, 30d - 30 days. Must be provided for fixed | [optional] +**FixedRate** | **string** | Fixed interest rate, must be specified for fixed | [optional] +**AutoRenew** | **bool** | Fixed interest rate, automatic renewal | [optional] +**AutoRepay** | **bool** | Fixed interest rate, automatic repayment | [optional] +**BorrowCurrency** | **string** | Borrowed currency | +**BorrowAmount** | **string** | Borrowing amount | +**CollateralCurrencies** | [**[]CollateralCurrency**](CollateralCurrency.md) | Collateral currency and amount | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/CurrencyChain.md b/docs/CurrencyChain.md index 7d1ceee..4656f5e 100644 --- a/docs/CurrencyChain.md +++ b/docs/CurrencyChain.md @@ -11,6 +11,7 @@ Name | Type | Description | Notes **IsDisabled** | **int32** | If it is disabled. 0 means NOT being disabled | [optional] **IsDepositDisabled** | **int32** | Is deposit disabled. 0 means not | [optional] **IsWithdrawDisabled** | **int32** | Is withdrawal disabled. 0 means not | [optional] +**Decimal** | **string** | Withdrawal precision | [optional] [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/docs/CurrencyQuota.md b/docs/CurrencyQuota.md new file mode 100644 index 0000000..38c8259 --- /dev/null +++ b/docs/CurrencyQuota.md @@ -0,0 +1,15 @@ +# CurrencyQuota + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Currency** | **string** | Currency | [optional] +**IndexPrice** | **string** | Currency Index Price | [optional] +**MinQuota** | **string** | Minimum borrowing/collateral quota for the currency | [optional] +**LeftQuota** | **string** | Remaining borrowing/collateral limit for the currency | [optional] +**LeftQuoteUsdt** | **string** | Remaining currency limit converted to USDT | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/EarnApi.md b/docs/EarnApi.md index 6eccbe4..730922d 100644 --- a/docs/EarnApi.md +++ b/docs/EarnApi.md @@ -8,7 +8,6 @@ Method | HTTP request | Description [**ListDualInvestmentPlans**](EarnApi.md#ListDualInvestmentPlans) | **Get** /earn/dual/investment_plan | Dual Investment product list [**ListDualOrders**](EarnApi.md#ListDualOrders) | **Get** /earn/dual/orders | Dual Investment order list [**PlaceDualOrder**](EarnApi.md#PlaceDualOrder) | **Post** /earn/dual/orders | Place Dual Investment order -[**CancelDualOrder**](EarnApi.md#CancelDualOrder) | **Delete** /earn/dual/orders/{order_id} | Cancel Dual Investment order [**ListStructuredProducts**](EarnApi.md#ListStructuredProducts) | **Get** /earn/structured/products | Structured Product List [**ListStructuredOrders**](EarnApi.md#ListStructuredOrders) | **Get** /earn/structured/orders | Structured Product Order List [**PlaceStructuredOrder**](EarnApi.md#PlaceStructuredOrder) | **Post** /earn/structured/orders | Place Structured Product Order @@ -274,87 +273,29 @@ func main() { [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) -## CancelDualOrder +## ListStructuredProducts -> CancelDualOrder(ctx, orderId) +> []StructuredGetProjectList ListStructuredProducts(ctx, status, optional) -Cancel Dual Investment order +Structured Product List ### Required Parameters Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. -**orderId** | **int32**| Order ID | - -### Example - -```golang -package main - -import ( - "context" - "fmt" +**status** | **string**| Status (default: all) `in_process`-processing `will_begin`-unstarted `wait_settlement`-unsettled `done`-finish | +**optional** | **ListStructuredProductsOpts** | optional parameters | nil if no parameters - "github.com/gateio/gateapi-go/v6" -) +### Optional Parameters -func main() { - client := gateapi.NewAPIClient(gateapi.NewConfiguration()) - // uncomment the next line if your are testing against testnet - // client.ChangeBasePath("https://fx-api-testnet.gateio.ws/api/v4") - ctx := context.WithValue(context.Background(), - gateapi.ContextGateAPIV4, - gateapi.GateAPIV4{ - Key: "YOUR_API_KEY", - Secret: "YOUR_API_SECRET", - } - ) - orderId := 1 // int32 - Order ID - - result, _, err := client.EarnApi.CancelDualOrder(ctx, orderId) - if err != nil { - if e, ok := err.(gateapi.GateAPIError); ok { - fmt.Printf("gate api error: %s\n", e.Error()) - } else { - fmt.Printf("generic error: %s\n", err.Error()) - } - } else { - fmt.Println(result) - } -} -``` - - -### Return type - - (empty response body) - -### Authorization - -[apiv4](../README.md#apiv4) - -### HTTP request headers - -- **Content-Type**: Not defined -- **Accept**: Not defined - -[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) -[[Back to Model list]](../README.md#documentation-for-models) -[[Back to README]](../README.md) - -## ListStructuredProducts - -> []StructuredGetProjectList ListStructuredProducts(ctx, structuredGetProjectListRequest) - -Structured Product List - -### Required Parameters +Optional parameters are passed through a pointer to a ListStructuredProductsOpts struct Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. -**structuredGetProjectListRequest** | [**StructuredGetProjectListRequest**](StructuredGetProjectListRequest.md)| | +**type_** | **optional.String**| Product Type (default all) `SharkFin2.0`-SharkFin `BullishSharkFin`-BullishSharkFin `BearishSharkFin`-BearishSharkFin `DoubleNoTouch`-DoubleNoTouch `RangeAccrual`-RangeAccrual `SnowBall`-SnowBall | +**page** | **optional.Int32**| Page number | [default to 1] +**limit** | **optional.Int32**| Maximum number of records to be returned in a single list | [default to 100] ### Example @@ -373,9 +314,9 @@ func main() { // uncomment the next line if your are testing against testnet // client.ChangeBasePath("https://fx-api-testnet.gateio.ws/api/v4") ctx := context.Background() - structuredGetProjectListRequest := gateapi.StructuredGetProjectListRequest{} // StructuredGetProjectListRequest - + status := "in_process" // string - Status (default: all) `in_process`-processing `will_begin`-unstarted `wait_settlement`-unsettled `done`-finish - result, _, err := client.EarnApi.ListStructuredProducts(ctx, structuredGetProjectListRequest) + result, _, err := client.EarnApi.ListStructuredProducts(ctx, status, nil) if err != nil { if e, ok := err.(gateapi.GateAPIError); ok { fmt.Printf("gate api error: %s\n", e.Error()) @@ -399,7 +340,7 @@ No authorization required ### HTTP request headers -- **Content-Type**: application/json +- **Content-Type**: Not defined - **Accept**: application/json [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) @@ -408,7 +349,7 @@ No authorization required ## ListStructuredOrders -> []StructuredOrderList ListStructuredOrders(ctx, structuredOrderListRequest) +> []StructuredOrderList ListStructuredOrders(ctx, optional) Structured Product Order List @@ -417,7 +358,18 @@ Structured Product Order List Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. -**structuredOrderListRequest** | [**StructuredOrderListRequest**](StructuredOrderListRequest.md)| | +**optional** | **ListStructuredOrdersOpts** | optional parameters | nil if no parameters + +### Optional Parameters + +Optional parameters are passed through a pointer to a ListStructuredOrdersOpts struct + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- +**from** | **optional.Int64**| Start timestamp | +**to** | **optional.Int64**| End timestamp | +**page** | **optional.Int32**| Page number | [default to 1] +**limit** | **optional.Int32**| Maximum number of records to be returned in a single list | [default to 100] ### Example @@ -442,9 +394,8 @@ func main() { Secret: "YOUR_API_SECRET", } ) - structuredOrderListRequest := gateapi.StructuredOrderListRequest{} // StructuredOrderListRequest - - result, _, err := client.EarnApi.ListStructuredOrders(ctx, structuredOrderListRequest) + result, _, err := client.EarnApi.ListStructuredOrders(ctx, nil) if err != nil { if e, ok := err.(gateapi.GateAPIError); ok { fmt.Printf("gate api error: %s\n", e.Error()) @@ -468,7 +419,7 @@ func main() { ### HTTP request headers -- **Content-Type**: application/json +- **Content-Type**: Not defined - **Accept**: application/json [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) diff --git a/docs/EarnUniApi.md b/docs/EarnUniApi.md index 0ead56d..23732d1 100644 --- a/docs/EarnUniApi.md +++ b/docs/EarnUniApi.md @@ -529,6 +529,8 @@ Name | Type | Description | Notes **currency** | **optional.String**| Retrieve data of the specified currency | **page** | **optional.Int32**| Page number | [default to 1] **limit** | **optional.Int32**| Maximum response items. Default: 100, minimum: 1, Maximum: 100 | [default to 100] +**from** | **optional.Int64**| Start timestamp | +**to** | **optional.Int64**| End timestamp | ### Example diff --git a/docs/FutureCancelOrderResult.md b/docs/FutureCancelOrderResult.md new file mode 100644 index 0000000..6878534 --- /dev/null +++ b/docs/FutureCancelOrderResult.md @@ -0,0 +1,14 @@ +# FutureCancelOrderResult + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Id** | **string** | Order ID | [optional] +**UserId** | **int64** | User ID | [optional] +**Succeeded** | **bool** | Whether cancellation succeeded | [optional] +**Message** | **string** | Error message when failed to cancel the order; empty if succeeded | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/FuturesAccountBook.md b/docs/FuturesAccountBook.md index 4cf0de1..d6c3386 100644 --- a/docs/FuturesAccountBook.md +++ b/docs/FuturesAccountBook.md @@ -7,7 +7,7 @@ Name | Type | Description | Notes **Time** | **float64** | Change time | [optional] **Change** | **string** | Change amount | [optional] **Balance** | **string** | Balance after change | [optional] -**Type** | **string** | Changing Type: - dnw: Deposit & Withdraw - pnl: Profit & Loss by reducing position - fee: Trading fee - refr: Referrer rebate - fund: Funding - point_dnw: POINT Deposit & Withdraw - point_fee: POINT Trading fee - point_refr: POINT Referrer rebate | [optional] +**Type** | **string** | Changing Type: - dnw: Deposit & Withdraw - pnl: Profit & Loss by reducing position - fee: Trading fee - refr: Referrer rebate - fund: Funding - point_dnw: POINT Deposit & Withdraw - point_fee: POINT Trading fee - point_refr: POINT Referrer rebate - bonus_offset: bouns deduction | [optional] **Text** | **string** | Comment | [optional] **Contract** | **string** | Futures contract, the field is only available for data after 2023-10-30. | [optional] **TradeId** | **string** | trade id | [optional] diff --git a/docs/FuturesApi.md b/docs/FuturesApi.md index a1a746c..4ce4d14 100644 --- a/docs/FuturesApi.md +++ b/docs/FuturesApi.md @@ -43,6 +43,8 @@ Method | HTTP request | Description [**ListAutoDeleverages**](FuturesApi.md#ListAutoDeleverages) | **Get** /futures/{settle}/auto_deleverages | List Auto-Deleveraging History [**CountdownCancelAllFutures**](FuturesApi.md#CountdownCancelAllFutures) | **Post** /futures/{settle}/countdown_cancel_all | Countdown cancel orders [**GetFuturesFee**](FuturesApi.md#GetFuturesFee) | **Get** /futures/{settle}/fee | Query user trading fee rates +[**ListRiskLimitTiers**](FuturesApi.md#ListRiskLimitTiers) | **Get** /futures/{settle}/risk_limit_tiers | List risk limit tiers +[**CancelBatchFutureOrders**](FuturesApi.md#CancelBatchFutureOrders) | **Post** /futures/{settle}/batch_cancel_orders | Cancel a batch of orders with an ID list [**ListPriceTriggeredOrders**](FuturesApi.md#ListPriceTriggeredOrders) | **Get** /futures/{settle}/price_orders | List all auto orders [**CreatePriceTriggeredOrder**](FuturesApi.md#CreatePriceTriggeredOrder) | **Post** /futures/{settle}/price_orders | Create a price-triggered order [**CancelPriceTriggeredOrderList**](FuturesApi.md#CancelPriceTriggeredOrderList) | **Delete** /futures/{settle}/price_orders | Cancel all open orders @@ -52,7 +54,7 @@ Method | HTTP request | Description ## ListFuturesContracts -> []Contract ListFuturesContracts(ctx, settle) +> []Contract ListFuturesContracts(ctx, settle, optional) List all futures contracts @@ -62,6 +64,16 @@ Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. **settle** | **string**| Settle currency | +**optional** | **ListFuturesContractsOpts** | optional parameters | nil if no parameters + +### Optional Parameters + +Optional parameters are passed through a pointer to a ListFuturesContractsOpts struct + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- +**limit** | **optional.Int32**| Maximum number of records to be returned in a single list | [default to 100] +**offset** | **optional.Int32**| List offset, starting from 0 | [default to 0] ### Example @@ -82,7 +94,7 @@ func main() { ctx := context.Background() settle := "usdt" // string - Settle currency - result, _, err := client.FuturesApi.ListFuturesContracts(ctx, settle) + result, _, err := client.FuturesApi.ListFuturesContracts(ctx, settle, nil) if err != nil { if e, ok := err.(gateapi.GateAPIError); ok { fmt.Printf("gate api error: %s\n", e.Error()) @@ -1021,9 +1033,10 @@ Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **contract** | **optional.String**| Futures contract, return related data only if specified | **limit** | **optional.Int32**| Maximum number of records to be returned in a single list | [default to 100] +**offset** | **optional.Int32**| List offset, starting from 0 | [default to 0] **from** | **optional.Int64**| Start timestamp | **to** | **optional.Int64**| End timestamp | -**type_** | **optional.String**| Changing Type: - dnw: Deposit & Withdraw - pnl: Profit & Loss by reducing position - fee: Trading fee - refr: Referrer rebate - fund: Funding - point_dnw: POINT Deposit & Withdraw - point_fee: POINT Trading fee - point_refr: POINT Referrer rebate | +**type_** | **optional.String**| Changing Type: - dnw: Deposit & Withdraw - pnl: Profit & Loss by reducing position - fee: Trading fee - refr: Referrer rebate - fund: Funding - point_dnw: POINT Deposit & Withdraw - point_fee: POINT Trading fee - point_refr: POINT Referrer rebate - bonus_offset: bouns deduction | ### Example @@ -1102,6 +1115,8 @@ Optional parameters are passed through a pointer to a ListPositionsOpts struct Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **holding** | **optional.Bool**| Return only real positions - true, return all - false. | +**limit** | **optional.Int32**| Maximum number of records to be returned in a single list | [default to 100] +**offset** | **optional.Int32**| List offset, starting from 0 | [default to 0] ### Example @@ -3006,6 +3021,150 @@ func main() { [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) +## ListRiskLimitTiers + +> []FuturesLimitRiskTiers ListRiskLimitTiers(ctx, settle, contract) + +List risk limit tiers + +### Required Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- +**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. +**settle** | **string**| Settle currency | +**contract** | **string**| Futures contract | + +### Example + +```golang +package main + +import ( + "context" + "fmt" + + "github.com/gateio/gateapi-go/v6" +) + +func main() { + client := gateapi.NewAPIClient(gateapi.NewConfiguration()) + // uncomment the next line if your are testing against testnet + // client.ChangeBasePath("https://fx-api-testnet.gateio.ws/api/v4") + ctx := context.WithValue(context.Background(), + gateapi.ContextGateAPIV4, + gateapi.GateAPIV4{ + Key: "YOUR_API_KEY", + Secret: "YOUR_API_SECRET", + } + ) + settle := "usdt" // string - Settle currency + contract := "BTC_USDT" // string - Futures contract + + result, _, err := client.FuturesApi.ListRiskLimitTiers(ctx, settle, contract) + if err != nil { + if e, ok := err.(gateapi.GateAPIError); ok { + fmt.Printf("gate api error: %s\n", e.Error()) + } else { + fmt.Printf("generic error: %s\n", err.Error()) + } + } else { + fmt.Println(result) + } +} +``` + + +### Return type + +[**[]FuturesLimitRiskTiers**](FuturesLimitRiskTiers.md) + +### Authorization + +[apiv4](../README.md#apiv4) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) +[[Back to Model list]](../README.md#documentation-for-models) +[[Back to README]](../README.md) + +## CancelBatchFutureOrders + +> []FutureCancelOrderResult CancelBatchFutureOrders(ctx, settle, requestBody) + +Cancel a batch of orders with an ID list + +Multiple distinct order ID list can be specified。Each request can cancel a maximum of 20 records. + +### Required Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- +**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. +**settle** | **string**| Settle currency | +**requestBody** | [**[]string**](string.md)| | + +### Example + +```golang +package main + +import ( + "context" + "fmt" + + "github.com/gateio/gateapi-go/v6" +) + +func main() { + client := gateapi.NewAPIClient(gateapi.NewConfiguration()) + // uncomment the next line if your are testing against testnet + // client.ChangeBasePath("https://fx-api-testnet.gateio.ws/api/v4") + ctx := context.WithValue(context.Background(), + gateapi.ContextGateAPIV4, + gateapi.GateAPIV4{ + Key: "YOUR_API_KEY", + Secret: "YOUR_API_SECRET", + } + ) + settle := "usdt" // string - Settle currency + requestBody := []string{"requestBody_example"} // []string - + + result, _, err := client.FuturesApi.CancelBatchFutureOrders(ctx, settle, requestBody) + if err != nil { + if e, ok := err.(gateapi.GateAPIError); ok { + fmt.Printf("gate api error: %s\n", e.Error()) + } else { + fmt.Printf("generic error: %s\n", err.Error()) + } + } else { + fmt.Println(result) + } +} +``` + + +### Return type + +[**[]FutureCancelOrderResult**](FutureCancelOrderResult.md) + +### Authorization + +[apiv4](../README.md#apiv4) + +### HTTP request headers + +- **Content-Type**: application/json +- **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) +[[Back to Model list]](../README.md#documentation-for-models) +[[Back to README]](../README.md) + ## ListPriceTriggeredOrders > []FuturesPriceTriggeredOrder ListPriceTriggeredOrders(ctx, settle, status, optional) diff --git a/docs/FuturesLimitRiskTiers.md b/docs/FuturesLimitRiskTiers.md new file mode 100644 index 0000000..cd8cca6 --- /dev/null +++ b/docs/FuturesLimitRiskTiers.md @@ -0,0 +1,15 @@ +# FuturesLimitRiskTiers + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Tier** | **int32** | tier | [optional] +**RiskLimit** | **string** | Position risk limit | [optional] +**InitialRate** | **string** | Initial margin rate | [optional] +**MaintenanceRate** | **string** | Maintenance margin rate | [optional] +**LeverageMax** | **string** | Maximum leverage | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/FuturesPriceTriggeredOrder.md b/docs/FuturesPriceTriggeredOrder.md index 2d1b645..cfcf672 100644 --- a/docs/FuturesPriceTriggeredOrder.md +++ b/docs/FuturesPriceTriggeredOrder.md @@ -15,7 +15,7 @@ Name | Type | Description | Notes **FinishAs** | **string** | How order is finished | [optional] [readonly] **Reason** | **string** | Additional remarks on how the order was finished | [optional] [readonly] **OrderType** | **string** | Take-profit/stop-loss types, which include: - `close-long-order`: order take-profit/stop-loss, close long position - `close-short-order`: order take-profit/stop-loss, close short position - `close-long-position`: position take-profit/stop-loss, close long position - `close-short-position`: position take-profit/stop-loss, close short position - `plan-close-long-position`: position planned take-profit/stop-loss, close long position - `plan-close-short-position`: position planned take-profit/stop-loss, close short position The order take-profit/stop-loss can not be passed by request. These two types are read only. | [optional] -**MeOrderId** | **string** | Corresponding order ID of order take-profit/stop-loss. | [optional] [readonly] +**MeOrderId** | **int64** | Corresponding order ID of order take-profit/stop-loss. | [optional] [readonly] [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/docs/LiquidateOrder.md b/docs/LiquidateOrder.md index 0390c05..6ca339d 100644 --- a/docs/LiquidateOrder.md +++ b/docs/LiquidateOrder.md @@ -8,6 +8,7 @@ Name | Type | Description | Notes **CurrencyPair** | **string** | Currency pair | **Amount** | **string** | Trade amount | **Price** | **string** | Order price | +**ActionMode** | **string** | Processing Mode: Different fields are returned when placing an order based on action_mode. This field is only valid during the request, and it is not included in the response result ACK: Asynchronous mode, only returns key order fields RESULT: No clearing information FULL: Full mode (default) | [optional] [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/docs/MarginApi.md b/docs/MarginApi.md index c232309..08e7da3 100644 --- a/docs/MarginApi.md +++ b/docs/MarginApi.md @@ -2221,6 +2221,8 @@ Name | Type | Description | Notes **currency** | **optional.String**| Retrieve data of the specified currency | **page** | **optional.Int32**| Page number | [default to 1] **limit** | **optional.Int32**| Maximum response items. Default: 100, minimum: 1, Maximum: 100 | [default to 100] +**from** | **optional.Int64**| Start timestamp | +**to** | **optional.Int64**| End timestamp | ### Example diff --git a/docs/MarginUniApi.md b/docs/MarginUniApi.md index a27aa80..6ccec04 100644 --- a/docs/MarginUniApi.md +++ b/docs/MarginUniApi.md @@ -456,7 +456,9 @@ Name | Type | Description | Notes **currencyPair** | **optional.String**| Currency pair | **currency** | **optional.String**| Retrieve data of the specified currency | **page** | **optional.Int32**| Page number | [default to 1] -**limit** | **optional.Int32**| Maximum response items. Default: 100, minimum: 1, Maximum: 100 | [default to 100] +**limit** | **optional.Int32**| Maximum number of records to be returned in a single list | [default to 100] +**from** | **optional.Int64**| Start timestamp | +**to** | **optional.Int64**| End timestamp | ### Example diff --git a/docs/MultiCollateralCurrency.md b/docs/MultiCollateralCurrency.md new file mode 100644 index 0000000..e842936 --- /dev/null +++ b/docs/MultiCollateralCurrency.md @@ -0,0 +1,12 @@ +# MultiCollateralCurrency + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**LoanCurrencies** | [**[]MultiLoanItem**](MultiLoanItem.md) | List of supported borrowing currencies | [optional] +**CollateralCurrencies** | [**[]MultiCollateralItem**](MultiCollateralItem.md) | List of supported collateral currencies | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/MultiCollateralItem.md b/docs/MultiCollateralItem.md new file mode 100644 index 0000000..53a85d8 --- /dev/null +++ b/docs/MultiCollateralItem.md @@ -0,0 +1,13 @@ +# MultiCollateralItem + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Currency** | **string** | Currency | [optional] +**IndexPrice** | **string** | Currency Index Price | [optional] +**Discount** | **string** | Discount | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/MultiCollateralLoanApi.md b/docs/MultiCollateralLoanApi.md new file mode 100644 index 0000000..c0c056a --- /dev/null +++ b/docs/MultiCollateralLoanApi.md @@ -0,0 +1,782 @@ +# MultiCollateralLoanApi + +All URIs are relative to *https://api.gateio.ws/api/v4* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**ListMultiCollateralOrders**](MultiCollateralLoanApi.md#ListMultiCollateralOrders) | **Get** /loan/multi_collateral/orders | List Multi-Collateral Orders +[**CreateMultiCollateral**](MultiCollateralLoanApi.md#CreateMultiCollateral) | **Post** /loan/multi_collateral/orders | Create Multi-Collateral Order +[**GetMultiCollateralOrderDetail**](MultiCollateralLoanApi.md#GetMultiCollateralOrderDetail) | **Get** /loan/multi_collateral/orders/{order_id} | Get Multi-Collateral Order Detail +[**ListMultiRepayRecords**](MultiCollateralLoanApi.md#ListMultiRepayRecords) | **Get** /loan/multi_collateral/repay | List Multi-Collateral Repay Records +[**RepayMultiCollateralLoan**](MultiCollateralLoanApi.md#RepayMultiCollateralLoan) | **Post** /loan/multi_collateral/repay | Repay Multi-Collateral Loan +[**ListMultiCollateralRecords**](MultiCollateralLoanApi.md#ListMultiCollateralRecords) | **Get** /loan/multi_collateral/mortgage | Query collateral adjustment records +[**OperateMultiCollateral**](MultiCollateralLoanApi.md#OperateMultiCollateral) | **Post** /loan/multi_collateral/mortgage | Operate Multi-Collateral +[**ListUserCurrencyQuota**](MultiCollateralLoanApi.md#ListUserCurrencyQuota) | **Get** /loan/multi_collateral/currency_quota | List User Currency Quota +[**ListMultiCollateralCurrencies**](MultiCollateralLoanApi.md#ListMultiCollateralCurrencies) | **Get** /loan/multi_collateral/currencies | Query supported borrowing and collateral currencies in Multi-Collateral +[**GetMultiCollateralLtv**](MultiCollateralLoanApi.md#GetMultiCollateralLtv) | **Get** /loan/multi_collateral/ltv | Get Multi-Collateral ratio +[**GetMultiCollateralFixRate**](MultiCollateralLoanApi.md#GetMultiCollateralFixRate) | **Get** /loan/multi_collateral/fixed_rate | Query fixed interest rates for the currency for 7 days and 30 days + + +## ListMultiCollateralOrders + +> []MultiCollateralOrder ListMultiCollateralOrders(ctx, optional) + +List Multi-Collateral Orders + +### Required Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- +**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. +**optional** | **ListMultiCollateralOrdersOpts** | optional parameters | nil if no parameters + +### Optional Parameters + +Optional parameters are passed through a pointer to a ListMultiCollateralOrdersOpts struct + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- +**page** | **optional.Int32**| Page number | [default to 1] +**limit** | **optional.Int32**| Maximum number of records to be returned in a single list | [default to 10] +**sort** | **optional.String**| Sort types: time_desc - default sorting by creation time in descending order, ltv_asc - ascending order of ltv, ltv_desc - descending order of ltv. | +**orderType** | **optional.String**| Order type, current - query current orders, fixed - query fixed orders. If not specified, default to querying current orders | + +### Example + +```golang +package main + +import ( + "context" + "fmt" + + "github.com/gateio/gateapi-go/v6" +) + +func main() { + client := gateapi.NewAPIClient(gateapi.NewConfiguration()) + // uncomment the next line if your are testing against testnet + // client.ChangeBasePath("https://fx-api-testnet.gateio.ws/api/v4") + ctx := context.WithValue(context.Background(), + gateapi.ContextGateAPIV4, + gateapi.GateAPIV4{ + Key: "YOUR_API_KEY", + Secret: "YOUR_API_SECRET", + } + ) + + result, _, err := client.MultiCollateralLoanApi.ListMultiCollateralOrders(ctx, nil) + if err != nil { + if e, ok := err.(gateapi.GateAPIError); ok { + fmt.Printf("gate api error: %s\n", e.Error()) + } else { + fmt.Printf("generic error: %s\n", err.Error()) + } + } else { + fmt.Println(result) + } +} +``` + + +### Return type + +[**[]MultiCollateralOrder**](MultiCollateralOrder.md) + +### Authorization + +[apiv4](../README.md#apiv4) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) +[[Back to Model list]](../README.md#documentation-for-models) +[[Back to README]](../README.md) + +## CreateMultiCollateral + +> OrderResp CreateMultiCollateral(ctx, createMultiCollateralOrder) + +Create Multi-Collateral Order + +### Required Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- +**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. +**createMultiCollateralOrder** | [**CreateMultiCollateralOrder**](CreateMultiCollateralOrder.md)| | + +### Example + +```golang +package main + +import ( + "context" + "fmt" + + "github.com/gateio/gateapi-go/v6" +) + +func main() { + client := gateapi.NewAPIClient(gateapi.NewConfiguration()) + // uncomment the next line if your are testing against testnet + // client.ChangeBasePath("https://fx-api-testnet.gateio.ws/api/v4") + ctx := context.WithValue(context.Background(), + gateapi.ContextGateAPIV4, + gateapi.GateAPIV4{ + Key: "YOUR_API_KEY", + Secret: "YOUR_API_SECRET", + } + ) + createMultiCollateralOrder := gateapi.CreateMultiCollateralOrder{} // CreateMultiCollateralOrder - + + result, _, err := client.MultiCollateralLoanApi.CreateMultiCollateral(ctx, createMultiCollateralOrder) + if err != nil { + if e, ok := err.(gateapi.GateAPIError); ok { + fmt.Printf("gate api error: %s\n", e.Error()) + } else { + fmt.Printf("generic error: %s\n", err.Error()) + } + } else { + fmt.Println(result) + } +} +``` + + +### Return type + +[**OrderResp**](OrderResp.md) + +### Authorization + +[apiv4](../README.md#apiv4) + +### HTTP request headers + +- **Content-Type**: application/json +- **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) +[[Back to Model list]](../README.md#documentation-for-models) +[[Back to README]](../README.md) + +## GetMultiCollateralOrderDetail + +> MultiCollateralOrder GetMultiCollateralOrderDetail(ctx, orderId) + +Get Multi-Collateral Order Detail + +### Required Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- +**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. +**orderId** | **string**| Order ID returned on successful order creation | + +### Example + +```golang +package main + +import ( + "context" + "fmt" + + "github.com/gateio/gateapi-go/v6" +) + +func main() { + client := gateapi.NewAPIClient(gateapi.NewConfiguration()) + // uncomment the next line if your are testing against testnet + // client.ChangeBasePath("https://fx-api-testnet.gateio.ws/api/v4") + ctx := context.WithValue(context.Background(), + gateapi.ContextGateAPIV4, + gateapi.GateAPIV4{ + Key: "YOUR_API_KEY", + Secret: "YOUR_API_SECRET", + } + ) + orderId := "12345" // string - Order ID returned on successful order creation + + result, _, err := client.MultiCollateralLoanApi.GetMultiCollateralOrderDetail(ctx, orderId) + if err != nil { + if e, ok := err.(gateapi.GateAPIError); ok { + fmt.Printf("gate api error: %s\n", e.Error()) + } else { + fmt.Printf("generic error: %s\n", err.Error()) + } + } else { + fmt.Println(result) + } +} +``` + + +### Return type + +[**MultiCollateralOrder**](MultiCollateralOrder.md) + +### Authorization + +[apiv4](../README.md#apiv4) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) +[[Back to Model list]](../README.md#documentation-for-models) +[[Back to README]](../README.md) + +## ListMultiRepayRecords + +> []MultiRepayRecord ListMultiRepayRecords(ctx, type_, optional) + +List Multi-Collateral Repay Records + +### Required Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- +**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. +**type_** | **string**| Operation type: repay - Regular repayment, liquidate - Liquidation | +**optional** | **ListMultiRepayRecordsOpts** | optional parameters | nil if no parameters + +### Optional Parameters + +Optional parameters are passed through a pointer to a ListMultiRepayRecordsOpts struct + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- +**borrowCurrency** | **optional.String**| Borrowed currency | +**page** | **optional.Int32**| Page number | [default to 1] +**limit** | **optional.Int32**| Maximum number of records to be returned in a single list | [default to 10] +**from** | **optional.Int64**| Start timestamp of the query | +**to** | **optional.Int64**| Time range ending, default to current time | + +### Example + +```golang +package main + +import ( + "context" + "fmt" + + "github.com/gateio/gateapi-go/v6" +) + +func main() { + client := gateapi.NewAPIClient(gateapi.NewConfiguration()) + // uncomment the next line if your are testing against testnet + // client.ChangeBasePath("https://fx-api-testnet.gateio.ws/api/v4") + ctx := context.WithValue(context.Background(), + gateapi.ContextGateAPIV4, + gateapi.GateAPIV4{ + Key: "YOUR_API_KEY", + Secret: "YOUR_API_SECRET", + } + ) + type_ := "repay" // string - Operation type: repay - Regular repayment, liquidate - Liquidation + + result, _, err := client.MultiCollateralLoanApi.ListMultiRepayRecords(ctx, type_, nil) + if err != nil { + if e, ok := err.(gateapi.GateAPIError); ok { + fmt.Printf("gate api error: %s\n", e.Error()) + } else { + fmt.Printf("generic error: %s\n", err.Error()) + } + } else { + fmt.Println(result) + } +} +``` + + +### Return type + +[**[]MultiRepayRecord**](MultiRepayRecord.md) + +### Authorization + +[apiv4](../README.md#apiv4) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) +[[Back to Model list]](../README.md#documentation-for-models) +[[Back to README]](../README.md) + +## RepayMultiCollateralLoan + +> MultiRepayResp RepayMultiCollateralLoan(ctx, repayMultiLoan) + +Repay Multi-Collateral Loan + +### Required Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- +**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. +**repayMultiLoan** | [**RepayMultiLoan**](RepayMultiLoan.md)| | + +### Example + +```golang +package main + +import ( + "context" + "fmt" + + "github.com/gateio/gateapi-go/v6" +) + +func main() { + client := gateapi.NewAPIClient(gateapi.NewConfiguration()) + // uncomment the next line if your are testing against testnet + // client.ChangeBasePath("https://fx-api-testnet.gateio.ws/api/v4") + ctx := context.WithValue(context.Background(), + gateapi.ContextGateAPIV4, + gateapi.GateAPIV4{ + Key: "YOUR_API_KEY", + Secret: "YOUR_API_SECRET", + } + ) + repayMultiLoan := gateapi.RepayMultiLoan{} // RepayMultiLoan - + + result, _, err := client.MultiCollateralLoanApi.RepayMultiCollateralLoan(ctx, repayMultiLoan) + if err != nil { + if e, ok := err.(gateapi.GateAPIError); ok { + fmt.Printf("gate api error: %s\n", e.Error()) + } else { + fmt.Printf("generic error: %s\n", err.Error()) + } + } else { + fmt.Println(result) + } +} +``` + + +### Return type + +[**MultiRepayResp**](MultiRepayResp.md) + +### Authorization + +[apiv4](../README.md#apiv4) + +### HTTP request headers + +- **Content-Type**: application/json +- **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) +[[Back to Model list]](../README.md#documentation-for-models) +[[Back to README]](../README.md) + +## ListMultiCollateralRecords + +> []MultiCollateralRecord ListMultiCollateralRecords(ctx, optional) + +Query collateral adjustment records + +### Required Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- +**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. +**optional** | **ListMultiCollateralRecordsOpts** | optional parameters | nil if no parameters + +### Optional Parameters + +Optional parameters are passed through a pointer to a ListMultiCollateralRecordsOpts struct + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- +**page** | **optional.Int32**| Page number | [default to 1] +**limit** | **optional.Int32**| Maximum number of records to be returned in a single list | [default to 10] +**from** | **optional.Int64**| Start timestamp of the query | +**to** | **optional.Int64**| Time range ending, default to current time | +**collateralCurrency** | **optional.String**| Collateral | + +### Example + +```golang +package main + +import ( + "context" + "fmt" + + "github.com/gateio/gateapi-go/v6" +) + +func main() { + client := gateapi.NewAPIClient(gateapi.NewConfiguration()) + // uncomment the next line if your are testing against testnet + // client.ChangeBasePath("https://fx-api-testnet.gateio.ws/api/v4") + ctx := context.WithValue(context.Background(), + gateapi.ContextGateAPIV4, + gateapi.GateAPIV4{ + Key: "YOUR_API_KEY", + Secret: "YOUR_API_SECRET", + } + ) + + result, _, err := client.MultiCollateralLoanApi.ListMultiCollateralRecords(ctx, nil) + if err != nil { + if e, ok := err.(gateapi.GateAPIError); ok { + fmt.Printf("gate api error: %s\n", e.Error()) + } else { + fmt.Printf("generic error: %s\n", err.Error()) + } + } else { + fmt.Println(result) + } +} +``` + + +### Return type + +[**[]MultiCollateralRecord**](MultiCollateralRecord.md) + +### Authorization + +[apiv4](../README.md#apiv4) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) +[[Back to Model list]](../README.md#documentation-for-models) +[[Back to README]](../README.md) + +## OperateMultiCollateral + +> CollateralAdjustRes OperateMultiCollateral(ctx, collateralAdjust) + +Operate Multi-Collateral + +### Required Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- +**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. +**collateralAdjust** | [**CollateralAdjust**](CollateralAdjust.md)| | + +### Example + +```golang +package main + +import ( + "context" + "fmt" + + "github.com/gateio/gateapi-go/v6" +) + +func main() { + client := gateapi.NewAPIClient(gateapi.NewConfiguration()) + // uncomment the next line if your are testing against testnet + // client.ChangeBasePath("https://fx-api-testnet.gateio.ws/api/v4") + ctx := context.WithValue(context.Background(), + gateapi.ContextGateAPIV4, + gateapi.GateAPIV4{ + Key: "YOUR_API_KEY", + Secret: "YOUR_API_SECRET", + } + ) + collateralAdjust := gateapi.CollateralAdjust{} // CollateralAdjust - + + result, _, err := client.MultiCollateralLoanApi.OperateMultiCollateral(ctx, collateralAdjust) + if err != nil { + if e, ok := err.(gateapi.GateAPIError); ok { + fmt.Printf("gate api error: %s\n", e.Error()) + } else { + fmt.Printf("generic error: %s\n", err.Error()) + } + } else { + fmt.Println(result) + } +} +``` + + +### Return type + +[**CollateralAdjustRes**](CollateralAdjustRes.md) + +### Authorization + +[apiv4](../README.md#apiv4) + +### HTTP request headers + +- **Content-Type**: application/json +- **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) +[[Back to Model list]](../README.md#documentation-for-models) +[[Back to README]](../README.md) + +## ListUserCurrencyQuota + +> []CurrencyQuota ListUserCurrencyQuota(ctx, type_, currency) + +List User Currency Quota + +### Required Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- +**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. +**type_** | **string**| Currency types: collateral - collateral currency, borrow - borrowing currency. | +**currency** | **string**| When specifying collateral currencies, you can use commas to separate multiple currencies; for borrowing currencies, only one currency can be provided. | + +### Example + +```golang +package main + +import ( + "context" + "fmt" + + "github.com/gateio/gateapi-go/v6" +) + +func main() { + client := gateapi.NewAPIClient(gateapi.NewConfiguration()) + // uncomment the next line if your are testing against testnet + // client.ChangeBasePath("https://fx-api-testnet.gateio.ws/api/v4") + ctx := context.WithValue(context.Background(), + gateapi.ContextGateAPIV4, + gateapi.GateAPIV4{ + Key: "YOUR_API_KEY", + Secret: "YOUR_API_SECRET", + } + ) + type_ := "collateral" // string - Currency types: collateral - collateral currency, borrow - borrowing currency. + currency := "BTC" // string - When specifying collateral currencies, you can use commas to separate multiple currencies; for borrowing currencies, only one currency can be provided. + + result, _, err := client.MultiCollateralLoanApi.ListUserCurrencyQuota(ctx, type_, currency) + if err != nil { + if e, ok := err.(gateapi.GateAPIError); ok { + fmt.Printf("gate api error: %s\n", e.Error()) + } else { + fmt.Printf("generic error: %s\n", err.Error()) + } + } else { + fmt.Println(result) + } +} +``` + + +### Return type + +[**[]CurrencyQuota**](CurrencyQuota.md) + +### Authorization + +[apiv4](../README.md#apiv4) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) +[[Back to Model list]](../README.md#documentation-for-models) +[[Back to README]](../README.md) + +## ListMultiCollateralCurrencies + +> MultiCollateralCurrency ListMultiCollateralCurrencies(ctx, ) + +Query supported borrowing and collateral currencies in Multi-Collateral + +### Required Parameters + + +### Example + +```golang +package main + +import ( + "context" + "fmt" + + "github.com/gateio/gateapi-go/v6" +) + +func main() { + client := gateapi.NewAPIClient(gateapi.NewConfiguration()) + // uncomment the next line if your are testing against testnet + // client.ChangeBasePath("https://fx-api-testnet.gateio.ws/api/v4") + ctx := context.Background() + + result, _, err := client.MultiCollateralLoanApi.ListMultiCollateralCurrencies(ctx) + if err != nil { + if e, ok := err.(gateapi.GateAPIError); ok { + fmt.Printf("gate api error: %s\n", e.Error()) + } else { + fmt.Printf("generic error: %s\n", err.Error()) + } + } else { + fmt.Println(result) + } +} +``` + + +### Return type + +[**MultiCollateralCurrency**](MultiCollateralCurrency.md) + +### Authorization + +No authorization required + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) +[[Back to Model list]](../README.md#documentation-for-models) +[[Back to README]](../README.md) + +## GetMultiCollateralLtv + +> CollateralLtv GetMultiCollateralLtv(ctx, ) + +Get Multi-Collateral ratio + +The Multi-Collateral ratio is fixed, irrespective of the currency. + +### Required Parameters + + +### Example + +```golang +package main + +import ( + "context" + "fmt" + + "github.com/gateio/gateapi-go/v6" +) + +func main() { + client := gateapi.NewAPIClient(gateapi.NewConfiguration()) + // uncomment the next line if your are testing against testnet + // client.ChangeBasePath("https://fx-api-testnet.gateio.ws/api/v4") + ctx := context.Background() + + result, _, err := client.MultiCollateralLoanApi.GetMultiCollateralLtv(ctx) + if err != nil { + if e, ok := err.(gateapi.GateAPIError); ok { + fmt.Printf("gate api error: %s\n", e.Error()) + } else { + fmt.Printf("generic error: %s\n", err.Error()) + } + } else { + fmt.Println(result) + } +} +``` + + +### Return type + +[**CollateralLtv**](CollateralLtv.md) + +### Authorization + +No authorization required + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) +[[Back to Model list]](../README.md#documentation-for-models) +[[Back to README]](../README.md) + +## GetMultiCollateralFixRate + +> []CollateralFixRate GetMultiCollateralFixRate(ctx, ) + +Query fixed interest rates for the currency for 7 days and 30 days + +### Required Parameters + + +### Example + +```golang +package main + +import ( + "context" + "fmt" + + "github.com/gateio/gateapi-go/v6" +) + +func main() { + client := gateapi.NewAPIClient(gateapi.NewConfiguration()) + // uncomment the next line if your are testing against testnet + // client.ChangeBasePath("https://fx-api-testnet.gateio.ws/api/v4") + ctx := context.Background() + + result, _, err := client.MultiCollateralLoanApi.GetMultiCollateralFixRate(ctx) + if err != nil { + if e, ok := err.(gateapi.GateAPIError); ok { + fmt.Printf("gate api error: %s\n", e.Error()) + } else { + fmt.Printf("generic error: %s\n", err.Error()) + } + } else { + fmt.Println(result) + } +} +``` + + +### Return type + +[**[]CollateralFixRate**](CollateralFixRate.md) + +### Authorization + +No authorization required + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) +[[Back to Model list]](../README.md#documentation-for-models) +[[Back to README]](../README.md) diff --git a/docs/MultiCollateralOrder.md b/docs/MultiCollateralOrder.md new file mode 100644 index 0000000..ba19551 --- /dev/null +++ b/docs/MultiCollateralOrder.md @@ -0,0 +1,24 @@ +# MultiCollateralOrder + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**OrderId** | **string** | Order ID | [optional] +**OrderType** | **string** | current - current, fixed - fixed | [optional] +**FixedType** | **string** | Fixed interest rate loan periods: 7d - 7 days, 30d - 30 days. | [optional] +**FixedRate** | **string** | Fixed interest rate | [optional] +**ExpireTime** | **int64** | Expiration time, timestamp, unit in seconds. | [optional] +**AutoRenew** | **bool** | Fixed interest rate, automatic renewal | [optional] +**AutoRepay** | **bool** | Fixed interest rate, automatic repayment | [optional] +**CurrentLtv** | **string** | The current collateralization rate | [optional] +**Status** | **string** | Order status: - initial: Initial state after placing the order - collateral_deducted: Collateral deduction successful - collateral_returning: Loan failed - Collateral return pending - lent: Loan successful - repaying: Repayment in progress - liquidating: Liquidation in progress - finished: Order completed - closed_liquidated: Liquidation and repayment completed | [optional] +**BorrowTime** | **int64** | Borrowing time, timestamp in seconds | [optional] +**TotalLeftRepayUsdt** | **string** | Value of Left repay amount converted in USDT | [optional] +**TotalLeftCollateralUsdt** | **string** | Value of Collateral amount in USDT | [optional] +**BorrowCurrencies** | [**[]BorrowCurrencyInfo**](BorrowCurrencyInfo.md) | Borrowing Currency List | [optional] +**CollateralCurrencies** | [**[]CollateralCurrencyInfo**](CollateralCurrencyInfo.md) | Collateral Currency List | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/MultiCollateralRecord.md b/docs/MultiCollateralRecord.md new file mode 100644 index 0000000..c461fb1 --- /dev/null +++ b/docs/MultiCollateralRecord.md @@ -0,0 +1,17 @@ +# MultiCollateralRecord + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**OrderId** | **int64** | Order ID | [optional] +**RecordId** | **int64** | Collateral record ID | [optional] +**BeforeLtv** | **string** | The collateral ratio before adjustment | [optional] +**AfterLtv** | **string** | The collateral ratio before adjustment | [optional] +**OperateTime** | **int64** | Operation time, timestamp in seconds. | [optional] +**BorrowCurrencies** | [**[]MultiCollateralRecordCurrency**](MultiCollateralRecordCurrency.md) | Borrowing Currency List | [optional] +**CollateralCurrencies** | [**[]MultiCollateralRecordCurrency**](MultiCollateralRecordCurrency.md) | Collateral Currency List | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/MultiCollateralRecordCurrency.md b/docs/MultiCollateralRecordCurrency.md new file mode 100644 index 0000000..1222586 --- /dev/null +++ b/docs/MultiCollateralRecordCurrency.md @@ -0,0 +1,16 @@ +# MultiCollateralRecordCurrency + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Currency** | **string** | Currency | [optional] +**IndexPrice** | **string** | Currency Index Price | [optional] +**BeforeAmount** | **string** | Amount before the operation | [optional] +**BeforeAmountUsdt** | **string** | USDT Amount before the operation. | [optional] +**AfterAmount** | **string** | Amount after the operation. | [optional] +**AfterAmountUsdt** | **string** | USDT Amount after the operation. | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/MultiLoanItem.md b/docs/MultiLoanItem.md new file mode 100644 index 0000000..1d871b1 --- /dev/null +++ b/docs/MultiLoanItem.md @@ -0,0 +1,12 @@ +# MultiLoanItem + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Currency** | **string** | Currency | [optional] +**Price** | **string** | Latest price of the currency | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/MultiLoanRepayItem.md b/docs/MultiLoanRepayItem.md new file mode 100644 index 0000000..26c5531 --- /dev/null +++ b/docs/MultiLoanRepayItem.md @@ -0,0 +1,13 @@ +# MultiLoanRepayItem + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Currency** | **string** | Repayment currency | [optional] +**Amount** | **string** | Size | [optional] +**RepaidAll** | **bool** | Repayment method, set to true for full repayment, false for partial repayment. | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/MultiRepayRecord.md b/docs/MultiRepayRecord.md new file mode 100644 index 0000000..e7df2fe --- /dev/null +++ b/docs/MultiRepayRecord.md @@ -0,0 +1,22 @@ +# MultiRepayRecord + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**OrderId** | **int64** | Order ID | [optional] +**RecordId** | **int64** | Repayment record ID | [optional] +**InitLtv** | **string** | The initial collateralization rate | [optional] +**BeforeLtv** | **string** | Ltv before the operation | [optional] +**AfterLtv** | **string** | Ltv after the operation | [optional] +**BorrowTime** | **int64** | Borrowing time, timestamp in seconds. | [optional] +**RepayTime** | **int64** | Repayment time, timestamp in seconds. | [optional] +**BorrowCurrencies** | [**[]RepayRecordCurrency**](RepayRecordCurrency.md) | List of borrowing information | [optional] +**CollateralCurrencies** | [**[]RepayRecordCurrency**](RepayRecordCurrency.md) | List of collateral information | [optional] +**RepaidCurrencies** | [**[]RepayRecordRepaidCurrency**](RepayRecordRepaidCurrency.md) | Repay Currency List | [optional] +**TotalInterestList** | [**[]RepayRecordTotalInterest**](RepayRecordTotalInterest.md) | Total Interest List | [optional] +**LeftRepayInterestList** | [**[]RepayRecordLeftInterest**](RepayRecordLeftInterest.md) | List of left repay interest | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/MultiRepayResp.md b/docs/MultiRepayResp.md new file mode 100644 index 0000000..9de4b16 --- /dev/null +++ b/docs/MultiRepayResp.md @@ -0,0 +1,12 @@ +# MultiRepayResp + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**OrderId** | **int64** | Order ID | [optional] +**RepaidCurrencies** | [**[]RepayCurrencyRes**](RepayCurrencyRes.md) | Repay Currency List | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/Order.md b/docs/Order.md index bc6976d..c61e9b3 100644 --- a/docs/Order.md +++ b/docs/Order.md @@ -23,6 +23,7 @@ Name | Type | Description | Notes **AutoBorrow** | **bool** | Used in margin or cross margin trading to allow automatic loan of insufficient amount if balance is not enough. | [optional] **AutoRepay** | **bool** | Enable or disable automatic repayment for automatic borrow loan generated by cross margin order. Default is disabled. Note that: 1. This field is only effective for cross margin orders. Margin account does not support setting auto repayment for orders. 2. `auto_borrow` and `auto_repay` cannot be both set to true in one order. | [optional] **Left** | **string** | Amount left to fill | [optional] [readonly] +**FilledAmount** | **string** | Amount traded to fill | [optional] [readonly] **FillPrice** | **string** | Total filled in quote currency. Deprecated in favor of `filled_total` | [optional] [readonly] **FilledTotal** | **string** | Total filled in quote currency | [optional] [readonly] **AvgDealPrice** | **string** | Average fill price | [optional] [readonly] @@ -38,6 +39,7 @@ Name | Type | Description | Notes **StpId** | **int32** | Orders between users in the same `stp_id` group are not allowed to be self-traded 1. If the `stp_id` of two orders being matched is non-zero and equal, they will not be executed. Instead, the corresponding strategy will be executed based on the `stp_act` of the taker. 2. `stp_id` returns `0` by default for orders that have not been set for `STP group` | [optional] [readonly] **StpAct** | **string** | Self-Trading Prevention Action. Users can use this field to set self-trade prevetion strategies 1. After users join the `STP Group`, he can pass `stp_act` to limit the user's self-trade prevetion strategy. If `stp_act` is not passed, the default is `cn` strategy。 2. When the user does not join the `STP group`, an error will be returned when passing the `stp_act` parameter。 3. If the user did not use 'stp_act' when placing the order, 'stp_act' will return '-' - cn: Cancel newest, Cancel new orders and keep old ones - co: Cancel oldest, Cancel old orders and keep new ones - cb: Cancel both, Both old and new orders will be cancelled | [optional] **FinishAs** | **string** | How the order was finished. - open: processing - filled: filled totally - cancelled: manually cancelled - ioc: time in force is `IOC`, finish immediately - stp: cancelled because self trade prevention | [optional] [readonly] +**ActionMode** | **string** | Processing Mode: When placing an order, different fields are returned based on action_mode. This field is only valid during the request and is not included in the response result ACK: Asynchronous mode, only returns key order fields RESULT: No clearing information FULL: Full mode (default) | [optional] [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/docs/OrderPatch.md b/docs/OrderPatch.md index 4463ac9..ccb6ce8 100644 --- a/docs/OrderPatch.md +++ b/docs/OrderPatch.md @@ -7,6 +7,7 @@ Name | Type | Description | Notes **Amount** | **string** | New order amount. `amount` and `price` must specify one of them | [optional] **Price** | **string** | New order price. `amount` and `Price` must specify one of them\" | [optional] **AmendText** | **string** | Custom info during amending order | [optional] +**ActionMode** | **string** | Processing Mode: When placing an order, different fields are returned based on action_mode. This field is only valid during the request and is not included in the response result ACK: Asynchronous mode, only returns key order fields RESULT: No clearing information FULL: Full mode (default) | [optional] [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/docs/Position.md b/docs/Position.md index 99ad589..c5d7a39 100644 --- a/docs/Position.md +++ b/docs/Position.md @@ -30,6 +30,7 @@ Name | Type | Description | Notes **Mode** | **string** | Position mode, including: - `single`: dual mode is not enabled- `dual_long`: long position in dual mode- `dual_short`: short position in dual mode | [optional] **CrossLeverageLimit** | **string** | Cross margin leverage(valid only when `leverage` is 0) | [optional] **UpdateTime** | **int64** | Last update time | [optional] [readonly] +**OpenTime** | **int64** | First Open Time | [optional] [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/docs/PositionClose.md b/docs/PositionClose.md index 175b566..f3e722b 100644 --- a/docs/PositionClose.md +++ b/docs/PositionClose.md @@ -9,6 +9,10 @@ Name | Type | Description | Notes **Side** | **string** | Position side, long or short | [optional] [readonly] **Pnl** | **string** | PNL | [optional] [readonly] **Text** | **string** | Text of close order | [optional] [readonly] +**MaxSize** | **string** | Max Trade Size | [optional] [readonly] +**FirstOpenTime** | **int64** | First Open Time | [optional] [readonly] +**LongPrice** | **string** | When 'side' is 'long,' it indicates the opening average price; when 'side' is 'short,' it indicates the closing average price. | [optional] [readonly] +**ShortPrice** | **string** | When 'side' is 'long,' it indicates the opening average price; when 'side' is 'short,' it indicates the closing average price | [optional] [readonly] [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/docs/RebateApi.md b/docs/RebateApi.md index cf8d459..ec89f36 100644 --- a/docs/RebateApi.md +++ b/docs/RebateApi.md @@ -4,15 +4,17 @@ All URIs are relative to *https://api.gateio.ws/api/v4* Method | HTTP request | Description ------------- | ------------- | ------------- -[**AgencyTransactionHistory**](RebateApi.md#AgencyTransactionHistory) | **Get** /rebate/agency/transaction_history | The broker obtains the transaction history of the recommended user -[**AgencyCommissionsHistory**](RebateApi.md#AgencyCommissionsHistory) | **Get** /rebate/agency/commission_history | The broker obtains the commission history of the recommended user +[**AgencyTransactionHistory**](RebateApi.md#AgencyTransactionHistory) | **Get** /rebate/agency/transaction_history | The agency obtains the transaction history of the recommended user +[**AgencyCommissionsHistory**](RebateApi.md#AgencyCommissionsHistory) | **Get** /rebate/agency/commission_history | The agency obtains the commission history of the recommended user +[**RebateBrokerCommissionHistory**](RebateApi.md#RebateBrokerCommissionHistory) | **Get** /rebate/broker/commission_history | The broker obtains the user's commission rebate records +[**RebateBrokerTransactionHistory**](RebateApi.md#RebateBrokerTransactionHistory) | **Get** /rebate/broker/transaction_history | The broker obtains the user's trading history ## AgencyTransactionHistory > []AgencyTransactionHistory AgencyTransactionHistory(ctx, optional) -The broker obtains the transaction history of the recommended user +The agency obtains the transaction history of the recommended user Record time range cannot exceed 30 days @@ -30,7 +32,7 @@ Optional parameters are passed through a pointer to a AgencyTransactionHistoryOp Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **currencyPair** | **optional.String**| Specify the currency pair, if not specified, return all currency pairs | -**userId** | **optional.String**| User ID. If not specified, all user records will be returned | +**userId** | **optional.Int64**| User ID. If not specified, all user records will be returned | **from** | **optional.Int64**| Time range beginning, default to 7 days before current time | **to** | **optional.Int64**| Time range ending, default to current time | **limit** | **optional.Int32**| Maximum number of records to be returned in a single list | [default to 100] @@ -95,7 +97,7 @@ func main() { > []AgencyCommissionHistory AgencyCommissionsHistory(ctx, optional) -The broker obtains the commission history of the recommended user +The agency obtains the commission history of the recommended user Record time range cannot exceed 30 days @@ -113,7 +115,7 @@ Optional parameters are passed through a pointer to a AgencyCommissionsHistoryOp Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **currency** | **optional.String**| Filter by currency. Return all currency records if not specified | -**userId** | **optional.String**| User ID. If not specified, all user records will be returned | +**userId** | **optional.Int64**| User ID. If not specified, all user records will be returned | **from** | **optional.Int64**| Time range beginning, default to 7 days before current time | **to** | **optional.Int64**| Time range ending, default to current time | **limit** | **optional.Int32**| Maximum number of records to be returned in a single list | [default to 100] @@ -173,3 +175,163 @@ func main() { [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +## RebateBrokerCommissionHistory + +> []BrokerCommission RebateBrokerCommissionHistory(ctx, optional) + +The broker obtains the user's commission rebate records + +Record time range cannot exceed 30 days + +### Required Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- +**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. +**optional** | **RebateBrokerCommissionHistoryOpts** | optional parameters | nil if no parameters + +### Optional Parameters + +Optional parameters are passed through a pointer to a RebateBrokerCommissionHistoryOpts struct + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- +**limit** | **optional.Int32**| Maximum number of records to be returned in a single list | [default to 100] +**offset** | **optional.Int32**| List offset, starting from 0 | [default to 0] +**userId** | **optional.Int64**| User ID. If not specified, all user records will be returned | + +### Example + +```golang +package main + +import ( + "context" + "fmt" + + "github.com/gateio/gateapi-go/v6" +) + +func main() { + client := gateapi.NewAPIClient(gateapi.NewConfiguration()) + // uncomment the next line if your are testing against testnet + // client.ChangeBasePath("https://fx-api-testnet.gateio.ws/api/v4") + ctx := context.WithValue(context.Background(), + gateapi.ContextGateAPIV4, + gateapi.GateAPIV4{ + Key: "YOUR_API_KEY", + Secret: "YOUR_API_SECRET", + } + ) + + result, _, err := client.RebateApi.RebateBrokerCommissionHistory(ctx, nil) + if err != nil { + if e, ok := err.(gateapi.GateAPIError); ok { + fmt.Printf("gate api error: %s\n", e.Error()) + } else { + fmt.Printf("generic error: %s\n", err.Error()) + } + } else { + fmt.Println(result) + } +} +``` + + +### Return type + +[**[]BrokerCommission**](BrokerCommission.md) + +### Authorization + +[apiv4](../README.md#apiv4) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) +[[Back to Model list]](../README.md#documentation-for-models) +[[Back to README]](../README.md) + +## RebateBrokerTransactionHistory + +> []BrokerTransaction RebateBrokerTransactionHistory(ctx, optional) + +The broker obtains the user's trading history + +Record time range cannot exceed 30 days + +### Required Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- +**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. +**optional** | **RebateBrokerTransactionHistoryOpts** | optional parameters | nil if no parameters + +### Optional Parameters + +Optional parameters are passed through a pointer to a RebateBrokerTransactionHistoryOpts struct + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- +**limit** | **optional.Int32**| Maximum number of records to be returned in a single list | [default to 100] +**offset** | **optional.Int32**| List offset, starting from 0 | [default to 0] +**userId** | **optional.Int64**| User ID. If not specified, all user records will be returned | + +### Example + +```golang +package main + +import ( + "context" + "fmt" + + "github.com/gateio/gateapi-go/v6" +) + +func main() { + client := gateapi.NewAPIClient(gateapi.NewConfiguration()) + // uncomment the next line if your are testing against testnet + // client.ChangeBasePath("https://fx-api-testnet.gateio.ws/api/v4") + ctx := context.WithValue(context.Background(), + gateapi.ContextGateAPIV4, + gateapi.GateAPIV4{ + Key: "YOUR_API_KEY", + Secret: "YOUR_API_SECRET", + } + ) + + result, _, err := client.RebateApi.RebateBrokerTransactionHistory(ctx, nil) + if err != nil { + if e, ok := err.(gateapi.GateAPIError); ok { + fmt.Printf("gate api error: %s\n", e.Error()) + } else { + fmt.Printf("generic error: %s\n", err.Error()) + } + } else { + fmt.Println(result) + } +} +``` + + +### Return type + +[**[]BrokerTransaction**](BrokerTransaction.md) + +### Authorization + +[apiv4](../README.md#apiv4) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) +[[Back to Model list]](../README.md#documentation-for-models) +[[Back to README]](../README.md) diff --git a/docs/RepayCurrencyRes.md b/docs/RepayCurrencyRes.md new file mode 100644 index 0000000..3e3fb81 --- /dev/null +++ b/docs/RepayCurrencyRes.md @@ -0,0 +1,16 @@ +# RepayCurrencyRes + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Succeeded** | **bool** | Has the repayment been successful | [optional] +**Label** | **string** | Error identifier for unsuccessful operations; empty for successful. | [optional] +**Message** | **string** | Error description in case of operation failure; empty when successful. | [optional] +**Currency** | **string** | Repayment currency | [optional] +**RepaidPrincipal** | **string** | Principal | [optional] +**RepaidInterest** | **string** | Principal | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/RepayMultiLoan.md b/docs/RepayMultiLoan.md new file mode 100644 index 0000000..70b13b7 --- /dev/null +++ b/docs/RepayMultiLoan.md @@ -0,0 +1,12 @@ +# RepayMultiLoan + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**OrderId** | **int64** | Order ID | +**RepayItems** | [**[]MultiLoanRepayItem**](MultiLoanRepayItem.md) | Repay Currency Item | + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/RepayRecordCurrency.md b/docs/RepayRecordCurrency.md new file mode 100644 index 0000000..3623ecc --- /dev/null +++ b/docs/RepayRecordCurrency.md @@ -0,0 +1,16 @@ +# RepayRecordCurrency + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Currency** | **string** | Currency | [optional] +**IndexPrice** | **string** | Currency Index Price | [optional] +**BeforeAmount** | **string** | Amount before the operation | [optional] +**BeforeAmountUsdt** | **string** | USDT Amount before the operation. | [optional] +**AfterAmount** | **string** | Amount after the operation. | [optional] +**AfterAmountUsdt** | **string** | USDT Amount after the operation. | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/RepayRecordLeftInterest.md b/docs/RepayRecordLeftInterest.md new file mode 100644 index 0000000..1d06f3e --- /dev/null +++ b/docs/RepayRecordLeftInterest.md @@ -0,0 +1,16 @@ +# RepayRecordLeftInterest + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Currency** | **string** | Currency | [optional] +**IndexPrice** | **string** | Currency Index Price | [optional] +**BeforeAmount** | **string** | Interest amount before repayment | [optional] +**BeforeAmountUsdt** | **string** | Converted value of interest before repayment in USDT | [optional] +**AfterAmount** | **string** | Interest amount after repayment | [optional] +**AfterAmountUsdt** | **string** | Converted value of interest after repayment in USDT | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/RepayRecordRepaidCurrency.md b/docs/RepayRecordRepaidCurrency.md new file mode 100644 index 0000000..2583bd7 --- /dev/null +++ b/docs/RepayRecordRepaidCurrency.md @@ -0,0 +1,16 @@ +# RepayRecordRepaidCurrency + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Currency** | **string** | Repayment currency | [optional] +**IndexPrice** | **string** | Currency Index Price | [optional] +**RepaidAmount** | **string** | Repayment amount | [optional] +**RepaidPrincipal** | **string** | Principal | [optional] +**RepaidInterest** | **string** | Interest | [optional] +**RepaidAmountUsdt** | **string** | Value of the repayment amount in USDT | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/RepayRecordTotalInterest.md b/docs/RepayRecordTotalInterest.md new file mode 100644 index 0000000..fd2858b --- /dev/null +++ b/docs/RepayRecordTotalInterest.md @@ -0,0 +1,14 @@ +# RepayRecordTotalInterest + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Currency** | **string** | Currency | [optional] +**IndexPrice** | **string** | Currency Index Price | [optional] +**Amount** | **string** | Interest Amount | [optional] +**AmountUsdt** | **string** | Interest amount converted to USDT | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/SmallBalance.md b/docs/SmallBalance.md new file mode 100644 index 0000000..53549d8 --- /dev/null +++ b/docs/SmallBalance.md @@ -0,0 +1,14 @@ +# SmallBalance + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Currency** | **string** | Currency | [optional] +**AvailableBalance** | **string** | Available balance | [optional] +**EstimatedAsBtc** | **string** | Estimated as BTC | [optional] +**ConvertibleToGt** | **string** | Estimated conversion to GT | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/SmallBalanceHistory.md b/docs/SmallBalanceHistory.md new file mode 100644 index 0000000..a918019 --- /dev/null +++ b/docs/SmallBalanceHistory.md @@ -0,0 +1,15 @@ +# SmallBalanceHistory + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Id** | **string** | Order ID | [optional] [readonly] +**Currency** | **string** | Currency | [optional] [readonly] +**Amount** | **string** | amount | [optional] [readonly] +**GtAmount** | **string** | GT amount | [optional] [readonly] +**CreateTime** | **int64** | Exchange time (in seconds) | [optional] [readonly] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/SpotApi.md b/docs/SpotApi.md index 3e62cb9..56cd372 100644 --- a/docs/SpotApi.md +++ b/docs/SpotApi.md @@ -588,7 +588,7 @@ No authorization required ## GetFee -> TradeFee GetFee(ctx, optional) +> SpotFee GetFee(ctx, optional) Query user trading fee rates @@ -649,7 +649,7 @@ func main() { ### Return type -[**TradeFee**](TradeFee.md) +[**SpotFee**](SpotFee.md) ### Authorization @@ -1296,6 +1296,7 @@ Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **side** | **optional.String**| All bids or asks. Both included if not specified | **account** | **optional.String**| Specify account type - classic account:Default to all account types being included - portfolio margin account:`cross_margin` only | +**actionMode** | **optional.String**| Processing Mode When placing an order, different fields are returned based on the action_mode - ACK: Asynchronous mode, returns only key order fields - RESULT: No clearing information - FULL: Full mode (default) | ### Example @@ -1530,6 +1531,7 @@ Optional parameters are passed through a pointer to a CancelOrderOpts struct Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **account** | **optional.String**| Specify operation account. Default to spot ,portfolio and margin account if not specified. Set to `cross_margin` to operate against margin account. Portfolio margin account must set to `cross_margin` only | +**actionMode** | **optional.String**| Processing Mode When placing an order, different fields are returned based on the action_mode - ACK: Asynchronous mode, returns only key order fields - RESULT: No clearing information - FULL: Full mode (default) | ### Example @@ -1887,7 +1889,7 @@ func main() { ## AmendBatchOrders -> []AmendOrderResult AmendBatchOrders(ctx, batchAmendItem) +> []BatchOrder AmendBatchOrders(ctx, batchAmendItem) Batch modification of orders @@ -1941,7 +1943,7 @@ func main() { ### Return type -[**[]AmendOrderResult**](AmendOrderResult.md) +[**[]BatchOrder**](BatchOrder.md) ### Authorization diff --git a/docs/SpotFee.md b/docs/SpotFee.md index 3aa5d98..78f2ab9 100644 --- a/docs/SpotFee.md +++ b/docs/SpotFee.md @@ -13,6 +13,7 @@ Name | Type | Description | Notes **LoanFee** | **string** | Loan fee rate of margin lending | [optional] **PointType** | **string** | Point type. 0 - Initial version. 1 - new version since 202009 | [optional] **CurrencyPair** | **string** | Currency pair | [optional] +**DebitFee** | **int32** | Deduction types for rates, 1 - GT deduction, 2 - Point card deduction, 3 - VIP rates | [optional] [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/docs/SubAccountToSubAccount.md b/docs/SubAccountToSubAccount.md index 61790f9..af20a3d 100644 --- a/docs/SubAccountToSubAccount.md +++ b/docs/SubAccountToSubAccount.md @@ -7,9 +7,9 @@ Name | Type | Description | Notes **Currency** | **string** | Transfer currency name | **SubAccountType** | **string** | Transfer from the account. (deprecate, use `sub_account_from_type` and `sub_account_to_type` instead) | [optional] **SubAccountFrom** | **string** | Transfer from the user id of the sub-account | -**SubAccountFromType** | **string** | Transfer from the account. `spot` - spot account, `futures` - perpetual contract account, `cross_margin` - cross margin account | +**SubAccountFromType** | **string** | The sub-account's outgoing trading account, spot - spot account, futures - perpetual contract account, delivery - delivery contract account, cross_margin - cross-margin account.\" | **SubAccountTo** | **string** | Transfer to the user id of the sub-account | -**SubAccountToType** | **string** | Transfer to the account. `spot` - spot account, `futures` - perpetual contract account, `cross_margin` - cross margin account | +**SubAccountToType** | **string** | The sub-account's incoming trading account, spot - spot account, futures - perpetual contract account, delivery - delivery contract account, cross_margin - cross-margin account. | **Amount** | **string** | Transfer amount | [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/docs/SubAccountTransfer.md b/docs/SubAccountTransfer.md index 638d3f7..ef84730 100644 --- a/docs/SubAccountTransfer.md +++ b/docs/SubAccountTransfer.md @@ -12,7 +12,7 @@ Name | Type | Description | Notes **ClientOrderId** | **string** | The custom ID provided by the customer serves as a safeguard against duplicate transfers. It can be a combination of letters (case-sensitive), numbers, hyphens '-', and underscores '_', with a length ranging from 1 to 64 characters. | [optional] **Timest** | **string** | Transfer timestamp | [optional] [readonly] **Source** | **string** | Where the operation is initiated from | [optional] [readonly] -**SubAccountType** | **string** | Target sub user's account. `spot` - spot account, `futures` - perpetual contract account, `cross_margin` - cross margin account, `delivery` - delivery account | [optional] [default to SUB_ACCOUNT_TYPE_SPOT] +**SubAccountType** | **string** | Target sub user's account. `spot` - spot account, `futures` - perpetual contract account, `cross_margin` - cross margin account, `delivery` - delivery account | [optional] [default to spot] [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/docs/TradeFee.md b/docs/TradeFee.md index f64ab2c..107b4ac 100644 --- a/docs/TradeFee.md +++ b/docs/TradeFee.md @@ -16,6 +16,7 @@ Name | Type | Description | Notes **FuturesMakerFee** | **string** | Future trading maker fee | [optional] **DeliveryTakerFee** | **string** | Delivery trading taker fee | [optional] **DeliveryMakerFee** | **string** | Delivery trading maker fee | [optional] +**DebitFee** | **int32** | Deduction types for rates, 1 - GT deduction, 2 - Point card deduction, 3 - VIP rates | [optional] [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/docs/UnifiedAccount.md b/docs/UnifiedAccount.md index dbdadcf..77f0f87 100644 --- a/docs/UnifiedAccount.md +++ b/docs/UnifiedAccount.md @@ -8,8 +8,8 @@ Name | Type | Description | Notes **RefreshTime** | **int64** | Time of the most recent refresh | [optional] **Locked** | **bool** | Whether account is locked | [optional] **Balances** | [**map[string]UnifiedBalance**](UnifiedBalance.md) | | [optional] -**Total** | **string** | The total asset value in USDT. Sum of `(available + freeze) * price` | [optional] -**Borrowed** | **string** | The total borrowed amount in USDT equivalent. Sum of `borrowed * price` | [optional] +**Total** | **string** | The total asset value in USD, calculated as the sum of the product of `(available + freeze) * price` for all currencies. | [optional] +**Borrowed** | **string** | The total borrowed amount in USD, calculated as the sum of the product of `borrowed * price` for all currencies (excluding points cards). | [optional] **TotalInitialMargin** | **string** | Total initial margin | [optional] **TotalMarginBalance** | **string** | Total margin balance | [optional] **TotalMaintenanceMargin** | **string** | Total maintenance margin | [optional] diff --git a/docs/UnifiedApi.md b/docs/UnifiedApi.md index 88caba4..a0044d4 100644 --- a/docs/UnifiedApi.md +++ b/docs/UnifiedApi.md @@ -13,6 +13,7 @@ Method | HTTP request | Description [**CreateUnifiedLoan**](UnifiedApi.md#CreateUnifiedLoan) | **Post** /unified/loans | Borrow or repay [**ListUnifiedLoanRecords**](UnifiedApi.md#ListUnifiedLoanRecords) | **Get** /unified/loan_records | Get load records [**ListUnifiedLoanInterestRecords**](UnifiedApi.md#ListUnifiedLoanInterestRecords) | **Get** /unified/interest_records | List interest records +[**GetUnifiedEstimateRate**](UnifiedApi.md#GetUnifiedEstimateRate) | **Get** /unified/estimate_rate | Get unified estimate rate ## ListUnifiedAccounts @@ -671,3 +672,74 @@ func main() { [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +## GetUnifiedEstimateRate + +> map[string]string GetUnifiedEstimateRate(ctx, currencies) + +Get unified estimate rate + +Due to fluctuations in lending depth, hourly interest rates may vary, and thus, I cannot provide exact rates. When a currency is not supported, the interest rate returned will be an empty string. + +### Required Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- +**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. +**currencies** | [**[]string**](string.md)| Specify the currency names for querying in an array, separated by commas, with a maximum of 10 currencies. | + +### Example + +```golang +package main + +import ( + "context" + "fmt" + + "github.com/gateio/gateapi-go/v6" +) + +func main() { + client := gateapi.NewAPIClient(gateapi.NewConfiguration()) + // uncomment the next line if your are testing against testnet + // client.ChangeBasePath("https://fx-api-testnet.gateio.ws/api/v4") + ctx := context.WithValue(context.Background(), + gateapi.ContextGateAPIV4, + gateapi.GateAPIV4{ + Key: "YOUR_API_KEY", + Secret: "YOUR_API_SECRET", + } + ) + currencies := []string{"[\"BTC\",\"GT\"]"} // []string - Specify the currency names for querying in an array, separated by commas, with a maximum of 10 currencies. + + result, _, err := client.UnifiedApi.GetUnifiedEstimateRate(ctx, currencies) + if err != nil { + if e, ok := err.(gateapi.GateAPIError); ok { + fmt.Printf("gate api error: %s\n", e.Error()) + } else { + fmt.Printf("generic error: %s\n", err.Error()) + } + } else { + fmt.Println(result) + } +} +``` + + +### Return type + +**map[string]string** + +### Authorization + +[apiv4](../README.md#apiv4) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) +[[Back to Model list]](../README.md#documentation-for-models) +[[Back to README]](../README.md) diff --git a/docs/WalletApi.md b/docs/WalletApi.md index 3c52b9f..37691b1 100644 --- a/docs/WalletApi.md +++ b/docs/WalletApi.md @@ -20,6 +20,9 @@ Method | HTTP request | Description [**ListSavedAddress**](WalletApi.md#ListSavedAddress) | **Get** /wallet/saved_address | Query saved address [**GetTradeFee**](WalletApi.md#GetTradeFee) | **Get** /wallet/fee | Retrieve personal trading fee [**GetTotalBalance**](WalletApi.md#GetTotalBalance) | **Get** /wallet/total_balance | Retrieve user's total balances +[**ListSmallBalance**](WalletApi.md#ListSmallBalance) | **Get** /wallet/small_balance | List small balance +[**ConvertSmallBalance**](WalletApi.md#ConvertSmallBalance) | **Post** /wallet/small_balance | Convert small balance +[**ListSmallBalanceHistory**](WalletApi.md#ListSmallBalanceHistory) | **Get** /wallet/small_balance_history | List small balance history ## ListCurrencyChains @@ -1227,3 +1230,214 @@ func main() { [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +## ListSmallBalance + +> SmallBalance ListSmallBalance(ctx, ) + +List small balance + +### Required Parameters + + +### Example + +```golang +package main + +import ( + "context" + "fmt" + + "github.com/gateio/gateapi-go/v6" +) + +func main() { + client := gateapi.NewAPIClient(gateapi.NewConfiguration()) + // uncomment the next line if your are testing against testnet + // client.ChangeBasePath("https://fx-api-testnet.gateio.ws/api/v4") + ctx := context.WithValue(context.Background(), + gateapi.ContextGateAPIV4, + gateapi.GateAPIV4{ + Key: "YOUR_API_KEY", + Secret: "YOUR_API_SECRET", + } + ) + + result, _, err := client.WalletApi.ListSmallBalance(ctx) + if err != nil { + if e, ok := err.(gateapi.GateAPIError); ok { + fmt.Printf("gate api error: %s\n", e.Error()) + } else { + fmt.Printf("generic error: %s\n", err.Error()) + } + } else { + fmt.Println(result) + } +} +``` + + +### Return type + +[**SmallBalance**](SmallBalance.md) + +### Authorization + +[apiv4](../README.md#apiv4) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) +[[Back to Model list]](../README.md#documentation-for-models) +[[Back to README]](../README.md) + +## ConvertSmallBalance + +> ConvertSmallBalance(ctx, convertSmallBalance) + +Convert small balance + +### Required Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- +**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. +**convertSmallBalance** | [**ConvertSmallBalance**](ConvertSmallBalance.md)| | + +### Example + +```golang +package main + +import ( + "context" + "fmt" + + "github.com/gateio/gateapi-go/v6" +) + +func main() { + client := gateapi.NewAPIClient(gateapi.NewConfiguration()) + // uncomment the next line if your are testing against testnet + // client.ChangeBasePath("https://fx-api-testnet.gateio.ws/api/v4") + ctx := context.WithValue(context.Background(), + gateapi.ContextGateAPIV4, + gateapi.GateAPIV4{ + Key: "YOUR_API_KEY", + Secret: "YOUR_API_SECRET", + } + ) + convertSmallBalance := gateapi.ConvertSmallBalance{} // ConvertSmallBalance - + + result, _, err := client.WalletApi.ConvertSmallBalance(ctx, convertSmallBalance) + if err != nil { + if e, ok := err.(gateapi.GateAPIError); ok { + fmt.Printf("gate api error: %s\n", e.Error()) + } else { + fmt.Printf("generic error: %s\n", err.Error()) + } + } else { + fmt.Println(result) + } +} +``` + + +### Return type + + (empty response body) + +### Authorization + +[apiv4](../README.md#apiv4) + +### HTTP request headers + +- **Content-Type**: application/json +- **Accept**: Not defined + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) +[[Back to Model list]](../README.md#documentation-for-models) +[[Back to README]](../README.md) + +## ListSmallBalanceHistory + +> SmallBalanceHistory ListSmallBalanceHistory(ctx, optional) + +List small balance history + +### Required Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- +**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. +**optional** | **ListSmallBalanceHistoryOpts** | optional parameters | nil if no parameters + +### Optional Parameters + +Optional parameters are passed through a pointer to a ListSmallBalanceHistoryOpts struct + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- +**currency** | **optional.String**| Currency | +**page** | **optional.Int32**| Page number | [default to 1] +**limit** | **optional.Int32**| Maximum response items. Default: 100, minimum: 1, Maximum: 100 | [default to 100] + +### Example + +```golang +package main + +import ( + "context" + "fmt" + + "github.com/gateio/gateapi-go/v6" +) + +func main() { + client := gateapi.NewAPIClient(gateapi.NewConfiguration()) + // uncomment the next line if your are testing against testnet + // client.ChangeBasePath("https://fx-api-testnet.gateio.ws/api/v4") + ctx := context.WithValue(context.Background(), + gateapi.ContextGateAPIV4, + gateapi.GateAPIV4{ + Key: "YOUR_API_KEY", + Secret: "YOUR_API_SECRET", + } + ) + + result, _, err := client.WalletApi.ListSmallBalanceHistory(ctx, nil) + if err != nil { + if e, ok := err.(gateapi.GateAPIError); ok { + fmt.Printf("gate api error: %s\n", e.Error()) + } else { + fmt.Printf("generic error: %s\n", err.Error()) + } + } else { + fmt.Println(result) + } +} +``` + + +### Return type + +[**SmallBalanceHistory**](SmallBalanceHistory.md) + +### Authorization + +[apiv4](../README.md#apiv4) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) +[[Back to Model list]](../README.md#documentation-for-models) +[[Back to README]](../README.md) diff --git a/model_account_balance.go b/model_account_balance.go index c26fbac..f9f417d 100644 --- a/model_account_balance.go +++ b/model_account_balance.go @@ -15,4 +15,8 @@ type AccountBalance struct { Amount string `json:"amount,omitempty"` // Currency Currency string `json:"currency,omitempty"` + // Unrealised_pnl, this field will only appear in futures, options, delivery, and total accounts + UnrealisedPnl string `json:"unrealised_pnl,omitempty"` + // Borrowed,this field will only appear in margin and cross_margin accounts + Borrowed string `json:"borrowed,omitempty"` } diff --git a/model_batch_order.go b/model_batch_order.go index 206a936..84c7b4f 100644 --- a/model_batch_order.go +++ b/model_batch_order.go @@ -11,6 +11,10 @@ package gateapi // Batch order details type BatchOrder struct { + // Order ID + OrderId string `json:"order_id,omitempty"` + // The custom data that the user remarked when amending the order + AmendText string `json:"amend_text,omitempty"` // User defined information. If not empty, must follow the rules below: 1. prefixed with `t-` 2. no longer than 28 bytes without `t-` prefix 3. can only include 0-9, A-Z, a-z, underscore(_), hyphen(-) or dot(.) Text string `json:"text,omitempty"` // Whether the batch of orders succeeded @@ -53,10 +57,14 @@ type BatchOrder struct { AutoRepay bool `json:"auto_repay,omitempty"` // Amount left to fill Left string `json:"left,omitempty"` + // Amount traded to fill + FilledAmount string `json:"filled_amount,omitempty"` // Total filled in quote currency. Deprecated in favor of `filled_total` FillPrice string `json:"fill_price,omitempty"` // Total filled in quote currency FilledTotal string `json:"filled_total,omitempty"` + // Average fill price + AvgDealPrice string `json:"avg_deal_price,omitempty"` // Fee deducted Fee string `json:"fee,omitempty"` // Fee currency unit diff --git a/model_borrow_currency_info.go b/model_borrow_currency_info.go new file mode 100644 index 0000000..9ed9c15 --- /dev/null +++ b/model_borrow_currency_info.go @@ -0,0 +1,23 @@ +/* + * Gate API v4 + * + * Welcome to Gate.io API APIv4 provides spot, margin and futures trading operations. There are public APIs to retrieve the real-time market statistics, and private APIs which needs authentication to trade on user's behalf. + * + * Contact: support@mail.gate.io + * Generated by: OpenAPI Generator (https://openapi-generator.tech) + */ + +package gateapi + +type BorrowCurrencyInfo struct { + // Currency + Currency string `json:"currency,omitempty"` + // Currency Index Price + IndexPrice string `json:"index_price,omitempty"` + // outstanding principal + LeftRepayPrincipal string `json:"left_repay_principal,omitempty"` + // outstanding interest + LeftRepayInterest string `json:"left_repay_interest,omitempty"` + // Value of left total repayments amount in USDT + LeftRepayUsdt string `json:"left_repay_usdt,omitempty"` +} diff --git a/model_broker_commission.go b/model_broker_commission.go new file mode 100644 index 0000000..816aaad --- /dev/null +++ b/model_broker_commission.go @@ -0,0 +1,17 @@ +/* + * Gate API v4 + * + * Welcome to Gate.io API APIv4 provides spot, margin and futures trading operations. There are public APIs to retrieve the real-time market statistics, and private APIs which needs authentication to trade on user's behalf. + * + * Contact: support@mail.gate.io + * Generated by: OpenAPI Generator (https://openapi-generator.tech) + */ + +package gateapi + +type BrokerCommission struct { + // Total + Total int64 `json:"total,omitempty"` + // List of comission history + List []BrokerCommission1 `json:"list,omitempty"` +} diff --git a/model_broker_commission_1.go b/model_broker_commission_1.go new file mode 100644 index 0000000..0bc719c --- /dev/null +++ b/model_broker_commission_1.go @@ -0,0 +1,31 @@ +/* + * Gate API v4 + * + * Welcome to Gate.io API APIv4 provides spot, margin and futures trading operations. There are public APIs to retrieve the real-time market statistics, and private APIs which needs authentication to trade on user's behalf. + * + * Contact: support@mail.gate.io + * Generated by: OpenAPI Generator (https://openapi-generator.tech) + */ + +package gateapi + +type BrokerCommission1 struct { + // Commission Time. (unix timestamp) + CommissionTime int64 `json:"commission_time,omitempty"` + // User ID + UserId int64 `json:"user_id,omitempty"` + // Group name + GroupName string `json:"group_name,omitempty"` + // The amount of commission rebates + Amount string `json:"amount,omitempty"` + // Fee + Fee string `json:"fee,omitempty"` + // Fee currency + FeeAsset string `json:"fee_asset,omitempty"` + // The income from rebates, converted to USDT + RebateFee string `json:"rebate_fee,omitempty"` + // Rebate Type: Spot、Futures、Options + Source string `json:"source,omitempty"` + // Currency pair + CurrencyPair string `json:"currency_pair,omitempty"` +} diff --git a/model_broker_transaction.go b/model_broker_transaction.go new file mode 100644 index 0000000..0d49280 --- /dev/null +++ b/model_broker_transaction.go @@ -0,0 +1,17 @@ +/* + * Gate API v4 + * + * Welcome to Gate.io API APIv4 provides spot, margin and futures trading operations. There are public APIs to retrieve the real-time market statistics, and private APIs which needs authentication to trade on user's behalf. + * + * Contact: support@mail.gate.io + * Generated by: OpenAPI Generator (https://openapi-generator.tech) + */ + +package gateapi + +type BrokerTransaction struct { + // Total + Total int64 `json:"total,omitempty"` + // List of transaction history + List []BrokerTransaction1 `json:"list,omitempty"` +} diff --git a/model_broker_transaction_1.go b/model_broker_transaction_1.go new file mode 100644 index 0000000..13d92b7 --- /dev/null +++ b/model_broker_transaction_1.go @@ -0,0 +1,29 @@ +/* + * Gate API v4 + * + * Welcome to Gate.io API APIv4 provides spot, margin and futures trading operations. There are public APIs to retrieve the real-time market statistics, and private APIs which needs authentication to trade on user's behalf. + * + * Contact: support@mail.gate.io + * Generated by: OpenAPI Generator (https://openapi-generator.tech) + */ + +package gateapi + +type BrokerTransaction1 struct { + // Transaction Time. (unix timestamp) + TransactionTime int64 `json:"transaction_time,omitempty"` + // User ID + UserId int64 `json:"user_id,omitempty"` + // Group name + GroupName string `json:"group_name,omitempty"` + // fee (usdt) + Fee string `json:"fee,omitempty"` + // Currency pair + CurrencyPair string `json:"currency_pair,omitempty"` + // Commission Amount + Amount string `json:"amount,omitempty"` + // Fee currency + FeeAsset string `json:"fee_asset,omitempty"` + // Rebate Type: Spot、Futures、Options + Source string `json:"source,omitempty"` +} diff --git a/model_cancel_batch_order.go b/model_cancel_batch_order.go index 8e18356..376400c 100644 --- a/model_cancel_batch_order.go +++ b/model_cancel_batch_order.go @@ -17,4 +17,6 @@ type CancelBatchOrder struct { Id string `json:"id"` // If cancelled order is cross margin order or is portfolio margin account's API key, this field must be set and can only be `cross_margin`If cancelled order is cross margin order, this field must be set and can only be `cross_margin` Account string `json:"account,omitempty"` + // Processing Mode: When placing an order, different fields are returned based on action_mode. This field is only valid during the request and is not included in the response result ACK: Asynchronous mode, only returns key order fields RESULT: No clearing information FULL: Full mode (default) + ActionMode string `json:"action_mode,omitempty"` } diff --git a/model_collateral_adjust.go b/model_collateral_adjust.go new file mode 100644 index 0000000..cac8db4 --- /dev/null +++ b/model_collateral_adjust.go @@ -0,0 +1,19 @@ +/* + * Gate API v4 + * + * Welcome to Gate.io API APIv4 provides spot, margin and futures trading operations. There are public APIs to retrieve the real-time market statistics, and private APIs which needs authentication to trade on user's behalf. + * + * Contact: support@mail.gate.io + * Generated by: OpenAPI Generator (https://openapi-generator.tech) + */ + +package gateapi + +type CollateralAdjust struct { + // Order ID + OrderId int64 `json:"order_id"` + // Operation types: append - for adding collateral, redeem - for withdrawing collateral + Type string `json:"type"` + // Collateral Currency List + Collaterals []CollateralCurrency `json:"collaterals,omitempty"` +} diff --git a/model_collateral_adjust_res.go b/model_collateral_adjust_res.go new file mode 100644 index 0000000..c0f9a39 --- /dev/null +++ b/model_collateral_adjust_res.go @@ -0,0 +1,18 @@ +/* + * Gate API v4 + * + * Welcome to Gate.io API APIv4 provides spot, margin and futures trading operations. There are public APIs to retrieve the real-time market statistics, and private APIs which needs authentication to trade on user's behalf. + * + * Contact: support@mail.gate.io + * Generated by: OpenAPI Generator (https://openapi-generator.tech) + */ + +package gateapi + +// Result of multi-collateral adjustment +type CollateralAdjustRes struct { + // Order ID + OrderId int64 `json:"order_id,omitempty"` + // Collateral Currency Information + CollateralCurrencies []CollateralCurrencyRes `json:"collateral_currencies,omitempty"` +} diff --git a/model_collateral_currency.go b/model_collateral_currency.go new file mode 100644 index 0000000..5261138 --- /dev/null +++ b/model_collateral_currency.go @@ -0,0 +1,17 @@ +/* + * Gate API v4 + * + * Welcome to Gate.io API APIv4 provides spot, margin and futures trading operations. There are public APIs to retrieve the real-time market statistics, and private APIs which needs authentication to trade on user's behalf. + * + * Contact: support@mail.gate.io + * Generated by: OpenAPI Generator (https://openapi-generator.tech) + */ + +package gateapi + +type CollateralCurrency struct { + // Currency + Currency string `json:"currency,omitempty"` + // Size + Amount string `json:"amount,omitempty"` +} diff --git a/model_collateral_currency_info.go b/model_collateral_currency_info.go new file mode 100644 index 0000000..66a32ee --- /dev/null +++ b/model_collateral_currency_info.go @@ -0,0 +1,21 @@ +/* + * Gate API v4 + * + * Welcome to Gate.io API APIv4 provides spot, margin and futures trading operations. There are public APIs to retrieve the real-time market statistics, and private APIs which needs authentication to trade on user's behalf. + * + * Contact: support@mail.gate.io + * Generated by: OpenAPI Generator (https://openapi-generator.tech) + */ + +package gateapi + +type CollateralCurrencyInfo struct { + // Currency + Currency string `json:"currency,omitempty"` + // Currency Index Price + IndexPrice string `json:"index_price,omitempty"` + // Left Collateral Amount + LeftCollateral string `json:"left_collateral,omitempty"` + // Value of left collateral amount in USDT + LeftCollateralUsdt string `json:"left_collateral_usdt,omitempty"` +} diff --git a/model_collateral_currency_res.go b/model_collateral_currency_res.go new file mode 100644 index 0000000..2b462af --- /dev/null +++ b/model_collateral_currency_res.go @@ -0,0 +1,23 @@ +/* + * Gate API v4 + * + * Welcome to Gate.io API APIv4 provides spot, margin and futures trading operations. There are public APIs to retrieve the real-time market statistics, and private APIs which needs authentication to trade on user's behalf. + * + * Contact: support@mail.gate.io + * Generated by: OpenAPI Generator (https://openapi-generator.tech) + */ + +package gateapi + +type CollateralCurrencyRes struct { + // Update success status + Succeeded bool `json:"succeeded,omitempty"` + // Error identifier for unsuccessful operations; empty for successful. + Label string `json:"label,omitempty"` + // Error description in case of operation failure; empty when successful. + Message string `json:"message,omitempty"` + // Currency + Currency string `json:"currency,omitempty"` + // Quantity of successful collateral operation; 0 if the operation fails. + Amount string `json:"amount,omitempty"` +} diff --git a/model_collateral_fix_rate.go b/model_collateral_fix_rate.go new file mode 100644 index 0000000..50f097b --- /dev/null +++ b/model_collateral_fix_rate.go @@ -0,0 +1,22 @@ +/* + * Gate API v4 + * + * Welcome to Gate.io API APIv4 provides spot, margin and futures trading operations. There are public APIs to retrieve the real-time market statistics, and private APIs which needs authentication to trade on user's behalf. + * + * Contact: support@mail.gate.io + * Generated by: OpenAPI Generator (https://openapi-generator.tech) + */ + +package gateapi + +// Multi-collateral fixed interest rate +type CollateralFixRate struct { + // Currency + Currency string `json:"currency,omitempty"` + // Fixed interest rate for a lending period of 7 days + Rate7d string `json:"rate_7d,omitempty"` + // Fixed interest rate for a lending period of 30 days + Rate30d string `json:"rate_30d,omitempty"` + // Update time, timestamp, unit in seconds + UpdateTime int64 `json:"update_time,omitempty"` +} diff --git a/model_collateral_ltv.go b/model_collateral_ltv.go new file mode 100644 index 0000000..8ebedd9 --- /dev/null +++ b/model_collateral_ltv.go @@ -0,0 +1,20 @@ +/* + * Gate API v4 + * + * Welcome to Gate.io API APIv4 provides spot, margin and futures trading operations. There are public APIs to retrieve the real-time market statistics, and private APIs which needs authentication to trade on user's behalf. + * + * Contact: support@mail.gate.io + * Generated by: OpenAPI Generator (https://openapi-generator.tech) + */ + +package gateapi + +// Collateral Ratio +type CollateralLtv struct { + // The initial collateralization rate + InitLtv string `json:"init_ltv,omitempty"` + // Warning collateralization ratio + AlertLtv string `json:"alert_ltv,omitempty"` + // The liquidation collateralization rate + LiquidateLtv string `json:"liquidate_ltv,omitempty"` +} diff --git a/model_contract.go b/model_contract.go index aac6b92..038ba6e 100644 --- a/model_contract.go +++ b/model_contract.go @@ -45,11 +45,11 @@ type Contract struct { FundingInterval int32 `json:"funding_interval,omitempty"` // Next funding time FundingNextApply float64 `json:"funding_next_apply,omitempty"` - // Risk limit base + // Risk limit base,deprecated RiskLimitBase string `json:"risk_limit_base,omitempty"` - // Step of adjusting risk limit + // Step of adjusting risk limit,deprecated RiskLimitStep string `json:"risk_limit_step,omitempty"` - // Maximum risk limit the contract allowed + // Maximum risk limit the contract allowed,deprecated,It is recommended to use /futures/{settle}/risk_limit_tiers to query risk limits. RiskLimitMax string `json:"risk_limit_max,omitempty"` // Minimum order size the contract allowed OrderSizeMin int64 `json:"order_size_min,omitempty"` diff --git a/model_convert_small_balance.go b/model_convert_small_balance.go new file mode 100644 index 0000000..1364f65 --- /dev/null +++ b/model_convert_small_balance.go @@ -0,0 +1,16 @@ +/* + * Gate API v4 + * + * Welcome to Gate.io API APIv4 provides spot, margin and futures trading operations. There are public APIs to retrieve the real-time market statistics, and private APIs which needs authentication to trade on user's behalf. + * + * Contact: support@mail.gate.io + * Generated by: OpenAPI Generator (https://openapi-generator.tech) + */ + +package gateapi + +// Convert Small Balance +type ConvertSmallBalance struct { + // Currency + Currency []string `json:"currency,omitempty"` +} diff --git a/model_create_multi_collateral_order.go b/model_create_multi_collateral_order.go new file mode 100644 index 0000000..36b0ab3 --- /dev/null +++ b/model_create_multi_collateral_order.go @@ -0,0 +1,31 @@ +/* + * Gate API v4 + * + * Welcome to Gate.io API APIv4 provides spot, margin and futures trading operations. There are public APIs to retrieve the real-time market statistics, and private APIs which needs authentication to trade on user's behalf. + * + * Contact: support@mail.gate.io + * Generated by: OpenAPI Generator (https://openapi-generator.tech) + */ + +package gateapi + +type CreateMultiCollateralOrder struct { + // Order ID + OrderId string `json:"order_id,omitempty"` + // current - current, fixed - fixed, if not specified, default to current + OrderType string `json:"order_type,omitempty"` + // Fixed interest rate loan period: 7d - 7 days, 30d - 30 days. Must be provided for fixed + FixedType string `json:"fixed_type,omitempty"` + // Fixed interest rate, must be specified for fixed + FixedRate string `json:"fixed_rate,omitempty"` + // Fixed interest rate, automatic renewal + AutoRenew bool `json:"auto_renew,omitempty"` + // Fixed interest rate, automatic repayment + AutoRepay bool `json:"auto_repay,omitempty"` + // Borrowed currency + BorrowCurrency string `json:"borrow_currency"` + // Borrowing amount + BorrowAmount string `json:"borrow_amount"` + // Collateral currency and amount + CollateralCurrencies []CollateralCurrency `json:"collateral_currencies,omitempty"` +} diff --git a/model_currency_chain.go b/model_currency_chain.go index 04e0885..dd0de36 100644 --- a/model_currency_chain.go +++ b/model_currency_chain.go @@ -24,4 +24,6 @@ type CurrencyChain struct { IsDepositDisabled int32 `json:"is_deposit_disabled,omitempty"` // Is withdrawal disabled. 0 means not IsWithdrawDisabled int32 `json:"is_withdraw_disabled,omitempty"` + // Withdrawal precision + Decimal string `json:"decimal,omitempty"` } diff --git a/model_currency_quota.go b/model_currency_quota.go new file mode 100644 index 0000000..da5b674 --- /dev/null +++ b/model_currency_quota.go @@ -0,0 +1,24 @@ +/* + * Gate API v4 + * + * Welcome to Gate.io API APIv4 provides spot, margin and futures trading operations. There are public APIs to retrieve the real-time market statistics, and private APIs which needs authentication to trade on user's behalf. + * + * Contact: support@mail.gate.io + * Generated by: OpenAPI Generator (https://openapi-generator.tech) + */ + +package gateapi + +// Currency Quota +type CurrencyQuota struct { + // Currency + Currency string `json:"currency,omitempty"` + // Currency Index Price + IndexPrice string `json:"index_price,omitempty"` + // Minimum borrowing/collateral quota for the currency + MinQuota string `json:"min_quota,omitempty"` + // Remaining borrowing/collateral limit for the currency + LeftQuota string `json:"left_quota,omitempty"` + // Remaining currency limit converted to USDT + LeftQuoteUsdt string `json:"left_quote_usdt,omitempty"` +} diff --git a/model_future_cancel_order_result.go b/model_future_cancel_order_result.go new file mode 100644 index 0000000..a502100 --- /dev/null +++ b/model_future_cancel_order_result.go @@ -0,0 +1,22 @@ +/* + * Gate API v4 + * + * Welcome to Gate.io API APIv4 provides spot, margin and futures trading operations. There are public APIs to retrieve the real-time market statistics, and private APIs which needs authentication to trade on user's behalf. + * + * Contact: support@mail.gate.io + * Generated by: OpenAPI Generator (https://openapi-generator.tech) + */ + +package gateapi + +// Order cancellation result +type FutureCancelOrderResult struct { + // Order ID + Id string `json:"id,omitempty"` + // User ID + UserId int64 `json:"user_id,omitempty"` + // Whether cancellation succeeded + Succeeded bool `json:"succeeded,omitempty"` + // Error message when failed to cancel the order; empty if succeeded + Message string `json:"message,omitempty"` +} diff --git a/model_futures_account_book.go b/model_futures_account_book.go index b5b82ce..2f3d620 100644 --- a/model_futures_account_book.go +++ b/model_futures_account_book.go @@ -16,7 +16,7 @@ type FuturesAccountBook struct { Change string `json:"change,omitempty"` // Balance after change Balance string `json:"balance,omitempty"` - // Changing Type: - dnw: Deposit & Withdraw - pnl: Profit & Loss by reducing position - fee: Trading fee - refr: Referrer rebate - fund: Funding - point_dnw: POINT Deposit & Withdraw - point_fee: POINT Trading fee - point_refr: POINT Referrer rebate + // Changing Type: - dnw: Deposit & Withdraw - pnl: Profit & Loss by reducing position - fee: Trading fee - refr: Referrer rebate - fund: Funding - point_dnw: POINT Deposit & Withdraw - point_fee: POINT Trading fee - point_refr: POINT Referrer rebate - bonus_offset: bouns deduction Type string `json:"type,omitempty"` // Comment Text string `json:"text,omitempty"` diff --git a/model_futures_limit_risk_tiers.go b/model_futures_limit_risk_tiers.go new file mode 100644 index 0000000..94a8eb2 --- /dev/null +++ b/model_futures_limit_risk_tiers.go @@ -0,0 +1,24 @@ +/* + * Gate API v4 + * + * Welcome to Gate.io API APIv4 provides spot, margin and futures trading operations. There are public APIs to retrieve the real-time market statistics, and private APIs which needs authentication to trade on user's behalf. + * + * Contact: support@mail.gate.io + * Generated by: OpenAPI Generator (https://openapi-generator.tech) + */ + +package gateapi + +// Retrieve risk limit configurations for different tiers under a specified contract. +type FuturesLimitRiskTiers struct { + // tier + Tier int32 `json:"tier,omitempty"` + // Position risk limit + RiskLimit string `json:"risk_limit,omitempty"` + // Initial margin rate + InitialRate string `json:"initial_rate,omitempty"` + // Maintenance margin rate + MaintenanceRate string `json:"maintenance_rate,omitempty"` + // Maximum leverage + LeverageMax string `json:"leverage_max,omitempty"` +} diff --git a/model_futures_price_triggered_order.go b/model_futures_price_triggered_order.go index a85cdaa..04940e3 100644 --- a/model_futures_price_triggered_order.go +++ b/model_futures_price_triggered_order.go @@ -32,5 +32,5 @@ type FuturesPriceTriggeredOrder struct { // Take-profit/stop-loss types, which include: - `close-long-order`: order take-profit/stop-loss, close long position - `close-short-order`: order take-profit/stop-loss, close short position - `close-long-position`: position take-profit/stop-loss, close long position - `close-short-position`: position take-profit/stop-loss, close short position - `plan-close-long-position`: position planned take-profit/stop-loss, close long position - `plan-close-short-position`: position planned take-profit/stop-loss, close short position The order take-profit/stop-loss can not be passed by request. These two types are read only. OrderType string `json:"order_type,omitempty"` // Corresponding order ID of order take-profit/stop-loss. - MeOrderId string `json:"me_order_id,omitempty"` + MeOrderId int64 `json:"me_order_id,omitempty"` } diff --git a/model_liquidate_order.go b/model_liquidate_order.go index 823c3e5..d1a976b 100644 --- a/model_liquidate_order.go +++ b/model_liquidate_order.go @@ -19,4 +19,6 @@ type LiquidateOrder struct { Amount string `json:"amount"` // Order price Price string `json:"price"` + // Processing Mode: Different fields are returned when placing an order based on action_mode. This field is only valid during the request, and it is not included in the response result ACK: Asynchronous mode, only returns key order fields RESULT: No clearing information FULL: Full mode (default) + ActionMode string `json:"action_mode,omitempty"` } diff --git a/model_multi_collateral_currency.go b/model_multi_collateral_currency.go new file mode 100644 index 0000000..e5e7c10 --- /dev/null +++ b/model_multi_collateral_currency.go @@ -0,0 +1,18 @@ +/* + * Gate API v4 + * + * Welcome to Gate.io API APIv4 provides spot, margin and futures trading operations. There are public APIs to retrieve the real-time market statistics, and private APIs which needs authentication to trade on user's behalf. + * + * Contact: support@mail.gate.io + * Generated by: OpenAPI Generator (https://openapi-generator.tech) + */ + +package gateapi + +// Borrowing and collateral currencies supported for Multi-Collateral. +type MultiCollateralCurrency struct { + // List of supported borrowing currencies + LoanCurrencies []MultiLoanItem `json:"loan_currencies,omitempty"` + // List of supported collateral currencies + CollateralCurrencies []MultiCollateralItem `json:"collateral_currencies,omitempty"` +} diff --git a/model_multi_collateral_item.go b/model_multi_collateral_item.go new file mode 100644 index 0000000..26272e7 --- /dev/null +++ b/model_multi_collateral_item.go @@ -0,0 +1,19 @@ +/* + * Gate API v4 + * + * Welcome to Gate.io API APIv4 provides spot, margin and futures trading operations. There are public APIs to retrieve the real-time market statistics, and private APIs which needs authentication to trade on user's behalf. + * + * Contact: support@mail.gate.io + * Generated by: OpenAPI Generator (https://openapi-generator.tech) + */ + +package gateapi + +type MultiCollateralItem struct { + // Currency + Currency string `json:"currency,omitempty"` + // Currency Index Price + IndexPrice string `json:"index_price,omitempty"` + // Discount + Discount string `json:"discount,omitempty"` +} diff --git a/model_multi_collateral_order.go b/model_multi_collateral_order.go new file mode 100644 index 0000000..38c64f9 --- /dev/null +++ b/model_multi_collateral_order.go @@ -0,0 +1,42 @@ +/* + * Gate API v4 + * + * Welcome to Gate.io API APIv4 provides spot, margin and futures trading operations. There are public APIs to retrieve the real-time market statistics, and private APIs which needs authentication to trade on user's behalf. + * + * Contact: support@mail.gate.io + * Generated by: OpenAPI Generator (https://openapi-generator.tech) + */ + +package gateapi + +// Multi-Collateral Order +type MultiCollateralOrder struct { + // Order ID + OrderId string `json:"order_id,omitempty"` + // current - current, fixed - fixed + OrderType string `json:"order_type,omitempty"` + // Fixed interest rate loan periods: 7d - 7 days, 30d - 30 days. + FixedType string `json:"fixed_type,omitempty"` + // Fixed interest rate + FixedRate string `json:"fixed_rate,omitempty"` + // Expiration time, timestamp, unit in seconds. + ExpireTime int64 `json:"expire_time,omitempty"` + // Fixed interest rate, automatic renewal + AutoRenew bool `json:"auto_renew,omitempty"` + // Fixed interest rate, automatic repayment + AutoRepay bool `json:"auto_repay,omitempty"` + // The current collateralization rate + CurrentLtv string `json:"current_ltv,omitempty"` + // Order status: - initial: Initial state after placing the order - collateral_deducted: Collateral deduction successful - collateral_returning: Loan failed - Collateral return pending - lent: Loan successful - repaying: Repayment in progress - liquidating: Liquidation in progress - finished: Order completed - closed_liquidated: Liquidation and repayment completed + Status string `json:"status,omitempty"` + // Borrowing time, timestamp in seconds + BorrowTime int64 `json:"borrow_time,omitempty"` + // Value of Left repay amount converted in USDT + TotalLeftRepayUsdt string `json:"total_left_repay_usdt,omitempty"` + // Value of Collateral amount in USDT + TotalLeftCollateralUsdt string `json:"total_left_collateral_usdt,omitempty"` + // Borrowing Currency List + BorrowCurrencies []BorrowCurrencyInfo `json:"borrow_currencies,omitempty"` + // Collateral Currency List + CollateralCurrencies []CollateralCurrencyInfo `json:"collateral_currencies,omitempty"` +} diff --git a/model_multi_collateral_record.go b/model_multi_collateral_record.go new file mode 100644 index 0000000..a1ba460 --- /dev/null +++ b/model_multi_collateral_record.go @@ -0,0 +1,28 @@ +/* + * Gate API v4 + * + * Welcome to Gate.io API APIv4 provides spot, margin and futures trading operations. There are public APIs to retrieve the real-time market statistics, and private APIs which needs authentication to trade on user's behalf. + * + * Contact: support@mail.gate.io + * Generated by: OpenAPI Generator (https://openapi-generator.tech) + */ + +package gateapi + +// Multi-Collateral adjustment record. +type MultiCollateralRecord struct { + // Order ID + OrderId int64 `json:"order_id,omitempty"` + // Collateral record ID + RecordId int64 `json:"record_id,omitempty"` + // The collateral ratio before adjustment + BeforeLtv string `json:"before_ltv,omitempty"` + // The collateral ratio before adjustment + AfterLtv string `json:"after_ltv,omitempty"` + // Operation time, timestamp in seconds. + OperateTime int64 `json:"operate_time,omitempty"` + // Borrowing Currency List + BorrowCurrencies []MultiCollateralRecordCurrency `json:"borrow_currencies,omitempty"` + // Collateral Currency List + CollateralCurrencies []MultiCollateralRecordCurrency `json:"collateral_currencies,omitempty"` +} diff --git a/model_multi_collateral_record_currency.go b/model_multi_collateral_record_currency.go new file mode 100644 index 0000000..afee7e0 --- /dev/null +++ b/model_multi_collateral_record_currency.go @@ -0,0 +1,25 @@ +/* + * Gate API v4 + * + * Welcome to Gate.io API APIv4 provides spot, margin and futures trading operations. There are public APIs to retrieve the real-time market statistics, and private APIs which needs authentication to trade on user's behalf. + * + * Contact: support@mail.gate.io + * Generated by: OpenAPI Generator (https://openapi-generator.tech) + */ + +package gateapi + +type MultiCollateralRecordCurrency struct { + // Currency + Currency string `json:"currency,omitempty"` + // Currency Index Price + IndexPrice string `json:"index_price,omitempty"` + // Amount before the operation + BeforeAmount string `json:"before_amount,omitempty"` + // USDT Amount before the operation. + BeforeAmountUsdt string `json:"before_amount_usdt,omitempty"` + // Amount after the operation. + AfterAmount string `json:"after_amount,omitempty"` + // USDT Amount after the operation. + AfterAmountUsdt string `json:"after_amount_usdt,omitempty"` +} diff --git a/model_multi_loan_item.go b/model_multi_loan_item.go new file mode 100644 index 0000000..f4b16fe --- /dev/null +++ b/model_multi_loan_item.go @@ -0,0 +1,17 @@ +/* + * Gate API v4 + * + * Welcome to Gate.io API APIv4 provides spot, margin and futures trading operations. There are public APIs to retrieve the real-time market statistics, and private APIs which needs authentication to trade on user's behalf. + * + * Contact: support@mail.gate.io + * Generated by: OpenAPI Generator (https://openapi-generator.tech) + */ + +package gateapi + +type MultiLoanItem struct { + // Currency + Currency string `json:"currency,omitempty"` + // Latest price of the currency + Price string `json:"price,omitempty"` +} diff --git a/model_multi_loan_repay_item.go b/model_multi_loan_repay_item.go new file mode 100644 index 0000000..455bd95 --- /dev/null +++ b/model_multi_loan_repay_item.go @@ -0,0 +1,19 @@ +/* + * Gate API v4 + * + * Welcome to Gate.io API APIv4 provides spot, margin and futures trading operations. There are public APIs to retrieve the real-time market statistics, and private APIs which needs authentication to trade on user's behalf. + * + * Contact: support@mail.gate.io + * Generated by: OpenAPI Generator (https://openapi-generator.tech) + */ + +package gateapi + +type MultiLoanRepayItem struct { + // Repayment currency + Currency string `json:"currency,omitempty"` + // Size + Amount string `json:"amount,omitempty"` + // Repayment method, set to true for full repayment, false for partial repayment. + RepaidAll bool `json:"repaid_all,omitempty"` +} diff --git a/model_multi_repay_record.go b/model_multi_repay_record.go new file mode 100644 index 0000000..aa9592d --- /dev/null +++ b/model_multi_repay_record.go @@ -0,0 +1,38 @@ +/* + * Gate API v4 + * + * Welcome to Gate.io API APIv4 provides spot, margin and futures trading operations. There are public APIs to retrieve the real-time market statistics, and private APIs which needs authentication to trade on user's behalf. + * + * Contact: support@mail.gate.io + * Generated by: OpenAPI Generator (https://openapi-generator.tech) + */ + +package gateapi + +// Mult Repay Record +type MultiRepayRecord struct { + // Order ID + OrderId int64 `json:"order_id,omitempty"` + // Repayment record ID + RecordId int64 `json:"record_id,omitempty"` + // The initial collateralization rate + InitLtv string `json:"init_ltv,omitempty"` + // Ltv before the operation + BeforeLtv string `json:"before_ltv,omitempty"` + // Ltv after the operation + AfterLtv string `json:"after_ltv,omitempty"` + // Borrowing time, timestamp in seconds. + BorrowTime int64 `json:"borrow_time,omitempty"` + // Repayment time, timestamp in seconds. + RepayTime int64 `json:"repay_time,omitempty"` + // List of borrowing information + BorrowCurrencies []RepayRecordCurrency `json:"borrow_currencies,omitempty"` + // List of collateral information + CollateralCurrencies []RepayRecordCurrency `json:"collateral_currencies,omitempty"` + // Repay Currency List + RepaidCurrencies []RepayRecordRepaidCurrency `json:"repaid_currencies,omitempty"` + // Total Interest List + TotalInterestList []RepayRecordTotalInterest `json:"total_interest_list,omitempty"` + // List of left repay interest + LeftRepayInterestList []RepayRecordLeftInterest `json:"left_repay_interest_list,omitempty"` +} diff --git a/model_multi_repay_resp.go b/model_multi_repay_resp.go new file mode 100644 index 0000000..4d057a5 --- /dev/null +++ b/model_multi_repay_resp.go @@ -0,0 +1,18 @@ +/* + * Gate API v4 + * + * Welcome to Gate.io API APIv4 provides spot, margin and futures trading operations. There are public APIs to retrieve the real-time market statistics, and private APIs which needs authentication to trade on user's behalf. + * + * Contact: support@mail.gate.io + * Generated by: OpenAPI Generator (https://openapi-generator.tech) + */ + +package gateapi + +// Repay Multi-Collateral Loan +type MultiRepayResp struct { + // Order ID + OrderId int64 `json:"order_id,omitempty"` + // Repay Currency List + RepaidCurrencies []RepayCurrencyRes `json:"repaid_currencies,omitempty"` +} diff --git a/model_order.go b/model_order.go index e5bc8df..535fde4 100644 --- a/model_order.go +++ b/model_order.go @@ -49,6 +49,8 @@ type Order struct { AutoRepay bool `json:"auto_repay,omitempty"` // Amount left to fill Left string `json:"left,omitempty"` + // Amount traded to fill + FilledAmount string `json:"filled_amount,omitempty"` // Total filled in quote currency. Deprecated in favor of `filled_total` FillPrice string `json:"fill_price,omitempty"` // Total filled in quote currency @@ -79,4 +81,6 @@ type Order struct { StpAct string `json:"stp_act,omitempty"` // How the order was finished. - open: processing - filled: filled totally - cancelled: manually cancelled - ioc: time in force is `IOC`, finish immediately - stp: cancelled because self trade prevention FinishAs string `json:"finish_as,omitempty"` + // Processing Mode: When placing an order, different fields are returned based on action_mode. This field is only valid during the request and is not included in the response result ACK: Asynchronous mode, only returns key order fields RESULT: No clearing information FULL: Full mode (default) + ActionMode string `json:"action_mode,omitempty"` } diff --git a/model_order_patch.go b/model_order_patch.go index 2f6f0a4..effec4e 100644 --- a/model_order_patch.go +++ b/model_order_patch.go @@ -17,4 +17,6 @@ type OrderPatch struct { Price string `json:"price,omitempty"` // Custom info during amending order AmendText string `json:"amend_text,omitempty"` + // Processing Mode: When placing an order, different fields are returned based on action_mode. This field is only valid during the request and is not included in the response result ACK: Asynchronous mode, only returns key order fields RESULT: No clearing information FULL: Full mode (default) + ActionMode string `json:"action_mode,omitempty"` } diff --git a/model_position.go b/model_position.go index 947660c..738f071 100644 --- a/model_position.go +++ b/model_position.go @@ -62,4 +62,6 @@ type Position struct { CrossLeverageLimit string `json:"cross_leverage_limit,omitempty"` // Last update time UpdateTime int64 `json:"update_time,omitempty"` + // First Open Time + OpenTime int64 `json:"open_time,omitempty"` } diff --git a/model_position_close.go b/model_position_close.go index 65d111c..96bb911 100644 --- a/model_position_close.go +++ b/model_position_close.go @@ -20,4 +20,12 @@ type PositionClose struct { Pnl string `json:"pnl,omitempty"` // Text of close order Text string `json:"text,omitempty"` + // Max Trade Size + MaxSize string `json:"max_size,omitempty"` + // First Open Time + FirstOpenTime int64 `json:"first_open_time,omitempty"` + // When 'side' is 'long,' it indicates the opening average price; when 'side' is 'short,' it indicates the closing average price. + LongPrice string `json:"long_price,omitempty"` + // When 'side' is 'long,' it indicates the opening average price; when 'side' is 'short,' it indicates the closing average price + ShortPrice string `json:"short_price,omitempty"` } diff --git a/model_repay_currency_res.go b/model_repay_currency_res.go new file mode 100644 index 0000000..edfcf53 --- /dev/null +++ b/model_repay_currency_res.go @@ -0,0 +1,25 @@ +/* + * Gate API v4 + * + * Welcome to Gate.io API APIv4 provides spot, margin and futures trading operations. There are public APIs to retrieve the real-time market statistics, and private APIs which needs authentication to trade on user's behalf. + * + * Contact: support@mail.gate.io + * Generated by: OpenAPI Generator (https://openapi-generator.tech) + */ + +package gateapi + +type RepayCurrencyRes struct { + // Has the repayment been successful + Succeeded bool `json:"succeeded,omitempty"` + // Error identifier for unsuccessful operations; empty for successful. + Label string `json:"label,omitempty"` + // Error description in case of operation failure; empty when successful. + Message string `json:"message,omitempty"` + // Repayment currency + Currency string `json:"currency,omitempty"` + // Principal + RepaidPrincipal string `json:"repaid_principal,omitempty"` + // Principal + RepaidInterest string `json:"repaid_interest,omitempty"` +} diff --git a/model_repay_multi_loan.go b/model_repay_multi_loan.go new file mode 100644 index 0000000..6933cc8 --- /dev/null +++ b/model_repay_multi_loan.go @@ -0,0 +1,18 @@ +/* + * Gate API v4 + * + * Welcome to Gate.io API APIv4 provides spot, margin and futures trading operations. There are public APIs to retrieve the real-time market statistics, and private APIs which needs authentication to trade on user's behalf. + * + * Contact: support@mail.gate.io + * Generated by: OpenAPI Generator (https://openapi-generator.tech) + */ + +package gateapi + +// Repay Multi-Collateral Loan +type RepayMultiLoan struct { + // Order ID + OrderId int64 `json:"order_id"` + // Repay Currency Item + RepayItems []MultiLoanRepayItem `json:"repay_items"` +} diff --git a/model_repay_record_currency.go b/model_repay_record_currency.go new file mode 100644 index 0000000..c4ee11a --- /dev/null +++ b/model_repay_record_currency.go @@ -0,0 +1,25 @@ +/* + * Gate API v4 + * + * Welcome to Gate.io API APIv4 provides spot, margin and futures trading operations. There are public APIs to retrieve the real-time market statistics, and private APIs which needs authentication to trade on user's behalf. + * + * Contact: support@mail.gate.io + * Generated by: OpenAPI Generator (https://openapi-generator.tech) + */ + +package gateapi + +type RepayRecordCurrency struct { + // Currency + Currency string `json:"currency,omitempty"` + // Currency Index Price + IndexPrice string `json:"index_price,omitempty"` + // Amount before the operation + BeforeAmount string `json:"before_amount,omitempty"` + // USDT Amount before the operation. + BeforeAmountUsdt string `json:"before_amount_usdt,omitempty"` + // Amount after the operation. + AfterAmount string `json:"after_amount,omitempty"` + // USDT Amount after the operation. + AfterAmountUsdt string `json:"after_amount_usdt,omitempty"` +} diff --git a/model_repay_record_left_interest.go b/model_repay_record_left_interest.go new file mode 100644 index 0000000..21a3376 --- /dev/null +++ b/model_repay_record_left_interest.go @@ -0,0 +1,25 @@ +/* + * Gate API v4 + * + * Welcome to Gate.io API APIv4 provides spot, margin and futures trading operations. There are public APIs to retrieve the real-time market statistics, and private APIs which needs authentication to trade on user's behalf. + * + * Contact: support@mail.gate.io + * Generated by: OpenAPI Generator (https://openapi-generator.tech) + */ + +package gateapi + +type RepayRecordLeftInterest struct { + // Currency + Currency string `json:"currency,omitempty"` + // Currency Index Price + IndexPrice string `json:"index_price,omitempty"` + // Interest amount before repayment + BeforeAmount string `json:"before_amount,omitempty"` + // Converted value of interest before repayment in USDT + BeforeAmountUsdt string `json:"before_amount_usdt,omitempty"` + // Interest amount after repayment + AfterAmount string `json:"after_amount,omitempty"` + // Converted value of interest after repayment in USDT + AfterAmountUsdt string `json:"after_amount_usdt,omitempty"` +} diff --git a/model_repay_record_repaid_currency.go b/model_repay_record_repaid_currency.go new file mode 100644 index 0000000..7ab0516 --- /dev/null +++ b/model_repay_record_repaid_currency.go @@ -0,0 +1,25 @@ +/* + * Gate API v4 + * + * Welcome to Gate.io API APIv4 provides spot, margin and futures trading operations. There are public APIs to retrieve the real-time market statistics, and private APIs which needs authentication to trade on user's behalf. + * + * Contact: support@mail.gate.io + * Generated by: OpenAPI Generator (https://openapi-generator.tech) + */ + +package gateapi + +type RepayRecordRepaidCurrency struct { + // Repayment currency + Currency string `json:"currency,omitempty"` + // Currency Index Price + IndexPrice string `json:"index_price,omitempty"` + // Repayment amount + RepaidAmount string `json:"repaid_amount,omitempty"` + // Principal + RepaidPrincipal string `json:"repaid_principal,omitempty"` + // Interest + RepaidInterest string `json:"repaid_interest,omitempty"` + // Value of the repayment amount in USDT + RepaidAmountUsdt string `json:"repaid_amount_usdt,omitempty"` +} diff --git a/model_repay_record_total_interest.go b/model_repay_record_total_interest.go new file mode 100644 index 0000000..b15d9a8 --- /dev/null +++ b/model_repay_record_total_interest.go @@ -0,0 +1,21 @@ +/* + * Gate API v4 + * + * Welcome to Gate.io API APIv4 provides spot, margin and futures trading operations. There are public APIs to retrieve the real-time market statistics, and private APIs which needs authentication to trade on user's behalf. + * + * Contact: support@mail.gate.io + * Generated by: OpenAPI Generator (https://openapi-generator.tech) + */ + +package gateapi + +type RepayRecordTotalInterest struct { + // Currency + Currency string `json:"currency,omitempty"` + // Currency Index Price + IndexPrice string `json:"index_price,omitempty"` + // Interest Amount + Amount string `json:"amount,omitempty"` + // Interest amount converted to USDT + AmountUsdt string `json:"amount_usdt,omitempty"` +} diff --git a/model_small_balance.go b/model_small_balance.go new file mode 100644 index 0000000..b578cd2 --- /dev/null +++ b/model_small_balance.go @@ -0,0 +1,22 @@ +/* + * Gate API v4 + * + * Welcome to Gate.io API APIv4 provides spot, margin and futures trading operations. There are public APIs to retrieve the real-time market statistics, and private APIs which needs authentication to trade on user's behalf. + * + * Contact: support@mail.gate.io + * Generated by: OpenAPI Generator (https://openapi-generator.tech) + */ + +package gateapi + +// Convert Small Balance +type SmallBalance struct { + // Currency + Currency string `json:"currency,omitempty"` + // Available balance + AvailableBalance string `json:"available_balance,omitempty"` + // Estimated as BTC + EstimatedAsBtc string `json:"estimated_as_btc,omitempty"` + // Estimated conversion to GT + ConvertibleToGt string `json:"convertible_to_gt,omitempty"` +} diff --git a/model_small_balance_history.go b/model_small_balance_history.go new file mode 100644 index 0000000..5497a9f --- /dev/null +++ b/model_small_balance_history.go @@ -0,0 +1,24 @@ +/* + * Gate API v4 + * + * Welcome to Gate.io API APIv4 provides spot, margin and futures trading operations. There are public APIs to retrieve the real-time market statistics, and private APIs which needs authentication to trade on user's behalf. + * + * Contact: support@mail.gate.io + * Generated by: OpenAPI Generator (https://openapi-generator.tech) + */ + +package gateapi + +// Convert Small Balance +type SmallBalanceHistory struct { + // Order ID + Id string `json:"id,omitempty"` + // Currency + Currency string `json:"currency,omitempty"` + // amount + Amount string `json:"amount,omitempty"` + // GT amount + GtAmount string `json:"gt_amount,omitempty"` + // Exchange time (in seconds) + CreateTime int64 `json:"create_time,omitempty"` +} diff --git a/model_spot_fee.go b/model_spot_fee.go index 872cbb6..6189a4d 100644 --- a/model_spot_fee.go +++ b/model_spot_fee.go @@ -28,4 +28,6 @@ type SpotFee struct { PointType string `json:"point_type,omitempty"` // Currency pair CurrencyPair string `json:"currency_pair,omitempty"` + // Deduction types for rates, 1 - GT deduction, 2 - Point card deduction, 3 - VIP rates + DebitFee int32 `json:"debit_fee,omitempty"` } diff --git a/model_sub_account_to_sub_account.go b/model_sub_account_to_sub_account.go index 9a7e038..aca545f 100644 --- a/model_sub_account_to_sub_account.go +++ b/model_sub_account_to_sub_account.go @@ -16,11 +16,11 @@ type SubAccountToSubAccount struct { SubAccountType string `json:"sub_account_type,omitempty"` // Transfer from the user id of the sub-account SubAccountFrom string `json:"sub_account_from"` - // Transfer from the account. `spot` - spot account, `futures` - perpetual contract account, `cross_margin` - cross margin account + // The sub-account's outgoing trading account, spot - spot account, futures - perpetual contract account, delivery - delivery contract account, cross_margin - cross-margin account.\" SubAccountFromType string `json:"sub_account_from_type"` // Transfer to the user id of the sub-account SubAccountTo string `json:"sub_account_to"` - // Transfer to the account. `spot` - spot account, `futures` - perpetual contract account, `cross_margin` - cross margin account + // The sub-account's incoming trading account, spot - spot account, futures - perpetual contract account, delivery - delivery contract account, cross_margin - cross-margin account. SubAccountToType string `json:"sub_account_to_type"` // Transfer amount Amount string `json:"amount"` diff --git a/model_trade_fee.go b/model_trade_fee.go index a2c59c2..7c8ab12 100644 --- a/model_trade_fee.go +++ b/model_trade_fee.go @@ -34,4 +34,6 @@ type TradeFee struct { DeliveryTakerFee string `json:"delivery_taker_fee,omitempty"` // Delivery trading maker fee DeliveryMakerFee string `json:"delivery_maker_fee,omitempty"` + // Deduction types for rates, 1 - GT deduction, 2 - Point card deduction, 3 - VIP rates + DebitFee int32 `json:"debit_fee,omitempty"` } diff --git a/model_unified_account.go b/model_unified_account.go index 1afe51a..189d1f8 100644 --- a/model_unified_account.go +++ b/model_unified_account.go @@ -17,9 +17,9 @@ type UnifiedAccount struct { // Whether account is locked Locked bool `json:"locked,omitempty"` Balances map[string]UnifiedBalance `json:"balances,omitempty"` - // The total asset value in USDT. Sum of `(available + freeze) * price` + // The total asset value in USD, calculated as the sum of the product of `(available + freeze) * price` for all currencies. Total string `json:"total,omitempty"` - // The total borrowed amount in USDT equivalent. Sum of `borrowed * price` + // The total borrowed amount in USD, calculated as the sum of the product of `borrowed * price` for all currencies (excluding points cards). Borrowed string `json:"borrowed,omitempty"` // Total initial margin TotalInitialMargin string `json:"total_initial_margin,omitempty"`