Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enable Automatic Debt Repayment #16

Open
4 tasks done
AlexCatarino opened this issue Dec 20, 2022 · 0 comments
Open
4 tasks done

Enable Automatic Debt Repayment #16

AlexCatarino opened this issue Dec 20, 2022 · 0 comments

Comments

@AlexCatarino
Copy link
Member

AlexCatarino commented Dec 20, 2022

Expected Behavior

Automatically repay dept for short-margin trades.

Actual Behavior

Debt is not automatically repaid and users need to manually do it.

Potential Solution

To enable auto replay, we need to set

body["sideEffectType"] = "MARGIN_BUY";

to

body["sideEffectType"] = "AUTO_REPAY";

However, we may want to do it via BinanceOrderProperties

Note

Lean doesn't model debt for short-margin trades, so the portfolio value is probably diverging.

From Binance user:

Currently, when closing a margin position, any outstanding debts need to be explicitly repaid via a separate API call. Closing a position via an opposite market order is not enough and will instead result in two opposite open positions. Setting the side effect type to AUTO_REPAY resolves this by automating the repay call when closing a short or leveraged margin position. I confirmed this with Binance support as my algorithms are constantly leaving open short positions behind after closing them.

Checklist

  • I have completely filled out this template
  • I have confirmed that this issue exists on the current master branch
  • I have confirmed that this is not a duplicate issue by searching issues
  • I have provided detailed steps to reproduce the issue
@AlexCatarino AlexCatarino changed the title Unable Automatic Debt Repayment Enable Automatic Debt Repayment Dec 20, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant