Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

xts-interactive-api

Package Overview
Dependencies
Maintainers
1
Versions
8
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

xts-interactive-api - npm Package Compare versions

Comparing version 3.0.1 to 3.0.2

6

examples/config/config.json
{
"secretKey": "Aoxf623#aa",
"appKey": "cccc0397aefe029ce61392",
"secretKey": "Wplt610$wg",
"appKey": "933074757c8e60cb2dd166",
"source": "WEBAPI",
"url": "http://103.69.170.14:10332"
"url": "https://developers.symphonyfintech.in"
}

@@ -232,3 +232,3 @@ //Accessing the Interactive and WS from node-xts-interactive-api library

var getBalance = async function (reqObject) {
let response = await xtsInteractive.getBalance(reqObject);
let response = await xtsInteractive.getBalance();
console.log(response);

@@ -235,0 +235,0 @@ return response;

{
"url": "https://developers.symphonyfintech.in"
"url": "https://developers.symphonyfintech.in",
"logEnabled": false
}
var config = require('./config/app/config.json'),
settings = require('./config/app/settings.json'),
request = require('./request'),
logger = require('./logger'),
CustomError = require('./customError');

@@ -18,4 +19,5 @@

this.url =
url == 'undefined' ? config.url + '/interactive' : url + '/interactive';
url === undefined ? config.url + '/interactive' : url + '/interactive';
this.responseTypes = { success: 'success', failure: 'failure' };
logger.init();
this.isLoggedIn = false;

@@ -22,0 +24,0 @@ }

@@ -18,3 +18,3 @@ var socketIoClient = require('socket.io-client');

constructor(url) {
this.url = url == 'undefined' ? config.url : url;
this.url = url === undefined ? config.url : url;
this.socketMD = {

@@ -21,0 +21,0 @@ isConnected: false,

var fs = require('fs');
var settings = require('./config/app/settings.json');
var config = require('./config/app/config.json');
Date.prototype.getMonthFormatted = function () {
var month = this.getMonth() + 1;
return month < 10 ? '0' + month : '' + month;
}
var month = this.getMonth() + 1;
return month < 10 ? '0' + month : '' + month;
};
Date.prototype.getMonthFormattedString = function () {
switch (this.getMonth()) {
case 0:
return "Jan";
case 1:
return "Feb";
case 2:
return "Mar";
case 3:
return "Apr";
case 4:
return "May";
case 5:
return "Jun";
case 6:
return "Jul";
case 7:
return "Aug";
case 8:
return "Sep";
case 9:
return "Oct";
case 10:
return "Nov";
case 11:
return "Dec";
}
return month < 10 ? '0' + month : '' + month;
}
switch (this.getMonth()) {
case 0:
return 'Jan';
case 1:
return 'Feb';
case 2:
return 'Mar';
case 3:
return 'Apr';
case 4:
return 'May';
case 5:
return 'Jun';
case 6:
return 'Jul';
case 7:
return 'Aug';
case 8:
return 'Sep';
case 9:
return 'Oct';
case 10:
return 'Nov';
case 11:
return 'Dec';
}
return month < 10 ? '0' + month : '' + month;
};
Date.prototype.getDayFormatted = function () {
var day = this.getDate();
return day < 10 ? '0' + day : '' + day;
}
var day = this.getDate();
return day < 10 ? '0' + day : '' + day;
};
Date.prototype.getHourFormatted = function () {
var hour = this.getHours();
return hour < 10 ? '0' + hour : '' + hour;
}
var hour = this.getHours();
return hour < 10 ? '0' + hour : '' + hour;
};
Date.prototype.getMinuteFormatted = function () {
var minute = this.getMinutes();
return minute < 10 ? '0' + minute : '' + minute;
}
var minute = this.getMinutes();
return minute < 10 ? '0' + minute : '' + minute;
};
Date.prototype.getSecondFormatted = function () {
var second = this.getSeconds();
return second < 10 ? '0' + second : '' + second;
}
var second = this.getSeconds();
return second < 10 ? '0' + second : '' + second;
};
Date.prototype.getFormatedDateTime = function () {
return this.getDayFormatted() + '/' + this.getMonthFormatted() + '/' + this.getFullYear() + " " + this.getHourFormatted() + ":" +
this.getMinuteFormatted() + ":" + this.getSecondFormatted();
}
return (
this.getDayFormatted() +
'/' +
this.getMonthFormatted() +
'/' +
this.getFullYear() +
' ' +
this.getHourFormatted() +
':' +
this.getMinuteFormatted() +
':' +
this.getSecondFormatted()
);
};
Date.prototype.getDateTimeFormatted = function () {
return `${this.getMonthFormattedString()} ${this.getDayFormatted()} ${this.getFullYear()} ${this.getHourFormatted()}:${this.getMinuteFormatted()}:${this.getSecondFormatted()}`;
}
return `${this.getMonthFormattedString()} ${this.getDayFormatted()} ${this.getFullYear()} ${this.getHourFormatted()}:${this.getMinuteFormatted()}:${this.getSecondFormatted()}`;
};
var dir = process.cwd() + '/logs';
var d = new Date();
var todaysDate = d.getDayFormatted() + '' + d.getMonthFormatted() + '' + d.getFullYear();
var logFileName =dir + "/debug_" + todaysDate + ".txt";
var initMessage = "============================================\nInitialized logger\n==================================================\n";
var todaysDate =
d.getDayFormatted() + '' + d.getMonthFormatted() + '' + d.getFullYear();
var logFileName = dir + '/debug_' + todaysDate + '.txt';
var initMessage =
'============================================\nInitialized logger\n==================================================\n';
//var dir = '../logs';
module.exports.init = function () {
console.info("logger module initialized successfully!");
if (config.logEnabled) {
console.info('logger module initialized successfully!');
// For uncaughtException Log
if (!fs.existsSync(dir)) {
fs.mkdirSync(dir);
fs.mkdirSync(dir);
}
if(!fs.existsSync(logFileName)){
fs.appendFile(logFileName, initMessage, function (err) {
if (err) {
// return module.exports.writeLine(enums.consoleColor.yellow + "%s" + enums.consoleColor.reset, err);
}
});
if (!fs.existsSync(logFileName)) {
fs.appendFile(logFileName, initMessage, function (err) {
if (err) {
// return module.exports.writeLine(enums.consoleColor.yellow + "%s" + enums.consoleColor.reset, err);
}
});
} else {
let message = "============================================\n RUN the application on"+new Date()+"\n==================================================\n";
fs.appendFile(logFileName, message, function (err) {
if (err) {
//return module.exports.writeLine(enums.consoleColor.yellow + "%s" + enums.consoleColor.reset, err);
}
});
let message =
'============================================\n RUN the application on' +
new Date() +
'\n==================================================\n';
fs.appendFile(logFileName, message, function (err) {
if (err) {
//return module.exports.writeLine(enums.consoleColor.yellow + "%s" + enums.consoleColor.reset, err);
}
});
}
}
}
};
module.exports.logFile = function(logMessage){
logMessage=logMessage+" \n";
module.exports.logFile = function (logMessage) {
if (config.logEnabled) {
logMessage = logMessage + ' \n';
fs.appendFile(logFileName, JSON.stringify(logMessage), function (err) {
if (err) {
// return module.exports.writeLine(enums.consoleColor.yellow + "%s" + enums.consoleColor.reset, err);
}
if (err) {
// return module.exports.writeLine(enums.consoleColor.yellow + "%s" + enums.consoleColor.reset, err);
}
});
}
}
};
{
"name": "xts-interactive-api",
"version": "3.0.1",
"version": "3.0.2",
"description": "The official JS client library for the Symphony Fintech Trading API's",

@@ -5,0 +5,0 @@ "main": "./lib/",

@@ -42,2 +42,3 @@ # xts-interactive-nodeJS-api-v2

appKey: '5a75a3616cabe678',
source: 'WEBAPI',
};

@@ -66,6 +67,5 @@

var socketInitRequest = {
userID: “AJ01”,
apiType:“INTERACTIVE”,
token: logIn.result.token // Token Generated after successful LogIn
}
userID: "XYZ",
token: "ABCDJGJKHK", // Token Generated after successful LogIn
};
xtsInteractiveWS.init(socketInitRequest);

@@ -77,26 +77,45 @@ ```

```js
xtsInteractiveWS.onConnect((connectData) => {
console.log(connectData);
});
xtsInteractiveWS.onJoined((joinedData) => {
console.log(joinedData);
});
xtsInteractiveWS.onError((errorData) => {
console.log(errorData);
});
xtsInteractiveWS.onDisconnect((disconnectData) => {
console.log(disconnectData);
});
xtsInteractiveWS.onOrder((orderData) => {
console.log(orderData);
});
xtsInteractiveWS.onTrade((tradeData) => {
console.log(tradeData);
});
xtsInteractiveWS.onPosition((positionData) => {
console.log(positionData);
});
xtsInteractiveWS.onLogout((logoutData) => {
console.log(logoutData);
});
var registerEvents = async function () {
//instantiating the listeners for all event related data
//"connect" event listener
xtsInteractiveWS.onConnect((connectData) => {
console.log(connectData);
});
//"joined" event listener
xtsInteractiveWS.onJoined((joinedData) => {
console.log(joinedData);
});
//"error" event listener
xtsInteractiveWS.onError((errorData) => {
console.log(errorData);
});
//"disconnect" event listener
xtsInteractiveWS.onDisconnect((disconnectData) => {
console.log(disconnectData);
});
//"order" event listener
xtsInteractiveWS.onOrder((orderData) => {
console.log(orderData);
});
//"trade" event listener
xtsInteractiveWS.onTrade((tradeData) => {
console.log(tradeData);
});
//"position" event listener
xtsInteractiveWS.onPosition((positionData) => {
console.log(positionData);
});
//"logout" event listener
xtsInteractiveWS.onLogout((logoutData) => {
console.log(logoutData);
});
};
```

@@ -116,14 +135,15 @@

let response = await xtsInteractive.placeOrder({
exchangeSegment: xtsInteractive.exchangeInfo.NSECM,
exchangeInstrumentID: 22, // can use "ACC-EQ" as well
productType: xtsInteractive.productTypes.MIS,
orderType: xtsInteractive.orderTypes.Limit,
orderSide: xtsInteractive.orderSide.BUY,
timeInForce: xtsInteractive.dayOrNet.DAY,
disclosedQuantity: 0,
orderQuantity: 20,
limitPrice: 1500.0,
stopPrice: 1600.0,
orderUniqueIdentifier: '45485',
});
exchangeSegment: 'NSECM',
exchangeInstrumentID: 22,
productType: 'NRML',
orderType: 'MARKET',
orderSide: 'BUY',
timeInForce: 'DAY',
disclosedQuantity: 0,
orderQuantity: 20,
limitPrice: 1500.0,
stopPrice: 1600.0,
orderUniqueIdentifier: '45485',
clientID: userID,
};);
```

@@ -137,5 +157,5 @@

let response = await xtsInteractive.modifyOrder({
appOrderID: 1991237756,
modifiedProductType: xtsInteractive.productTypes.NRML,
modifiedOrderType: xtsInteractive.orderTypes.Limit,
appOrderID: 1200037025,
modifiedProductType: 'CO',
modifiedOrderType: 'MARKET',
modifiedOrderQuantity: 100,

@@ -145,4 +165,5 @@ modifiedDisclosedQuantity: 0,

modifiedStopPrice: 300,
modifiedTimeInForce: xtsInteractive.dayOrNet.DAY,
orderUniqueIdentifier: '5656',
modifiedTimeInForce: 'DAY',
orderUniqueIdentifier: '454845',
clientID: userID,
});

@@ -168,10 +189,12 @@ ```

let response = await xtsInteractive.placeCoverOrder({
exchangeSegment: xtsInteractive.exchangeInfo.NSECM,
exchangeInstrumentID: 22, //can use "ACC-EQ" as well
orderSide: xtsInteractive.orderSide.BUY,
exchangeSegment: 'NSECM',
exchangeInstrumentID: 22,
orderSide: 'Buy',
orderQuantity: 2,
disclosedQuantity: 2,
disclosedQuantity: 0,
limitPrice: 2054,
stopPrice: 2054,
orderType: 'MARKET',
orderUniqueIdentifier: '45485',
clientID: userID,
});

@@ -185,3 +208,7 @@ ```

```js
let response = await xtsInteractive.exitCoverOrder("2426016103"));
let response = await xtsInteractive.exitCoverOrder({
appOrderID: '1400070884',
clientID: userID,
orderUniqueIdentifier: '454845',
});
```

@@ -213,3 +240,4 @@

let response = await xtsInteractive.getPositions({
dayOrNet: xtsInteractive.dayOrNet.DAY,
dayOrNet: 'NetWise',
clientID: userID,
});

@@ -225,26 +253,11 @@ ```

exchangeSegment: 'NSECM',
exchangeInstrumentID: 22,
oldProductType: xtsInteractive.productTypes.NRML,
newProductType: xtsInteractive.productTypes.MIS,
isDayWise: true,
targetQty: 1,
exchangeInstrumentID: 1922,
oldProductType: 'MIS',
newProductType: 'CNC',
isDayWise: false,
targetQty: '1',
clientID: userID,
});
```
## squareOff
Calls PUT /portfolio/squareoff
```js
let response = await xtsInteractive.squareOff({
exchangeSegment: xtsInteractive.exchangeInfo.NSECM,
exchangeInstrumentID: 22,
productType: xtsInteractive.productTypes.NRML,
squareoffMode: xtsInteractive.positionSqureOffMode.DayWise,
positionSquareOffQuantityType:
xtsInteractive.positionSquareOffQuantityType.ExactQty,
squareOffQtyValue: 5,
});
```
## Holdings API

@@ -280,18 +293,4 @@

Below is the brief information related to streaming events provided by XTS-Interactive-API SDK.
```js
xtsInteractiveWS.init(socketInitRequest); // Init the socket instance
xtsInteractiveWS.onConnect((connectData) => {}); //registering for Connect event
xtsInteractiveWS.onJoined((joinedData) => {}); //registering for Joined event
xtsInteractiveWS.onError((errorData) => {}); //registering for Error event
xtsInteractiveWS.onDisconnect((disconnectData) => {}); //registering for Disconnect event
xtsInteractiveWS.onOrder((orderData) => {}); //registering for Order event
xtsInteractiveWS.onTrade((tradeData) => {}); //registering for Trade event
xtsInteractiveWS.onPosition((positionData) => {}); //registering for Position event
xtsInteractiveWS.onLogout((logoutData) => {}); //registering for Logout event
```
We do have a market data component which will provide the streaming of our real-time streaming market data. For more info please check the following link.
https://symphonyfintech.com/xts-market-data-front-end-api/
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc