Skip to content

Latest commit

 

History

History
122 lines (92 loc) · 4.08 KB

README.md

File metadata and controls

122 lines (92 loc) · 4.08 KB

Live Forex API - PHP

Update: 2021-02-12 (version 3)

FCS currency exchange quotes API is a PHP Library for fetching forex quotes, provide response in array or JSON format. This library is designed to get latest exchange quotes data, historical rates, economy calendar and indicators data.

API Supports Features

  • 2000+ Currency exchange rates.
  • 10 secods price update frequency
  • 25 years historical data
  • MA lines and indicators signals
  • Economic calendar data

Requirements

Installation

Include FCS php library files in your project from github. Next

<?php 
use FCS\FCS_forex;

require_once(__DIR__.'/api/FCS_forex.php'); // Include library

Instantiate the client

<?php

// You can get your API key from fcsapi.com
define('FCS_KEY', 'API_KEY');

$forex = new FCS_forex(); // create class object

API reponse format

Default output is array for php, valid values are: array, json, jsonp, object, xml, serialize

$forex->set_output_type('JSON'); // optional

Get the list of available symbols:

$response = $forex->get_symbols_list();

Get quotes for specific currency:

$response = $forex->get_latest_price([
	'EUR/USD',
	'USD/JPY',
	'GBP/CHF'
]);

// OR  without array
$response = $forex->get_latest_price('EUR/USD,GBP/CHF');

// OR  by ids
$response = $forex->get_latest_price('1,2,3,4');

Convert one currency into another:

Convert 200 EUR : output = 240USD

$response = $forex->	get_converter(200, 'EUR','USD');

Other API methods

You can check full documentaions here https://fcsapi.com/document/forex-api

<?php 
	$response = $forex->	get_symbols_list();
	$response = $forex->	get_profile('EUR,USD,JPY');
	$response = $forex->	get_converter(200, 'EUR','USD'); // 200EUR to output 240 USD
	
	$response = $forex->	get_base_prices('EUR');
	$response = $forex->	get_base_prices('EUR','forex',true); // return with last update time
	$response = $forex->	get_base_prices('EUR','crypto');

	$response = $forex->	get_latest_price('all_forex');
	$response = $forex->	get_latest_price('1,2'); // by id, Latest OHLC
	$response = $forex->	get_latest_price( ['EUR/USD','JPY/USD'] ); // OHLC, Ask,bid,spread, change 
	
	$response = $forex->	get_last_candle('all_forex',	'5m');
	$response = $forex->	get_last_candle('all_forex',	'1h');
	$response = $forex->	get_last_candle('all_forex',	'1d');
	$response = $forex->	get_last_candle('1,2,3,4,5',	'1d'); 	// OHLC of specific time period
	
	$response = $forex->	get_pivot_points('1','1d'); 		// Support / Resistance
	$response = $forex->	get_pivot_points('EUR/USD','4h');
	
	$response = $forex->	get_moving_averages('1','1d'); // MA Lines signals
	$response = $forex->	get_moving_averages('EUR/USD','1d');

	$response = $forex->	get_technical_indicator('1','1d'); // Top Indicators
	$response = $forex->	get_technical_indicator('EUR/USD','1d');

	$response = $forex->	get_economy_calendar('USD,JPY');
	$response = $forex->	get_economy_calendar('USD','2021-02-01','2021-02-10');
	
	$response = $forex->	get_search_query('BTC Dollar',0);  // contain any words
	$response = $forex->	get_search_query('BTC Dollar',1); // contain all words

	$response = $forex->	get_history( ['id'=>1,'period'=>'1h'] );
	$response = $forex->	get_history( ['id'=>1,'period'=>'1h','from'=>'2020-01-01', 'to'=>'2020-01-31'] );

Other Links

Support and Contact

you can contact us at support@fcsapi.com or Live chat at https://fcsapi.com

License and Terms

This library is provided under the MIT license, also FCS privacy policy, terms and conditons apply.