Profile Picture

Custom Property for bardata

Posted By fffernest 7 Years Ago
Message
Posted Saturday January 02 2010
Hi, is there any way to add custom field to bardata? I collected some data other than the default fields of bardata, such as daily short selling volume, and stored in MySQL. I would like to retrieve and manipulate these data in RE for strategy analysis.

Thanks!

Ernest

Posted Monday January 04 2010
Sure, just use the framework itself. Perhaps a Dictionary. Use the BarData as the key and your data structure as the value. If you're not familiar with using a Dictionary, see this tutorial.

fffernest (1/2/2010)
Hi, is there any way to add custom field to bardata? I collected some data other than the default fields of bardata, such as daily short selling volume, and stored in MySQL. I would like to retrieve and manipulate these data in RE for strategy analysis.

Thanks!

Ernest
Posted Monday January 04 2010
Hi billb, do you mean I should manipulate the custom data by requesting data from MySQL on the fly during optimization?

I expect I can retrieve everything from database and store in local (RE's default) data store for processing. I observe in the MySQL data adapter sample, OHLC data is stored in a List of BarData. How can I modifiy it to handle Dictionary while not affecting RE system internal processing of data in BarData? Thanks!

Posted Monday January 04 2010
I'm not sure I'd approach it like that. While you want the data coupled, you may want to let the bardata store do its thing unmodified, then in the Startup or on each NewBar, use the OleDbDataReader or whatever your preferred class is for database access to load/populate the auxiliary structures you require. Will that work?

fffernest (1/4/2010)
Hi billb, do you mean I should manipulate the custom data by requesting data from MySQL on the fly during optimization?

I expect I can retrieve everything from database and store in local (RE's default) data store for processing.I observe inthe MySQL data adapter sample, OHLC data is stored in a List of BarData. How can I modifiy it to handle Dictionary while not affecting RE system internal processing of data in BarData? Thanks!
Posted Monday January 04 2010
If I am not misunderstanding, you are suggesting to access database during strategy optimization. It is not a good idea for me as the database is located in another Linux host. The database access through network during optimization has big impact on performance.

So, as I cannot add custom property to BarData, all custom data should be retrieved on demand, instead of collect and store into default data store through Data Manager before use. Seems that I better configure a local database to store all wanted data and let RE to retrieve locally when needed. Please let me know if I am wrong. Thanks a lot!

Posted Tuesday January 05 2010
BarData does not have a variable for custom data. However, I offered a few suggestions, none of which have to be utilized. I understood it that you were using a custom mysql store that holds your bar and extra data. Is this local or remote? Another option, if this is remote is to load the custom data in Startup and perform the associate at that time. This way there is only one round trip. You could also store it locally if it isn't already. The code to perform this would essentially be the same, you're just wanting to put it in the bar data storage plugin vs. the system.

This brings me to another idea. If you create a custom bar data storage plugin that knows about this custom data, you could always have the custom bar data store load this custom data on demand. So if RightEdge goes out and asks for data for symbols A, B and C, the data store, retrieves that and the custom data and stores it locally. In your system, you could create an instance of your data store and request the custom data. Since it's already been retrieved and associated with a symbol, it just feeds it to your system without a network round trip.

These are just ideas.

fffernest (1/4/2010)
If I am not misunderstanding, you are suggesting to access database during strategy optimization. It isnot a good idea for me as the database is located in another Linux host. The database access through network during optimization has big impact on performance.

So, as I cannot add custom property to BarData, all custom data should be retrieved on demand, instead of collect and store into default data store through Data Manager before use. Seems that I better configure a local database to store all wanted data and let RE to retrieve locally when needed. Please let me know if Iam wrong. Thanks a lot!
Posted Wednesday January 06 2010
Hi billb, thanks so much. Your ideas make me have a better picture. I am thinking about the approach of single round trip vs data replication to local. Both are good and bad.

The custom BarData data store is what initially I want. Is there any sample for it?

Thanks! 

Posted Wednesday January 06 2010
There are samples for every plugin type we support installed in the samples folder. The sample data store we ship with will connect to a database.

fffernest (1/6/2010)
Hi billb, thanks so much. Your ideas make me have a better picture. I am thinking about the approach of single round trip vs data replication to local. Both are good and bad.

The customBarDatadata store is what initially I want. Is there any sample for it?

Thanks!
Posted Thursday January 07 2010
Hi billb, would you elaborate a bit more on the Database datastore sample?

In the DatabaseDataStore sample which use MS Access as data store, I see that the schema of mdb match exactly the properties of BarData class. How can I add custom porperty into it? If I create another customer data structure, say, a class contains data I needed, and whose data will be stored in the seperate table of the database data store, should I just refer to this custom class by static reference, just like Bars in system samples?

Thanks!

Posted Thursday January 07 2010
The schema is not set in stone. Since you have a database and the source code, you can make it do whatever you want. Store whatever you'd like with the BarData and then relate the custom data to each bar in some way. Perhaps the date and OHLC are a key and you could perform a join against it in that way.

fffernest (1/7/2010)
Hi billb, would you elaborate a bit more on the Database datastore sample?

In the DatabaseDataStore sample which use MS Access as data store, I see that the schema of mdb match exactly the properties of BarData class. How can I add custom porperty into it? If I create another customer data structure, say, a class contains data I needed, and whose data will be stored in the seperate table of the database data store, should I just refer to this custom class by static reference, just like Bars in system samples?

Thanks!


Similar Topics


Reading This Topic


2005-2017 © RightEdge Systems