Closed 5queezer closed 3 years ago
made a pull request #80 for an automatic update of the margin pairs, but this doesn't solve the problem
What problem does the PR solve then?
The hardcoded margin list was outdated. The PR should be a step in the right direction. Checking if a pair is available as a margin buy can be implemented at a later stage.
âŁBlueMail for Android herunterladen â
Am 1. MĂ€rz 2021, 21:36, um 21:36, Jonas Thelemann notifications@github.com schrieb:
made a pull request #80 for an automatic update of the margin pairs, but this doesn't solve the problem
What problem does the PR solve then?
-- You are receiving this because you authored the thread. Reply to this email directly or view it on GitHub: https://github.com/jsappme/node-binance-trader/issues/81#issuecomment-788554427
Ok, gotcha. So why do margin trades still fail? You mention bnb_client.mgBorrow
. Is it because the margin tradable pairs could be outdated again by when the trade is executed or what do you see there?
Because some coins are not available for cross margin trading, such as ENJ or MTL. Opening a Long on them would be easy: buy them in the Spot wallet. But a Short on a coin you don't own would be only possible as an isolated margin or as a future. Both options are USDT paired, as far as I know.
âŁBlueMail for Android herunterladen â
Am 2. MĂ€rz 2021, 14:49, um 14:49, Jonas Thelemann notifications@github.com schrieb:
Ok, gotcha. So why do margin trades still fail? You mention
bnb_client.mgBorrow
. Is it because the margin tradable pairs could be outdated again by when the trade is executed or what do you see there?-- You are receiving this because you authored the thread. Reply to this email directly or view it on GitHub: https://github.com/jsappme/node-binance-trader/issues/81#issuecomment-789205686
Please excuse my confusion, but what's the difference between available margin pairs and coins available for cross margin trading? When we fetch the pairs, no matter what they're quoted against, that are available for margin trading, under which circumstances will there be an error?
Please excuse my confusion, but what's the difference between available margin pairs and coins available for cross margin trading?
The script uses cross margin trading only. There's no difference between those two. There's also isolated margin, which is not used in our script.
When we fetch the pairs, no matter what they're quoted against, that are available for margin trading, under which circumstances will there be an error?
The error occurs when the signal from BVA contains a coin that is not available for cross margin trading.
For example, go to https://www.binance.com/en/my/wallet/account/margin and type into the search coin field ENJ, which you wonât find. Then go to isolated margin https://www.binance.com/en/my/wallet/account/margin/isolated and type ENJ again, and there you can find the coin.
For example, go to https://www.binance.com/en/my/wallet/account/margin and type into the search coin field ENJ, which you wonât find. Then go to isolated margin https://www.binance.com/en/my/wallet/account/margin/isolated and type ENJ again, and there you can find the coin.
Ok, understood so far. But https://www.binance.com/gateway-api/v1/friendly/margin/symbols only returns margin symbols so if a symbol isn't included there, the script should already fall back to normal trading. But it doesn't for you and that's the error you experience?
Obviously, the error affects short trades only that aren't in the margin pair list. Therefore a fallback to normal trading isn't possible. Possible workarounds: using futures or isolated margin.
Ohh, we're talking about selling đ Well, I think we can exclude unsellable pairs from execution. I doubt that using isolated margin is a good choice for now, because you'd need to have funds there for every possibly tradable pair, don't we? At least for now. I currently don't have experience with future trading, so I can't say if that's currently a desired workaround. @jsappme that'd be your decision.
For some coins, the trader.js script fails to margin buy them. Since they are not available for margin trading, the script fails to trade with them. An example of such coins is MTLBTC and ENJBTC.
The error looks like this:
ERROR 55555555555 ENJ 177 {"statusCode":500,"body":"{\"code\":-3027,\"msg\":\"Not a valid margin asset.\"}", ...
I made a pull request #80 for an automatic update of the margin pairs, but this doesn't solve the problem. In line 354
bnb_client.mgBorrow(
the script should be checking if the pair is available as a margin buy/sell first.