Skip to content

Commit

Permalink
Merge pull request #90 from ranjanrak/feat-auction
Browse files Browse the repository at this point in the history
feat: add getAuctionInstruments, variety in place order, auction tests and update submodule
  • Loading branch information
vividvilla committed Jan 6, 2023
2 parents 228bbae + 468a909 commit 9c34f72
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 2 deletions.
19 changes: 18 additions & 1 deletion lib/connect.js
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,7 @@ var KiteConnect = function(params) {

"portfolio.positions": "/portfolio/positions",
"portfolio.holdings": "/portfolio/holdings",
"portfolio.holdings.auction": "/portfolio/holdings/auctions",
"portfolio.positions.convert": "/portfolio/positions",

"mf.orders": "/mf/orders",
Expand Down Expand Up @@ -281,6 +282,11 @@ var KiteConnect = function(params) {
*/
self.VARIETY_ICEBERG = "iceberg";

/**
* @memberOf KiteConnect
*/
self.VARIETY_AUCTION = "auction";

// Transaction type
/**
* @memberOf KiteConnect
Expand Down Expand Up @@ -578,7 +584,7 @@ var KiteConnect = function(params) {
* @param {string} params.transaction_type Transaction type (BUY or SELL).
* @param {number} params.quantity Order quantity
* @param {string} params.product Product code (NRML, MIS, CNC).
* @param {string} params.order_type Order type (NRML, SL, SL-M, MARKET).
* @param {string} params.order_type Order type (LIMIT, SL, SL-M, MARKET).
* @param {string} [params.validity] Order validity (DAY, IOC).
* @param {number} [params.price] Order Price
* @param {number} [params.disclosed_quantity] Disclosed quantity
Expand All @@ -589,6 +595,7 @@ var KiteConnect = function(params) {
* @param {number} [params.validity_ttl] Order validity in minutes for TTL validity orders
* @param {number} [params.iceberg_legs] Total number of legs for iceberg order variety
* @param {number} [params.iceberg_quantity] Split quantity for each iceberg leg order
* @param {number} [params.auction_number] A unique identifier for a particular auction
* @param {string} [params.tag] An optional tag to apply to an order to identify it (alphanumeric, max 20 chars)
*/
self.placeOrder = function (variety, params) {
Expand Down Expand Up @@ -749,6 +756,16 @@ regular).
return _get("portfolio.holdings");
};

/**
* Retrieves list of available instruments for a auction session.
* @method getAuctionInstruments
* @memberOf KiteConnect
* @instance
*/
self.getAuctionInstruments = function() {
return _get("portfolio.holdings.auction");
}

/**
* Retrieve positions.
* @method getPositions
Expand Down
18 changes: 18 additions & 0 deletions test/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,10 @@ function testSuite(){
.get("/portfolio/holdings")
.reply(200, parseJson("holdings.json"))

// getHoldings
.get("/portfolio/holdings/auctions")
.reply(200, parseJson("auctions_list.json"))

// getPositions
.get("/portfolio/positions")
.reply(200, parseJson("positions.json"))
Expand Down Expand Up @@ -310,6 +314,20 @@ function testSuite(){
})
});

// Retrieves list of available instruments for a auction session
describe("getAuctionInstruments", function() {
it("Retrieves list of available instruments for a auction session", (done) => {
kc.getAuctionInstruments()
.then(function(response) {
expect(response).to.be.an("array");
expect(response).to.have.nested.property("[0].auction_number");
expect(response).to.have.nested.property("[0].instrument_token");
expect(response).to.have.nested.property("[0].tradingsymbol");
return done();
}).catch(done);
})
});

// Retrieve the list of positions
describe("getPositions", function() {
it("Retrieve the list of positions", (done) => {
Expand Down

0 comments on commit 9c34f72

Please sign in to comment.