foreks-sdk
TypeScript icon, indicating that this package has built-in type declarations

1.0.63 • Public • Published

Foreks Logo

NPM version NPM downloads

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
);

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);
  }
);

Documentation

Documentation Web SDK

Example project

Example Web SDK Example

Readme

Keywords

Package Sidebar

Install

npm i foreks-sdk

Weekly Downloads

345

Version

1.0.63

License

ISC

Unpacked Size

4.02 MB

Total Files

212

Last publish

Collaborators

  • foreksorg