Skip to content

Commit

Permalink
refactor: rest api response
Browse files Browse the repository at this point in the history
  • Loading branch information
linstohu committed Dec 25, 2023
1 parent 1fefe3f commit 4d69e01
Show file tree
Hide file tree
Showing 55 changed files with 1,229 additions and 747 deletions.
450 changes: 284 additions & 166 deletions binance/coinmfutures/account/client.go

Large diffs are not rendered by default.

7 changes: 7 additions & 0 deletions binance/coinmfutures/account/types/account.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,13 @@

package types

import "github.com/linstohu/nexapi/utils"

type GetAccountInfoResp struct {
Http *utils.ApiResponse
Body *Account
}

type Account struct {
Assets []struct {
Asset string `json:"asset"`
Expand Down
7 changes: 7 additions & 0 deletions binance/coinmfutures/account/types/balance.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,13 @@

package types

import "github.com/linstohu/nexapi/utils"

type GetBalanceResp struct {
Http *utils.ApiResponse
Body []*Balance
}

type Balance struct {
AccountAlias string `json:"accountAlias"`
Asset string `json:"asset"`
Expand Down
6 changes: 6 additions & 0 deletions binance/coinmfutures/account/types/leverage.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ package types

import (
bnutils "github.com/linstohu/nexapi/binance/utils"
"github.com/linstohu/nexapi/utils"
)

type ChangeLeverageParam struct {
Expand All @@ -32,6 +33,11 @@ type ChangeLeverageParams struct {
}

type ChangeLeverageResp struct {
Http *utils.ApiResponse
Body *ChangeLeverageAPIResp
}

type ChangeLeverageAPIResp struct {
Leverage int `json:"leverage"`
MaxQty string `json:"maxQty"`
Symbol string `json:"symbol"`
Expand Down
6 changes: 6 additions & 0 deletions binance/coinmfutures/account/types/margin.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ package types
import (
umutils "github.com/linstohu/nexapi/binance/usdmfutures/utils"
bnutils "github.com/linstohu/nexapi/binance/utils"
"github.com/linstohu/nexapi/utils"
)

type ChangeMarginTypeParam struct {
Expand All @@ -45,6 +46,11 @@ type ModifyIsolatedPositionMarginParams struct {
}

type ModifyIsolatedPositionMarginResp struct {
Http *utils.ApiResponse
Body *ModifyIsolatedPositionMarginAPIResp
}

type ModifyIsolatedPositionMarginAPIResp struct {
Amount float64 `json:"amount"`
Code int `json:"code"`
Msg string `json:"msg"`
Expand Down
11 changes: 11 additions & 0 deletions binance/coinmfutures/account/types/order.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,19 @@ package types
import (
umutils "github.com/linstohu/nexapi/binance/usdmfutures/utils"
bnutils "github.com/linstohu/nexapi/binance/utils"
"github.com/linstohu/nexapi/utils"
)

type OrderResp struct {
Http *utils.ApiResponse
Body *Order
}

type OrdersResp struct {
Http *utils.ApiResponse
Body []*Order
}

type Order struct {
ClientOrderID string `json:"clientOrderId"`
CumQty string `json:"cumQty"`
Expand Down
6 changes: 6 additions & 0 deletions binance/coinmfutures/account/types/position.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ package types

import (
bnutils "github.com/linstohu/nexapi/binance/utils"
"github.com/linstohu/nexapi/utils"
)

type GetPositionParam struct {
Expand All @@ -31,6 +32,11 @@ type GetPositionParams struct {
bnutils.DefaultParam
}

type GetPositionResp struct {
Http *utils.ApiResponse
Body []*Position
}

type Position struct {
Symbol string `json:"symbol"`
PositionAmt string `json:"positionAmt"`
Expand Down
6 changes: 6 additions & 0 deletions binance/coinmfutures/account/types/position_mode.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ package types

import (
bnutils "github.com/linstohu/nexapi/binance/utils"
"github.com/linstohu/nexapi/utils"
)

type ChangePositionModeParam struct {
Expand All @@ -31,5 +32,10 @@ type ChangePositionModeParams struct {
}

type GetCurrentPositionModeResp struct {
Http *utils.ApiResponse
Body *GetCurrentPositionModeAPIResp
}

type GetCurrentPositionModeAPIResp struct {
DualSidePosition bool `json:"dualSidePosition"`
}
7 changes: 7 additions & 0 deletions binance/coinmfutures/account/types/response.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,13 @@

package types

import "github.com/linstohu/nexapi/utils"

type DefaultResp struct {
Http *utils.ApiResponse
Body *Response
}

type Response struct {
Code int `json:"code"`
Message string `json:"msg"`
Expand Down
6 changes: 6 additions & 0 deletions binance/coinmfutures/account/types/trade.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ package types

import (
bnutils "github.com/linstohu/nexapi/binance/utils"
"github.com/linstohu/nexapi/utils"
)

type GetTradeListParam struct {
Expand All @@ -35,6 +36,11 @@ type GetTradeListParams struct {
bnutils.DefaultParam
}

type GetTradeListResp struct {
Http *utils.ApiResponse
Body []*Trade
}

type Trade struct {
Symbol string `json:"symbol"`
ID int64 `json:"id"`
Expand Down
Loading

0 comments on commit 4d69e01

Please sign in to comment.