-
-
Notifications
You must be signed in to change notification settings - Fork 293
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 #1524 from c9s/edwin/binance-update-api-changes-2
MINOR: [binance] update borrow/repay api changes
- Loading branch information
Showing
10 changed files
with
177 additions
and
449 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
64 changes: 64 additions & 0 deletions
64
pkg/exchange/binance/binanceapi/get_margin_borrow_repay_history_request.go
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,64 @@ | ||
package binanceapi | ||
|
||
import ( | ||
"time" | ||
|
||
"github.com/c9s/requestgen" | ||
|
||
"github.com/c9s/bbgo/pkg/fixedpoint" | ||
"github.com/c9s/bbgo/pkg/types" | ||
) | ||
|
||
// one of PENDING (pending execution), CONFIRMED (successfully loaned), FAILED (execution failed, nothing happened to your account); | ||
type MarginBorrowStatus string | ||
|
||
const ( | ||
BorrowRepayStatusPending MarginBorrowStatus = "PENDING" | ||
BorrowRepayStatusConfirmed MarginBorrowStatus = "CONFIRMED" | ||
BorrowRepayStatusFailed MarginBorrowStatus = "FAILED" | ||
) | ||
|
||
type BorrowRepayType string | ||
|
||
const ( | ||
BorrowRepayTypeBorrow BorrowRepayType = "BORROW" | ||
BorrowRepayTypeRepay BorrowRepayType = "REPAY" | ||
) | ||
|
||
type MarginBorrowRepayRecord struct { | ||
IsolatedSymbol string `json:"isolatedSymbol"` | ||
Amount fixedpoint.Value `json:"amount"` | ||
Asset string `json:"asset"` | ||
Interest fixedpoint.Value `json:"interest"` | ||
Principal fixedpoint.Value `json:"principal"` | ||
Status MarginBorrowStatus `json:"status"` | ||
Timestamp types.MillisecondTimestamp `json:"timestamp"` | ||
TxId uint64 `json:"txId"` | ||
} | ||
|
||
// GetMarginBorrowRepayHistoryRequest | ||
// | ||
// txId or startTime must be sent. txId takes precedence. | ||
// Response in descending order | ||
// If isolatedSymbol is not sent, crossed margin data will be returned | ||
// The max interval between startTime and endTime is 30 days. | ||
// If startTime and endTime not sent, return records of the last 7 days by default | ||
// Set archived to true to query data from 6 months ago | ||
// | ||
//go:generate requestgen -method GET -url "/sapi/v1/margin/borrow-repay" -type GetMarginBorrowRepayHistoryRequest -responseType .RowsResponse -responseDataField Rows -responseDataType []MarginBorrowRepayRecord | ||
type GetMarginBorrowRepayHistoryRequest struct { | ||
client requestgen.AuthenticatedAPIClient | ||
|
||
asset string `param:"asset"` | ||
startTime *time.Time `param:"startTime,milliseconds"` | ||
endTime *time.Time `param:"endTime,milliseconds"` | ||
isolatedSymbol *string `param:"isolatedSymbol"` | ||
archived *bool `param:"archived"` | ||
size *int `param:"size"` | ||
current *int `param:"current"` | ||
BorrowRepayType BorrowRepayType `param:"type"` | ||
} | ||
|
||
func (c *RestClient) NewGetMarginBorrowRepayHistoryRequest() *GetMarginBorrowRepayHistoryRequest { | ||
return &GetMarginBorrowRepayHistoryRequest{client: c} | ||
} |
79 changes: 59 additions & 20 deletions
79
...argin_repay_history_request_requestgen.go → ...orrow_repay_history_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
54 changes: 0 additions & 54 deletions
54
pkg/exchange/binance/binanceapi/get_margin_loan_history_request.go
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.