Free data from NSENOW to AmiBroker via Excel

Status
Not open for further replies.

sikandar

Active Member
#31
Version 2 of Realtime data capture from NSE-NOW is ready. It is uploaded for sharing here :- http://www.4shared.com/zip/Vmx_S1yg/NSE-NOW-RT2.html

http://www.4shared.com/zip/Vmx_S1yg/NSE-NOW-RT2.html

What is new?
1. Improved simplicity.
2. Choice of database path
3. Date column brought to leftmost so that new scrips can be added easily.
4. Method of saving .csv file changed. Now we are writing the range to csv file instead of copying Sheet1 to new workbook and saving it as .csv file. This method has eliminated that irritating shaking of the screen. The data transfer has become very smooth.
5. AmiBroker is started automatically.
6. Another instance of AmiBroker can be opened without problem.
7. Another instance of Excel can be opened without problem. In fact Nowbackfill.xlsm can be opened for backfill simultaneously.
8. Automatic detection of Now instance.
9. Fifteen days backfill possible from Nestplus. However, this is semi automatic.

Detail instructions are given in attached Readme file.

Open source code. Change it to suit your need
Hi bro
How can any body use it with Diet odin or what i want to edit
pls show some guidance
thanks in advance
:)
 

josh1

Well-Known Member
#32
Josh1

i am talking about the column arrangement in NOW/NEST Trader. what is the arrangement? almost all data pulling utility have its own column arrangement in the market watch. what about it?

please specify.

regards
sr
I am talking about the same issue SR. Arrange the columns in whichever way you want but tell AmiBroker the order of of columns.

1. Excel does not bother about the Column arrangement. It knows what is to be pulled based on the formula given in cells. For example, =RTD("now.scriprtd",,"MktWatch","nse_cm|TATAMOTORS-EQ","Symbol") will fetch "Symbol" for TataMotors which is "TATAMOTORS" and
=RTD("now.scriprtd",,"MktWatch","nse_cm|TATAMOTORS-EQ","Trading Symbol") will fetch "Trading Symbol" which is "TATAMOTORS-EQ" and
=RTD("now.scriprtd",,"MktWatch","nse_cm|CAIRN-EQ","Last Traded Price") will fetch the Last Traded Price of CAIRN.

Once the quotations are pulled in Excel, we have to push them to AmiBroker. For this purpose, we are saving the quotations every three seconds in a comma seperated value (MyCSV.csv) file in the same order that we currently see in NSE-NOW-RT2.xlsm.

2. Thereafter, we tell AmiBroker to import the quotations from MyCSV.csv file. Look at the following subroutine in NSE-NOW-RT2.xlsm
Sub CallAmiBroker()
FileName = "C:\MyCSV.csv"
Call AB.Import(0, FileName, "NSENOW2.format")
Call AB.RefreshAll
End Sub
The green line calls AmiBroker to import quotations from a text file named "C:\MyCSV.csv" as per the order of columns stated in the NSENOW2.format file.

AmiBroker looks at the $FORMAT line in NSENOW2.format file which at present is like this-
$FORMAT Date_MDY, Ticker, Time, Close, Volume, Appendticker, Appendticker

Here is a snapshot of the "MyCSV.csv" file. The columns are in the same order as above -
05/03/2012,TATAMOTORS,10:33:17,300,50,
05/03/2012,CIPLA,10:33:05,321.6,50,
05/03/2012,CAIRN,10:33:17,344,50,
05/03/2012,NIFTY,10:33:17,5207.35,50,,,

If you change this order in excel, you will have to edit the $FORMAT line in NSENOW2.format file accordingly. If you add more columns, state the names of the columns in that line.
 
Last edited:

josh1

Well-Known Member
#33
Hi bro
How can any body use it with Diet odin or what i want to edit
pls show some guidance
thanks in advance
:)
Rohitb has given an excellent explanation here http://www.traderji.com/intraday/68...atch-data-amibroker-without-any-software.html on how to import data from Diet ODIN to AmiBroker to excel.

Please read the thread. I have not used Diet ODIN. I am relying on that thread.

Download NSE-NOW-RT2 zip and copy the files as instructed in the readme file.
Follow the first four steps for excel configuration as it is. I am repeating them here-

1> Login to you diet odin and open the desired market watch
2> Right click in the market watch and select open in ms-excel
3> Small box appears asking for select sheet. select sheet1
4> A file named Arbitrage.xls will open with all the scripts/futures/options and u will see the rates changing.this is your source we need to purify this as we don't need most of the data.

Now do as below-
5> We need TICKER (Scrip Name), LAST TRADED TIME, LAST TRADED PRICE AND LAST TRADED QUANTITY. Remove the remaining columns. Assuming that you get the columns in the same order, you will have TICKER (Scrip Name), LAST TRADED TIME, LAST TRADED PRICE AND LAST TRADED QUANTITY in Column A, B, C and D respectively.

6> Use office 2007 or above. Open Excel by clicking Start-Programs-Microsoft Office-Excel2007

7> A blank workbook opens with name book1. Ignore it and Open NSE-NOW-RT2.xlsm from within Excel. Change the database path to Your\Database\folder\Path

8>Select the Range B4 to G14 and press delete to clear all the contents. Let Cell A4 to A14 be as it is. They will be showing current date.

9> We want Symbol, Last Trade Time, Last Traded Price, Last Trade Qty in columns B, C, D, E respectively. Therefore,
In Cell B4 type "=[Arbitrage.xls]Sheet1!A2",
In Cell C4 type "=[Arbitrage.xls]Sheet1!B2",
In Cell D4 type "=[Arbitrage.xls]Sheet1!C2",
In Cell E4 type "=[Arbitrage.xls]Sheet1!D2",

10> Copy the entire row in four rows below. (Let us restrict for five scrips for a start). Check the format of the columns once. Column C should have Time format and columns D, E should have number format.

11>If you see the rates changing, Open the NSENOW2.format file in notepad.
Change the line - $FORMAT Date_MDY, Ticker, Time, Close, Volume, Appendticker, Appendticker
to this - $FORMAT Date_MDY, Ticker, Time, Close, Volume,
and save.

12>click on the "Start" Sheet and enjoy realtime feed in AmiBroker. Note: AmiBroker will automatically add the scrip names in database.

13> If you get any issue with date, locate and open the MyCSV.csv file on your C drive with notepad and check the date format. If date is being written in DMY format, change the Date_MDY field in $FORMAT line to Date_DMY.
 
Last edited:

sr114

Well-Known Member
#34
Josh1

how to add new scrip in the excel sheet? also if we are to capture data from NEST Trader are we to change anything in the VBA module?

please specify the steps of adding the new scrips.

regards n thanx
sr
 

josh1

Well-Known Member
#35
Josh1

how to add new scrip in the excel sheet? also if we are to capture data from NEST Trader are we to change anything in the VBA module?

please specify the steps of adding the new scrips.

regards n thanx
sr
If you are running NOW, just select the scrips and RightClick-Link to Excel-Selected Items. Select empty cell below the last scrip and Paste. All columns in NOW will be copied. Note the column headings in Excel. If your columns in NOW are not in the same order, you will have to cut and paste the cells to put them in that order. The scrip will be automatically added in AmiBroker when you start data feed.
I do not know how data is captured from Nest Trader to Excel. If you tell me that, I will be able to help.
 

josh1

Well-Known Member
#37

sr114

Well-Known Member
#38
Josh1

yes the main part is capturing data from Nest Trader and getting it in Ami. 1st part is ok in your utility. data is coming and updating. the 2nd part is confusing - how to push the captured data to Ami. As the start button when clicked actually ask to log on to NOW but we require the NEST trader. so some tweaking is needed - please look at the matter.

regards
sr
 

josh1

Well-Known Member
#39
Josh1

yes the main part is capturing data from Nest Trader and getting it in Ami. 1st part is ok in your utility. data is coming and updating. the 2nd part is confusing - how to push the captured data to Ami. As the start button when clicked actually ask to log on to NOW but we require the NEST trader. so some tweaking is needed - please look at the matter.

regards
sr
Okay. I got your problem. This is due to the utility checking whether NOW is running.
Here is the solution.:-
Open NSE-NOW-RT2.xlsm. Do not click on Start.
Click on Visual Basic in the Developer Tab in Excel.
A window like this will open. If the right side is blank, click inside VBA Project part on the left side and find Module1. Double Click on Module1 and you will see the code on right side. Find this highlighted line in the code. -
IsNOWRunning 'Check whether NOW is running. If not close down.
Option 1 - Change the line to this and go to next line-
' IsNOWRunning 'Check whether NOW is running. If not close down.
Entire line will become green.
Option 2- Just delete it.

Save the Workbook and click on Start.
 
Last edited:

josh1

Well-Known Member
#40
Hi bro
How can any body use it with Diet odin or what i want to edit
pls show some guidance
thanks in advance
:)
Sikandar,

You will have the same problem. When you click on Start, Excel will ask you to login into NOW and stop. Follow the instructions in #40 given to SR. You will be able to get Realtime Feed.

Inconvenience regretted
 
Status
Not open for further replies.

Similar threads