mirror of
https://github.com/c9s/bbgo.git
synced 2024-11-10 09:11:55 +00:00
add margin repay and borrow api
This commit is contained in:
parent
c2d1ef0fc8
commit
37b5d80f6f
|
@ -227,11 +227,20 @@ func (e *Exchange) NewStream() types.Stream {
|
|||
return stream
|
||||
}
|
||||
|
||||
func (e *Exchange) repayCrossMarginAccountAsset(ctx context.Context, asset string, amount fixedpoint.Value) error {
|
||||
return nil
|
||||
func (e *Exchange) RepayMarginAsset(ctx context.Context, asset string, amount fixedpoint.Value) error {
|
||||
req := e.Client.NewMarginRepayService()
|
||||
req.Asset(asset)
|
||||
req.Amount(amount.String())
|
||||
if e.IsIsolatedMargin {
|
||||
req.IsolatedSymbol(e.IsolatedMarginSymbol)
|
||||
}
|
||||
|
||||
resp, err := req.Do(ctx)
|
||||
log.Debugf("margin repayed %f %s, transaction id = %d", amount.Float64(), asset, resp.TranID)
|
||||
return err
|
||||
}
|
||||
|
||||
func (e *Exchange) borrowMarginAccountAsset(ctx context.Context, asset string, amount fixedpoint.Value) error {
|
||||
func (e *Exchange) BorrowMarginAsset(ctx context.Context, asset string, amount fixedpoint.Value) error {
|
||||
req := e.Client.NewMarginLoanService()
|
||||
req.Asset(asset)
|
||||
req.Amount(amount.String())
|
||||
|
|
Loading…
Reference in New Issue
Block a user