Pages:
Author

Topic: BTC-E PHP Currency Arbitrage Bot Full Code - page 3. (Read 39926 times)

legendary
Activity: 1610
Merit: 1000
Crackpot Idealist
Well hello mr fancy pants...

Thank you for the technical answer and the fun code to play with.
donator
Activity: 686
Merit: 519
It's for the children!
Is arbitrage still profitable? and how has your experience been so far running this?

Arbitrage is less profitable now that a lot of bots exist.   As I said I have abandoned this for a rolling buy sell bot which is proving more profitable.  I did make several B over the course of a few weeks using this bot.  I would think that other exchanges and auto transfers could be added in order to take advantage of the dozen or so alts out there with different prices and faster transaction times than B.

All of that said.  I'm not one to turn down making even $.01 a day while I sleep, eat and work.  Free money is free money.

Can you point a noob to something that explains what the strategy is for a rolling buy sell bot?

Thanks.

BTC to USD rolls, as in the value repeatedly crosses the same point or the same trailing/advancing points.

In it's simplest form a lot of people roll BTC just by buying at 120,110,100,90,80 and selling at 100,110,120,130. 

In a more advanced form BTC experiences hundreds of micro spikes and dips (my trade engine V2) which lets you buy at 114.26 and sell at 114.84 etc.
Code:
Buy = Last*(1-.002)*((1-$profitThreshold/2)^(1+iteration))
Sell = Buy/(1-.002)/((1-$profitThreshold/2)^(1+iteration))
up to hundreds of times a day.   


In a more advanced form, BTC experiences macro-rolls of 2-10% on a daily/weekly/monthly basis allowing you to buy at almost any price and sell at an advancing price of +2.5/5/10% while at the same time experiencing micro-rolls mentioned above (my trade engine V3)
Code:
Sell = Dolar Cost Average /(1-.002)/(1-.002)/((1-$biggerProfitThreshold)^(1+iteration))

In an even more advanced form, BTC Appreciates and Depreciates to USD at different intervals (rolling price) and moves toward and away from a rolling 24 hour high and low.  If you were always 100% in BTC as it approached and broke the high, and were always 100% in USD as BTC approached and broke the low, you would profit (a lot) from the resulting appreciation of BTC vs USD and USD vs BTC.
Code:
Omitted

The n00b answer is "a rolling bot, automatically buys low and sells high using a very volatile vehicle" 

My trade history for the first three versions of the engine show low buys followed by high sells in each version.  They also show an overall loss due to B appreciation beating the profit from rolling.  If the price of B slowly declined I would have made a profit from the micro and macro rolls in addition to USD vs BTC appreciation.
donator
Activity: 686
Merit: 519
It's for the children!
newbie
Activity: 44
Merit: 0
Is arbitrage still profitable? and how has your experience been so far running this?

Arbitrage is less profitable now that a lot of bots exist.   As I said I have abandoned this for a rolling buy sell bot which is proving more profitable.  I did make several B over the course of a few weeks using this bot.  I would think that other exchanges and auto transfers could be added in order to take advantage of the dozen or so alts out there with different prices and faster transaction times than B.

All of that said.  I'm not one to turn down making even $.01 a day while I sleep, eat and work.  Free money is free money.

Can you point a noob to something that explains what the strategy is for a rolling buy sell bot?

Thanks.
legendary
Activity: 1610
Merit: 1000
Crackpot Idealist
well shit, I didn't even spot the (obvious) curl call. Shame on me.

Curl alone did not sort it out. I had to create the nonce file and now the bot is spitting out what looks like morse code so I guess its working now. Thanks!

[edit] ok, i will bite. this is what the output looks like

Code:
#screen -dmS arbot -h 1024 -L ./roundrobin.sh
..---....-....----.--------.--..-.---.------------.---.--.-.----.---------------------.----.----.-.--------.------.--.-..--..------------------------.-------.-----------.-..-.--.-..-.--....---------.-------.------------------.--.---.----.-------------------------..-..------.-.--.---.----..-----------------------.-----------.------------.---.--------.-----.-------------.--------.----.-----------.-.3....-..-.---.-.----.----..---....-.-..-..----.---.--......-----..-...---------.---...-..---..-..---.----..---.-..-----.-----.--.-------...---.---..-----.-.----.----------.---.-..-.----.-.1------.-.--.------.-------.----.---.---------.----------------------.-..-.---.---..-------.---.----.-.-.--...---..-.-------------..-.--.---..-----.-.....-.----.--..--.--....1-------..---.---..------..--..--.--....-.-----...-.-..--.--.-.---..---.---.----.-------.--.-....--.-------.-.-----.--...--.-..-..--.-.---..-..-..-.--.--.....-.-..-..-........--.-......--------.-..1-.------------..------.1----.------------...-.-----..--..-..-.----.--.-----------....---.-..--.--------.----.-...-.-...-.--...--.-.-..-..-..--...--.....-.--...-...--------.-----.-...---.-------.------.-----------.---.---..-.-.-...-.--------...-------.--.-.--.---.---.-----.2..----.------..-..--..-------..--.--------.-------.-.--.-.1----.-.------.-.1.-.-...-...--.1.----.--..-..--.-----.------.--.--.--------------.------..-..--.----..-.---.--.------------.---------.-.-----.--.----..---------....-.--.-.-.--.---------.----..------..-----.-.--------.----------..---...-----...--.-.1.---.-...-----.-----.----.--------------------------..------------.----.-.----.-..-.-..1---.-..-.--..--------.---------.--------.1-..-.-...-..-.1----.--.-..--.-----.--------...--.---..--.--------.--.-..------.-.-----.1-.--...-.-------.-.-..-..-------.----------.---..---.----.

Reading the translation of this I ASSUME all is well and the script just does not see a profitable path? Reason I ask is becuase this looks nothing like Jude Austin's output he posted.
newbie
Activity: 23
Merit: 0
I've been mining LTC and depositing directly to my btc-e account, running the arb bot to find the most profitable path to BTC on btc-e then sending the BTC to gox to cash out for USD and take advantage of the price difference. It's a rather round-a-bout way of going about things but it works out pretty well.

Also I figured out if you put in a support request with btc-e and ask them to white list your IP address it will stop your bot from getting blocked and eliminate the need for the round robin script.

I would highly suggest anyone using their API to ask them to white list their IP address.
donator
Activity: 848
Merit: 1078
Is arbitrage still profitable? and how has your experience been so far running this?

I ran an arb bot for a long time and it was very profitable. I stopped it to pursue more profitable ventures, i monitor the prices a lot still (out of habit) and see a lot of arb opportunities. Good luck to those running the script. The more arbitrage there is, the more efficient the market will become.

Thank you for pointing that out!  Since exchanges are not internally arbitrating and there is no open cooperation to create an inter-exchange arbitration system the markets have strange gaps in prices and exchange rates.  In an ideal system the prices and rates would automatically even out over all of the exchanges (which could also reduce BTC's price correlation to gox uptime).

Thats the whole idea of people running arb bots, as well as giving them profits, it helps normalise the prices across each exchange. At the moment MtGox still leads price movements.

As for internal arb, an exchange trading on its own books isn't good practise and is a severe conflict of interest as they would easily have the capability to both under cut everyone and perform 'front running'.
donator
Activity: 686
Merit: 519
It's for the children!
Tried running this to see what it would do and it's throwing me these errors:

Code:
gdlinux@gdlinux:~/Desktop$ php phpbot.php
#screen -dmS arbot -h 1024 -L ./roundrobin.sh
PHP Warning:  fopen(nonce): failed to open stream: No such file or directory in /home/gdlinux/Desktop/phpbot.php on line 689
PHP Warning:  fread() expects parameter 1 to be resource, boolean given in /home/gdlinux/Desktop/phpbot.php on line 690
PHP Warning:  fclose() expects parameter 1 to be resource, boolean given in /home/gdlinux/Desktop/phpbot.php on line 691
PHP Fatal error:  Call to undefined function curl_init() in /home/gdlinux/Desktop/phpbot.php on line 665

and this is a little beyond me to figure out. I set debug to TRUE and the output did not give me any more hints. Thoughts?

My guess would be that you don't have the Curl extension installed for PHP

I would agree that curl_init() error would tell me you don't have the curl extension.  Also this is odd "PHP Warning:  fopen(nonce): failed to open stream: No such file or directory in /home/gdlinux/Desktop/phpbot.php on line 689"  Try creating an empty file called nonce with no extension at /home/gdlinux/Desktop/nonce and see if that helps.

Code:
touch /home/gdlinux/Desktop/nonce
donator
Activity: 686
Merit: 519
It's for the children!
Is arbitrage still profitable? and how has your experience been so far running this?

I ran an arb bot for a long time and it was very profitable. I stopped it to pursue more profitable ventures, i monitor the prices a lot still (out of habit) and see a lot of arb opportunities. Good luck to those running the script. The more arbitrage there is, the more efficient the market will become.

Thank you for pointing that out!  Since exchanges are not internally arbitrating and there is no open cooperation to create an inter-exchange arbitration system the markets have strange gaps in prices and exchange rates.  In an ideal system the prices and rates would automatically even out over all of the exchanges (which could also reduce BTC's price correlation to gox uptime).
donator
Activity: 848
Merit: 1078
Is arbitrage still profitable? and how has your experience been so far running this?

I ran an arb bot for a long time and it was very profitable. I stopped it to pursue more profitable ventures, i monitor the prices a lot still (out of habit) and see a lot of arb opportunities. Good luck to those running the script. The more arbitrage there is, the more efficient the market will become.
sr. member
Activity: 350
Merit: 250
Tried running this to see what it would do and it's throwing me these errors:

Code:
gdlinux@gdlinux:~/Desktop$ php phpbot.php
#screen -dmS arbot -h 1024 -L ./roundrobin.sh
PHP Warning:  fopen(nonce): failed to open stream: No such file or directory in /home/gdlinux/Desktop/phpbot.php on line 689
PHP Warning:  fread() expects parameter 1 to be resource, boolean given in /home/gdlinux/Desktop/phpbot.php on line 690
PHP Warning:  fclose() expects parameter 1 to be resource, boolean given in /home/gdlinux/Desktop/phpbot.php on line 691
PHP Fatal error:  Call to undefined function curl_init() in /home/gdlinux/Desktop/phpbot.php on line 665

and this is a little beyond me to figure out. I set debug to TRUE and the output did not give me any more hints. Thoughts?

My guess would be that you don't have the Curl extension installed for PHP
legendary
Activity: 1610
Merit: 1000
Crackpot Idealist
Tried running this to see what it would do and it's throwing me these errors:

Code:
gdlinux@gdlinux:~/Desktop$ php phpbot.php
#screen -dmS arbot -h 1024 -L ./roundrobin.sh
PHP Warning:  fopen(nonce): failed to open stream: No such file or directory in /home/gdlinux/Desktop/phpbot.php on line 689
PHP Warning:  fread() expects parameter 1 to be resource, boolean given in /home/gdlinux/Desktop/phpbot.php on line 690
PHP Warning:  fclose() expects parameter 1 to be resource, boolean given in /home/gdlinux/Desktop/phpbot.php on line 691
PHP Fatal error:  Call to undefined function curl_init() in /home/gdlinux/Desktop/phpbot.php on line 665

and this is a little beyond me to figure out. I set debug to TRUE and the output did not give me any more hints. Thoughts?
sr. member
Activity: 350
Merit: 250
It's officially working, I appreciate the help! It totally was the SSL.

My fix should work for anyone using Windows who wants to run the bot.

Thanks again, I'll donate my first week of profit and a little extra next Sunday for taking the time to code this thing and help me out.

Hi!  I am giving this a try to see how it performs.  I tried out grabble's fix on windows here and can confirm it successfully fixed the issue for me as well.  Loaded the account with a couple LTC and smaller amounts of BTC so its not a huge loss if I do lose Cheesy

I will donate some of my profits if I am successful aswell!
newbie
Activity: 23
Merit: 0
It's officially working, I appreciate the help! It totally was the SSL.

My fix should work for anyone using Windows who wants to run the bot.

Thanks again, I'll donate my first week of profit and a little extra next Sunday for taking the time to code this thing and help me out.
donator
Activity: 686
Merit: 519
It's for the children!
Nice!  I would assume it has something to do with the windows vs linux curl and ssl implementations?

That output shows it's searching for trades.  If you change debug from NULL to TRUE it will spit out some more information.

Keep in mind debug has to be off in order to complete any trades as it takes to much time for php to print messages between trades.
newbie
Activity: 23
Merit: 0
Holy crap. Progress! (I think).

I started to understand php more and got suspicious of the send function.

I modified the function's options to this:

Code:
	

function send( $url = NULL )
{
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_HEADER, FALSE);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);
curl_setopt($ch, CURLOPT_USERAGENT, 'Mozilla/4.0 (compatible; BTCE PHP client; '.php_uname('s').'; PHP/'.phpversion().')');
curl_setopt($ch, CURLOPT_POSTFIELDS, $postData);
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, TRUE);
$result = curl_exec($ch);
curl_close($ch);

return $result;
}


I seem to be getting this:

Code:
C:\Apache2\htdocs>php bot.php
..---..--.-------------------------------------------.--.--------------------.--------.-.-

At least it's not getting errors anymore right? I think it had to do with SSL using HTTPS. It was giving curl an error that wasn't coming over to the php side for me to see but when I started messing with curl I realized it was getting a certificate error ...
newbie
Activity: 23
Merit: 0
C:\Apache24\htdocs>php bot.php
.E1Array
(
)
Array
(
)
Array
(
)
-E2Array
(
)
Array
(
)
Array
(
)
-E3Array
(
)
Array
(
)
Array
(
)
-E4Array
(
)
Array
(
)
Array
(
)
-E5

I don't even know what to make of it, it's not returning anything it appears. I'm going to try downgrading my PHP as I'm running 5.4.15 maybe this will help? I don't really see why else it does not seem to work.
donator
Activity: 686
Merit: 519
It's for the children!
I'm running PHP 5.3.2-1ubuntu4.19 with Suhosin-Patch (cli)

Try changing this code block out with the changes below and past the output, this should show what's happening.

Code:
	while( empty($BTCtoUSD) || empty($LTCtoBTC) || empty($LTCtoUSD) ){
$BTCtoUSD = @json_decode( send( 'https://btc-e.com/api/2/btc_usd/depth' ), TRUE );
$LTCtoBTC = @json_decode( send( 'https://btc-e.com/api/2/ltc_btc/depth' ), TRUE );
$LTCtoUSD = @json_decode( send( 'https://btc-e.com/api/2/ltc_usd/depth' ), TRUE );
//Verify the order book changed
$old = $BTCtoUSDold+$LTCtoBTCold+$LTCtoUSDold+$BTCtoUSDold1+$LTCtoBTCold1+$LTCtoUSDold1;
$new = $BTCtoUSD['bids'][0][0]+$LTCtoBTC['bids'][0][0]+$LTCtoUSD['bids'][0][0]+$BTCtoUSD['asks'][0][0]+$LTCtoBTC['asks'][0][0]+$LTCtoUSD['asks'][0][0];
if( !@$BTCtoUSD['bids'] || !@$LTCtoBTC['bids'] || !@$LTCtoUSD['bids']){
$BTCtoUSD = $LTCtoBTC = $LTCtoUSD = array();
//$sleep=rand(6, 36)*(++$e);
$e++;
print "E" . $e;
sleep(5);
if ( $e > 2 ) exit;
/*
if ($nanosleep > 100000)
{$nanosleep = $nanosleep+100000;} //up to 9999 runs
else
{$nanosleep = $nanosleep^10;}
*/
}


TO:
Code:
	while( empty($BTCtoUSD) || empty($LTCtoBTC) || empty($LTCtoUSD) ){
$BTCtoUSD = json_decode( send( 'https://btc-e.com/api/2/btc_usd/depth' ), TRUE );
$LTCtoBTC = json_decode( send( 'https://btc-e.com/api/2/ltc_btc/depth' ), TRUE );
$LTCtoUSD = json_decode( send( 'https://btc-e.com/api/2/ltc_usd/depth' ), TRUE );
//Verify the order book changed
$old = $BTCtoUSDold+$LTCtoBTCold+$LTCtoUSDold+$BTCtoUSDold1+$LTCtoBTCold1+$LTCtoUSDold1;
$new = $BTCtoUSD['bids'][0][0]+$LTCtoBTC['bids'][0][0]+$LTCtoUSD['bids'][0][0]+$BTCtoUSD['asks'][0][0]+$LTCtoBTC['asks'][0][0]+$LTCtoUSD['asks'][0][0];
if( !$BTCtoUSD['bids'] || !$LTCtoBTC['bids'] || !$LTCtoUSD['bids']){
$BTCtoUSD = $LTCtoBTC = $LTCtoUSD = array();
$e++;
print "E" . $e;
sleep(5);
if ( $e > 4 ) exit;
                        print_r($BTCtoUSD);
                        print_r($LTCtoBTC);
                        print_r($LTCtoUSD);
}
newbie
Activity: 23
Merit: 0
I can pull the data just fine with:

Code:

$c = curl_init('https://btc-e.com/api/2/btc_usd/depth');
curl_setopt($c, CURLOPT_RETURNTRANSFER, true);
curl_setopt($c, CURLOPT_SSL_VERIFYPEER, false);

$html = curl_exec($c);

if (curl_error($c))
    die(curl_error($c));

// Get the status code
$status = curl_getinfo($c, CURLINFO_HTTP_CODE);

curl_close($c);

echo "
".print_r($html, true)."
";


It prints this:

{"asks":[[110.999,0.482],[111,0.08565512],[111.44,2.42373056],[111.45,0.95797641],[111.46,12.766699],[111.47,43.73969491],[111.499,0.02],[111.5,1.0
4798],[111.59,0.22061],[111.6,1.35216595],[111.608,0.01],[111.64,0.011],[111.65,0.2989164],[111.69,0.08],[111.698,0.010978],[111.7,0.6438],[111.769,0.01],[111
.829,5.282],[111.839,0.1825],[111.84,0.25],[111.93,0.25],[111.949,0.02],[111.95,0.2601796],[111.96,0.01],[111.98,0.14],[111.99,4.55689031],[111.999,0.21026026
],[112,6.56381636],[112.01,0.01],[112.012,0.1117995],[112.06,0.01],[112.07,0.25],[112.1,24.371],[112.14,0.09123795],[112.198,0.010978],[112.2,0.3323],[112.28,
0.25],[112.298,0.01],[112.3,1.925859],[112.312,0.010976],[112.32,0.01],[112.373,0.05],[112.384,0.05],[112.394,0.05],[112.395,0.05],[112.4,3.2528],[112.406,0.1
],[112.41,0.01],[112.417,0.05],[112.418,0.05],[112.428,0.05],[112.43,0.25],[112.44,1.05],[112.45,0.0101796],[112.46,0.01],[112.47,0.11079744],[112.479,0.01],[
112.49,0.01],[112.5,6.79002662],[112.51,0.04998],[112.544,0.1996],[112.55,0.25691786],[112.555,0.01],[112.57,0.25],[112.578,0.05],[112.598,0.0101796],[112.6,0
.07858852],[112.63,0.0113],[112.634,0.01],[112.65,0.2685204],[112.69,10.01300269],[112.698,0.010978],[112.7,0.2994],[112.75,0.04882465],[112.77,0.1127627],[11
2.79,5],[112.8,2.20190831],[112.81,0.02104057],[112.86,0.25],[112.87,0.0109],[112.878,0.019],[112.89,0.30755],[112.9,5.80713602],[112.93,0.474],[112.94,0.2009
6176],[112.95,10.0101796],[112.967,0.01],[112.98,5.89170535],[112.988,0.02],[112.99,6.111],[113,34.99802712],[113.03,0.25],[113.05,0.15],[113.13,10.01996],[11
3.136,0.02062671],[113.16,3.961],[113.17,0.5],[113.171,0.03369487],[113.176,0.04990195],[113.177,0.2],[113.178,2.42799529],[113.179,0.2],[113.187,0.2],[113.18
8,0.2],[113.189,0.2],[113.19,0.6],[113.197,0.2],[113.198,0.010978],[113.199,1],[113.2,1.01400002],[113.22,0.27],[113.227,0.24837326],[113.228,0.05],[113.229,0
.05],[113.23,3.5325],[113.25,0.31757619],[113.3,1.33626884],[113.32,0.25],[113.33,0.2],[113.39,0.84166937],[113.4,10.05373585],[113.412,0.01],[113.421,0.03],[
113.423,0.01],[113.45,0.0101796],[113.47,3.992],[113.471,0.022],[113.49,1.32405],[113.5,232.2819077],[113.58,0.1],[113.59,10],[113.6,1.87955804],[113.606,0.02
],[113.61,0.25],[113.613,0.1996],[113.64,0.05],[113.65,0.05198778],[113.698,0.010978],[113.7,0.69915719],[113.71,0.1],[113.75,0.02],[113.751,0.02],[113.759,0.
0103152],[113.76,0.1],[113.8,1.91389155],[113.82,1],[113.83,0.02],[113.839,0.95492748],[113.84,0.01],[113.865,0.02]],"bids":[[110.9,0.13374988],[110.84,0.15],
[110.83,1.91367751],[110.829,3.02409137],[110.82,0.25],[110.74,0.44115717],[110.71,4.4743],[110.7,8.68410389],[110.699,0.01],[110.69,0.15],[110.506,0.01002],[
110.5,0.0399],[110.401,5.96690474],[110.4,0.743],[110.381,0.01795565],[110.38,0.25],[110.37,0.89],[110.347,0.017],[110.27,0.25],[110.179,0.02004008],[110.01,0
.0102],[110.002,0.011],[110.001,1.803123],[110,11.24350583],[109.981,0.1825],[109.98,0.25],[109.95,0.0102],[109.93,4.90219398],[109.793,0.017],[109.699,0.01],
[109.698,0.03],[109.61,0.12729965],[109.55,0.25],[109.502,0.011],[109.42,0.0101],[109.4,5.17183642],[109.39,0.25],[109.27,0.25],[109.239,0.017],[109.18,0.8502
],[109.176,2.583],[109.061,0.1],[109.02,0.01],[109.01,2.9652],[109.002,0.011],[109,2.48760606],[108.96,0.01],[108.834,0.0122],[108.685,0.017],[108.65,0.261211
22],[108.61,3.7799184],[108.6,22.45158424],[108.59,5.9299154],[108.56,0.25],[108.52,0.02],[108.51,0.7],[108.502,0.011],[108.5,6.47790337],[108.42,1.25680822],
[108.352,0.030764],[108.3,0.55],[108.29,0.25],[108.25,1.05030486],[108.131,0.017],[108.13,1.453],[108.1,4.55772433],[108.085,0.011],[108.084,0.01],[108.07,0.0
5201],[108.06,0.2555],[108.02,9.794],[108.01,0.0202],[108.002,0.011],[108,35.30530543],[107.945,2.2234],[107.847,0.5563],[107.8,0.05],[107.75,0.05],[107.74,0.
25],[107.7,0.1],[107.685,11.972857],[107.66,0.0553],[107.6,0.35039174],[107.577,0.03704008],[107.539,0.2],[107.53,0.03],[107.52,5],[107.51,0.71513592],[107.50
2,0.011],[107.5,8.202],[107.47,0.01],[107.43,0.51262715],[107.4,0.4],[107.348,0.027],[107.337,0.2],[107.33,0.8],[107.32,0.2],[107.3,0.4],[107.28,0.09],[107.21
,0.45],[107.18,0.02],[107.17,0.02],[107.12,1.59895495],[107.111,0.01],[107.1,3.10063865],[107.023,0.017],[107.01,1.16919169],[107.002,0.011],[107,24.92454336]
,[106.93,3],[106.9,1],[106.838,0.32819],[106.76,0.01683],[106.63,1.35803264],[106.614,0.0235],[106.6,0.2056],[106.54,0.04],[106.517,0.01],[106.502,0.011],[106
.5,24.31393613],[106.469,0.017],[106.44,0.01872844],[106.411,0.01],[106.41,0.011],[106.4,1],[106.305,0.01],[106.25,2.91808503],[106.21,10],[106.2,23.19],[106.
12,0.92432135],[106.1,40.05754467],[106.01,10.0617591],[106.002,0.011],[106,18.16052253],[105.99,499.22271165],[105.94,0.7],[105.915,0.017],[105.9,1.2525],[10
5.89,0.664],[105.72,4],[105.711,0.040504],[105.6,3.49097394],[105.56,0.4],[105.55,0.05],[105.502,0.011],[105.5,1.55],[105.45,0.304844],[105.42,1.10233139],[10
5.361,0.017],[105.36,0.011]]}

C:\Apache24\htdocs>php bot.php
.E1-E2-E3
C:\Apache24\htdocs>

So I don't think I'm running up against the DDOS protection. I've been wracking my brain for 2 days and can't figure it out.

What version of php do you run? Maybe that has something to do with it?
donator
Activity: 686
Merit: 519
It's for the children!
EDIT: You can also remove the @ symbol before each of those three json_decode lines and it should spit out an error that will help find out what's wrong with the url.

I think I'm just doing something wrong, I got past the 301 error but now the only output I get is .E1-E2-E3 and then the process terminates. I think I must have configured something wrong with my php or I'm executing it wrong (I'm literally just putting php bot.php). PHP has never been my strong suit haha.

Your getting hit by their DDOS protection still.

Those errors show when you can't pull the ticker pages from E:

Code:
		$BTCtoUSD = @json_decode( send( 'https://btc-e.com/api/2/btc_usd/depth' ), TRUE );
$LTCtoBTC = @json_decode( send( 'https://btc-e.com/api/2/ltc_btc/depth' ), TRUE );
$LTCtoUSD = @json_decode( send( 'https://btc-e.com/api/2/ltc_usd/depth' ), TRUE );

check those links from a browser using the same IP as the machine you are running the script from:
https://btc-e.com/api/2/btc_usd/depth
https://btc-e.com/api/2/ltc_btc/depth
https://btc-e.com/api/2/ltc_usd/depth

This is where swapping IP's comes in handy.

You can also stop the program from exiting (so it will keep trying to pull the books until your IP is banned Smiley  by removing this line:

Code:
			
if ( $e > 2 ) exit;
Pages:
Jump to: