indiTraders - Forum for the Active Indian Trader  

Go Back   indiTraders - Forum for the Active Indian Trader > Tools > Software > Other Platforms

DPonline
Reply
 
Bookmark and Share LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 30-03-2016, 10:51 PM
nTP's Avatar
nTP nTP is offline
Flash Crash
 
Join Date: Dec 2013
Location: kolkata
Posts: 2,115
Thanks: 7,950
Thanked 2,357 Times in 1,408 Posts
nTP has much to be proud ofnTP has much to be proud ofnTP has much to be proud ofnTP has much to be proud ofnTP has much to be proud ofnTP has much to be proud ofnTP has much to be proud ofnTP has much to be proud ofnTP has much to be proud ofnTP has much to be proud ofnTP has much to be proud ofnTP has much to be proud ofnTP has much to be proud of
Default PY: Delverable Volume for alpha index

tested Ubuntu 15.10
Code:
:~$ python --version
Python 2.7.10

Code:
from nsepy import get_history
from datetime import date
import pandas as pd
import requests
from io import BytesIO 
import certifi
from dateutil.relativedelta import relativedelta


url = 'https://www1.nseindia.com/content/indices/ind_nifty_Alpha_Index.csv'

headers = { 'Accept' : '*/*',
            'User-Agent' : 'Mozilla/5.0',
            'Refers' : 'http://www.nseindia.com',
            'Connection' : 'keep-alive'
          }
            
getContents = requests.get(url,headers=headers).content
symbol_list=pd.read_csv(BytesIO(getContents))

print(symbol_list.head())

for eachSymbol in symbol_list['Symbol'][1:2]:
    stock = get_history(symbol = eachSymbol,
                        start = date(2016,3,20),
                        end = date(2016,3,30))
    stock.drop_duplicates(inplace=True)
    stock.drop(stock.columns[[0,1,2,6,7,8,10,11,13]], axis = 1, inplace = True)
    ##print(stock.head())
    stock.index=pd.to_datetime(stock.index)
    stock.to_csv('./HistoricalData//' + eachSymbol + '.csv' , date_format='%Y%m%d')

Ref: Data In Python

Code:
~$ sudo python dataInPy.py
                   Company Name                  Industry      Symbol Series  \
0   Ajanta Pharmaceuticals Ltd.                    PHARMA  AJANTPHARM     EQ   
1  Alembic Pharmaceuticals Ltd.                    PHARMA      APLLTD     EQ   
2            Ashok Leyland Ltd.                AUTOMOBILE    ASHOKLEY     EQ   
3         Aurobindo Pharma Ltd.                    PHARMA  AUROPHARMA     EQ   
4                     BEML Ltd.  INDUSTRIAL MANUFACTURING        BEML     EQ   

      ISIN Code  
0  INE031B01049  
1  INE901L01018  
2  INE208A01029  
3  INE406A01037  
4  INE258A01016  
:~$ cd HistoricalData/
:HistoricalData$ ls
APLLTD.csv
:HistoricalData$ cat APLLTD.csv 
Date,Open,High,Low,Volume,Deliverable Volume
20160321,611.0,616.0,606.95,61811,49506
20160322,615.0,621.65,610.0,69249,43337
20160323,615.0,625.0,606.7,166128,136046
20160328,615.3,638.0,610.6,207560,51144
20160329,620.0,620.45,571.55,517972,266963
20160330,595.0,615.0,594.15,81684,50946
:HistoricalData$ cd ..
Auto Trading Libraries http://www.quantinsti.com/blog/autom...ython-webinar/
__________________
thx
nTuple

Disclaimer: I am not a Research Analyst and not registered with any regulating authority. All posts are for educational purpose only.

Consider us a dumb -dumble guy in this analysis, any type of real time example will be quick-learn approach.

Last edited by nTP; 31-03-2016 at 08:41 PM.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
The Following User Says Thank You to nTP For This Useful Post:
  #2 (permalink)  
Old 30-03-2016, 11:01 PM
no1lives4ever no1lives4ever is offline
Newbie
 
Join Date: Jul 2009
Posts: 3,452
Thanks: 20,777
Thanked 5,849 Times in 2,488 Posts
no1lives4ever has a reputation beyond repute
no1lives4ever has a reputation beyond reputeno1lives4ever has a reputation beyond reputeno1lives4ever has a reputation beyond reputeno1lives4ever has a reputation beyond reputeno1lives4ever has a reputation beyond reputeno1lives4ever has a reputation beyond reputeno1lives4ever has a reputation beyond reputeno1lives4ever has a reputation beyond reputeno1lives4ever has a reputation beyond reputeno1lives4ever has a reputation beyond reputeno1lives4ever has a reputation beyond reputeno1lives4ever has a reputation beyond repute
Default

The nsepy library has various methods to get data from the nse website.

check out its github home here: https://github.com/swapniljariwala/nsepy

-- no1lives4ever
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
The Following User Says Thank You to no1lives4ever For This Useful Post:
  #3 (permalink)  
Old 31-03-2016, 11:15 AM
nTP's Avatar
nTP nTP is offline
Flash Crash
 
Join Date: Dec 2013
Location: kolkata
Posts: 2,115
Thanks: 7,950
Thanked 2,357 Times in 1,408 Posts
nTP has much to be proud ofnTP has much to be proud ofnTP has much to be proud ofnTP has much to be proud ofnTP has much to be proud ofnTP has much to be proud ofnTP has much to be proud ofnTP has much to be proud ofnTP has much to be proud ofnTP has much to be proud ofnTP has much to be proud ofnTP has much to be proud ofnTP has much to be proud of
Default

Originally Posted by no1lives4ever View Post
The nsepy library has various methods to get data from the nse website.

check out its github home here: https://github.com/swapniljariwala/nsepy

-- no1lives4ever

not all the code is running with my version.



btw: for all script of alpha index

Code:
from nsepy import get_history
from datetime import date
import pandas as pd
import requests
from io import BytesIO 
import certifi
from dateutil.relativedelta import relativedelta
#import numpy as np
#import matplotlib.pyplot as plt
import datetime
import numpy as np
import matplotlib.colors as colors
import matplotlib.finance as finance
import matplotlib.dates as mdates
import matplotlib.ticker as mticker
import matplotlib.mlab as mlab
import matplotlib.pyplot as plt
import matplotlib.font_manager as font_manager


url = 'https://www1.nseindia.com/content/indices/ind_nifty_Alpha_Index.csv'

headers = { 'Accept' : '*/*',
            'User-Agent' : 'Mozilla/5.0',
            'Refers' : 'http://www.nseindia.com',
            'Connection' : 'keep-alive'
          }
            
getContents = requests.get(url,headers=headers).content
symbol_list=pd.read_csv(BytesIO(getContents))

print(symbol_list.head())

for eachSymbol in symbol_list['Symbol']:
    stock = get_history(symbol = eachSymbol,
                        start = date(2016,3,20),
                        end = date(2016,3,30))
    stock.drop_duplicates(inplace=True)
    stock.drop(stock.columns[[0,1,2,6,7,8,10,11,13]], axis = 1, inplace = True)
    ##print(stock.head())
    stock.index=pd.to_datetime(stock.index)
    stock.to_csv('./HistoricalData//' + eachSymbol + '.csv' , date_format='%Y%m%d')

can anyone help me to get this rank in python
https://www.tradestation.com/educati...damental-score

PyAlgoTrade PyAlgoTrade
__________________
thx
nTuple

Disclaimer: I am not a Research Analyst and not registered with any regulating authority. All posts are for educational purpose only.

Consider us a dumb -dumble guy in this analysis, any type of real time example will be quick-learn approach.

Last edited by nTP; 31-03-2016 at 09:45 PM.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
The Following User Says Thank You to nTP For This Useful Post:
  #4 (permalink)  
Old 03-04-2016, 04:40 PM
nTP's Avatar
nTP nTP is offline
Flash Crash
 
Join Date: Dec 2013
Location: kolkata
Posts: 2,115
Thanks: 7,950
Thanked 2,357 Times in 1,408 Posts
nTP has much to be proud ofnTP has much to be proud ofnTP has much to be proud ofnTP has much to be proud ofnTP has much to be proud ofnTP has much to be proud ofnTP has much to be proud ofnTP has much to be proud ofnTP has much to be proud ofnTP has much to be proud ofnTP has much to be proud ofnTP has much to be proud ofnTP has much to be proud of
Default

Ploying would be easy with seaborn and matplotlib

Code:
from nsepy.archives import get_price_history
from datetime import date
import seaborn as sns
import numpy as np
import matplotlib.pyplot as plt


df = get_price_history(stock = 'SBIN', start = date(2016,01,01), end = date(2016,01,20))

##df[['Volume', 'Close']].plot( secondary_y = ['Volume'])
##sns.set()
#sns.pairplot(df)
##sns.plt.show()

sns.set_style("whitegrid")

plt.plot(df['Close'],df['Volume'])
sns.plt.show()
http://i.imgur.com/wUUabAT.png
Quote:
A paint brush is simply a tool that an artist uses. It can't produce a painting on its own and the painting can only be as good as the skills of the artist who wields the paintbrush

__________________
thx
nTuple

Disclaimer: I am not a Research Analyst and not registered with any regulating authority. All posts are for educational purpose only.

Consider us a dumb -dumble guy in this analysis, any type of real time example will be quick-learn approach.

Last edited by nTP; 03-04-2016 at 10:35 PM.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
The Following User Says Thank You to nTP For This Useful Post:
  #5 (permalink)  
Old 09-04-2016, 03:11 PM
nTP's Avatar
nTP nTP is offline
Flash Crash
 
Join Date: Dec 2013
Location: kolkata
Posts: 2,115
Thanks: 7,950
Thanked 2,357 Times in 1,408 Posts
nTP has much to be proud ofnTP has much to be proud ofnTP has much to be proud ofnTP has much to be proud ofnTP has much to be proud ofnTP has much to be proud ofnTP has much to be proud ofnTP has much to be proud ofnTP has much to be proud ofnTP has much to be proud ofnTP has much to be proud ofnTP has much to be proud ofnTP has much to be proud of
Default

Code:
from nsepy import get_history
from datetime import date
import pandas as pd
import requests
from io import BytesIO 
import certifi
from dateutil.relativedelta import relativedelta
#import numpy as np
#import matplotlib.pyplot as plt
import datetime
import numpy as np
import matplotlib.colors as colors
import matplotlib.finance as finance
import matplotlib.dates as mdates
import matplotlib.ticker as mticker
import matplotlib.mlab as mlab
import matplotlib.pyplot as plt
import matplotlib.font_manager as font_manager


url1 = 'https://www1.nseindia.com/content/indices/ind_nifty_Alpha_Index.csv'

##ADD URLS HERE AS url2 url3 etc###


def datainpy(url):

	headers = { 'Accept' : '*/*',
	            'User-Agent' : 'Mozilla/5.0',
	            'Refers' : 'http://www.nseindia.com',
	            'Connection' : 'keep-alive'
	          }
            
	getContents = requests.get(url,headers=headers).content
	symbol_list=pd.read_csv(BytesIO(getContents))

	print(symbol_list.head())

	for eachSymbol in symbol_list['Symbol']:
	    stock = get_history(symbol = eachSymbol,
	                        start = date(2016,3,20),
	                        end = date(2016,3,30))
	    stock.drop_duplicates(inplace=True)
	    stock.drop(stock.columns[[0,1,2,6,7,8,10,11,13]], axis = 1, inplace = True)
	    print (stock.head())
	    print(stock.head())
	    stock.index=pd.to_datetime(stock.index)
	    stock.to_csv('./HistoricalData//' + eachSymbol + '.csv' , date_format='%Y%m%d')

 

datainpy(url=url1)   
    
#### calls function passing urls ####
__________________
thx
nTuple

Disclaimer: I am not a Research Analyst and not registered with any regulating authority. All posts are for educational purpose only.

Consider us a dumb -dumble guy in this analysis, any type of real time example will be quick-learn approach.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
The Following User Says Thank You to nTP For This Useful Post:
  #6 (permalink)  
Old 11-04-2016, 03:32 PM
nTP's Avatar
nTP nTP is offline
Flash Crash
 
Join Date: Dec 2013
Location: kolkata
Posts: 2,115
Thanks: 7,950
Thanked 2,357 Times in 1,408 Posts
nTP has much to be proud ofnTP has much to be proud ofnTP has much to be proud ofnTP has much to be proud ofnTP has much to be proud ofnTP has much to be proud ofnTP has much to be proud ofnTP has much to be proud ofnTP has much to be proud ofnTP has much to be proud ofnTP has much to be proud ofnTP has much to be proud ofnTP has much to be proud of
Default

http://mpld3.github.io/quickstart.html#plugins

to get charts in browser
__________________
thx
nTuple

Disclaimer: I am not a Research Analyst and not registered with any regulating authority. All posts are for educational purpose only.

Consider us a dumb -dumble guy in this analysis, any type of real time example will be quick-learn approach.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
The Following User Says Thank You to nTP For This Useful Post:
Reply

indiTraders - Forum for the Active Indian Trader > Tools > Software > Other Platforms


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are On


DPonline

All times are GMT +5.5. The time now is 02:09 PM.


vBulletin Copyright by vBulletin

Content Relevant URLs by vBSEO 3.3.2