PHP Script for USD/DRK accounting

catlasshrugged

New Member
Aug 14, 2014
20
23
13

thelonecrouton

Well-known Member
Foundation Member
Apr 15, 2014
1,135
813
283
Either I've somehow picked up php by osmosis, or that's one pretty piece of php. :)
 

crowning

Well-known Member
May 29, 2014
1,415
1,997
183
Alpha Centauri Bc
Either I've somehow picked up php by osmosis, or that's one pretty piece of php. :)
I agree, it's nicely written.

People are often surprised how few lines of comments you need when you call a method/function which e.g. extracts the date from a datetimestamp just extract_date_from_datetimestamp.

I call this "self-commenting code" and am a big fan of it because it enables me to understand MY OWN code even after a couple of weeks.

No to mention the poor souls who might have to understand it after some years :eek:
 

TanteStefana

Grizzled Member
Foundation Member
Mar 9, 2014
2,861
1,854
1,283
Well, I guess it is possible to track prices now! The only problem now is how to figure mined coins into the picture, as it cost way more to mine 'em than to buy them, and...er.... I don't know if I still have all my wallet.dat files....??
 

ourlink

Well-known Member
Foundation Member
Jun 9, 2014
237
65
188
Heartland, USA
www.p2poolmining.us
Hmmm... This is a pretty nifty piece of coding. If I could only get it to work for me?

I took the code an put it into a PHP file and executed the code "as is" and I get the following error;

Fetching address data from http://explorer.darkcoin.io/address/XjAdaR6T3yBSENmBCx5Nvw5vw316g96h6R... Fetching BTC/DRK rates from https://poloniex.com/public?command...yPair=BTC_DRK&start=1399680000&end=1399766400... SSL certificate problem: unable to get local issuer certificate

This looks like it is appearing in this section of code;

function get_html_contents($url)
{
$c = curl_init($url);
curl_setopt($c, CURLOPT_RETURNTRANSFER, true);
$html = curl_exec($c);

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

return $html;
}


Anyone have any ideas what I missed? Do I need to have SSL on my server enabled?
 

darkjack

Active Member
Foundation Member
Mar 3, 2015
22
13
103
TanteStefana I stumbled across Moneydance and have begun using it for full GAAP. It allows you to setup unlimited custom currencies. For hardware mining you can track your costs equipment and electrical costs as expenses. For cloud mining services with markets (ie Hashnest), I setup the hashing power as an investment and record payouts as dividends. That way you can track the fluctuating value of the hashing power too and get a pretty accurate ROI. It's a lot of manual work, but nothing is simple yet...