ms2txt icon indicating copy to clipboard operation
ms2txt copied to clipboard

how to use your classes correctly?

Open localcreator opened this issue 4 years ago • 5 comments

I can't understand what data to pass and to which class. Can you please show us a live example? It's hard to know when you first see it. Although, I understand that we are passing data to the metastockfiles class, but which ones exactly? What is 'encoding' in parameters of metastockfiles class?

localcreator avatar Dec 19 '20 15:12 localcreator

This is a tool I wrote quickly in 2008 and it could use some cleanup. I just never got to it :( Anyway Metastock data consists of several files in a single folder and MASTER and EMASTER files are sort of an index describing the content of the other files. This tool looks for a master file in the current dir and either list the symbols or extracts them to text files. The encoding parameter is used when decoding the stock name, as this can contain non-ASCII character like Cyrillic or Arabic characters. In terms of basic usage the entrypoint is here: https://github.com/themech/ms2txt/blob/master/ms2txt.py#L42-L47. Right now it reads data from the current folder but this shouldn't be hard to change. When the MetastockFiles is initialized it reads information about stocks from the master file. Then it can be used to dump the information to txt files: https://github.com/themech/ms2txt/blob/master/metastock/files.py#L419-L429. The general idea for this tool is to convert the binary files into txt files which then can be used easily by other programs or tools. If you would like to use the MetastockFiles class directly then I guess it requires some extra method that would return the data instead of writing it to text files.

themech avatar Dec 19 '20 16:12 themech

if i understand correctly, then just assign, for example, Usage = '%prog -p 2 --all' and everything should work. but i don't see the execution result as a txt file in the folder

localcreator avatar Dec 19 '20 17:12 localcreator

When you execute python ms2txt.py --list does it list any symbols?

themech avatar Dec 19 '20 17:12 themech

Yes, em_file.list_all_symbols() Number of available symbols: 2 symbol: EURUSD, name: EURUSD, file number: 1 symbol: GBPUSD, name: GBPUSD, file number: 2

localcreator avatar Dec 19 '20 17:12 localcreator

Oh, interesting, there should be two MWD files in the folder then and python ms2txt.py EURUSD should work, same for python ms2txt.py --all.

themech avatar Dec 19 '20 17:12 themech