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

finvasia-extra

Package Overview
Dependencies
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

finvasia-extra - npm Package Compare versions

Comparing version 1.2.1 to 1.2.2

dist/src/types/timeseries.types.d.ts

2

dist/src/decorators/order-type.decorator.d.ts

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

export type FinvasiaOriginalOrderType = 'MKT';
export declare type FinvasiaOriginalOrderType = 'MKT';
export declare function TransformOrderType(): PropertyDecorator;
import ApiRequest from './ApiRequest';
import { CreateOrderParams, ExchangeType, ModifyOrderParams, OrderType, PositionResponseItem, ProductType, TransactionType } from './types';
import { CreateOrderParams, ExchangeType, GetTimeSeriesParams, GetTimeSeriesResponse, ModifyOrderParams, OrderType, PositionResponseItem, ProductType, TransactionType } from './types';
export interface SearchParams {

@@ -65,3 +65,3 @@ exchange: ExchangeType;

}
type OrderHistoryResponse = OrderHistoryResponseItem[];
declare type OrderHistoryResponse = OrderHistoryResponseItem[];
declare class RestAPI {

@@ -78,2 +78,3 @@ static routes: {

"positions.book": string;
"market.series": string;
};

@@ -95,2 +96,3 @@ static baseURL: string;

getOrders(): Promise<OrderHistoryResponse>;
getTimeSeries(params: GetTimeSeriesParams): Promise<GetTimeSeriesResponse>;
getOrderHistory(orderId: string): Promise<any>;

@@ -97,0 +99,0 @@ getPositionsBook(): Promise<PositionResponseItem[]>;

@@ -121,2 +121,16 @@ "use strict";

}
getTimeSeries(params) {
var _a, _b;
return __awaiter(this, void 0, void 0, function* () {
const data = yield this.apiRequest.post('market.series', {}, {
uid: this.userId,
exch: params.exchange,
token: params.token,
st: (_a = params.startTime) === null || _a === void 0 ? void 0 : _a.toString(),
et: (_b = params.endTime) === null || _b === void 0 ? void 0 : _b.toString(),
intrv: params.interval,
});
return data.map((item) => new types_1.GetTimeSeriesResponseItem(item));
});
}
getOrderHistory(orderId) {

@@ -167,2 +181,3 @@ return __awaiter(this, void 0, void 0, function* () {

placeOrder(params) {
var _a;
return __awaiter(this, void 0, void 0, function* () {

@@ -184,5 +199,5 @@ let parsed;

trantype: parsed.transactionType,
qty: parsed.quantity,
prc: parsed.price,
trgprc: parsed.triggerPrice,
qty: parsed.quantity.toString(),
prc: parsed.price.toString(),
trgprc: (_a = parsed.triggerPrice) === null || _a === void 0 ? void 0 : _a.toString(),
dscqty: parsed.disclosedQuantity,

@@ -189,0 +204,0 @@ prd: parsed.product,

@@ -10,3 +10,4 @@ {

"market.search": "/SearchScrip",
"positions.book": "/PositionBook"
"positions.book": "/PositionBook",
"market.series": "/TPSeries"
}

@@ -1,3 +0,3 @@

export type ExchangeType = 'NSE' | 'NFO' | 'BSE';
export type TransactionType = 'S' | 'B';
export declare type ExchangeType = 'NSE' | 'NFO' | 'BSE';
export declare type TransactionType = 'S' | 'B';
/**

@@ -8,3 +8,3 @@ * NRML - M

*/
export type ProductType = 'M' | 'I' | 'C';
export type OrderType = 'MKT' | 'LMT' | 'SL-LMT' | 'SL-MKT';
export declare type ProductType = 'M' | 'I' | 'C';
export declare type OrderType = 'MKT' | 'LMT' | 'SL-LMT' | 'SL-MKT';
export * from './common';
export * from './order';
export * from './timeseries.types';

@@ -19,1 +19,2 @@ "use strict";

__exportStar(require("./order"), exports);
__exportStar(require("./timeseries.types"), exports);

@@ -40,3 +40,3 @@ {

"types": "dist/index.d.ts",
"version": "1.2.1"
"version": "1.2.2"
}

@@ -8,2 +8,6 @@ import { string, z } from 'zod';

ExchangeType,
GetOriginalTimeSeriesResponseItem,
GetTimeSeriesParams,
GetTimeSeriesResponse,
GetTimeSeriesResponseItem,
ModifyOrderParams,

@@ -221,2 +225,19 @@ OrderType,

async getTimeSeries(params: GetTimeSeriesParams): Promise<GetTimeSeriesResponse> {
const data = await this.apiRequest.post(
'market.series',
{},
{
uid: this.userId,
exch: params.exchange,
token: params.token,
st: params.startTime?.toString(),
et: params.endTime?.toString(),
intrv: params.interval,
}
);
return data.map((item: GetOriginalTimeSeriesResponseItem) => new GetTimeSeriesResponseItem(item));
}
async getOrderHistory(orderId: string) {

@@ -281,5 +302,5 @@ if (!orderId) {

trantype: parsed.transactionType,
qty: parsed.quantity,
prc: parsed.price,
trgprc: parsed.triggerPrice,
qty: parsed.quantity.toString(),
prc: parsed.price.toString(),
trgprc: parsed.triggerPrice?.toString(),
dscqty: parsed.disclosedQuantity,

@@ -286,0 +307,0 @@ prd: parsed.product,

@@ -10,3 +10,4 @@ {

"market.search": "/SearchScrip",
"positions.book": "/PositionBook"
"positions.book": "/PositionBook",
"market.series": "/TPSeries"
}
export * from './common';
export * from './order';
export * from './timeseries.types';
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