foreks-sdk
v1.0.73
Published
Foreks Web SDK
Downloads
1,381
Readme
Foreks SDK for web development. This SDK is used to connect to the Foreks websocket server and to use the Foreks API.
Installation
$ npm i foreks-sdk -s
import ForeksWebSDK from 'foreks-sdk/web-sdk';
import {
DefinitionLocale,
NewsSources,
NewsLocale
} from 'foreks-sdk/commons/enums';
import PubsubData from 'foreks-sdk/commons/type/PubsubData';
const sdk = new ForeksWebSDK(
'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)
);
Usage Example
// initialize foreks web sdk
await foreksWebSDK.initialize();
// connect to socket
await foreksWebSDK.connectToSocket();
// set fx definitions
await foreksWebSDK.definition.setDefinitionByDomain(
'FX',
DefinitionLocale.BIST
);
// get foreks news example
const newsData = await this.$foreksWebSDK.news.getNews(
NewsSources.FRKS,
10,
NewsLocale.TR
);
// socket subscribe example usdtry and eurtry ask and bid
foreksWebSDK.socket.subscribe(
['o10', 'o11'],
['a', 'b'],
(data: PubsubData) => {
console.log(data);
}
);
Legal Disclaimer
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
Documentation Web SDK
Example project
Example Web SDK Example