Bash Script for Stock Market Analysis
-
I am trying to analyse the stock market data through nsepy and this command works if I run this in my Ubuntu terminal with specific stock.Example )
nsecli history --symbol WIPRO -s $start_date -e $end_date -0 test.csv
When I try to get the data of same through bash script its not working
#!/bin/bash cd /home/shiva/Desktop data=["WIPRO"] start_date=2017-01-01 end_date=$(date "+%Y-%m-%d") nsecli history --symbol $data -s $start_date -e $end_date -o test.csv
Empty DataFrame Columns:[Symbol,Sries] Index[]
When checked that csv only the heading is there.Anyone tried this before ?
-
@laksh1999 said in Bash Script for Stock Market Analysis:
data=["WIPRO"]
Should this not simply be
data="WIPRO"
? -
@dafyre said in Bash Script for Stock Market Analysis:
@laksh1999 said in Bash Script for Stock Market Analysis:
data=["WIPRO"]
Should this not simply be
data="WIPRO"
?i can do that,i am trying to download more companies like 50.So need to add through [] only
-
@laksh1999 said in Bash Script for Stock Market Analysis:
@dafyre said in Bash Script for Stock Market Analysis:
@laksh1999 said in Bash Script for Stock Market Analysis:
data=["WIPRO"]
Should this not simply be
data="WIPRO"
?i can do that,i am trying to download more companies like 50.So need to add through [] only
In bash arrays are defined with parens, like
data=("WIPRO")
. Then you would need to loop over the items in the array. Something likefor i in ${data[@]}; do nsecli history --symbol $i..... done
-
@stacksofplates said in Bash Script for Stock Market Analysis:
@laksh1999 said in Bash Script for Stock Market Analysis:
@dafyre said in Bash Script for Stock Market Analysis:
@laksh1999 said in Bash Script for Stock Market Analysis:
data=["WIPRO"]
Should this not simply be
data="WIPRO"
?i can do that,i am trying to download more companies like 50.So need to add through [] only
In bash arrays are defined with parens, like
data=("WIPRO")
. Then you would need to loop over the items in the array. Something likefor i in ${data[@]}; do nsecli history --symbol $i..... done
This Worked.How to make multiple stock there ?
GNU nano 5.4 #!/bin/bash cd /home/shiva/Documents data=('WIPRO') start_date=2017-01-01 end_date=$(date "+%Y-%m-%d") for i in ${data[@]}; do nsecli history --symbol $i -s $start_date -e $end_date -o 01.wipro.csv done