?? GreyFile — Mystic File Browser

Current path: home/webdevt/cryptoimpot.fr/module/Application/src/Service/ApiHistorical/



?? Go up: /home/webdevt/cryptoimpot.fr/module/Application/src/Service

?? Viewing: APINomicsService.php

<?php

/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

namespace Application\Service\ApiHistorical;

use Application\Entity\Devise;

/**
 * Description of CMCService
 *
 * @author jimmy
 */
class APINomicsService
{

    /*
      *  https://nomics.com/docs/#section/General
      * https://api.nomics.com/v1/markets?key=your-key-here
      * payant
      */
   public function getUnitPriceInEur(Devise $devise, \DateTime $dateTime)
    {

        if (empty($devise->getIdNomics())) {
            throw new \Exception('Absence d id Nomics pour : ' . $devise->getCode());
        }
        // get id asset from nomics
        // curl "https://api.nomics.com/v1/currencies?key=your-key-here&ids=BTC,ETH,XRP&attributes=id,name,logo_url"


// @todo tester
        $urlApi = 'https://api.nomics.com/v1?';

        // asset fsym


        $urlApi .= 'ids=' . $devise->getIdNomics();
        $urlApi .= '&convert=EUR';
        $urlApi .= '&ts=' . $dateTime->format('U');
        $urlApi .= '&api_key=fd3aea02118639009c4a4de12b5f8a0f4619b08a814e04e9fa0aafc678127ea2';
        echo $urlApi; exit;
        // fetch data
        $curl = curl_init();
        curl_setopt($curl, CURLOPT_URL, $urlApi);
        curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
        $rawData = curl_exec($curl);
        curl_close($curl);
//        73db4525d47bff9731b96e71a2eef868
        $price = $data[$asset]['EUR'];
    }

}


??

??