1forge / php-forex-quotes Goto Github PK
View Code? Open in Web Editor NEWPHP Library for fetching realtime forex quotes.
Home Page: https://1forge.com/forex-data-api
License: MIT License
PHP Library for fetching realtime forex quotes.
Home Page: https://1forge.com/forex-data-api
License: MIT License
ForexDataClient class, getQuotes function does not handle errors returned from the API.
For example, if quota has been exceeded, API returns something like:
{
"error": true
"message": "Your quota has been used fully. Quotas reset at midnight EST. If you have any questions please email us at [email protected]"
}
but code ignores that and just tries to read quote data - which doesn't exist and PHP notices get thrown.
Hello,
Our company just met an issue with your newest v6.0.0 library.
There is a redundant print
used in getQuotes()
method. This resulted in malformed API response in our application. (debugging-relic perhaps?)
php-forex-quotes/lib/ForexDataClient.php
Line 192 in ab8951a
Our walk-around for this bug was to cut off buffered output:
ob_start();
$result = $client->getQuotes();
ob_end_clean();
... but it is kind of dirty way. We hope that you could clean it up so we all can have a little more pretty code. :-)
Thanks in advance!
Kind regards,
Mike
Sometime use websocket to receive prices will happen exception "Receive server happen exception => Undefined offset: 2" ! Here is my code
try {
$this->webSocket_client->onUpdate(function ($symbol, $data) {
echo "[" . Carbon::now('Asia/Taipei')->toDateTimeString() . "] Receive {$symbol} ..." . PHP_EOL;
echo "[" . Carbon::now('Asia/Taipei')->toDateTimeString() . "] Price => " . var_dump($data) . PHP_EOL;
try {
$price = round($data['price'], 6);
$id = $this->product_list[$symbol];
$this->product_redisServer->hset($id, 'price', $price);
} catch (\Exception $exception) {
echo "[" . Carbon::now('Asia/Taipei')->toDateTimeString() . "] Receive price happen exception => {$exception->getMessage()}" . PHP_EOL;
}
});
$this->webSocket_client->onMessage(function ($message) {
echo $message;
});
$this->webSocket_client->connect(function ($client) {
//Subscribe to an array of currency pairs
$client->subscribeTo([
'EURUSD',
'USDJPY',
'AUDUSD',
'GBPUSD',
'EURGBP',
'EURJPY',
'GBPJPY',
'BTCUSD',
'ETHUSD',
'XAUUSD',
'XAGUSD'
]);
});
} catch (\Exception $exception) {
echo "[" . Carbon::now('Asia/Taipei')->toDateTimeString() . "] Receive server happen exception => {$exception->getMessage()}" . PHP_EOL;
}
Seem there is not any archives of prices, it's bad.
I am installing this package using composer but it requires php 5.6.4 but I am having the php 7.0 version
below error occurred
Problem 1
- Installation request for oneforge/forexquotes 2.0.8 -> satisfiable by oneforge/forexquotes[2.0.8].
- oneforge/forexquotes 2.0.8 requires php >=5.6.4 -> your PHP version (7.0.28-0ubuntu0.16.04.1) overridden by "config.platform.php" version (5.6) does not satisfy that requirement.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.