Topic: Interfacing with MySql DB

Hi,

has anyone interfaced this with MySql DB.

I have tick data in MySql and would like to interface this with this application.

Can someone help me please on how to go about doing this.

Thanks in advance.

Regards,
Sanjay

Re: Interfacing with MySql DB

Hi Sanjay, I think you might be best off with the manual way -- select from MySQL and write out to CSV. MySQL Query Browser has a "Export as CSV" function. I think you would probably have to open the csv file to be sure the format matches something FSB can read. Then save to FSB's data folder, hit Ctrl L, FSB loads the new data file.

Another way is to write a small app to enter the query parameters, retrieve the data from MySQL, and write out the data in a csv with the correct format. This is what I do for my 5-minute data, I didn't like opening MySQL Query Browser all the time.

If you really want to connect FSB to MySQL, there is the MySql.Data.MySqlClient class. I use this class for interfacing with MySQL, but only for inserting some data I calculate in FSB. If you select the data this way, then it would be another step to get that returned data into the Data object that FSB uses. I suppose it could be done, but then it is a question of, is it worth doing the extra step? or using the csv technique above? I've opted for the csv technique, just personal preference that it got the job done quickly, works with the existing program design, and is not too inconvenient.

Re: Interfacing with MySql DB

Hi Krog,

Thanks for the reply.  The data I am trying to do backtesting on is tick, and I have more than three years data. So getting it into a CSV file will not be possible due to the limitation of the rows.
I guess I will need to take the two step way due to the constraint of the size of data.
Is there any document which I can refer to getting the MySql dB connectivity,

Thanks and really appreciate your help,

Regards,
Sanjay

Re: Interfacing with MySql DB

Do you mean document for FSB? Unfortunately I don't think so, it's not a feature in FSB. For my post, I meant you would have to get the FSB source and add the feature. In doing that, I used MySql.Data.MySqlClient class. Do a google search, it will find the mysql developer pages for the API reference, and should be able to point you to any resources that need to be downloaded or installed.

Re: Interfacing with MySql DB

Update -- I took a look at the instrument settings on FSB, they only go down to 1 minute data. I'd recommend posting a question on the Forex Strategy Builder subforum if it can handle tick data. It might have been added, I'm not sure, I have an old version; if not, someone might be able to point you in the right direction on how to use tick data with it.

Re: Interfacing with MySql DB

Hi Korg,

Thanks for the info.  Will keep you posted on my development.

Thanks once again,

7

Re: Interfacing with MySql DB

You may be able to one of the other features of FSB to achieve this.

If you can extract your MySQL data into the same format as TrueFX data, which I believe to be <Instrument>,<DateTime>,<Bid>,<Ask> you can probably use the 'TrueFX Import' function in FSB to bring the data into the application.

A sample of the TrueFX data format is below:

AUD/USD,20130101 21:59:59.975,1.03923,1.03988
AUD/USD,20130101 22:00:06.555,1.03919,1.04001
AUD/USD,20130101 22:00:07.078,1.03922,1.03988
AUD/USD,20130101 22:00:10.305,1.0393,1.04003
AUD/USD,20130101 22:00:10.805,1.03929,1.04001
AUD/USD,20130101 22:00:11.558,1.03919,1.04001
AUD/USD,20130101 22:00:12.061,1.03922,1.03988

Re: Interfacing with MySql DB

Thanks ab,  what I was trying was to store MySql data in the same format as TrueFX, and directly read it from MySql DB, instead of exporting it into a csv or a flat file

9

Re: Interfacing with MySql DB

I see ... FSB doesn't natively work with tick data so you will need to convert your data into bar data at some stage before bringing it into the application anyway.  Is it possible for you just to use the SELECT * INTO OUTFILE ... functionality in MySQL to dump the data set first, and then import into FSB using the existing toolset?

10 (edited by sanjay_floyd 2013-02-21 12:32:57)

Re: Interfacing with MySql DB

Hi ab,  I have certain analysis done against tick data. An oscillatoion theory which i have been workin on lately. I need to backtest this against the tick data.  I have this data also in tick. 
My table1 contains the tick data against the timestamp. and the table 2 / table 3 (in MySql Db) contains the tick data which is generated with this oscillation theory. Both these have a common factor which is the timestamp. 
Simplest way to relate this would be:  backtesting the tick data against the mutiple stochastic.