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 diff --git a/example/sss3Test.js b/example/sss3Test.js new file mode 100644 index 0000000..2477ccc --- /dev/null +++ b/example/sss3Test.js @@ -0,0 +1,63 @@ +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); + // }) + + // 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); + // })