using API from exchanges. then add on any fee's incurred plus your profit to equal the viewable BTC cost.
heres a load of MTGox API for you to try
https://en.bitcoin.it/wiki/MtGox/API/HTTP/v1EG grab the high price from this ticker
https://mtgox.com/api/1/BTCUSD/tickeri grabbed this code from somewhere that uses BTC-E.com not mtgox
$json_url = 'https://btc-e.com/api/2/btc_usd/ticker';
$ch = curl_init( $json_url );
$options = array(
CURLOPT_RETURNTRANSFER => true,
);
curl_setopt_array( $ch, $options );
$string = curl_exec($ch); // Getting jSON result string
$object = json_decode($string, true);
$price=$object['ticker'][high];
you know it will cost 6% in fee's to fully cash out to your bank account
and you want to make 4% profit for yourself
so if $price shows BTC is $10.80 SUBTRACT 10% for costs / profit, making it worthy/profitable to process BTC for $9.81
then divide that by the cash value they input to give you a BTC amount.
so a $100 bill will cost 10.19367991BTC
so when you sell the 10.19BTC at the actual $10.80 exchange price you will get $110 to then cash out, cover fees and still have about 4% profit