$amt=shift(@ARGV);$price=shift(@ARGV);
use Digest::SHA;use Time::HiRes qw(time);use POSIX qw(strftime);
$id=int(time()*1000000);$tstamp=strftime("%Y-%m-%dT%H:%M:%S",gmtime());
$token="$secret;$username;$tstamp;$id;create_order;SELL;$amt;$c;$price;$cc";
$sig=Digest::SHA::sha256_hex($token);
$data=readpipe("curl -L -m 30 -s -k \"https://vircurex.com/api/create_order.json?ordertype=SELL&amount=$amt¤cy1=$c&unitprice=$price¤cy2=$cc&account=$username&id=$id&token=$sig×tamp=$tstamp\"");
$_=$data;s/[" ]//ig;if(/orderid:([0-9\.]*),/ig){$oid=$1;sleep(0.2);
$id=int(time()*1000000);$tstamp=strftime("%Y-%m-%dT%H:%M:%S",gmtime());
$token="$secret;$username;$tstamp;$id;release_order;$oid";
$sig=Digest::SHA::sha256_hex($token);
$data=readpipe("curl -L -m 30 -s -k \"https://vircurex.com/api/release_order.json?orderid=$oid&account=$username&id=$id&token=$sig×tamp=$tstamp\"");
$out=$amt*$price;print "Selling $amt $c for $cc on Vircurex at $price (total $out $cc)\n";