Security News
Highlights from the 2024 Rails Community Survey
A record 2,709 developers participated in the 2024 Ruby on Rails Community Survey, revealing key tools, practices, and trends shaping the Rails ecosystem.
forex-quotes
Advanced tools
javascript-forex-quotes is a Javascript Library for fetching realtime forex quotes.
npm install forex-quotes --save
// With require
const ForgeClient = require("forex-quotes").default;
// With es6 or TypeScript
import ForgeClient from 'forex-quotes';
let client = new ForgeClient('YOUR_API_KEY');
// Handle incoming price updates from the server
client.onUpdate((symbol, data) => {
console.log(symbol, data);
});
// Handle non-price update messages
client.onMessage((message) => {
console.log(message);
});
// Handle disconnection from the server
client.onDisconnect(() => {
console.log("Disconnected from server");
});
// Handle successful connection
client.onConnect(() => {
// 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();
// Disconnect from the server
client.disconnect();
});
client.connect();
// You can get an API key at 1forge.com
let client = new ForgeClient('YOUR_API_KEY');
// Get the list of available symbols
client.getSymbols().then(response => {
console.log(response);
});
// Get quotes for specified symbols:
client.getQuotes(['EUR/USD', 'GBP/JPY', 'AUD/USD']).then(response => {
console.log(response);
});
// Convert from one currency to another:
client.convert('EUR', 'USD', 100).then(response => {
console.log(response);
});
// Check if the market is open:
client.getMarketStatus().then(response => {
console.log(response);
});
// Check your usage / quota limit:
client.getQuota().then(response => {
console.log(response);
});
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.
Please contact me at contact@1forge.com if you have any questions or requests.
This library is provided without warranty under the MIT license.
FAQs
Realtime forex quote API client
The npm package forex-quotes receives a total of 78 weekly downloads. As such, forex-quotes popularity was classified as not popular.
We found that forex-quotes demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
A record 2,709 developers participated in the 2024 Ruby on Rails Community Survey, revealing key tools, practices, and trends shaping the Rails ecosystem.
Security News
In 2023, data breaches surged 78% from zero-day and supply chain attacks, but developers are still buried under alerts that are unable to prevent these threats.
Security News
Solo open source maintainers face burnout and security challenges, with 60% unpaid and 60% considering quitting.