Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add getAuctionInstruments, variety in place order, auction tests and update submodule #90

Merged
merged 1 commit into from
Jan 6, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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