clerusync-sdk
v1.0.7
Published
Node.js SDK for Clerusync Investment APIs (Stocks, Forex, Economic Calendar, News)
Downloads
544
Maintainers
Readme
Clerusync SDK
Official Node.js SDK for accessing the Clerusync Investment API including stocks, forex trends with AI insights, economic calendar data and financial news.
Installation
npm install clerusync-sdkAuthentication
You must provide your API key when initialising the SDK.
JavaScript
const ClerusyncSDK = require("clerusync-sdk");
const api = new ClerusyncSDK("YOUR_API_KEY");TypeScript
import { ClerusyncAPI } from "clerusync-sdk";
const api = new ClerusyncAPI("YOUR_API_KEY");Usage
Get Stocks
const stocks = await api.getStocks();
console.log(stocks);Get Forex + AI Insight
const forex = await api.getForex("currency_code_1", "currency_code_2");
console.log(forex);Get Economic Calendar
const calendar = await api.getCalendar("currency_code_1", "currency_code_2");
console.log(calendar);Get Financial News
const news = await api.getNews("currency_code_1", "currency_code_2");
console.log(news);Functional Example
import { ClerusyncAPI } from "clerusync-sdk";
const api = new ClerusyncAPI("YOUR_API_KEY");
(async () => {
try {
const stocks = await api.getStocks();
console.log("Stocks:", stocks);
const forex = await api.getForex("currency_code_1", "currency_code_2");
console.log("Forex:", forex);
const calendar = await api.getCalendar("currency_code_1", "currency_code_2");
console.log("Calendar:", calendar);
const news = await api.getNews("currency_code_1", "currency_code_2");
console.log("News:", news);
} catch (err) {
console.error("Error:", err.message);
}
})();Base URL
https://clerusyncinvestment.com/public/apiUsing Environment Variables
You can store your API key in an environment variable.
Unix / macOS / Linux:
export CLERUSYNC_INVESTMENT_API_KEY=your_key_hereWindows (PowerShell):
setx CLERUSYNC_INVESTMENT_API_KEY "your_key_here"Usage:
import { ClerusyncAPI } from "clerusync-sdk";
const api = new ClerusyncAPI(process.env.CLERUSYNC_INVESTMENT_API_KEY!);Creating .env file
CLERUSYNC_INVESTMENT_API_KEY=your_key_hereYou can use packages like dotenv to load this in your project:
JavaScript
require("dotenv").config();TypeScript
import dotenv from "dotenv";
dotenv.config();
import { ClerusyncAPI } from "clerusync-sdk";
const api = new ClerusyncAPI(process.env.CLERUSYNC_INVESTMENT_API_KEY!);License
MIT
Contributing
Pull requests are welcome. If you would like to recommend new changes, please open an issue to discuss what you would like to added.
Support
If you run into issues, open an issue on GitHub or contact [email protected]
