Skip to content

uunmask2000/coin_currency

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

50 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

coin_currency

API doc

api-doc

目前支持3家

  • CoinMarketCap
  • CryptoCompare
  • Freecurrencyrates

簡單範例

TWD-USD

https://api.jim-kk.com/api/currency/converter?from={}&to={}
{} = 法定/虛擬 英文code (可以不區分大小寫)

例子

require 'vendor/autoload.php';

use \uunmask2000_kk\CoinCurrency\CoinCurrency;

$class = new CoinCurrency();
print_r($class->CryptoCompare->call_A2B());
print_r($class->Freecurrencyrates->call_A2B());
EX :
print_r($CoinCurrency->CryptoCompare->call_A2B('usdt', 'hkd'));
print_r($CoinCurrency->Freecurrencyrates->call_A2B('usdt', 'hkd'));

Array
(
    [A_B] => usdt-hkd
    [rate] => 7.627
    [original] => 7.627
)
Array
(
    [rate] => 7.7969157151701
    [original] => 7.7969157151701
    [A_B] => usdt-hkd
)

測試

require('vendor/autoload.php');

use uunmask2000_kk\CoinCurrency\CoinCurrency;

$coinCurrency = new CoinCurrency();
// var_dump($coinCurrency);
foreach ($coinCurrency as $key => $value) {
    // $tmp = $key->call_A2B();
    // print_r($key);
    print_r($coinCurrency->$key->call_A2B());
    print_r($coinCurrency->$key->historyDays());
}