mirror of
https://github.com/c9s/bbgo.git
synced 2024-11-10 09:11:55 +00:00
binance: add QueryMarginAssetMaxBorrowable api
This commit is contained in:
parent
9f9f13dfe2
commit
76733898db
|
@ -227,6 +227,20 @@ func (e *Exchange) NewStream() types.Stream {
|
|||
return stream
|
||||
}
|
||||
|
||||
func (e *Exchange) QueryMarginAssetMaxBorrowable(ctx context.Context, asset string) (amount fixedpoint.Value, err error) {
|
||||
req := e.Client.NewGetMaxBorrowableService()
|
||||
req.Asset(asset)
|
||||
if e.IsIsolatedMargin {
|
||||
req.IsolatedSymbol(e.IsolatedMarginSymbol)
|
||||
}
|
||||
resp, err := req.Do(ctx)
|
||||
if err != nil {
|
||||
return 0, err
|
||||
}
|
||||
|
||||
return fixedpoint.NewFromString(resp.Amount)
|
||||
}
|
||||
|
||||
func (e *Exchange) RepayMarginAsset(ctx context.Context, asset string, amount fixedpoint.Value) error {
|
||||
req := e.Client.NewMarginRepayService()
|
||||
req.Asset(asset)
|
||||
|
|
Loading…
Reference in New Issue
Block a user