ForInvest CLI. This CLI is used to connect ForInvest WebSocket and REST API services.
$ npm i forinvest-cli -s
import ForInvestCLI from 'forinvest-cli';
import {
DefinitionLocale,
NewsSources,
NewsLocale
} from 'forinvest-cli/commons/enums';
import PubsubData from 'forinvest-cli/commons/type/PubsubData';
const sdk = new ForInvestCLI(
'username', // username
'password', // password
'token', // if you have token (you can send undefined for username and password)
'company', // company
'foreks', // resource
'wss://', // wss address
'myapp', // your application name
'production' // sdk env default is production (development, test, production)
);
// initialize ForInvest web sdk
await sdk.initialize();
// connect to socket
await sdk.connectToSocket();
// set fx definitions
await sdk.definition.setDefinitionByDomain(
'FX',
DefinitionLocale.BIST
);
// get forinvest news example
const newsData = await sdk.news.getNews(
NewsSources.FRKS,
10,
NewsLocale.TR
);
// socket subscribe example usdtry and eurtry ask and bid
sdk.socket.subscribe(
['o10', 'o11'],
['a', 'b'],
(data: PubsubData) => {
console.log(data);
}
);
Please do not put this SDK into production use. For user credentials and password information, please contact the ForInvest sales team. ForInvest reserves the right to enforce its rights in cases of unauthorized or improper use.
Documentation Web SDK
ForInvest All rights reserved.