|
1 | 1 | # PHPForexQuotes |
2 | 2 |
|
3 | | -Use <a href="http://getcomposer.org">Composer</a> to download the required packages using <code>composer update</code> |
| 3 | +PHPForexQuotes is a PHP Library for fetching realtime forex quotes |
4 | 4 |
|
5 | | -Get the list of available symbols like: |
6 | | -<code>QuoteRequest::getSymbols();</code> |
| 5 | +# Table of Contents |
7 | 6 |
|
8 | | -Get quotes for specified symbols like: |
9 | | -<code> |
| 7 | +- [Requirements](#requirements) |
| 8 | +- [Installation](#installation) |
| 9 | +- [Usage](#usage) |
| 10 | + - [List of Symbols available](#get-the-list-of-available-symbols) |
| 11 | + - [Get quotes for specific symbols](#get-quotes-for-specified-symbols) |
| 12 | +- [Other implementations](#other-implementations) |
| 13 | + - [API Call: Get all quotes](#get-all-quotes) |
| 14 | + - [API Call: Get specific quotes](#get-specific-quotes) |
| 15 | + - [API Call: Get the symbol list](#get-the-symbol-list) |
| 16 | +- [Support / Contact](#support-and-contact) |
| 17 | +- [License / Terms](#license-and-terms) |
| 18 | + |
| 19 | +## Requirements |
| 20 | +* PHP >= 7.0 |
| 21 | + |
| 22 | + |
| 23 | +## Installation |
| 24 | +``` |
| 25 | +composer require oneforge/forexquotes |
| 26 | +``` |
| 27 | +Or in your composer.json |
| 28 | +```javascript |
| 29 | +"require": { |
| 30 | + "oneforge/forexquotes": "dev-master" |
| 31 | +}, |
| 32 | +``` |
| 33 | +## Usage |
| 34 | + |
| 35 | +### Get the list of available symbols: |
| 36 | + |
| 37 | +```php |
| 38 | +<?php |
| 39 | + |
| 40 | +use OneForge\ForexQuotes\QuoteRequest; |
| 41 | + |
| 42 | +//Returns an array of symbols, eg: ['EURUSD', 'GBPJPY'] |
| 43 | +QuoteRequest::getSymbols(); |
| 44 | +``` |
| 45 | +### Get quotes for specified symbols: |
| 46 | +```php |
| 47 | +<?php |
| 48 | + |
| 49 | +use OneForge\ForexQuotes\QuoteRequest; |
| 50 | + |
| 51 | +/* |
| 52 | +Returns an array of quotes, eg: |
| 53 | + [ |
| 54 | + [ |
| 55 | + "symbol" => "EURUSD", |
| 56 | + "bid" => 1.11725, |
| 57 | + "ask" => 1.11746, |
| 58 | + "timestamp" => 1496190844, |
| 59 | + ], |
| 60 | + [ |
| 61 | + "symbol" => "GBPJPY", |
| 62 | + "bid" => 142.037, |
| 63 | + "ask" => 142.09, |
| 64 | + "timestamp" => 1496190844, |
| 65 | + ], |
| 66 | + ] |
| 67 | +*/ |
10 | 68 | QuoteRequest::getQuotes([ |
11 | 69 | 'AUDUSD', |
12 | 70 | 'GBPJPY' |
13 | 71 | ]); |
14 | | -</code> |
| 72 | +``` |
| 73 | + |
| 74 | +## Other implementations |
| 75 | +You can also implement the api directly in any other way you wish. Full documentation is maintained here: <a href="https://1forge.com/forex-data-api">https://1forge.com/forex-data-api</a> |
| 76 | + |
| 77 | + |
| 78 | +### Get all quotes |
| 79 | +#### Request |
| 80 | +``` |
| 81 | +GET https://1forge.com/forex-quotes/quotes |
| 82 | +``` |
| 83 | + |
| 84 | +#### Response |
| 85 | +```javascript |
| 86 | +[ |
| 87 | + { |
| 88 | + symbol: "AUDJPY", |
| 89 | + timestamp: 1496096332, |
| 90 | + bid: 82.726, |
| 91 | + ask: 82.757 |
| 92 | + }, |
| 93 | + { |
| 94 | + symbol: "AUDUSD", |
| 95 | + timestamp: 1496096332, |
| 96 | + bid: 0.74396, |
| 97 | + ask: 0.74418 |
| 98 | + }, |
| 99 | + { |
| 100 | + etc: "........" |
| 101 | + } |
| 102 | +] |
| 103 | +``` |
| 104 | + |
| 105 | +### Get specific quotes |
| 106 | +#### Request |
| 107 | +``` |
| 108 | +GET https://1forge.com/forex-quotes/quotes?pairs=EURUSD,GBPJPY,AUDUSD |
| 109 | +``` |
| 110 | + |
| 111 | +#### Response |
| 112 | +```javascript |
| 113 | +[ |
| 114 | + { |
| 115 | + symbol: "AUDUSD", |
| 116 | + timestamp: 1496096387, |
| 117 | + bid: 0.74392, |
| 118 | + ask: 0.74416 |
| 119 | + }, |
| 120 | + { |
| 121 | + symbol: "EURUSD", |
| 122 | + timestamp: 1496096387, |
| 123 | + bid: 1.11383, |
| 124 | + ask: 1.11404 |
| 125 | + }, |
| 126 | + { |
| 127 | + symbol: "GBPJPY", |
| 128 | + timestamp: 1496096387, |
| 129 | + bid: 142.657, |
| 130 | + ask: 142.715 |
| 131 | + } |
| 132 | +] |
| 133 | +``` |
| 134 | + |
| 135 | + |
| 136 | +### Get the symbol list |
| 137 | +#### Request |
| 138 | +``` |
| 139 | +GET https://1forge.com/forex-quotes/symbols |
| 140 | +``` |
15 | 141 |
|
16 | | -You can also implement in other way you wish using the API documented here: <a href="https://1forge.com/forex-data-api">https://1forge.com/forex-data-api</a> |
| 142 | +#### Response |
| 143 | +```javascript |
| 144 | +[ |
| 145 | + "AUDJPY", |
| 146 | + "AUDUSD", |
| 147 | + "CHFJPY", |
| 148 | + "EURAUD", |
| 149 | + "EURCAD", |
| 150 | + "EURCHF", |
| 151 | + "EURGBP", |
| 152 | + "EURJPY", |
| 153 | + "etc..." |
| 154 | +] |
| 155 | +``` |
17 | 156 |
|
| 157 | +## Support and Contact |
18 | 158 | Please contact me at contact@1forge.com if you have any questions or requests. |
19 | 159 |
|
| 160 | +## License and Terms |
20 | 161 | This library is provided without warranty under the MIT license. |
0 commit comments