- ago
I've been running the KuCoin extension successfully, and decided to try a Short strategy for the first time this evening. At the time the strategy attempted to place a "Short at Limit" entry, it received the following error:
QUOTE:
borrow size precision must be 100


Log file: https://www.dropbox.com/s/ixl9bp9h93ctber/error_kucoin_short.txt?dl=0

0
765
10 Replies

Reply

Bookmark

Sort
Glitch8
 ( 13.42% )
- ago
#1
Thanks for reporting, will take a look.
1
- ago
#2
Is there anything I might be able to do in the short term to side-step or workaround this issue? Perhaps use a different order type, or convert to a coded strategy and modify the code somewhere?
0
Glitch8
 ( 13.42% )
- ago
#3
I don’t think so, and I won’t be able to dig into this until early next week unfortunately. It must be related to that particular crypto because I was able to successfully short other symbols during the development and testing.
1
Cone8
 ( 23.64% )
- ago
#4
Per the KuCoin doc: "The precision of the amount field shall satisfy the withdrawal precision requirements of the currency. The precision requirements for the currencies can be obtained by Withdrawals Quotas."

- so we'll have to check if we're checking those Withdrawals Quotas.
1
- ago
#5
I just wanted to check in on this. If it's something that can be fixed without a huge amount of effort, it would be greatly appreciated!
0
Glitch8
 ( 13.42% )
- ago
#6
I'm not sure the best approach here.

I wouldn't want WL8 to borrow more than the position size.

I think it would be best if you establish a short position size that matches the precision of the quota (in this case multiples of 100.)

This way the intent is clear and WL8 won't be borrowing more than a user might expect.

The error message gives you good info of what the required position size precision needs to be.
0
Cone8
 ( 23.64% )
- ago
#7
@Glitch, isn't the problem like round lots, except that the "round number" is changing for every instrument?
0
Glitch8
 ( 13.42% )
- ago
#8
Yes, position size needs to be rounded to match precision of borrowable amount. It’s something the user needs to do, WL won’t do this automatically.
0
Glitch8
 ( 13.42% )
- ago
#9
I wanted to put together a method you could add to your strategies to automatically adjust the position size for short trades based on the withdrawal quota. But I'm running into some different values than the 100 that you showed above. Take a look, I'm obtaining the withdrawal quota and the minimum withdrawal size from KuCoin API for VRA and USDT here, not seeing 100 anywhere so it's a bit confusing.

CODE:
using WealthLab.Backtest; using System; using WealthLab.Core; using WealthLab.Data; using WealthLab.Indicators; using System.Collections.Generic; using CryptoExchange.Net.Objects; using WealthLab.KuCoin; namespace WealthScript1 { public class MyStrategy : UserStrategyBase { //create indicators and other objects here, this is executed prior to the main trading loop public override void Initialize(BarHistory bars) { } //execute the strategy rules here, this is executed once for each bar in the backtest history public override void Execute(BarHistory bars, int idx) {          if (idx == bars.Count - 1)          {             Transaction t = PlaceTrade(bars, TransactionType.Short, OrderType.Limit);             AdjustQtyForShort(bars.Symbol.BaseAsset());             AdjustQtyForShort(bars.Symbol.QuoteAsset());          } }       //declare private variables below       private void AdjustQtyForShort(string symbol)       {          var c = KuCoinConnection.Instance.Client.SpotApi.Account.GetWithdrawalQuotasAsync(symbol).Result;          if (c.Success)          {             var wd = c.Data;             WriteToDebugLog(symbol);             WriteToDebugLog("Precision: " + wd.WithdrawPrecision);             WriteToDebugLog("Min Qty: " + wd.WithdrawMinQuantity);          }       } } }


0
Cone8
 ( 23.64% )
- ago
#10
Fixed in KuCoin Build 3 for BarHistory (used for Position Sizing).
0

Reply

Bookmark

Sort