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

inves-broker

Package Overview
Dependencies
Maintainers
1
Versions
67
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

inves-broker - npm Package Compare versions

Comparing version 0.2.6 to 0.2.7

3

dist/brokers/Broker.d.ts

@@ -1,2 +0,2 @@

import { GetLoginURLParams, GenerateSessionParams, GetMarginsParams, GetOrdersParams, GetOrderHistoryParams, GetOrderTradesParams, GetPositionsParams, GetProfileParams, SessionInformation, MarginInformation, OrderInformation, ProfileInformation, GetTradesParams, TradeInformation, GetHoldingsParams, HoldingInformation, PositionInformation, GetGTTParams, GetGTTsParams, GetHistoricalDataParams, HistoricalInformation, GetInstrumentsParams, GetLTPParams, GetQuoteParams, PlaceOrderParams, PlaceOrderInformation } from '../types';
import { GetLoginURLParams, GenerateSessionParams, GetMarginsParams, GetOrdersParams, GetOrderHistoryParams, GetOrderTradesParams, GetPositionsParams, GetProfileParams, SessionInformation, MarginInformation, OrderInformation, ProfileInformation, GetTradesParams, TradeInformation, GetHoldingsParams, HoldingInformation, PositionInformation, GetGTTParams, GetGTTsParams, GetHistoricalDataParams, HistoricalInformation, GetInstrumentsParams, GetLTPParams, GetQuoteParams, PlaceOrderParams, PlaceOrderInformation, CancelOrderParams, CancelOrderInformation } from '../types';
export declare abstract class Broker {

@@ -23,2 +23,3 @@ abstract getLoginURL(params: GetLoginURLParams): Promise<string>;

abstract placeOrder(params: PlaceOrderParams, accessToken: string): Promise<PlaceOrderInformation>;
abstract cancelOrder(params: CancelOrderParams, accessToken: string): Promise<CancelOrderInformation>;
}

@@ -1,2 +0,2 @@

import { GenerateSessionParams, GetGTTParams, GetGTTsParams, GetHistoricalDataParams, GetHoldingsParams, GetInstrumentsParams, GetLoginURLParams, GetLTPParams, GetMarginsParams, GetOrderHistoryParams, GetOrdersParams, GetOrderTradesParams, GetPositionsParams, GetProfileParams, GetQuoteParams, GetTradesParams, HistoricalInformation, HoldingInformation, MarginInformation, OrderInformation, PlaceOrderInformation, PlaceOrderParams, PositionInformation, ProfileInformation, SessionInformation, TradeInformation } from "../types";
import { CancelOrderInformation, CancelOrderParams, GenerateSessionParams, GetGTTParams, GetGTTsParams, GetHistoricalDataParams, GetHoldingsParams, GetInstrumentsParams, GetLoginURLParams, GetLTPParams, GetMarginsParams, GetOrderHistoryParams, GetOrdersParams, GetOrderTradesParams, GetPositionsParams, GetProfileParams, GetQuoteParams, GetTradesParams, HistoricalInformation, HoldingInformation, MarginInformation, OrderInformation, PlaceOrderInformation, PlaceOrderParams, PositionInformation, ProfileInformation, SessionInformation, TradeInformation } from "../types";
import { Broker } from "./Broker";

@@ -39,2 +39,3 @@ export declare class DhanBroker implements Broker {

triggerMemoizationOfSecurityList(): Promise<void>;
cancelOrder(params: CancelOrderParams, accessToken: string): Promise<CancelOrderInformation>;
}

@@ -136,3 +136,3 @@ "use strict";

orderId: response.data.orderId,
status: response.data.status,
status: response.data.orderStatus,
message: '',

@@ -516,4 +516,24 @@ };

}
cancelOrder(params, accessToken) {
return __awaiter(this, void 0, void 0, function* () {
try {
const response = yield axios_1.default.delete(`${this.baseApiUrl}/orders/${params.orderId}`, {
headers: {
"Content-Type": "application/json",
"access-token": accessToken,
}
});
return {
orderId: response.data.orderId,
status: response.data.orderStatus,
message: '',
};
}
catch (err) {
throw err;
}
});
}
}
exports.DhanBroker = DhanBroker;
//# sourceMappingURL=DhanBroker.js.map
import { Broker } from "./Broker";
import { GenerateSessionParams, GetLoginURLParams, GetMarginsParams, GetOrdersParams, GetOrderHistoryParams, GetOrderTradesParams, GetPositionsParams, GetProfileParams, MarginInformation, SessionInformation, ProfileInformation, OrderInformation, GetTradesParams, TradeInformation, GetHoldingsParams, HoldingInformation, GetGTTParams, GetGTTsParams, GetHistoricalDataParams, HistoricalInformation, GetInstrumentsParams, GetLTPParams, GetQuoteParams, PlaceOrderParams, PlaceOrderInformation } from "../types";
import { GenerateSessionParams, GetLoginURLParams, GetMarginsParams, GetOrdersParams, GetOrderHistoryParams, GetOrderTradesParams, GetPositionsParams, GetProfileParams, MarginInformation, SessionInformation, ProfileInformation, OrderInformation, GetTradesParams, TradeInformation, GetHoldingsParams, HoldingInformation, GetGTTParams, GetGTTsParams, GetHistoricalDataParams, HistoricalInformation, GetInstrumentsParams, GetLTPParams, GetQuoteParams, PlaceOrderParams, PlaceOrderInformation, CancelOrderInformation, CancelOrderParams } from "../types";
export declare class KiteBroker implements Broker {

@@ -29,3 +29,4 @@ private baseLoginURL;

placeOrder(params: PlaceOrderParams, accessToken: string): Promise<PlaceOrderInformation>;
cancelOrder(params: CancelOrderParams, accessToken: string): Promise<CancelOrderInformation>;
private getKiteConnection;
}

@@ -375,3 +375,3 @@ "use strict";

return {
status: response.data,
status: response.data.status,
orderId: response.data.data.order_id,

@@ -386,2 +386,18 @@ message: '',

}
cancelOrder(params, accessToken) {
return __awaiter(this, void 0, void 0, function* () {
try {
const kc = this.getKiteConnection(accessToken);
const response = yield kc.cancelOrder(params.variety, params.orderId);
return {
status: response.data.status,
orderId: response.data.data.order_id,
message: '',
};
}
catch (err) {
throw err;
}
});
}
getKiteConnection(accessToken) {

@@ -388,0 +404,0 @@ return new KiteConnect({

@@ -1,2 +0,2 @@

import { GenerateSessionParams, GetGTTParams, GetGTTsParams, GetHistoricalDataParams, GetHoldingsParams, GetInstrumentsParams, GetLoginURLParams, GetLTPParams, GetMarginsParams, GetOrderHistoryParams, GetOrdersParams, GetOrderTradesParams, GetPositionsParams, GetProfileParams, GetQuoteParams, GetTradesParams, HistoricalInformation, HoldingInformation, MarginInformation, OrderInformation, PlaceOrderInformation, PlaceOrderParams, PositionInformation, ProfileInformation, SessionInformation, TradeInformation } from "../types";
import { CancelOrderInformation, CancelOrderParams, GenerateSessionParams, GetGTTParams, GetGTTsParams, GetHistoricalDataParams, GetHoldingsParams, GetInstrumentsParams, GetLoginURLParams, GetLTPParams, GetMarginsParams, GetOrderHistoryParams, GetOrdersParams, GetOrderTradesParams, GetPositionsParams, GetProfileParams, GetQuoteParams, GetTradesParams, HistoricalInformation, HoldingInformation, MarginInformation, OrderInformation, PlaceOrderInformation, PlaceOrderParams, PositionInformation, ProfileInformation, SessionInformation, TradeInformation } from "../types";
import { Broker } from "./Broker";

@@ -11,2 +11,3 @@ export declare class PaytmMoneyBroker implements Broker {

private securityList;
private securitySymbolMap;
private getSecurityListMemoized;

@@ -45,2 +46,3 @@ constructor(apiKey: string, apiSecret: string);

private transformPaytmToKiteOrderType;
cancelOrder(params: CancelOrderParams, accessToken: string): Promise<CancelOrderInformation>;
}

@@ -32,3 +32,3 @@ "use strict";

securityMasterList: "/data/v1/scrips/security_master.csv",
getAllOrders: '/orders/v1/user/orders',
getAllOrders: '/orders/v1/order-book',
getTradeDetails: '/orders/v1/trade-details',

@@ -38,2 +38,3 @@ getPositions: '/orders/v1/position',

getMargins: '/accounts/v1/funds/summary?config=true',
cancelRegularOrder: '/orders/v1/cancel/regular',
};

@@ -47,2 +48,3 @@ this.transactionType = {

this.securityList = {};
this.securitySymbolMap = {};
this.getSecurityListMemoized = (0, memoizee_1.default)(this.getSecurityList, {

@@ -155,3 +157,3 @@ promise: true,

exchange: order.exchange,
tradingSymbol: this.securityList[order.security_id].symbol,
tradingSymbol: this.securitySymbolMap[order.security_id],
instrumentToken: order.instrument_token || null,

@@ -175,2 +177,4 @@ orderType: this.transformPaytmToKiteOrderType(order.order_type),

guid: order.guid || null,
serialNumber: order.serial_no,
groupId: order.group_id,
};

@@ -344,18 +348,21 @@ });

jsonDump.forEach((item) => {
this.securityList[item.symbol] = {
securityId: item.security_id,
symbol: item.symbol,
name: item.name,
series: item.series,
tickSize: item.tick_size,
lotSize: item.lot_size,
instrumentType: item.instrument_type,
segment: item.segment,
exchange: item.exchange,
upperLimit: item.upper_limit,
lowerLimit: item.lower_limit,
expiryDate: item.expiry_date,
strikePrice: item.strike_price,
freezeQuantity: item.freeze_quantity,
};
if (item.exchange === 'NSE') {
this.securityList[item.symbol] = {
securityId: item.security_id,
symbol: item.symbol,
name: item.name,
series: item.series,
tickSize: item.tick_size,
lotSize: item.lot_size,
instrumentType: item.instrument_type,
segment: item.segment,
exchange: item.exchange,
upperLimit: item.upper_limit,
lowerLimit: item.lower_limit,
expiryDate: item.expiry_date,
strikePrice: item.strike_price,
freezeQuantity: item.freeze_quantity,
};
this.securityList[item.security_id] = item.symbol;
}
});

@@ -455,4 +462,36 @@ });

}
cancelOrder(params, accessToken) {
return __awaiter(this, void 0, void 0, function* () {
try {
yield this.getSecurityListMemoized();
const response = yield this.post(this.endpoints.cancelRegularOrder, {
order_no: params.orderId,
serial_no: params.serialNo,
group_id: params.groupId,
source: 'W',
txn_type: this.transformKiteToPaytmTransactionType(params === null || params === void 0 ? void 0 : params.transactionType),
exchange: params === null || params === void 0 ? void 0 : params.exchange,
security_id: this.securityList[params === null || params === void 0 ? void 0 : params.tradingSymbol].securityId,
segment: this.securityList[params === null || params === void 0 ? void 0 : params.tradingSymbol].segment,
order_type: this.transformKiteToPaytmOrderType(params === null || params === void 0 ? void 0 : params.orderType),
price: (params === null || params === void 0 ? void 0 : params.price) || 0,
trigger_price: (params === null || params === void 0 ? void 0 : params.triggerPrice) || null,
quantity: params === null || params === void 0 ? void 0 : params.quantity,
validity: params === null || params === void 0 ? void 0 : params.validity,
product: this.transformKiteToPaytmProduct(params),
off_mkt_flag: params.variety === 'amo',
}, accessToken);
return {
orderId: response.data.orderId,
status: response.data.status,
message: '',
};
}
catch (err) {
throw err;
}
});
}
}
exports.PaytmMoneyBroker = PaytmMoneyBroker;
//# sourceMappingURL=PaytmMoney.js.map

@@ -95,2 +95,8 @@ interface GetLoginURLParams {

}
interface CancelOrderParams extends PlaceOrderParams {
orderId: string;
variety?: string;
serialNo?: number;
groupId?: number;
}
interface SessionInformation {

@@ -169,2 +175,4 @@ userType: string;

guid: string;
serialNumber?: number;
groupId?: number;
}

@@ -227,2 +235,7 @@ interface TradeInformation {

}
export { GetLoginURLParams, GenerateSessionParams, GetMarginsParams, GetProfileParams, GetOrdersParams, GetOrderHistoryParams, GetTradesParams, GetOrderTradesParams, GetPositionsParams, GetHoldingsParams, GetGTTParams, GetGTTsParams, GetHistoricalDataParams, GetInstrumentsParams, GetLTPParams, GetQuoteParams, PlaceOrderParams, SessionInformation, MarginInformation, ProfileInformation, OrderInformation, TradeInformation, HoldingInformation, PositionInformation, HistoricalInformation, PlaceOrderInformation, };
interface CancelOrderInformation {
status: string;
orderId: string;
message: string;
}
export { GetLoginURLParams, GenerateSessionParams, GetMarginsParams, GetProfileParams, GetOrdersParams, GetOrderHistoryParams, GetTradesParams, GetOrderTradesParams, GetPositionsParams, GetHoldingsParams, GetGTTParams, GetGTTsParams, GetHistoricalDataParams, GetInstrumentsParams, GetLTPParams, GetQuoteParams, PlaceOrderParams, CancelOrderParams, SessionInformation, MarginInformation, ProfileInformation, OrderInformation, TradeInformation, HoldingInformation, PositionInformation, HistoricalInformation, PlaceOrderInformation, CancelOrderInformation };
{
"name": "inves-broker",
"version": "0.2.6",
"version": "0.2.7",
"description": "Interact with multiple broker APIs in the Indian stock market.",

@@ -5,0 +5,0 @@ "main": "dist/index.js",

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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