Welcome to the Dash Forum!

Please sign up to discuss the most innovative cryptocurrency!

PHP Script for USD/DRK accounting

Discussion in 'Projects' started by catlasshrugged, Dec 23, 2014.

  1. catlasshrugged

    catlasshrugged New Member

    Joined:
    Aug 14, 2014
    Messages:
    20
    Likes Received:
    23
    Trophy Points:
    13
    • Like Like x 6
  2. crowning

    crowning Well-known Member

    Joined:
    May 29, 2014
    Messages:
    1,428
    Likes Received:
    2,005
    Trophy Points:
    183
    Mmmh, regex....I like this :)
     
  3. thelonecrouton

    thelonecrouton Well-known Member
    Foundation Member

    Joined:
    Apr 15, 2014
    Messages:
    1,135
    Likes Received:
    813
    Trophy Points:
    283
    Either I've somehow picked up php by osmosis, or that's one pretty piece of php. :)
     
  4. crowning

    crowning Well-known Member

    Joined:
    May 29, 2014
    Messages:
    1,428
    Likes Received:
    2,005
    Trophy Points:
    183
    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:
     
    • Like Like x 2
  5. TanteStefana

    TanteStefana Grizzled Member
    Foundation Member

    Joined:
    Mar 9, 2014
    Messages:
    2,861
    Likes Received:
    1,854
    Trophy Points:
    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....??
     
  6. ourlink

    ourlink Well-known Member
    Foundation Member

    Joined:
    Jun 9, 2014
    Messages:
    237
    Likes Received:
    65
    Trophy Points:
    188
    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?
     
  7. darkjack

    darkjack Active Member
    Foundation Member

    Joined:
    Mar 3, 2015
    Messages:
    22
    Likes Received:
    13
    Trophy Points:
    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...