2017 © Pedro Peláez
 

library forexquotes

Library to fetch and parse realtime Forex quotes and convert currencies

image

oneforge/forexquotes

Library to fetch and parse realtime Forex quotes and convert currencies

  • Wednesday, May 23, 2018
  • by 1forge
  • Repository
  • 4 Watchers
  • 40 Stars
  • 460 Installations
  • PHP
  • 2 Dependents
  • 0 Suggesters
  • 4 Forks
  • 1 Open issues
  • 12 Versions
  • 24 % Grown

The README.md

php-forex-quotes

php-forex-quotes is a 1Forge PHP Library for fetching realtime forex quotes. See the examples for REST and WebSocket implementation in the /examples folder., (*1)

1Forge Data, (*2)

Table of Contents

Requirements

  • PHP >= 6.0.1
  • An API key which you can obtain for free at https://1forge.com/register

Installation

composer require oneforge/forexquotes

Or in your composer.json, (*3)

"require": {
    "oneforge/forexquotes": "~6.0"
},

Usage

Instantiate the client

<?php

use OneForge\ForexQuotes\ForexDataClient;

//You can get an API key for free at 1forge.com
$client = new ForexDataClient('YOUR_API_KEY');

Get the list of available symbols:

$client->getSymbols(); 

Get quotes for specified symbols:

$client->getQuotes([
    'AUD/USD',
    'GBP/JPY'
]);

Convert from one currency to another:

$client->convert('USD', 'EUR', 100);

Check if the market is open:

if ($client->marketIsOpen())
{
    echo "Market is open";    
}

Check your usage / quota limit:

$client->quota();

Stream quote updates:

WebSocket quote streaming is only available on paid plans., (*4)

//Handle incoming price updates from the server
$client->onUpdate(function($symbol, $data)
{
    echo $symbol . ": " . $data["b"] . " " .$data["a"] . " " . $data["p"]."\n";
});

//Handle non-price update messages
$client->onMessage(function($message)
{
    echo $message;
});

//Connect to the server
$client->connect(function($client)
{
    //Subscribe to a single currency pair
    $client->subscribeTo('EUR/USD');

    //Subscribe to an array of currency pairs
    $client->subscribeTo([
        'GBP/JPY',
        'AUD/CAD',
        'EUR/CHF'
    ]);

    //Subscribe to all currency pairs
    $client->subscribeToAll();

    //Unsubscribe from a single currency pair
    $client->unsubscribeFrom('EUR/USD');

    //Unsubscribe from an array of currency pairs
    $client->unsubscribeFrom([
        'GBP/JPY',
        'AUD/CAD',
        'EUR/CHF'
    ]);

    //Unsubscribe from all currency pairs
    $client->unsubscribeFromAll();

});

Contributing

Thank you for considering contributing! Any issues, bug fixes, suggestions, improvements or help in any other way is always appreciated. Please feel free to open an issue or create a pull request., (*5)

Support and Contact

Please contact me at contact@1forge.com if you have any questions or requests., (*6)

License and Terms

This library is provided without warranty under the MIT license., (*7)

The Versions

23/05 2018

dev-master

9999999-dev http://1forge.com

Library to fetch and parse realtime Forex quotes and convert currencies

  Sources   Download

MIT

The Requires

 

by Avatar 1forge

api realtime forex quotes

21/04 2018

2.0.10

2.0.10.0 http://1forge.com

Library to fetch and parse realtime Forex quotes and convert currencies

  Sources   Download

MIT

The Requires

 

by Avatar 1forge

api realtime forex quotes

05/04 2018

2.0.9

2.0.9.0 http://1forge.com

Library to fetch and parse realtime Forex quotes and convert currencies

  Sources   Download

MIT

The Requires

 

by Avatar 1forge

api realtime forex quotes

07/02 2018

2.0.8

2.0.8.0 http://1forge.com

Library to fetch and parse realtime Forex quotes and convert currencies

  Sources   Download

MIT

The Requires

 

by Avatar 1forge

api realtime forex quotes

15/01 2018

2.0.7

2.0.7.0 http://1forge.com

Library to fetch and parse realtime Forex quotes and convert currencies

  Sources   Download

MIT

The Requires

 

by Avatar 1forge

api realtime forex quotes

11/01 2018

2.0.6

2.0.6.0 http://1forge.com

Library to fetch and parse realtime Forex quotes and convert currencies

  Sources   Download

MIT

The Requires

 

by Avatar 1forge

api realtime forex quotes

09/01 2018

2.0.5

2.0.5.0 http://1forge.com

Library to fetch and parse realtime Forex quotes and convert currencies

  Sources   Download

MIT

The Requires

 

by Avatar 1forge

api realtime forex quotes

19/09 2017

2.0.4

2.0.4.0 http://1forge.com

Library to fetch and parse realtime Forex quotes and convert currencies

  Sources   Download

MIT

The Requires

 

by Avatar 1forge

api realtime forex quotes

19/09 2017

2.0.3

2.0.3.0 http://1forge.com

Library to fetch and parse realtime Forex quotes and convert currencies

  Sources   Download

MIT

The Requires

 

by Avatar 1forge

api realtime forex quotes

28/06 2017

2.0.0

2.0.0.0 http://1forge.com

Library to fetch and parse realtime Forex quotes and convert currencies

  Sources   Download

MIT

The Requires

 

by Avatar 1forge

api realtime forex quotes

05/06 2017

1.0.5

1.0.5.0 http://1forge.com

Library to fetch and parse realtime Forex quotes

  Sources   Download

MIT

The Requires

 

by Avatar 1forge

api realtime forex quotes

03/06 2017

1.0.4

1.0.4.0 http://1forge.com

Library to fetch and parse realtime Forex quotes

  Sources   Download

MIT

The Requires

 

by Avatar 1forge

api realtime forex quotes