-
-
Notifications
You must be signed in to change notification settings - Fork 302
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1493 from c9s/edwin/okx/refactor-account
FEATURE: [okx] generate account info request by requestgen
- Loading branch information
Showing
6 changed files
with
224 additions
and
59 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
package okexapi | ||
|
||
import ( | ||
"github.com/c9s/requestgen" | ||
|
||
"github.com/c9s/bbgo/pkg/fixedpoint" | ||
"github.com/c9s/bbgo/pkg/types" | ||
) | ||
|
||
//go:generate -command GetRequest requestgen -method GET -responseType .APIResponse -responseDataField Data | ||
//go:generate -command PostRequest requestgen -method POST -responseType .APIResponse -responseDataField Data | ||
|
||
type BalanceDetail struct { | ||
Currency string `json:"ccy"` | ||
Available fixedpoint.Value `json:"availEq"` | ||
CashBalance fixedpoint.Value `json:"cashBal"` | ||
OrderFrozen fixedpoint.Value `json:"ordFrozen"` | ||
Frozen fixedpoint.Value `json:"frozenBal"` | ||
Equity fixedpoint.Value `json:"eq"` | ||
EquityInUSD fixedpoint.Value `json:"eqUsd"` | ||
UpdateTime types.MillisecondTimestamp `json:"uTime"` | ||
UnrealizedProfitAndLoss fixedpoint.Value `json:"upl"` | ||
} | ||
|
||
type Account struct { | ||
TotalEquityInUSD fixedpoint.Value `json:"totalEq"` | ||
UpdateTime types.MillisecondTimestamp `json:"uTime"` | ||
Details []BalanceDetail `json:"details"` | ||
} | ||
|
||
//go:generate GetRequest -url "/api/v5/account/balance" -type GetAccountInfoRequest -responseDataType []Account | ||
type GetAccountInfoRequest struct { | ||
client requestgen.AuthenticatedAPIClient | ||
} | ||
|
||
func (c *RestClient) NewGetAccountInfoRequest() *GetAccountInfoRequest { | ||
return &GetAccountInfoRequest{ | ||
client: c, | ||
} | ||
} |
157 changes: 157 additions & 0 deletions
157
pkg/exchange/okex/okexapi/get_account_info_request_requestgen.go
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters