Skip to content

Commit 1974d58

Browse files
committed
change in symbol format to weekly expiry
1 parent 6ed9fe7 commit 1974d58

File tree

6 files changed

+1028
-97
lines changed

6 files changed

+1028
-97
lines changed

algo/validation/convertsymbol.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ class ConvertToSymbol extends StringUDF {
4949
const months = ['M', "JAN", "FEB", "MAR", "APR", "MAY", "JUN", "JUL", "AUG", "SEP", "OCT", "NOV", "DEC"];
5050

5151
let scrip = stringSymbol.toUpperCase().split(' ');
52+
console.log(scrip)
5253

5354
//find fut/ce/pe
5455
let scripType = scrip[scrip.length - 1];
@@ -63,10 +64,9 @@ class ConvertToSymbol extends StringUDF {
6364

6465
//is weekly
6566
if (this.isNumeric(scrip[1])) {
66-
//YEAR MONTHINDEX DATE STRIKE CE/PE
67-
//2021 1 07 14000 CE
68-
var monthIndex = months.findIndex(element => element === scrip[2]);
69-
ex = `${scrip[3]}${Number(monthIndex)}` + `0${scrip[1]}`.slice(-2) + `${Number(scrip[4])}${scrip[5]}`;
67+
//YEAR MONTH_first_letter DATE STRIKE CE/PE
68+
//2021 J 07 14000 CE
69+
ex = `${scrip[3]}${scrip[2].slice(0, 1)}` + `0${scrip[1]}`.slice(-2) + `${Number(scrip[4])}${scrip[5]}`;
7070
} else {
7171
ex = `${scrip[2]}${scrip[1]}${Number(scrip[3])}${scrip[4]}`;
7272
}

api_calls/axios_calls.js

Lines changed: 0 additions & 55 deletions
This file was deleted.

error_handler/express.js

Lines changed: 0 additions & 34 deletions
This file was deleted.

example/test.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,8 @@ const insertInToArray = () => {
2424
}
2525

2626
const convertToTradingSymbol = () => {
27-
let output = udf.convertToTradingSymbol('USDINR 6 AUG 74.25 PE');
27+
let output = udf.convertToTradingSymbol('NIFTY 7 OCT 18000 PE');
28+
// let output = udf.convertToTradingSymbol('NIFTY OCT 18000 PE');
2829
console.log(output);
2930
}
3031

index.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,9 @@ const Pushlog = require('./telegram/logs');
99
const QuickTelegramFn = require('./telegram/quickfn');
1010
const BhavCopy = require('./public_api/bhavcopy');
1111
const Cache = require("./misc/cache");
12-
const AxiosCalls = require('./api_calls/axios_calls');
1312

14-
class UDF extends Many(StringUDF, Table, InputValidation, ConvertToSymbol, SqlUDF, BroadCastMessage, Pushlog, QuickTelegramFn, BhavCopy, Cache, AxiosCalls) {
13+
class UDF extends Many(StringUDF, Table, InputValidation, ConvertToSymbol, SqlUDF,
14+
BroadCastMessage, Pushlog, QuickTelegramFn, BhavCopy, Cache) {
1515
constructor(params) {
1616
super(params)
1717
this.params = params;

0 commit comments

Comments
 (0)