Realtime data NOW,ODIN,TradeTiger,Google,Yahoo > AmiBroker, Fcharts, Qtstalker

Status
Not open for further replies.

mrkanitkar

Well-Known Member
Hi Josh,
I am trying to add functionality to this utility, I have as2ms, if we can pass same data to as2ms, it will get data in Metastock.
Here is latest version of as2ms
https://docs.google.com/file/d/0B6_dAJjDDQgwYmI2ZTNlZDktYjYwNy00ZDkwLTgzNjctYTk0ZTk0NzVhMGYw/edit#

Instead of calling amibroker, you need to call as2ms.
As2ms or metastockcmdlineutils discussion group is here
https://groups.google.com/forum/?fromgroups#!forum/metastockcmdlineutils
as2ms need data in following format
(SYMB,I,YYMMDD,HH:MM:SS,O,H,L,C,V,OI) format or
NIFTY_SPT,I,20120703,15:59,5287.95,5287.95,5287.95,5287.95,0,0
^NSEBANK,I,20120703,15:59,10481.30,10481.30,10481.30,10481.30,0,0
$INDU*60,I,20031112,11:30:00,9763.55957,9805.34961,9763.49023,9798.00977,219761,0
NIFTY_SPT,I,20120510,9:01:56,5101.2998,5183.2998,5026.2998,5026.2998,0,0
NIFTY_SPT,I,20120510,9:02:55,5118.3999,5129.0498,5068.8501,5120.3501,0,0
NIFTY_SPT,I,20120510,9:03:59,5063.1499,5161.1001,5063.1499,5161.1001,0,0
command like
copy *.txt NSE.txt
c:\downloaderdata\asc2ms -f c:\Downloaderdata\ASCII\NSE\NSE.txt -r r -o c:\Downloaderdata\Metadata\Nse
works in normal way. I think your data is not in required format. Any thoughts?

Can you please guide or help? Since you have developed basic utility.
 
Last edited:

josh1

Well-Known Member
Thanks SR, I will try today to import data into excel from nest plus and then to amibroker, I will follow the thread from the beginning while doing this. I was going through the post and I think it will be difficult for me to do this but I will give it a try and keep you posted.
Abhi,

Watch the video developed by mrkanitkar. link is in post #173 on page 18 of this thread
 

josh1

Well-Known Member
Hi Josh,
I am trying to add functionality to this utility, I have as2ms, if we can pass same data to as2ms, it will get data in Metastock.
Can you please guide or help? Since you have developed basic utility.
e.g.
NIFTY12JULFUT,I,20031124,12:30:00,9732.75000,9738.98047,9719.34961,9719.34961,161175,0
We are creating C:\RT\MyCSV.txt in the subroutine MakeCSV. You have to convert that file in MS format with asc2ms. You will have to insert I and O,H,L manually. In our case it is tick data so O,H and L are equal to Close, insert close 4 times.

This is extract from latest RT31.xlsm that uses "Volume Traded Today"

If NSENOW = "Yes" Then
MyBook.Sheets("Now").Select 'Selects sheet containing quotations

For r = 7 To Range("A65536").End(xlUp).Row
S = Date & ","
C = 1
While Not IsEmpty(Cells(r, C))
If C = 1 then
CellValue = Cells(r, C).Value & ",I" ' (Insert comma and I after ticker name)
Elseif C = 3 then 'Insert Last Traded Price 4 times for O,H,L,C
CellValue = Cells(r, C).Value & "," & Cells(r, C).Value & "," & Cells(r, C).Value & "," & Cells(r, C).Value
Else
If C = 4 Then
CellValue = Cells(r, C).Value - Vol(r, 1)
Vol(r, 1) = Cells(r, C).Value

' Debug.Print Cells(r, 1).Value & " - " & CellValue & " - " & Vol(r, 1)

Else
CellValue = Cells(r, C).Value '
End If

' CellValue = Cells(r, C).Value '
S = S & CellValue & "," 'Add contents of current cell to string 's' and a comma
C = C + 1
Wend
a.writeline S 'write line
Next r
End If

Change as given in red and green colours and check the MyCSV.txt file. It should be generated in required format.

Replace this line in "Timer" subroutine
CallAmiBroker 'Calls AmiBroker for importing file
with this
c:\downloaderdata\asc2ms -f c:\RT\MyCSV.txt -r r -o C:\RT\masterdir '(Your asc2ms seems to be in c:\downloader data)

You will have MASTER and Fxxx.DAT files created in "masterdir"
directory. Before running this program if you already had MASTER
and Fxxx.DAT files, the records with same date, or with same date
and time for intraday data files, would be replaced with the data
in the ASCII file.

Using with Metastock:
1. Install Metastock Pro (version 8 or above required).
2. Run the Metastock in Offline Mode.
3. Open Any Chart you want from the folder C:\RT\masterdir
4. Now your realtime chart in Metastock will be updated automatically tick by tick.

AmiBroker also will be able to read C:\RT\masterdir if you replace data source "Local Database" with "Metastock Plugin" and configure the plugin to look at C:\RT\masterdir. Import symbols.

Test and revert. If you know programming, this will not take more than 2 hours of your effort since I have already given the code.
 
Last edited:

mrkanitkar

Well-Known Member
I tried it.
Here is code
-------
Private Sub Timer()
If TimerActive = True Then
If GetGoogle = "Yes" Then
GetGoogleData
End If
MakeCSV 'Calls Subroutine for generating csv file
C:\\RTDATA\asc2ms -f c:\\rtdata\mycsv.txt -r r -o C:\\RTDATA\ms
Application.OnTime Now() + RP, "Timer" 'This code runs the Timer subroutine every 3 seconds
End If
End Sub
---------
It given red line at new line (C:\\RTDATA\asc2ms -f c:\\rtdata\mycsv.txt -r r -o C:\\RTDATA\ms) error is expected line no or statement or end of statement

Can you please suggest?
 
Last edited:

josh1

Well-Known Member
I tried it.
Here is code
-------
Private Sub Timer()
If TimerActive = True Then
If GetGoogle = "Yes" Then
GetGoogleData
End If
MakeCSV 'Calls Subroutine for generating csv file
C:\\RTDATA\asc2ms -f c:\\rtdata\mycsv.txt -r r -o C:\\RTDATA\ms
Application.OnTime Now() + RP, "Timer" 'This code runs the Timer subroutine every 3 seconds
End If
End Sub
---------
It given red line at new line (C:\\RTDATA\asc2ms -f c:\\rtdata\mycsv.txt -r r -o C:\\RTDATA\ms) error is expected line no or statement or end of statement

Can you please suggest?
Sorry... We are calling external program from Excel VBA. Do it with Shell command or FollowHyperlink.
Try one of these
Shell ("C:\\RTDATA\asc2ms -f c:\\rtdata\mycsv.txt -r r -o C:\\RTDATA\ms")
or
ActiveWorkbook.FollowHyperlink "C:\\RTDATA\asc2ms -f c:\\rtdata\mycsv.txt -r r -o C:\\RTDATA\ms", NewWindow:=True
or
ActiveWorkbook.FollowHyperlink Address:="C:\\RTDATA\asc2ms" extrainfo:="-f c:\\rtdata\mycsv.txt -r r -o C:\\RTDATA\ms", NewWindow:=True

You will have to check the syntax. We are calling asc2ms every three seconds to convert the csv file into MS format.
BTW - this step is after generating the mycsv.txt file in desired format. Are you getting that? Open it in notepad and check.
 

mrkanitkar

Well-Known Member
Shell command worked.
However Output needs to be in following format
<TICKER>,<PER>,<DTYYYYMMDD>,<TIME>,<OPEN>,<HIGH>,<LOW>,<CLOSE>,<VOL>,<OPENINT>
NIFTY12JUL5100PE,I,20120704,13:54:07,25.7,25.7,25.7,25.7,700,5188600

And we are getting it in following format. This is not getting imported in MS
--------------
04-07-2012,NIFTY12JUL5100PE,I,14:06:22,24.45,24.45,24.45,24.45,250,5180750,NIFTY,
04-07-2012,NIFTY12JUL5000PE,I,14:06:25,13.2,13.2,13.2,13.2,950,6936200,NIFTY,
04-07-2012,NIFTY12JUL5300PE,I,14:06:25,79.55,79.55,79.55,79.55,850,3374150,NIFTY,
04-07-2012,NIFTY12JUL5300CE,I,14:06:25,95.95,95.95,95.95,95.95,1200,5840300,NIFTY,
04-07-2012,NIFTY12JUL5200PE,I,14:06:25,44.95,44.95,44.95,44.95,700,5348700,NIFTY,
04-07-2012,NIFTY12JUL5100CE,I,14:06:20,237.8,237.8,237.8,237.8,0,1769150,NIFTY,
04-07-2012,NIFTY12JUL5200CE,I,14:06:26,159.7,159.7,159.7,159.7,150,3438500,NIFTY,
04-07-2012,NIFTY12JULFUT,I,14:06:25,5317.5,5317.5,5317.5,5317.5,900,23602200,NIFTY,
04-07-2012,BANKNIFTY12JULFUT,I,14:06:24,10536,10536,10536,10536,175,2757675,BANKNIFTY,
04-07-2012,TATAMOTORS-EQ,I,14:06:25,237.3,237.3,237.3,237.3,231,0,TATAMOTORS,
04-07-2012,NIFTY12JUL5400CE,I,14:06:25,50.2,50.2,50.2,50.2,1600,6431650,NIFTY,
----------

I modified same data in following format manually, which worked fine.
----------------
<TICKER>,<PER>,<DTYYYYMMDD>,<TIME>,<OPEN>,<HIGH>,<LOW>,<CLOSE>,<VOL>,<OPENINT>
NIFTY12JUL5100PE,I,20120704,14:06:22,24.45,24.45,24.45,24.45,250,5180750
NIFTY12JUL5000PE,I,20120704,14:06:25,13.2,13.2,13.2,13.2,950,6936200
NIFTY12JUL5300PE,I,20120704,14:06:25,79.55,79.55,79.55,79.55,850,3374150
NIFTY12JUL5300CE,I,20120704,14:06:25,95.95,95.95,95.95,95.95,1200,5840300
NIFTY12JUL5200PE,I,20120704,14:06:25,44.95,44.95,44.95,44.95,700,5348700
NIFTY12JUL5100CE,I,20120704,14:06:20,237.8,237.8,237.8,237.8,0,1769150
NIFTY12JUL5200CE,I,20120704,14:06:26,159.7,159.7,159.7,159.7,150,3438500
NIFTY12JULFUT,I,20120704,14:06:25,5317.5,5317.5,5317.5,5317.5,900,23602200
BANKNIFTY12JULFUT,I,20120704,14:06:24,10536,10536,10536,10536,175,2757675
TATAMOTORSEQ,I,20120704,14:06:25,237.3,237.3,237.3,237.3,231,0
NIFTY12JUL5400CE,I,20120704,14:06:25,50.2,50.2,50.2,50.2,1600,6431650
-----------

We need to change Date format, remove Symbol at end and need to insert <TICKER>,<PER>,<DTYYYYMMDD>,<TIME>,<OPEN>,<HIGH>,<LOW>,<CLOSE>,<VOL>,<OPENINT> at top at all time.
How do we do it?
Thanks in advance.
 
Last edited:

josh1

Well-Known Member
mrkanitkar,

comment out or remove this line from Makecsv
S = Date & ","

Change this line - CellValue = Cells(r, C).Value & ",I" ' (Insert comma and I after ticker name)

to - CellValue = Cells(r, C).Value & ",I" & Date' (Insert comma and I and today's date after ticker name)

For date format to yyyy/mm/dd you will have to change your system date format.
Else try this first -
CellValue = Cells(r, C).Value & ",I" & text(Date,"yyyy/mm/dd") ' (Insert comma and I and today's date formatted after ticker name)

Remove symbol - just erase in excel

Check the csv file. If in desired format, start with blank database. If you are able to get symbols in MS and one quote, you are done
 
Last edited:
Status
Not open for further replies.

Similar threads