This board has been archived, no new registrations are allowed. Please come join us on our discord!

Trade amount is not respected

Can't figure out how to get a specific feature working? Ask for help here.
coinflipper
Registered User
Posts: 13
Joined: Thu Nov 16, 2017 11:51 am

Trade amount is not respected

Postby coinflipper » Thu Nov 23, 2017 9:21 pm

I've set up a trade bot for BCC-BTC because Bitcoin Cash has a rather big fluctuation. Trade amount is set to 10 BCC, buy and sell template were set to limit order. According to the backtest, the bot should make a nice profit. I started the bot last evening (platform is Bittrex) with 0 BCC.

Now after about 7 hours the status is the following: the position is set to "Sold", but I still have 7.77 BCC in my wallet.

Looking at the buy and sell orders which were placed by the bot, it seems that the bot does not respect the trade amount of 10 BCC. This is the exact order history ("UNITS FILLED BCC" field), oldest on top:

Code: Select all

Limit Buy:  3.41287971 !!!
Limit Buy: 10.00000000 ***
Limit Sell: 9.97500000
Limit Buy:  4.31136664 !!!
Limit Buy: 10.00000000 ***
Limit Sell: 9.97500000

Can someone please tell me why the bot does not respect the trade amount which is configured? Why do the buys marked with !!! happen, they do not match to what I have configured. Everything would be fine if the bot would order 10 minus the already present amount in the subsequent buy orders (the orders marked with ***, both are carried out about seven minutes after the !!! orders). However that's not happening either, which is somewhat counter-intuitive. After the *** limit buys, there were about 13.4 respectively 14.3 Bitcoin Cash on my account, which is far more than what I've configured. And even that would still be fine in case the limit sells would include the full amount, but both (approximately) stick to the configuration of 10 BCC.

In summary, the situation at the end of my overnight test is quite odd because I still have about 7.77 BCC on my account, but the bot thinks they are all sold because the position is set to "Sold". What worries me most is that the performance of the bot in real life might be quite different from the backtest as long as this behavior is not resolved.

I of course understand that a limit order might not necessarily be completely fulfilled. However, my understanding was that the bot will respect the configured amount (both for buy and sell orders), so that buy and sell orders will always operate within the configured 10 BCC range. Is this assumption wrong for the "limit order" template? Would be nice if someone could enlighten me.

coinflipper
Registered User
Posts: 13
Joined: Thu Nov 16, 2017 11:51 am

Re: Trade amount is not respected

Postby coinflipper » Sun Nov 26, 2017 7:02 pm

I just observed the same issue again with DCR/BTC, the order history is as follows (trade amount is 500 DCR, oldest first):

Code: Select all

Limit Buy:  55.19904436
Limit Buy:  28.90968628
Limit Buy: 276.68637364
Limit Buy:   3.55416533
Limit Buy:  26.83889598
Limit Buy: 129.83120927 +++
Limit Buy: 500.00000000

If you sum up the numbers, then you see that the bot has reached the configured trade amount after the limit buy marked with +++. At that time, roughly 521 DCR were bought (each trade was placed as 500 DCR total units). As in the last posting, I used the normal limit order buy/sell template. Bot version was .73, platform was again Bittrex.

I really would like to know why the bot placed another order of 500 DCR after the configured amount was already reached. This was done about 3 minutes after +++, and IMHO it does not make sense. Is this a bug or normal behavior? The bot is not really usable for me as long as the order volume is so unpredictable. Why does the bot:
1) place orders about the full amount, even if the configured value is already partially fulfilled?
2) place further orders if the configured trade amount is already reached or even exceeded?

I've screened the documentation and several video tutorials and found nothing about this behavior and how to prevent it. Is there a documentation what the default limit order buy/sell template actually does? I did find nothing. Support, plz help!

chris1
Registered User
Posts: 12
Joined: Sun Oct 04, 2015 3:54 pm

Re: Trade amount is not respected

Postby chris1 » Tue Nov 28, 2017 5:54 pm

Just a guess, im new here, but:
if you have something under 10 'filled' that doesn't mean it was under 10 posted. The bot can't control how much gets actually filled.
I think you limit of 10 is per posting, not 'total at any time'.

so, my unqualified hunch is that each of the bid/ask listings was <= 10, but you can have multiple, whether in series or parallel I dont know, and they are not guaranteed to fill 100%.

Keep in mind, in a backtest simulation they are sort of guessing how much would get filled based on the orderbook and assuming you arent effecting the market. In reality, you effect the market. Also, make sure you are familiar with the concept of overfitting when you tune your bot to history and test it on a time that you didnt use to develop it.

Hope that helps, interested if anyone can give a qualified confirm / dispute on this.

coinflipper
Registered User
Posts: 13
Joined: Thu Nov 16, 2017 11:51 am

Re: Trade amount is not respected

Postby coinflipper » Tue Nov 28, 2017 9:56 pm

What I found out is that the bot seems to always post the configured trade amount (at least in case of the default templates). What I don't get is why the bot buys another full trade amount more than "timeout" seconds after the last order. This means that the last order did no longer exist, and then the bot posted another order about the full trade amount. IMHO this is a bug. The bot should have either not posted this last order about 500 DCR, or it should have canceled it.

In any case, I advise you to use the default buy/sell templates with care. One probably has to define own templates to work around this behavior.

Franco
Community Ambassador
Posts: 4
Joined: Tue Sep 26, 2017 6:38 am

Re: Trade amount is not respected

Postby Franco » Wed Nov 29, 2017 4:11 pm

Depending on what order template you use in your bot setup, your order have a time out. This means that your order gets canceled after (in example) 600 seconds. Even if your order got partially filled, the order has been canceled after the timeout. Only 100% filled orders are successfully completed.

You have two options to prevent this from happening:
[*] Use an order template without timeout
[*] Decrease the amount of coins traded

From [Haasonline]Stephan
About this trade-amount discussion... i fully understand the points suggested here and you are both right and wrong. The reason why you do not see the trade-amount beeing adjusted is because there are 2 solutions. One group of people like the bot to accept a partial trade and another group want the bot to retry. Both solutions are valid.

We did not wanted to make a decision and pick a side into this. Again both solutions are equally valid.

But this does not mean its impossible. We did made it possible for bots to accept partial trades, but its hidden behind a option. If you look to the screenshot below then you see it marked. If you check this box then the bot can adjust its trade-amount down.

I am adding in a warning at the same time, because the moment you enable this then you are saying that it is acceptable to leave coins behind. Personally i oppose this because it can give losses. To protect yourself against these losses i like to give the suggestion to add in extra bots, set to Bought (or sold) at a All-in and with a safety. Its just to create a extra layer of protection, please do this if you enable this option.
Partially.jpg

coinflipper
Registered User
Posts: 13
Joined: Thu Nov 16, 2017 11:51 am

Re: Trade amount is not respected

Postby coinflipper » Wed Nov 29, 2017 6:56 pm

Thanks for your feedback. Does the "order template without timeout" have side-effects? At which point in time are these orders canceled? I also do not have an "Enable Max Trade" checkbox below "All In". In my bot, the checkbox below "All In" is called "Max trade amount".


I don't have a trading background, but from my intuition the trading bot should be changed like this:
1) A new field "overall trade amount" needs to be introduced for each coin. This field tells the bot when it can stop buying or selling. As long as the configured amount is not reached (either for buying or selling), further orders are generated for the corresponding coin. There wouldn't be an exact Bought/Sold status anymore.
For example, imagine that the "overall trade amount" is much bigger than "trade amount". The indicators indicate "buy" and the bot buys about half the "overall trading amount" and then the market turns. Then the bot should start selling, even if the "overall trade amount" is not reached yet.
This of course only works if the "trade amount" is smaller than the "overall trade amount". In case "trade amount" == "overall trade amount", the bot would have the old behavior.
2) The "coin position" is changed into a numerical field. It tells the bot what amount of coins are currently bought.

This change has numerous advantages:
- Because there is no exact Bought/Sold status anymore, partially fulfilled orders or orders which time-out are much easier to handle. The bot only needs to check "coin position" in order to decide whether a the allowed amount is already completely bought or sold. if it is not the case, further orders can be placed.
- At the moment there is no real limitation w.r.t. amount of bought or sold coins. The new field would change this.
- A much better control of the coins. It would be e.g. even possible to trade e.g. a big amount (like 100BTC) manually and let the bot trade with 10BTC automatically.
- The bot would always stay (plus/minus a few percent) within the range of [0 .. overall trading amount] for each coin. At the moment, the individual coin wallets quickly get out of whack.
- Running several bots in parallel for different coins on the same exchange is much easier.

BTW - I would rename "trade amount" into "order amount" (or at least change the help description). Because according to my understanding, trade amount equals the amount of coins of an order.


Return to “Help and Support”

Who is online

Users browsing this forum: No registered users and 7 guests