Pages:
Author

Topic: Qt Bitcoin Trader [Open Source secure trading client for Mac/Windows/Linux] - page 23. (Read 383582 times)

hero member
Activity: 981
Merit: 500
DIV - Your "Virtual Life" Secured and Decentralize
Another set of mistakes. The errors only show up in a non range bound situation. My last range was higher so I have a sell significantly above where the 1% back and forth rules should work the following seems to happen. I have a sell at 335 a buy at 330 and 324 (another rule serves to buy back as the market moves down) then a sell at 327 then a buy at 327 then a sell at 327. This is with a 5 minute delay.

So it appears the new Last Sell isn't the actual last sell for around 10 minutes. Possibly 10 minutes would work I am testing that now.  It shouldn't have more then 2 mistakes if I am wrong. At 5 minutes there ended up being 3 and at 1 second there could be more then 20. Obviously 3 is a huge improvement. Now for the problem I am currently seeing. Assuming 10 minutes works and there are 0 mistakes (I can't prove it yet) the maximum trades per hour is 6. Realistically I should bet 5 maybe would complete. As long as they are profitable I guess it is ok. If the market gets busy though I will see potentially many possibilities to have made money and the bot waiting for the Last Buy or Sell to be the actual Last Buy or Sell that was filled.

I'm not sure how you can reproduce the problem but I can see something happening.
hero member
Activity: 981
Merit: 500
DIV - Your "Virtual Life" Secured and Decentralize
Here are some trades from today.
11:16:03 0.010025 Bought 344.774
2:59:12   0.01        Sold     350.00
4:13:20   0.01        Sold     348.565  (wasn't manual but seems odd it happened there. I know one of these was manual I believe it was 3.50)
1:42:31   0.01        Sold     353.508  (manually started this one to force it to move into a new range. It seems I don't have up buy then sell working correctly yet.)
2:42:45   0.010021 Bought 349.92    (that should be about 1% lower then 353.508)
2:43:46   0.01        Sold     349.157  (I believe this trade keyed its price off of the 11:16:03 PM price last night not the 2:42:45 Price this afternoon.)
The lack of a following buy tells me that 62 minutes 15 seconds is long enough to use that price as a last. That isn't super helpful but is closer to an answer then nothing.

I'm not sure the Delays will help as it should pull the last buy price automatically when it starts that rule. The delay would likely give the order more time to actually clear but the order cleared 61 seconds before the next Sell. I'm not sure how big to go on delay I am sure it helps somewhat because eventually it should pull the last trade as the one that happened a while ago. I know it either works or sometimes works as I can go back and put the sell rule back on and it doesn't sell immediately when the delay runs out. I am not sure that I have found a workable solution. Eventually I should have a high enough delay that the trade will happen long enough ago that the last buy or sell gets pulled in correctly. I'm just not sure how long that will take.

As an aside. Although upping the delay would help as long as said delay is before the actual trade test portion I am not sure its a good answer. At some point the delay will force the bot to miss valid trades in a volatile market. Precisely when it would be the most logical to have a cold calculating piece of software looking for trades to make.

I have increased my pre test delay to 90 seconds. This seems excessive but hopefully no more mistakes or very very rare mistakes.
I wonder if it would be possible to export trade data to a csv file. It would seem easier to color the buys and sells and maybe mistakes differently. It would be easier to see the differences on working vs not working. Then again I could just go through manually and check each one looking for the shortest time that worked.

Thank You for your hard work. I am sorry I am having so much trouble with it. I shouldn't be I don't think but maybe its OS or something else related.
Exchange BTCe, OS win 7 64 bit, currency pair BTC/USD. Delay seems to be less then 0.1 frequently listed as 0.0.


Today the same thing happened. I am starting to think there is a definite pattern. That pattern is the last buy or sell isn't the actual last buy or sell for some time after the buy or sell. I was sure the manual trade caused problems but it seems not.

2:09:26AM   0.010000  sold       353.443 (automatic sell that the miss seems to be keyed off of)
9:53:45AM   0.010021  bought   349.624 (automatic buy)
8:46:33PM   0.010025  bought  345.00 (manual trade)
8:58:41PM   0.010021  bought  344.78 (automatic buy)
10.26.26PM  0.010000  sold      348.34 (automatic sell)
10:27:58PM 0.010021  sold       348.81 (automatic buy) Swing and a miss.

Ok math time. 1:32 I do believe is the time to beat. Odd. It took 2 seconds more then the initial 90 second delay. It paid more then the last sell...

Added more info:
Another day another similar occurrence. I have again an big move outside the 1% trading window. This time up. I have a buy then 2 sells ( I started the second one manually). Then a buy at a profitable price (it has to wait either to be below the actual last or below the one before it that is even lower). Now after that buy finishes after maybe an hour there is a sell nearly immediately. Well after 240 seconds of delay but immediate enough and the sell is below the last buy.

I have upped the delay to 300 hoping that waiting for 5 minutes after the sell or buy happens will give me that buy or sells price as the last price. For now I am using trial and error. If anyone knows a delay that will work I would love to know. Increasing by 60 seconds per mistake and hoping it will eventually at least make money rather then flushing quite a few trades profits down the exchanges coffers.
hero member
Activity: 981
Merit: 500
DIV - Your "Virtual Life" Secured and Decentralize
I'm Still having troubles with the % up and down not calculating correctly. I had another thought as to why they didn't work. I was looking at failed trades and winning trades and noticed a likely arbitrary coincidence that the short time span ( 28 seconds or less) trades all failed to be at least 1% apart as the rule should require. I have noted nothing in the log pointing towards the API lag being the cause of this. Apparently that too was a red herring.

So after noticing that the short turn around trade pairs always ended in failure and that long delays between the two usually an hour at least ended with a successful trade I got to thinking. What if the last buy or last sell isn't immediately correct? So I added first a 30 second delay into the rule that did the trading (wow random trade data). I eventually looked at the code and noticed that it doesn't delay testing it delays execution. Well that was a no go for me. So I add a rule before the rule that trades just to have a 30 second delay in it. At this point 5 of 6 rules had been put at 30 seconds delay before trying to buy or sell. I had to, a while later, ratchet it up to 45 seconds of delay on 5 of 6. Apparently I forgot one of them.

It seemed to work for a couple of days I had maybe 1 failed trade in 20. Not both a buy and sell just a buy or just a sell. The market was relatively flat though. Today I had another cluster of bad trades. 4 fail 2 success. This also pointed me to the fact that the maximum time on failures was 58 seconds. Orders farther then 58 seconds apart actually managed to be at least 1% apart. I have changed the starting delay up to 60 seconds but I don't believe this will be of help. On failures the order seems to nearly immediately execute and will do so regardless of prices and its relation to the other price.

I'm not sure what is going wrong nothing that is actually logged by default will help me find the answer. On the auto generated version of the new system the rules as it where, could you add a variable trace inside execute? That being the baseVariable. It would show what the number as calculated should be above of below.
legendary
Activity: 1034
Merit: 1065



"buy btc" is exact btc amount and "spend usd" btc amount depends on price.

could you please describe it with an example. dont  understand it. thank you.



Sell 1 BTC at 400 USD will place 1 BTC order.
Spend 400 USD will place 1 BTC order only if price is equal to 400 USD
So if you configure "Spend 50% my USD" than you will don't know exact amount of received btc (depends on price), but you will know exact % of usd.
Spend 20 USD will get 0.1BTC at 200 USD price and 0.2 BTC at 100 USD price.
Usage depends on your strategy.
sr. member
Activity: 407
Merit: 250
"buy btc" is exact btc amount and "spend usd" btc amount depends on price.

could you please describe it with an example.i  dont  understand it. thank you.

legendary
Activity: 1034
Merit: 1065
i am trading exactly now and its happening about 80% of the orders. really

This bug will be fixed in upcoming update in few days.
sr. member
Activity: 407
Merit: 250
HI,

low chance? this are 2 rule options

Sorry, mistyped messages.
There is low chance to get 383.80 instead of 383.81.

"buy btc" is exact btc amount and "spend usd" btc amount depends on price.

i am trading exactly now and its happening about 80% of the orders. really
legendary
Activity: 1034
Merit: 1065
HI,

low chance? this are 2 rule options

Sorry, mistyped messages.
There is low chance to get 383.80 instead of 383.81.

"buy btc" is exact btc amount and "spend usd" btc amount depends on price.
sr. member
Activity: 407
Merit: 250
does anybody know that?

Hi. Thanks for bug report. I can confirm that this is bug and it happens with low chance.
It will be fixed in upcoming update.

HI,

low chance? this are 2 rule options
"buy btc" and "spend usd"
legendary
Activity: 1034
Merit: 1065
does anybody know that?

Hi. Thanks for bug report. I can confirm that this is bug and it happens with low chance.
It will be fixed in upcoming update.
sr. member
Activity: 407
Merit: 250
HI,

what is exactly the difference between "buy btc" and "spend usd" ? ..both used with 100% - Fee

does anybody know that?
sr. member
Activity: 407
Merit: 250
HI Ighor,

2 things:

1. Will you add the support for OKCOIN?
2. The newest versions (1.08-1.08.02) are making in about 60% of order creating times this small mistakes (bug):
I make for example an order with 383.81USD (by typing or using the arrow buttons) but QT  creates an order with 383.80 USD

1. I'll work on it.
2. Thanks, I'll fix it soon. Can you please tell exchange and currency pair you used when this bug happens?

HI,

Stamp. only BTC/usd of course.
legendary
Activity: 1034
Merit: 1065
HI Ighor,

2 things:

1. Will you add the support for OKCOIN?
2. The newest versions (1.08-1.08.02) are making in about 60% of order creating times this small mistakes (bug):
I make for example an order with 383.81USD (by typing or using the arrow buttons) but QT  creates an order with 383.80 USD

1. I'll work on it.
2. Thanks, I'll fix it soon. Can you please tell exchange and currency pair you used when this bug happens?
sr. member
Activity: 407
Merit: 250
HI Ighor,

2 things:

1. Will you add the support for OKCOIN?
2. The newest versions (1.08-1.08.02) are making in about 60% of order creating times this small mistakes (bug):
I make for example an order with 383.81USD (by typing or using the arrow buttons) but QT  creates an order with 383.80 USD
legendary
Activity: 1034
Merit: 1065
I made another mistake before and left out 2 return's. I think that is why the modified script wouldn't execute all day yesterday. I have corrected that issue. I really need to put in a few more log items to chase down that not executing problem to where I messed up.

Ok, give me more info when more log collected.
hero member
Activity: 981
Merit: 500
DIV - Your "Virtual Life" Secured and Decentralize
Updated to current version and still having a selling/buying at the wrong price going on. Not on every trade. I think I have found the cause. As only a couple of my rules use the script engine I'm not sure how to correct it. Tonight the internet connection dropped for a while 2 times. The first time the rule was into the executeRule section.
The code I'm thinking was involved is the following:
Code:
 if(trader.get("ApiLag")>10)
 {
 trader.log("Api lag is to high");
 trader.delay(1,"executeRule()");
 return;
 }
The trouble seems to be that the rule will correctly decide the price is right for trading but if something goes wrong I get a trade as soon as the API is back under 10. I am not 100% positive that is it but I am unable to reliably cause this sell or buy issue with only enabling or disabling a rule. I don't have anything setup to figure out if the API is delaying too much. I will try to figure out if I can get the execute to log the API lag when the trade is placed as that should show if this is the issue. I can't be 100% sure it is as the log of the API lag being to high hasn't to my knowledge been on the console. Occasionally I do not check quickly. This leads me to an issue where I have checked after the 20 lines that the history has saved.

As another question this time on to a small problem I am having with the trader.log. I think I am messing up something but the following should be under 4 items with unlimited characters. I can't say for sure that this line has a problem but it appears the condition should have gotten far enough to trigger it.
Code:
 trader.log(baseVariable, " < ", trader.get(AskPrice));

I managed to get a code error on validation with a trader.get in front of baseVariable. I should be able to log the values prior to calling execute and see the last values that the trade should be based on.

EDIT: The second enable on the same group didn't cause a trade to happen low. The API went down while the price was too low and nothing happened when the API came back up.

Thanks I'll inspect what happens on API down.
What event have you used?
The event is trader.on("AskPrice").changed(). For the whole script. For the trader.log portion it is under the execute() function.

I was trying to set up a script to do some upward trading. The initial problem was I would get a buy above the last sell (expected behavior) then a sell that either didn't fill or had another issue (expected to happen occasionally). Then the buy would trigger again as the sell that should stop it from executing at the same price didn't fill (expected behavior). The problem was I didn't like the amount of churn it had. So I tried adding a sanity check. I had to swap to script to make it work. I wanted the price to be both above the last sell and the last buy. My reasoning was it would slow or stop the constant trading that wasn't always profitable.

I made another mistake before and left out 2 return's. I think that is why the modified script wouldn't execute all day yesterday. I have corrected that issue. I really need to put in a few more log items to chase down that not executing problem to where I messed up.
newbie
Activity: 4
Merit: 0
Question about trader.startApp():

Is it possible to pass arguments like
Code:
trader.startApp("/home/usr/test.py myOwnArgument")
or
Code:
trader.startApp("/home/usr/test.py", myOwnArgument)
?

If not, feature request, would be awesome Smiley (sorry, hadn't got the time to test it yet)

Yes, up to 4 arguments for now.
Your second code is correct.
But maybe you need to put python app first and test.py as first and myOwnArgument as second argument.
Code:
trader.startApp("python", "/home/usr/test.py", myOwnArgument)

Awesome! Smiley
(Thanks for the fast answer)
legendary
Activity: 1034
Merit: 1065
Question about trader.startApp():

Is it possible to pass arguments like
Code:
trader.startApp("/home/usr/test.py myOwnArgument")
or
Code:
trader.startApp("/home/usr/test.py", myOwnArgument)
?

If not, feature request, would be awesome Smiley (sorry, hadn't got the time to test it yet)

Yes, up to 4 arguments for now.
Your second code is correct.
But maybe you need to put python app first and test.py as first and myOwnArgument as second argument.
Code:
trader.startApp("python", "/home/usr/test.py", myOwnArgument)
newbie
Activity: 4
Merit: 0
Question about trader.startApp():

Is it possible to pass arguments like
Code:
trader.startApp("/home/usr/test.py myOwnArgument")
or
Code:
trader.startApp("/home/usr/test.py", myOwnArgument)
?

If not, feature request, would be awesome Smiley (sorry, hadn't got the time to test it yet)
legendary
Activity: 1034
Merit: 1065
Updated to current version and still having a selling/buying at the wrong price going on. Not on every trade. I think I have found the cause. As only a couple of my rules use the script engine I'm not sure how to correct it. Tonight the internet connection dropped for a while 2 times. The first time the rule was into the executeRule section.
The code I'm thinking was involved is the following:
Code:
 if(trader.get("ApiLag")>10)
 {
 trader.log("Api lag is to high");
 trader.delay(1,"executeRule()");
 return;
 }
The trouble seems to be that the rule will correctly decide the price is right for trading but if something goes wrong I get a trade as soon as the API is back under 10. I am not 100% positive that is it but I am unable to reliably cause this sell or buy issue with only enabling or disabling a rule. I don't have anything setup to figure out if the API is delaying too much. I will try to figure out if I can get the execute to log the API lag when the trade is placed as that should show if this is the issue. I can't be 100% sure it is as the log of the API lag being to high hasn't to my knowledge been on the console. Occasionally I do not check quickly. This leads me to an issue where I have checked after the 20 lines that the history has saved.

As another question this time on to a small problem I am having with the trader.log. I think I am messing up something but the following should be under 4 items with unlimited characters. I can't say for sure that this line has a problem but it appears the condition should have gotten far enough to trigger it.
Code:
 trader.log(baseVariable, " < ", trader.get(AskPrice));

I managed to get a code error on validation with a trader.get in front of baseVariable. I should be able to log the values prior to calling execute and see the last values that the trade should be based on.

EDIT: The second enable on the same group didn't cause a trade to happen low. The API went down while the price was too low and nothing happened when the API came back up.

Thanks I'll inspect what happens on API down.
What event have you used?
Pages:
Jump to: