FORUMS BROKERS SOFTWARE
Home
 
    Forums > Technically Speaking > Programming > Calling all C++ programmers


Reply
 
Thread Tools
Old Jul 27th, 2011, 12:03 PM   #13
rosy2
 
 
Join Date: Aug 2006
Posts: 1,399
you said you have a csv file of data. Isnt that file already sorted by date? so you dont need to worry about sorting. you just get the data put it in an object and add that to a list. This is trivial. You probably spent more time typeing on this forum thread than it would take to code it. if you need a sort then put the objects in a tree
    Quote
Old Jul 27th, 2011, 12:19 PM   #14
dcvtss
 
 
Join Date: Mar 2006
Location: Texas
Posts: 427
Quote:
Quote from keyser1:

have you thought of using a database? sql server express or ms access?

'find me the lowest price within this date range' is easy to do in sql.
Its also relatively easy to do in c# .net using linq -- a bunch of technologies to learn, but speed of development will be much faster in .net; execution speed will be slower than c++, but that can be solved by having a faster machine.

The answer to your question really depends on
1. How fast do queries have to be
2. How much data is there
3. How often are you adding data
4. How often are you querying data
What he said...I've set up a MySQL DB for EOD OHLC data from excel in about 25 minutes, including installing the MySQL software, defining the tables, and importing the csv data. Use a free front end like HeidiSQL or phpmyadmin and it does the imports for you. Best thing is you can use excel to fromat the date string in MySQL's format before you import and then once it's in there as a native timestamp it's easy to query as keyser said.
    Quote
Old Jul 27th, 2011, 12:29 PM   #15
Maverick1
 
 
Join Date: Jun 2002
Posts: 528
Quote:
Quote from rosy2:

you said you have a csv file of data. Isnt that file already sorted by date? so you dont need to worry about sorting. you just get the data put it in an object and add that to a list. This is trivial. You probably spent more time typeing on this forum thread than it would take to code it. if you need a sort then put the objects in a tree
Yes the file is sorted by date. Here's the issue though: Each date has ~390 minutes of price data associated with it. For example:

09/11/2009 9.30 o, h, l, c
09/11/2009 9.31 o, h, l, c

and so on to
09/11/2009 16.14 o, h, l, c

That completes one day, and then starts the next which could be 9/14/2009 due to weekend, say.

What I want to do is simple analysis for now: for ex, find the time at which the low was made for each date in my data file. That requires that I be able to iterate over each date in sequence and because of weekends and holidays, that sequence is not a simple as +1 each time.

From the responses so far, it looks like best bet is to convert the date string into a long using strptime()?
    Quote
Old Jul 27th, 2011, 01:24 PM   #16
jedwards
 
 
Join Date: Jul 2009
Posts: 313
Quote:
Quote from Maverick1:

Yes the file is sorted by date. Here's the issue though: Each date has ~390 minutes of price data associated with it. For example:

09/11/2009 9.30 o, h, l, c
09/11/2009 9.31 o, h, l, c

and so on to
09/11/2009 16.14 o, h, l, c

That completes one day, and then starts the next which could be 9/14/2009 due to weekend, say.

What I want to do is simple analysis for now: for ex, find the time at which the low was made for each date in my data file. That requires that I be able to iterate over each date in sequence and because of weekends and holidays, that sequence is not a simple as +1 each time.

From the responses so far, it looks like best bet is to convert the date string into a long using strptime()?
If this is all you want to do then just stick it into a map where the key is the timestamp. Using minute data you can reasonably store years worth of data in memory on a current system.

strptime and mktime will work, although I myself used ICU libraries (ICU4C) because I was dealing with various time zones trading data from Hong Kong, Germany, and the US. It's more complex but doing things like date addition is a bit easier.

If you start getting into tick data, then you might need to go with something more complex because some data feeds are adding millisecond components to the timestamp.
    Quote
Old Jul 31st, 2011, 08:58 PM   #17
Mr_You
 
 
Join Date: Dec 2010
Posts: 277
FYI, PostgreSQL is also an excellent "enterprise class" quality database that is opensource and free. Easy to use and install on Windows and other OSs.
    Quote
 
Reply
Thread Tools

Forum Jump



   Conduct Rules   Privacy Policy   Sitemap Copyright © 2014, Elite Trader. All rights reserved.   

WHILE YOU'RE HERE, TAKE A MINUTE TO VISIT SOME OF OUR SPONSORS:
Advantage Futures
Futures Trading & Clearing
Alpha 7 Trading Academy
Proprietary Trading Education
AMP Global Clearing
Futures and FX Trading
Bright Trading
Professional Equities Trading
CTS
Futures Trading Software
DaytradingBias.com
Professional Trading Analytics
ECHOtrade
Professional Trading Firm
eSignal
Trading Software Provider
FXCM
Forex Trading Services
Global Futures
Futures, Options & FX Trading
Interactive Brokers
Pro Gateway to World Markets
JC Trading Group
Direct Access Trading
MB Trading
Direct Access Trading
MultiCharts
Trading Software Provider
NinjaTrader
Trading Software Provider
OANDA
Currency Trading
optionshouse
Option Trading & Education
Rithmic
Futures Trade Execution Platform
SpeedTrader
Direct Access Trading
SpreadProfessor
Spread Trading Instruction
thinkorswim by TD Ameritrade
Direct Access TradingAdvertisement
TradersStudio
System Building & Backtesting
Trading Technologies
Trading Software Provider
Trend Following
Trading Systems Provider