Bitcoin Forum
November 14, 2024, 10:01:52 AM *
News: Check out the artwork 1Dq created to commemorate this forum's 15th anniversary
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: BTC-e and bitcoinwisdom trade differences  (Read 1599 times)
Eric14 (OP)
Newbie
*
Offline Offline

Activity: 20
Merit: 0


View Profile
January 13, 2014, 09:20:36 PM
 #1

I've been working on a trading bot for BTC-e and I was comparing 3min intervals with bitcoinwisdom and my software.  I noticed the bitcoinwisdom (BCW for short) produced some odd numbers.

For example here is the trades that take place according to btc-e's API:

date               timestamp      price      trade id   seqId      amount
2014-01-13 09:41:59   1389642119   23.0611   27081938   42874   6.4243
2014-01-13 09:42:01   1389642121   23.0045   27081939   42875   7
2014-01-13 09:42:02   1389642122   23.09      27081940   42876   0.22634
2014-01-13 09:42:12   1389642132   23.09      27081942   42877   0.1
2014-01-13 09:42:12   1389642132   23.09      27081943   42878   0.1
2014-01-13 09:42:59   1389642179   23.1378   27081972   42879   1
2014-01-13 09:43:39   1389642219   23.1376   27082018   42880   0.64829
2014-01-13 09:43:39   1389642219   23.1377   27082019   42881   11.2153
2014-01-13 09:43:50   1389642230   23.1373   27082027   42882   100
2014-01-13 09:44:37   1389642277   23.0046   27082041   42883   0.64826
2014-01-13 09:44:54   1389642294   23.0046   27082053   42884   0.134273
2014-01-13 09:45:18   1389642318   23.0045   27082064   42885   0.922397

These time bracket the interval from 9:42 to 9:45 for computing a 3min interval.  If you compare this to BCW report for the same time (9:45 with 3min interval)

open   23
close   23.1
high   23.1
low   22.97

While it seems ok until the Close and LOW, which are not correct.  I've noticed other odd things on BCW like the volume not adding up correctly.  Has anyone spent time looking at BCW's numbers?  Is there something I'm not getting here?
tradewave
Newbie
*
Offline Offline

Activity: 31
Merit: 0


View Profile WWW
January 13, 2014, 11:07:08 PM
 #2

I have quite a lot of experience with the BTC-e API and have used bitcoinwisdom a fair amount too. Which sources are you comparing exactly?

Here are some other feeds supplied by BTC-e, perhaps they will help you:

https://btc-e.com/api/2/btc_usd/ticker
https://btc-e.com/api/2/btc_usd/depth
https://btc-e.com/api/2/btc_usd/trades
https://btc-e.com/api/2/btc_usd/fees
Eric14 (OP)
Newbie
*
Offline Offline

Activity: 20
Merit: 0


View Profile
January 14, 2014, 01:53:44 AM
 #3

Thanks for getting back to me.  I've been doing a lot of work with their API.  I'm pulling these trades I posted (for LTC) via https://btc-e.com/api/2/ltc_usd/trades

I can't seem to duplicate some of BCW numbers for their time intervals as you can see by my example I posted.  Is it correct to assume a 9:45 data point spans trades between 9:45 and 9:42?  I took a screen shot from BCW from the above example and I've attached it:

https://i.imgur.com/lK7WTh0.png

I also can not duplicate their indicators.  Are their parameters based on intervals?  For example a SMA of 10/20 on a 3min chart is that 10 moving sample once every 3 minutes or are they doing something different?  Their lines are much smoother than I am able to duplicate for the same settings.
DCP
Member
**
Offline Offline

Activity: 110
Merit: 10


View Profile
January 14, 2014, 03:45:28 AM
 #4

I have been trading a lot with BTC-E's metatrader, be careful as they often manipulate the spread when you enter and cause delays to open and close trades. You'll want to account for that in your program. (This mostly affects people for short-term trading, it's very challenging with the high commissions)

H ~ O ~ D ~ L
Eric14 (OP)
Newbie
*
Offline Offline

Activity: 20
Merit: 0


View Profile
January 14, 2014, 05:52:59 AM
 #5

@DCP.  I'm really interested in understanding what is going on with the TRADE api vs bitcoinwisdom and how the calculations compare.  It appears they are not working from exactly the same data, or I don't understand their algorithm correctly.  I could be looking at the time periods wrong or there could be something else I don't know about going on.  So I thought I would ask if there are others who have noticed discrepancies or have done these type of calculations before for some insight.

Thanks.
DCP
Member
**
Offline Offline

Activity: 110
Merit: 10


View Profile
January 14, 2014, 07:58:32 AM
 #6

Hey Eric, how are you getting your data for BTC-E?  Are you using a period converter script in mt4 to create a 3 minute chart?

H ~ O ~ D ~ L
Eric14 (OP)
Newbie
*
Offline Offline

Activity: 20
Merit: 0


View Profile
January 14, 2014, 08:15:33 AM
 #7

I wrote my own program to pull the trade data for the selected period, which is what you see in the orginal post.
DCP
Member
**
Offline Offline

Activity: 110
Merit: 10


View Profile
January 14, 2014, 08:43:12 AM
 #8

Hmm, I only have experience using their metatrader platform, not with the api. From what I've seen from my spread history indicator is that they widen the bid/ask frequently.

H ~ O ~ D ~ L
tradewave
Newbie
*
Offline Offline

Activity: 31
Merit: 0


View Profile WWW
January 14, 2014, 05:32:29 PM
 #9

Thanks for getting back to me.  I've been doing a lot of work with their API.  I'm pulling these trades I posted (for LTC) via https://btc-e.com/api/2/ltc_usd/trades

I can't seem to duplicate some of BCW numbers for their time intervals as you can see by my example I posted.  Is it correct to assume a 9:45 data point spans trades between 9:45 and 9:42?  I took a screen shot from BCW from the above example and I've attached it:

https://i.imgur.com/lK7WTh0.png

I also can not duplicate their indicators.  Are their parameters based on intervals?  For example a SMA of 10/20 on a 3min chart is that 10 moving sample once every 3 minutes or are they doing something different?  Their lines are much smoother than I am able to duplicate for the same settings.


You have 3m selected for your time interval, so presumably (and it depends on how BCW is calculating it) that data is for a window beginning 3 minutes prior to that point, ending at the point you selected. So the 'open' amount is the price 3 minutes ago and the 'close' amount is the price at that point.

I think SMA of 10/20 should be across the 3 min samples yes. Again, depends on their implementation.

I'd advise focusing on your own interpretation of the data rather than trying to duplicate BCW, because who knows what they're doing under the hood.

Hope that helps.
Eric14 (OP)
Newbie
*
Offline Offline

Activity: 20
Merit: 0


View Profile
January 14, 2014, 06:29:07 PM
 #10

I am looking for something to test my numbers against and what you describe is what I'm doing (see data in first post).  But it doesn't appear to be how BCW does it.  Since I don't know technical trading I'm trying to figure out what is going on.

Also the btc-e api has many issues that are complicating the calculations so I'm trying to see how pros like BCW handle the data.  It seems like the example I'm illustrating with the raw data vs. their charts shows that they are doing something that I don't understand or are getting data from somewhere other than the API.
diacon
Newbie
*
Offline Offline

Activity: 42
Merit: 0


View Profile
January 14, 2014, 09:17:41 PM
 #11

May be there's error on the BCW side. Do you try to find your rate values on the trading list on the right on BCW at 9:45 or nearly? May be there is some strange shifting.

Not the topic: Can i ask what programming language do you use?
Eric14 (OP)
Newbie
*
Offline Offline

Activity: 20
Merit: 0


View Profile
January 14, 2014, 11:10:29 PM
 #12

I've tried a few time slices and the example I posted is typical.  The BCW site shows numbers that are not in the API trade data.  However I have not checked it against other time intervals.  Perhaps a 3min interval posted at 9:45 does not mean 9:45 to 9:42 but something else.  Since I've run into a lot of weird problems with the btc-e trade data I thought someone here might be familiar with it or BCW methods.  Maybe I should run it over 1 min intervals to reduce any errors in how the time frames are defined.

I'm using python with a sqlite3 database and matplotlib modules.
Eric14 (OP)
Newbie
*
Offline Offline

Activity: 20
Merit: 0


View Profile
January 15, 2014, 04:33:59 AM
 #13

Wow it is worse than I thought.  Their own reported trade data is all messed up.  I captured their own "trade" list and the API and their chart values all at once.  Since their chart data seems to be wrong too this might be a systemic problem rather than just how bitcoinwisdom.com prints out the display.

From Chart 3m period
17:39:00 - 17:36:00
open: 23.55
High: 23.60
close: 23.58  (not according to btc-e API)
Low: 23.50 (not according to btc-e API)

From the chart's trade list it never hits 23.50, or 23.58 during this time frame. 

For some reason BCW is modifying the time stamps and it appears their volume data is often very wrong and there are missing trades!  And I understand combining trades at similar times at same prices, but changing the times?

From bitcoinwisdom's trade window:
17:40:11 23.551 70.6785 (real time stamp from API shows 17:39:59)
17:39:59 23.551 0.25 (time stamp shows this should be 17:39:56 )
17:39:56 23.551 0.4008 (this is two trades combined that were 1 seconds apart)
17:39:52 23.551 0.2004 (really 17:39:49)
17:39:49 23.551 0.2004 (??!  This trade never occurred!)
17:39:44 23.5999 1.18955 (at 17:39:44)
(missing a trade here?  17:39:44  23.511 0.98915 )
17:39:44 23.551 0.25038 (is this the missing trade with wrong volume?)
17:39:37 23.5999 0.23395 (really is at 17:39:42 and volume is wrong!  0.25038!  See above trade vol.)
17:39:21 23.6 0.2004 (volume is wrong here too)
17:39:18 23.6 70 (never happened at 70 shares....errors go on and on)
17:39:15 23.551 38.2491 (vol is really 63.2996)
17:38:28 23.6 0.38036
17:38:11 23.6 0.11827
17:37:38 23.6 0.15
17:37:34 23.6 0.32719 (this volume actually traded at 23.5996)
17:36:56 23.5996 3.44501
17:36:21 23.5997 0.1
17:35:59 23.5998 0.10360

From BCT-e api for comparison:

{"date":1389757199,"price":23.551,"amount":70.6785,"tid":27194971,"price_currency":"USD","item":"LTC","trade_type":"ask"}, ** 2014-01-14 17:39:59 **
{"date":1389757196,"price":23.551,"amount":0.25,"tid":27194970,"price_currency":"USD","item":"LTC","trade_type":"bid"}, ** 2014-01-14 17:39:56 **

{"date":1389757192,"price":23.551,"amount":0.2004,"tid":27194965,"price_currency":"USD","item":"LTC","trade_type":"bid"}, ** 2014-01-14 17:39:52 **
{"date":1389757191,"price":23.551,"amount":0.2004,"tid":27194964,"price_currency":"USD","item":"LTC","trade_type":"bid"}, ** 2014-01-14 17:39:51 **

{"date":1389757189,"price":23.551,"amount":0.2004,"tid":27194963,"price_currency":"USD","item":"LTC","trade_type":"ask"}, **  2014-01-14 17:39:49 **

{"date":1389757184,"price":23.5999,"amount":0.2004,"tid":27194962,"price_currency":"USD","item":"LTC","trade_type":"bid"}, **  2014-01-14 17:39:44 **

{"date":1389757184,"price":23.551,"amount":0.98915,"tid":27194961,"price_currency":"USD","item":"LTC","trade_type":"ask"}, **  2014-01-14 17:39:44 **

{"date":1389757184,"price":23.551,"amount":0.2004,"tid":27194960,"price_currency":"USD","item":"LTC","trade_type":"ask"}, **  2014-01-14 17:39:44 **

{"date":1389757177,"price":23.5999,"amount":0.25038,"tid":27194948,"price_currency":"USD","item":"LTC","trade_type":"bid"} **  2014-01-14 17:39:42 **

,{"date":1389757161,"price":23.6,"amount":0.233955,"tid":27194943,"price_currency":"USD","item":"LTC","trade_type":"bid"},{"date":1389757158,"price":23.6,"amount":0.2004,"tid":27194940,"price_currency":"USD","item":"LTC","trade_type":"bid"},{"date":1389757155,"price":23.551,"amount":63.2996,"tid":27194939,"price_currency":"USD","item":"LTC","trade_type":"ask"},{"date":1389757155,"price":23.552,"amount":6.5,"tid":27194938,"price_currency":"USD","item":"LTC","trade_type":"ask"},{"date":1389757155,"price":23.552,"amount":0.2004,"tid":27194937,"price_currency":"USD","item":"LTC","trade_type":"ask"},{"date":1389757108,"price":23.6,"amount":38.2491,"tid":27194927,"price_currency":"USD","item":"LTC","trade_type":"bid"},{"date":1389757091,"price":23.6,"amount":0.380361,"tid":27194925,"price_currency":"USD","item":"LTC","trade_type":"bid"},{"date":1389757058,"price":23.6,"amount":0.118274,"tid":27194894,"price_currency":"USD","item":"LTC","trade_type":"bid"},{"date":1389757054,"price":23.6,"amount":0.15,"tid":27194892,"price_currency":"USD","item":"LTC","trade_type":"ask"},{"date":1389757016,"price":23.5996,"amount":0.327193,"tid":27194874,"price_currency":"USD","item":"LTC","trade_type":"bid"},{"date":1389756981,"price":23.5997,"amount":3.44501,"tid":27194779,"price_currency":"USD","item":"LTC","trade_type":"bid"},{"date":1389756959,"price":23.5998,"amount":0.1,"tid":27194723,"price_currency":"USD","item":"LTC","trade_type":"bid"},{"date":1389756945,"price":23.5998,"amount":0.103609,"tid":27194713,"price_currency":"USD","item":"LTC","trade_type":"bid"},
knightcoin
Full Member
***
Offline Offline

Activity: 238
Merit: 100


Stand on the shoulders of giants


View Profile
January 15, 2014, 05:10:54 AM
 #14

Wow it is worse than I thought.  Their own reported trade data is all messed up.  I captured their own "trade" list and the API and their chart values all at once.  Since their chart data seems to be wrong too this might be a systemic problem rather than just how bitcoinwisdom.com prints out the display.

From Chart 3m period
17:39:00 - 17:36:00
open: 23.55
High: 23.60
close: 23.58  (not according to btc-e API)
Low: 23.50 (not according to btc-e API)

From the chart's trade list it never hits 23.50, or 23.58 during this time frame.  

For some reason BCW is modifying the time stamps and it appears their volume data is often very wrong and there are missing trades!  And I understand combining trades at similar times at same prices, but changing the times?

From bitcoinwisdom's trade window:
17:40:11 23.551 70.6785 (real time stamp from API shows 17:39:59)
17:39:59 23.551 0.25 (time stamp shows this should be 17:39:56 )
17:39:56 23.551 0.4008 (this is two trades combined that were 1 seconds apart)
17:39:52 23.551 0.2004 (really 17:39:49)
17:39:49 23.551 0.2004 (??!  This trade never occurred!)
17:39:44 23.5999 1.18955 (at 17:39:44)
(missing a trade here?  17:39:44  23.511 0.98915 )
17:39:44 23.551 0.25038 (is this the missing trade with wrong volume?)
17:39:37 23.5999 0.23395 (really is at 17:39:42 and volume is wrong!  0.25038!  See above trade vol.)
17:39:21 23.6 0.2004 (volume is wrong here too)
17:39:18 23.6 70 (never happened at 70 shares....errors go on and on)
17:39:15 23.551 38.2491 (vol is really 63.2996)
17:38:28 23.6 0.38036
17:38:11 23.6 0.11827
17:37:38 23.6 0.15
17:37:34 23.6 0.32719 (this volume actually traded at 23.5996)
17:36:56 23.5996 3.44501
17:36:21 23.5997 0.1
17:35:59 23.5998 0.10360


is it a order matching engine bug Huh

http://www.introversion.co.uk/
mit/x11 licence 18.x/16|o|3ffe ::71
Eric14 (OP)
Newbie
*
Offline Offline

Activity: 20
Merit: 0


View Profile
January 15, 2014, 05:59:55 AM
 #15

There is a bug somewhere.  The volumes seem to get swapped around and the time stamps are different.  And there are trades that I don't know where they came from.  I don't have time to go through them line by line, but all the data is posted if someone wants to try.

The second question is BCW using the API or are they getting a different feed from BTC-e?
BitcoinWisdom
Hero Member
*****
Offline Offline

Activity: 602
Merit: 505


View Profile
January 15, 2014, 08:40:54 PM
 #16

We group the trades.

17:39:21 23.6 0.2004
17:39:18 23.6 70 (63.2996+6.5+0.2004)
17:39:15 23.551 38.2491 (The volume is correct, but the price seems different, I have no idea, the data in our database is correct)
17:38:28 23.6 0.38036
17:38:11 23.6 0.11827
17:37:38 23.6 0.15
17:37:34 23.6 0.32719 (this volume is the same as BTC-e)
17:36:56 23.5996 3.44501
17:36:21 23.5997 0.1
17:35:59 23.5998 0.10360

Realtime Bitcoin/Litecoin Charts: BitcoinWisdom
BitcoinWisdom
Hero Member
*****
Offline Offline

Activity: 602
Merit: 505


View Profile
January 15, 2014, 08:48:49 PM
 #17

We group the trades.

17:39:21 23.6 0.2004
17:39:18 23.6 70 (63.2996+6.5+0.2004)
17:39:15 23.551 38.2491 (The volume is correct, but the price seems different, I have no idea, the data in our database is correct)
17:38:28 23.6 0.38036
17:38:11 23.6 0.11827
17:37:38 23.6 0.15
17:37:34 23.6 0.32719 (this volume is the same as BTC-e)
17:36:56 23.5996 3.44501
17:36:21 23.5997 0.1
17:35:59 23.5998 0.10360

I see, because of we float the price first, directly copy & paste will mess the date. it shows correct in trade view

It should be

0.2004 17:39:18 23.6
70 (63.2996+6.5+0.2004) 17:39:15 23.551
38.2491 (Now it is correct.) 17:38:28 23.6
0.38036 17:38:11 23.6
0.11827 17:37:38 23.6

Realtime Bitcoin/Litecoin Charts: BitcoinWisdom
BitcoinWisdom
Hero Member
*****
Offline Offline

Activity: 602
Merit: 505


View Profile
January 15, 2014, 08:54:03 PM
 #18

9:45 for BitcoinWisdom is from 9:45:00 to 9:47:59 instead of from 42 to 45

Realtime Bitcoin/Litecoin Charts: BitcoinWisdom
Eric14 (OP)
Newbie
*
Offline Offline

Activity: 20
Merit: 0


View Profile
January 15, 2014, 10:30:03 PM
 #19

Thanks for taking the time to clear that up for me.  I understand why the open/closes/etc. are not working for me when I compare them.  And now I understand better how your cool charts work.

I am curious how you group the trades.  I've found 3 cases that occur with BTC-e:

1.  Multiple trades at the same time with same time stamp.  (Just add volumes together.)
2.  Multiple trades at different prices with same time stamp. (I have just been sequencing them assuming that the newest trade is always on top even if the time stamp is the same).
3.  Multiple trades at different prices and same prices all with the same time stamp (confusing but I only combine volumes of trades of the same price that are in a sequence together, if there is a different price in between the two same prices I treat them separately).

Are you doing something different to group them and which time stamps do you designate to them?  I have been trying to preserve their time data 100% because I re-sample the values with linear interpolation to even out the time base into a per second basis to do my time averages.  Is this a good approach?
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!