Skip to content
Open
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
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
63 changes: 63 additions & 0 deletions example/sss3Test.js
Original file line number Diff line number Diff line change
@@ -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);
// })