From 3b5c6d0c6657a5a5511dc70160cbd1209637452b Mon Sep 17 00:00:00 2001 From: Amod Date: Fri, 7 Jul 2023 10:22:06 +0530 Subject: [PATCH 1/3] readme updated --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 8474b4f..ff92601 100644 --- a/README.md +++ b/README.md @@ -9,7 +9,7 @@ npm i smartapi-javascript ## Getting started with API ```javascript -let { SmartAPI, WebSocket } = require('smartapi-javascript'); +let { SmartAPI, WebSocket,WebSocketV2 } = require('smartapi-javascript'); let smart_api = new SmartAPI({ api_key: 'smartapi_key', // PROVIDE YOUR API KEY HERE From ee4e6355b45c512c6dd13ce0de75d2c165d7ff3d Mon Sep 17 00:00:00 2001 From: Amod Date: Fri, 7 Jul 2023 10:51:56 +0530 Subject: [PATCH 2/3] SSS-3 ticket tested --- example/sss3Test.js | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100644 example/sss3Test.js diff --git a/example/sss3Test.js b/example/sss3Test.js new file mode 100644 index 0000000..e4a512a --- /dev/null +++ b/example/sss3Test.js @@ -0,0 +1,38 @@ +let { SmartAPI, WebSocketClient, WebSocketV2 } = require('../lib'); + +let smart_api = new SmartAPI({ + api_key: 'smartapi_key', // PROVIDE YOUR API KEY HERE + // OPTIONAL : If user has valid access token and refresh token then it can be directly passed to the constructor + // access_token: "YOUR_ACCESS_TOKEN", + // refresh_token: "YOUR_REFRESH_TOKEN" +}); + +// // If user does not have valid access token and refresh token then use generateSession method + +// } +// smart_api +// .generateSession('CLIENT_CODE', 'PASSWORD', 'TOTP') +// .then((data) => { +// console.log(data); + // return smart_api.getProfile(); + + + smart_api.placeOrder({ + "variety": "NORMAL", + "tradingsymbol": "SBIN-EQ", + "symboltoken": "304", + "transactiontype": "BUY", + "exchange": "NSE", + "ordertype": "LIMIT", + "producttype": "INTRADAY", + "duration": "DAY", + "price": "195", + "squareoff": "0", + "stoploss": "0", + "quantity": "1" + }).then((data)=>{ + console.log("placeOrder:::",data); + }).catch((error)=>{ + console.log("error:::",error); + }) + // }) \ No newline at end of file From f36f83051a3f2479c4a79682ef4ae079f59aadf5 Mon Sep 17 00:00:00 2001 From: Amod Date: Fri, 7 Jul 2023 11:09:24 +0530 Subject: [PATCH 3/3] api call tested --- example/sss3Test.js | 63 +++++++++++++++++++++++++++++++-------------- 1 file changed, 44 insertions(+), 19 deletions(-) diff --git a/example/sss3Test.js b/example/sss3Test.js index e4a512a..2477ccc 100644 --- a/example/sss3Test.js +++ b/example/sss3Test.js @@ -17,22 +17,47 @@ let smart_api = new SmartAPI({ // return smart_api.getProfile(); - smart_api.placeOrder({ - "variety": "NORMAL", - "tradingsymbol": "SBIN-EQ", - "symboltoken": "304", - "transactiontype": "BUY", - "exchange": "NSE", - "ordertype": "LIMIT", - "producttype": "INTRADAY", - "duration": "DAY", - "price": "195", - "squareoff": "0", - "stoploss": "0", - "quantity": "1" - }).then((data)=>{ - console.log("placeOrder:::",data); - }).catch((error)=>{ - console.log("error:::",error); - }) - // }) \ No newline at end of file + // smart_api.placeOrder({ + // "variety": "NORMAL", + // "tradingsymbol": "SBIN-EQ", + // "symboltoken": "304", + // "transactiontype": "BUY", + // "exchange": "NSE", + // "ordertype": "LIMIT", + // "producttype": "INTRADAY", + // "duration": "DAY", + // "price": "195", + // "squareoff": "0", + // "stoploss": "0", + // "quantity": "1" + // }).then((data)=>{ + // console.log("placeOrder:::",data); + // }).catch((error)=>{ + // console.log("error:::",error); + // }) + + // smart_api.modifyOrder({ + // "orderid": "201130000006424", + // "variety": "NORMAL", + // "tradingsymbol": "SBIN-EQ", + // "symboltoken": "3045", + // "transactiontype": "BUY", + // "exchange": "NSE", + // "ordertype": "LIMIT", + // "producttype": "INTRADAY", + // "duration": "DAY", + // "price": "19500", + // "squareoff": "0", + // "stoploss": "0", + // "quantity": "1" + // }).then((data)=>{ + // console.log("modifyOrder:::",data); + // }).catch((error)=>{ + // console.log("error:::",error); + // }) + + // smart_api.getOrderBook().then((data)=>{ + // console.log("res:::",data); + // }).catch((error)=>{ + // console.log("error:::",error); + // })