How to: Create WL4 binary files from ASCII using WL5
Author: Eugene
Creation Date: 1/28/2008 10:24 AM
profile picture

Eugene

#1
Wealth-Lab (.NET) 5.0

_Here_ we had a request to export ASCII data into WL4 native binary format to speed up optimizations. This little piece of code can export the data contained in ASCII DataSets into WL4 binary files. No external libraries are required; this will merely help illustrate the usage of BinaryWriter class.

UPDATE 06/21/2017: CODE removed
http://www2.wealth-lab.com/WL5WIKI/kbExportDataFromWL5.ashx


P.S. Oh, my first topic ever started. ;)
profile picture

tmantrader

#2
Eugene,

I was reading the wiki on how to create ASCII CSV files. Extremely helpful. Can you tell me what would the code look like to create the date in yyyymmdd format?

Thanks.

Tom
profile picture

Eugene

#3
Hi Tom,

QUOTE:
Can you tell me what would the code look like to create the date in yyyymmdd format?


Several ways are possible to change the output string.

1. Not recommended: The output format depends on Windows regional settings, so you can get the desired output by changing the culture by using the Date and Time item in Control Panel.
2. Conventional: by parsing the Date object and concatenating fragments the way you like.
3. The preferred way (with .NET in mind): by simply passing a Custom DateTime Format String as a .ToString() parameter:

CODE:
Please log in to see this code.


Hope you get the picture.

For more details: Standard DateTime Format Strings , Custom DateTime Format Strings.
profile picture

DaveAronow

#4
Eugene,

I'm looking for an easy way to create my own data files (from the Fidelity ones) which only have specific data. For example I only want data between 9:30 AM and 11 AM and then 2-4 PM (ignoring the middle of the day since I won't be entering trades then).

I can pretty easily generate my own Bars object, append only the data I want to it, and then save this to a file using the SaveToFile method. However, once I do that I can't access the files through any kind of standard data source. Without writing my own static data adapter, is there any way to trick the Fidelity adapter into loading the files? Symbol names are not important, so I could name all symbols differently if that would help (for example change AAPL to __AAPL).

Thanks.
Dave
profile picture

Eugene

#5
I guess that the .WL files are provider-dependent. At least when I was working on my static adapter and played with editing some data with .SaveToFile, it couldn't be read when the resulting files were put in Fidelity's BarDataStore but only in its own directories. If you're editing a Fidelity symbol in the manner shown here for example, then the output file must be recognized with Fidelity static data provider. Is your experience different from mine?
profile picture

DaveAronow

#6
My problem is that I don't want to overwrite the existing WL5 files, I want to save these files elsewhere and have them loaded. I guess I can change my script to load them manually and that will probably be good enough. If that gets too slow I will try to write an adapter to do it.
profile picture

Eugene

#7
Then you could save the symbols under a different name (e.g. _AAPL, AAPL_) under Fidelity static provider's directories and build an artificial dataset by generating an XML file that would point to those symbols.
This website uses cookies to improve your experience. We'll assume you're ok with that, but you can opt-out if you wish (Read more).