Skip to content

Commit 9c34f72

Browse files
authored
Merge pull request #90 from ranjanrak/feat-auction
feat: add getAuctionInstruments, variety in place order, auction tests and update submodule
2 parents 228bbae + 468a909 commit 9c34f72

File tree

3 files changed

+37
-2
lines changed

3 files changed

+37
-2
lines changed

lib/connect.js

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,7 @@ var KiteConnect = function(params) {
115115

116116
"portfolio.positions": "/portfolio/positions",
117117
"portfolio.holdings": "/portfolio/holdings",
118+
"portfolio.holdings.auction": "/portfolio/holdings/auctions",
118119
"portfolio.positions.convert": "/portfolio/positions",
119120

120121
"mf.orders": "/mf/orders",
@@ -281,6 +282,11 @@ var KiteConnect = function(params) {
281282
*/
282283
self.VARIETY_ICEBERG = "iceberg";
283284

285+
/**
286+
* @memberOf KiteConnect
287+
*/
288+
self.VARIETY_AUCTION = "auction";
289+
284290
// Transaction type
285291
/**
286292
* @memberOf KiteConnect
@@ -578,7 +584,7 @@ var KiteConnect = function(params) {
578584
* @param {string} params.transaction_type Transaction type (BUY or SELL).
579585
* @param {number} params.quantity Order quantity
580586
* @param {string} params.product Product code (NRML, MIS, CNC).
581-
* @param {string} params.order_type Order type (NRML, SL, SL-M, MARKET).
587+
* @param {string} params.order_type Order type (LIMIT, SL, SL-M, MARKET).
582588
* @param {string} [params.validity] Order validity (DAY, IOC).
583589
* @param {number} [params.price] Order Price
584590
* @param {number} [params.disclosed_quantity] Disclosed quantity
@@ -589,6 +595,7 @@ var KiteConnect = function(params) {
589595
* @param {number} [params.validity_ttl] Order validity in minutes for TTL validity orders
590596
* @param {number} [params.iceberg_legs] Total number of legs for iceberg order variety
591597
* @param {number} [params.iceberg_quantity] Split quantity for each iceberg leg order
598+
* @param {number} [params.auction_number] A unique identifier for a particular auction
592599
* @param {string} [params.tag] An optional tag to apply to an order to identify it (alphanumeric, max 20 chars)
593600
*/
594601
self.placeOrder = function (variety, params) {
@@ -749,6 +756,16 @@ regular).
749756
return _get("portfolio.holdings");
750757
};
751758

759+
/**
760+
* Retrieves list of available instruments for a auction session.
761+
* @method getAuctionInstruments
762+
* @memberOf KiteConnect
763+
* @instance
764+
*/
765+
self.getAuctionInstruments = function() {
766+
return _get("portfolio.holdings.auction");
767+
}
768+
752769
/**
753770
* Retrieve positions.
754771
* @method getPositions

test/test.js

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,10 @@ function testSuite(){
7272
.get("/portfolio/holdings")
7373
.reply(200, parseJson("holdings.json"))
7474

75+
// getHoldings
76+
.get("/portfolio/holdings/auctions")
77+
.reply(200, parseJson("auctions_list.json"))
78+
7579
// getPositions
7680
.get("/portfolio/positions")
7781
.reply(200, parseJson("positions.json"))
@@ -310,6 +314,20 @@ function testSuite(){
310314
})
311315
});
312316

317+
// Retrieves list of available instruments for a auction session
318+
describe("getAuctionInstruments", function() {
319+
it("Retrieves list of available instruments for a auction session", (done) => {
320+
kc.getAuctionInstruments()
321+
.then(function(response) {
322+
expect(response).to.be.an("array");
323+
expect(response).to.have.nested.property("[0].auction_number");
324+
expect(response).to.have.nested.property("[0].instrument_token");
325+
expect(response).to.have.nested.property("[0].tradingsymbol");
326+
return done();
327+
}).catch(done);
328+
})
329+
});
330+
313331
// Retrieve the list of positions
314332
describe("getPositions", function() {
315333
it("Retrieve the list of positions", (done) => {

0 commit comments

Comments
 (0)