Trade with Ajeet Singh

A Free trading Hub for fellow traders, updated fortnightly.

20 Nov 2017

Stocks 20-20







Nest To AmiBroker Data Feeder


Nest to AmiBroker Data Feeder is a utility which facilitates to transfer data from NEST Trading Terminal to Amibroker. Which provides RealTime and Backfill data to Amibroker from Nest Trading Terminal, it supports NSE equity, NSE futures and Option, MCX, Currency Market (CDS), and also BSE Exchanges.

Nest to AmiBroker Data Feeder takes Real Time data from Nest Terminal using RTD feature of Nest Terminal and it provides Backfill from Nest Plus Data table, also provides google Backfill for NSE equity stocks. 


Silent Features of Nest to Amibroker data Feeder

  • Updates RealTime Tick data to Amibroker.
  • Updates data for all the available symbols in the watchlist
  • User can backfill data using Nest Plus data table.
  • Google backfill facility available for NSE equity stocks. 
  • User can Map the watchlist symbols as he required.
  • Works On booth 32 and 64 bit operating system.
  • Easy to navigate the application.
  • Supports NSE equity, NSE futures and Option, MCX, Currency Market (CDS), and also BSE Exchanges.
* To run Nest to Amibroker Data Feeder you need Microsoft dot net 4.6,
you can download it here

Price for cracked version: Rs.499
Sms/Whatsapp: 96500-350-67
Pay to: ajeets@yesbank
(Mention your name in remarks)



17 Nov 2017

Stocks 20 20









15 Nov 2017



BankNifty
Resistances at 25460 & 25520
If breaks 25520 and holds then will try to move 25620
Supports are at 25345 & 25275
and if trades below 25275 then next support at 25150




Sun Pharma: Sell - 526, Goal - 500, Stoplaus - 532

Gayle: Buy - 456, Goal - 475, Stoplaus - 450

Bank of Baroda: Buy - 174, Goal - 184, Stoplaus - 171

Lupine: Sell - 835, Goal - 800, Stoplaus - 845

Laurus Labs: Buy - 524, Goals - 535, Stoplaus - 521

Indiabulls Housing: Buy - 1192, Target - 1250, Stoplaus - 1180

Sumit Industries: Buy - 33.8, Goal - 37, Stoplaus - 33

Indo Count: Sell - 112, Goal - 100, Stoplaus - 115

Gitanjali James: Buy - 71.25, Goal - 80, Stoplaus - 70

Panicias Biotech: Buy - 231, Target - 245, Stoplaus - 225

Engineers India: Buy - 183, Goal - 195, Stoplaus - 180

NBCC: Buy - 270, Goal - 290, Stoplaus - 268

NHPC: Buy - 27, Target - 29, Stoplaus - 26.5

SJVN: Buy - 34, Goal - 36, Stoplaus - 33.5

Indian Bank: Buy - 401, Goal - 425, Stoplaus - 400

NLC India: Buy - 100, Goal - 110, Stoplaus - 98

HPCL: Buy - 493, Goal - 510, Stoplaus - 490

IOC: Buy - 387, Goal - 410, Stoplaus - 380

Chennai Petro: Buy - 419, Goal - 430, Stoplaus - 415

MRPL: Buy - 122, Goal - 135, Stoplaus - 120



14 Nov 2017



BankNifty
Resistances at 25500 & 25560
If breaks 25560 and holds then will try to move 25650
Supports are at 25400 & 25350
and there after 25250
If afraid of BNF then apply any EMA trade to YESBANK

Nifty
Expected to open flattish note
Resistances at 10295 & 10320
If breaks 10320 and holds then will try to move 10375
Supports at 10240 & 10215
Below 10215 I see more selling pressure upto 10190










Google Data Downloader

Sincere thanks to RMIKE for this wonderful utility





  1. This is a Python distributable utility to download 1 min historical data for NSE from Google finance. This is compiled to work on Microsoft Windows OS. Will not work for Mac and Linux OS.
  2. Important – Follow all instructions regarding package and file placement. Don’t modify the name of any file or folder!!!
  3. Download the zip package from the provided link, unzip the package to the root directory of your C: drive. This will place the ‘PyDownloader’ Folder in C: drive, like so “C:\PyDownloader”.
  4. Inside the PyDownloader Folder, you’ll find the following :-

    (a) ‘TickerList’ Text File – Enter Ticker symbols for which data is required. The sample Tickers viz. Nifty & BANKNIFTY are placed in the list as reference example. Input to list each desired Ticker in a separate line. The maximum limit of the TickerList is 100 Tickers
    (b) ‘Data’ Folder – The downloaded 1 min historical data by the utility will be written to this folder as a csv file for each individual Ticker in the TickerList. Historical 1 min IEOD can be downloaded for a maximum of 15 trading days.
    (c) ‘PyD.format’ File – If you wish to manually import the downloaded IEOD into Amibroker, place this file in the ‘Formats’ Folder of your Amibroker installation. You’ll also need to edit the ‘import.types’ file in the Formats folder by inserting the following instruction.PyDownloader (*.*)|*.*|PyD.format

    (d) ‘PyDn_v1.0_Lic’ – The License file for the utility.(e) ‘PyDn_v1.0 Help’ Pdf File – Help file.(f) ‘PyDownloader_nse_v1.0.exe’ – The executable distro package of the utility.
  5. After inputting desired Tickers in TickerList, double click on PyDownloader_nse_v1.0.exe. A console window will pop up. This window will remain inactive for some while (approx. 40 to 65 seconds, depending upon your rig’s CPU and RAM configuration) during which the Python virtual environment is loaded for the utility to function.
  6. After the virtual environment loading is complete, the console window becomes active. As the utility executes, it will ask the user to input the desired no. of days for which IEOD is required to be downloaded.
  7. Input the no. of days as a NUMBER. For e.g Three days = 3 and NOT 03 OR Three. And Fourteen days = 14 and NOT 014 OR Fourteen. After providing input, press Enter/ Return. The utility will then execute as per the user input for no. of days and no. of Tickers in TickerList. The image below illustrates the example of downloading IEOD for 1 day for NIFTY & BANKNIFTY.
  8. After the process is complete, the utility and the console window will auto exit. The IEOD can then be imported from the ‘Data’ Folder
  9. This utility is distributed ‘as is’ without any cost to user for providing retail traders with means to utilize publically available data from Google Finance for analytical purposes. No user is authorized to distribute this utility without credit to the copyright holder(s). No user is authorized to commercialize this utility in any form.





PairTrading Recommendations


Recommendations for Pair Trade:





Problem in viewing?
Visit Here and refresh

Fetching Intraday data from Google using Python

All credits to RMIKE

Here is an yet another interesting python tutorial to fetch intraday data using Google Finance API , store the data in csv format and also plot the intraday data as candlestick format. We are using plotly library for plotting candlestick charts and pandas to manage time-series data. Luckily found and interesting python code which fetches google intraday data and store in csv format. Done some little modification in the code (exchange added to the Google API) so that one can fetch data for any exchange.
In our example we try to retrieve the data (Date,Time,Symbol,Open,High,Low,Close,Volume data) for RCOM (Reliance Communication) and plot as candlesticks using plotly library. Download the sample RCOM CSV file fetched from Google Finance
Sample IPython Notebook using Plotly and pandas to plot Interactive Intraday Candlestick Charts using Google Finance API :


In [1]:
import requests.packages.urllib3
requests.packages.urllib3.disable_warnings()

In [2]:
import plotly
plotly.__version__
Out[2]:
'1.9.0'

Code to Fetch Google Intrday Data and Save in CSV Format



In [7]:

# Copyright (c) 2011, Mark Chenoweth
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without modification, are permitted 
# provided that the following conditions are met:
#
# - Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
#
# - Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following 
#   disclaimer in the documentation and/or other materials provided with the distribution.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, 
# INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 
# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS 
# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 
# STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF 
# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

import urllib,time,datetime
import  pandas as pd


class Quote(object):
  
  DATE_FMT = '%Y-%m-%d'
  TIME_FMT = '%H:%M:%S'
  
  def __init__(self):
    self.symbol = ''
    self.date,self.time,self.open_,self.high,self.low,self.close,self.volume = ([] for _ in range(7))

  def append(self,dt,open_,high,low,close,volume):
    self.date.append(dt.date())
    self.time.append(dt.time())
    self.open_.append(float(open_))
    self.high.append(float(high))
    self.low.append(float(low))
    self.close.append(float(close))
    self.volume.append(int(volume))
      
  def to_csv(self):
    return ''.join(["{0},{1},{2},{3:.2f},{4:.2f},{5:.2f},{6:.2f},{7}\n".format(self.symbol,
              self.date[bar].strftime('%Y-%m-%d'),self.time[bar].strftime('%H:%M:%S'),
              self.open_[bar],self.high[bar],self.low[bar],self.close[bar],self.volume[bar]) 
              for bar in xrange(len(self.close))])
    
  def write_csv(self,filename):
    with open(filename,'w') as f:
      f.write(self.to_csv())
        
  def read_csv(self,filename):
    self.symbol = ''
    self.date,self.time,self.open_,self.high,self.low,self.close,self.volume = ([] for _ in range(7))
    for line in open(filename,'r'):
      symbol,ds,ts,open_,high,low,close,volume = line.rstrip().split(',')
      self.symbol = symbol
      dt = datetime.datetime.strptime(ds+' '+ts,self.DATE_FMT+' '+self.TIME_FMT)
      self.append(dt,open_,high,low,close,volume)
    return True

  def __repr__(self):
    return self.to_csv()

class GoogleIntradayQuote(Quote):
  ''' Intraday quotes from Google. Specify interval seconds and number of days '''
  def __init__(self,symbol,interval_seconds=300,num_days=5):
    super(GoogleIntradayQuote,self).__init__()
    self.symbol = symbol.upper()
    url_string = "http://www.google.com/finance/getprices?q={0}".format(self.symbol)
    url_string += "&x=NSE&i={0}&p={1}d&f=d,o,h,l,c,v".format(interval_seconds,num_days)
    csv = urllib.urlopen(url_string).readlines()
    for bar in xrange(7,len(csv)):
      if csv[bar].count(',')!=5: continue
      offset,close,high,low,open_,volume = csv[bar].split(',')
      if offset[0]=='a':
        day = float(offset[1:])
        offset = 0
      else:
        offset = float(offset)
      open_,high,low,close = [float(x) for x in [open_,high,low,close]]
      dt = datetime.datetime.fromtimestamp(day+(interval_seconds*offset))
      self.append(dt,open_,high,low,close,volume)
   
   
if __name__ == '__main__':
  q = GoogleIntradayQuote('RCOM',300,30)
  #print q                                           # print it out
  q.write_csv('c://data//rcom.csv')  


Read the CSV file and Convert into Dataframe


In [4]:
dateparse = lambda x: pd.datetime.strptime(x, '%Y-%m-%d %H:%M:%S')  
df = pd.read_csv('c://data//rcom.csv',sep=',',header=None, parse_dates={'datetime': [1, 2]}, date_parser=dateparse)
df.columns = ['Datetime', 'Symbol','Open','High','Low','Close','Volume']
#df.index = df['Datetime']
#df.index.name = None
df.head(5)


Out[4]:

DatetimeSymbolOpenHighLowCloseVolume
02015-10-14 09:20:00RCOM77.8078.5077.6078.40552244
12015-10-14 09:25:00RCOM78.4079.0578.3078.85546950
22015-10-14 09:30:00RCOM78.7578.8578.2578.25223054
32015-10-14 09:35:00RCOM78.3078.5078.2578.35125523
42015-10-14 09:40:00RCOM78.4078.6578.3578.55105811


Plot the intrday data as charts using plotly

In [5]:
from datetime import date
import plotly.plotly as py
from plotly.tools import FigureFactory as FF
from datetime import datetime

In [9]:
fig = FF.create_candlestick(df.Open, df.High, df.Low, df.Close, dates=df.index)
fig['layout'].update({
    'title': 'RCOM Intraday Charts',
    'yaxis': {'title': 'RCOM Stock'}})
py.iplot(fig, filename='finance/intraday-candlestick', validate=False)
The draw time for this plot will be slow for all clients.

Out[9]: