Forums  > Software  > CSI UA API  
     
Page 2 of 4Goto to page: 1, [2], 3, 4 Prev Next
Display using:  

dgn2


Total Posts: 2047
Joined: May 2004
 
Posted: 2007-04-12 06:50

Also, here is some code for downloading a list of futures:use Time::Local;
use Getopt::Long;
use Win32::OLE;
use Win32::Clipboard;
use Win32::OLE::Variant;

#===============================================================================
# Notes
#===============================================================================
# -fetch Natural Gas, Oil, Eurodollars, Euribor, short sterling
# -load all contracts to MySQL symbol table
# -get all of the unique dates
# -for each unique date, fetch all of the contracts with data and construct a curve
#

Win32::OLE::CreateObject("UA.Api2", $ua) || die "unable to create UA.Api2 object: $!";
#$ua->UpdateDatabase();
#$ua->{HoldUAOpenOnClose} = 0;
#undef($ua);

#-------------------------------------------------------------------------------
#
#-------------------------------------------------------------------------------
my %FUTURES = (
"Eurodollar-3 Mth-CME-Globex(Floor+Electronic Combined)" => "141",
"Gas-Natural Henry Hub e-miNY-NYMEX" => "724",
"Gas-Natural Henry Hub-NYMEX(Floor Trading Only)" => "191",
"Gas-Natural Henry Hub-NYMEX(Floor+Electronic Combined)" => "869",
"Petroleum-Crude Oil Light-e-miNY-NYMEX" => "725",
"Petroleum-Crude Oil Light-NYMEX(Floor Trading Only)" => "188",
"Petroleum-Crude Oil-Light-NYMEX(Floor+Electronic Combined)" => "856",
"Mexican TIIE-MXN" => "918",
"Euroyen-3Mth-TFX(TIFFE)" => "70",
"Swap Note (5 Yr)-TFX(TIFFE)" => "910",
"Swap Note(10 Yr)-TFX(TIFFE)" => "911",
"Intrbnk Offer Rate-Euroyen LIBOR 3 Mth-SGX(SIMEX)" => "567",
"Intrbnk Offer Rate-SIBOR-3 Mth-SGX(SIMEX)" => "569",
"Eurodollar(3Mth)-SGX(SIMEX)" => "244",
"Euroyen-3Mth-SGX (SIMEX)" => "249",
"Bank Bills-Australian (90 day)-SFE" => "228",
"Bank Bills-Australian(90 Day)-SFE(Floor+Electronic Combined)" => "614",
"Bank Bills-New Zealand(90 Day)-SFE(NZFE)" => "316",
"Wheat(Electronic)-KCBT" => "1067",
"Wheat-Kansas City-KCBT" => "22",
"Wheat-KCBT(Floor+Electronic Combined)" => "1066",
"Intrbnk Offer Rate-EURIBOR-3 Mth-EURONEXT(LIFFE)" => "565",
"Sterling Rate-3Mth-EURONEXT(LIFFE)" => "173",
"Euro Swiss Franc-EURONEXT(LIFFE)" => "185",
"Euro Swapnote-2 Yr-EURONEXT(LIFFE)" => "658",
"Swap Note(5 Yr)-EURONEXT(LIFFE)" => "558",
"Swap Note(10 Yr)-EURONEXT(LIFFE)" => "559",
"Swap Note (2 Yr) USD-EURONEXT(LIFFE)" => "730",
"Swap Note (5 Yr)- USD-EURONEXT(LIFFE)" => "731",
"Swap Note (10 Yr) USD-EURONEXT(LIFFE)" => "732",
"Gilt-Long(8.75-13yr)-EURONEXT(LIFFE)" => "174",
"Euro German Schatz-EUREX" => "554",
"Euro German Bobl-EUREX" => "553",
"Euro German Bund-EUREX" => "552",
"Euro Buxl 4%-EUREX" => "551",
"Euro German Schatz(Last Trade in Close Field)-EUREX" => "997",
"Euro German Bobl(Last Trade in Close Field)-EUREX" => "996",
"Euro German Bund(Last Trade in Close Field)-EUREX " => "995",
"Index-Dax-EUREX" => "131",
"Index-Dax(Last Trade in Close Field)-EUREX" => "993",
"Govt Bond-Swiss(10Yr)-EUREX(SOFFEX)" => "299",
"Index-Swiss Market-EUREX" => "214",
"Gold-COMEX(Floor Trading Only)" => "30",
"Gold-COMEX(Floor+Electronic Combined)" => "867",
"Silver-COMEX(Floor Trading Only)" => "16",
"Silver-COMEX(Floor+Electronic Combined)" => "868",
"Gold-MiNY-COMEX" => "1102",
"Silver-MiNY-COMEX" => "1103",
"Wheat-CBT(Floor Trading Only)" => "21",
"Wheat-CBT(Floor+Electronic Combined)" => "413",
"Intrbnk Offer Rate-HIBOR 3Mth-HKEX(HKFE)" => "500",
"Corn Index-National-MGE" => "692",
"Electricity-On Peak-MGE" => "542",
"Soybean Index-National-MGE" => "693",
"Wheat Index(Hard Winter)-MGE" => "746",
"Wheat Index-Red Spring-MGE" => "958",
"Wheat Index-Soft Red Winter-MGE" => "957",
"Wheat-Spring (Electronic Only)-MGE" => "1079",
"Wheat-Spring (Floor-Electronic Combined)-MGE" => "1080",
"Wheat-Spring-MGE" => "68",
"Wheat-Winter-MGE" => "236"
);
#-------------------------------------------------------------------------------
#
#-------------------------------------------------------------------------------
my %h2hh = (
"1" => "01",
"2" => "02",
"3" => "03",
"4" => "04",
"5" => "05",
"6" => "06",
"7" => "07",
"8" => "08",
"9" => "09",
"10" => "10",
"11" => "11",
"12" => "12"
);
#-------------------------------------------------------------------------------
#
#-------------------------------------------------------------------------------
my %yy2yyyy = (
"97" => "1997",
"98" => "1998",
"99" => "1999",
"00" => "2000",
"01" => "2001",
"02" => "2002",
"03" => "2003",
"04" => "2004",
"05" => "2005",
"06" => "2006",
"07" => "2007",
"08" => "2008",
"09" => "2009",
"10" => "2010"
);
#-------------------------------------------------------------------------------
#
#-------------------------------------------------------------------------------
my %yyyy2yy = (
"1997" => "97",
"1998" => "98",
"1999" => "99",
"2000" => "00",
"2001" => "01",
"2002" => "02",
"2003" => "03",
"2004" => "04",
"2005" => "05",
"2006" => "06",
"2007" => "07",
"2008" => "08",
"2009" => "09",
"2010" => "10"
);
#-------------------------------------------------------------------------------
#
#-------------------------------------------------------------------------------
my %monthnum = (
"Jan" => "01",
"Feb" => "02",
"Mar" => "03",
"Apr" => "04",
"May" => "05",
"Jun" => "06",
"Jul" => "07",
"Aug" => "08",
"Sep" => "09",
"Oct" => "10",
"Nov" => "11",
"Dec" => "12"
);
#-------------------------------------------------------------------------------
#
#-------------------------------------------------------------------------------
my %nummonth = (
"01" => "Jan",
"02" => "Feb",
"03" => "Mar",
"04" => "Apr",
"05" => "May",
"06" => "Jun",
"07" => "Jul",
"08" => "Aug",
"09" => "Sep",
"10" => "Oct",
"11" => "Nov",
"12" => "Dec"
);
#-------------------------------------------------------------------------------
#
#-------------------------------------------------------------------------------
my %daynum = (
"1" => "01",
"2" => "02",
"3" => "03",
"4" => "04",
"5" => "05",
"6" => "06",
"7" => "07",
"8" => "08",
"9" => "09",
"10" => "10",
"11" => "11",
"12" => "12",
"13" => "13",
"14" => "14",
"15" => "15",
"16" => "16",
"17" => "17",
"18" => "18",
"19" => "19",
"20" => "20",
"21" => "21",
"22" => "22",
"23" => "23",
"24" => "24",
"25" => "25",
"26" => "26",
"27" => "27",
"28" => "28",
"29" => "29",
"30" => "30",
"31" => "31"
);
#-------------------------------------------------------------------------------

################################################################################
#
################################################################################
sub getFutures{
my $output_directory=@_;
($day,$month,$year)=(localtime)[3,4,5];
my $yyyy=$year+1900;
my $mm=$h2hh{$month+1};
my $dd=$daynum{$day};

my $updateFile="update-$yyyy-$mm-$dd";

# open the daily download log
open(UPDATE,">$updateFile");

# iterate over the %FUTURES hash

while (($name,$futuresSymbol) = each(%FUTURES)){

print "...getting: <|$futuresSymbol|$name|>\n";

# build the contract list
$ua->BuildContractList($futuresSymbol,0,0);

$ua->{ShowDecimalPoint} = 1;
$ua->{IncludeHolidays} = 0;
$ua->{detrendMethod} = 0;
$ua->{FillInCashPrice} = 0;

# determine the number of contracts
$numberOfContracts=$ua->NumContracts;
print "$numberOfContracts\n";

# fetch the contracts one by one
for($i = 0;$i<=$numberOfContracts;$i++) {
$ua->GetNextContractDetails;
$deliveryCode=$ua->ContractDeliveryCode;
$firstDate=$ua->ContractFirstDate;
$lastDate=$ua->ContractLastDate;
print "$futuresSymbol|$deliveryCode|$firstDate|$lastDate\n";

# create


# create output file for delivery code
$fileName=$futuresSymbol."_".$deliveryCode.".txt";

open(OUTPUT,">$output_directory/$fileName") or die "Can't open $fileName!";;

$CLIP = Win32::Clipboard();

# fetch the time series data for each contract
$numrec_1 = $ua->RetrieveContract($futuresSymbol,$deliveryCode,$firstDate,$lastDate);
$numrec_2 = $ua->CopyDataToClipboard(); # the second numrec is the number of returned records which may be different

my $text = $CLIP->Get();
my @data = split("\n",$text);
foreach (@data){
($date,$dow,$dydm,$open,$high,$low,$close,$cash,$vol,$oi,$tvol,$toi,$ClosingBid,$ClosingAsk)= split(',',$_);

# format datetime
$template = 'A4A2A2A*';
($date_yyyy,$date_mm,$date_dd)=unpack($template,$date);
$datetime=$date_yyyy."-".$date_mm."-".$date_dd;

print OUTPUT "$futuresSymbol|$dydm|$datetime|$open|$high|$low|$close|$vol|$oi|$tvol|$toi\n";
} # foreach
close(OUTPUT);
$CLIP->Empty();

my $update="$yyyy-$mm-$dd|$name|$futuresSymbol|$deliveryCode|$firstDate|$lastDate|$date|$vol|$oi|$tvol|$toi\n";
print UPDATE "$update\n";
} # for

} # while
} # sub
my $output_directory="M://MarketData/Daily/CSI";
getFutures($output_directory);


...WARNING: I am an optimal f'er

dgn2


Total Posts: 2047
Joined: May 2004
 
Posted: 2007-04-12 06:52

Finally, here is some rough code for table setup and bulk loading in MySQL:

#!/usr/bin/perl
#-------------------------------------------------------------------------------
# link modules
#-------------------------------------------------------------------------------
use DBI;
################################################################################
# DATABASE UTILITIES #
################################################################################

# create database
# check if database exists
#=>change $$$ to @_ variable passing

#-------------------------------------------------------------------------------
# Check to determine whether a table exists
#-------------------------------------------------------------------------------
sub table_exists{
my ($db_handle,$table)=@_;
my $db_clause="";
($db_clause,$table)=(" FROM $1",$2) if $table =~/(.*)\.(.*)/;
$table =~ s/([%_])/\\$1/g; # escape any special characters
return ($db_handle->selectrow_array("SHOW TABLES $db_clause LIKE '$table'"));
}
#-------------------------------------------------------------------------------------------
# Connect to a database
#-------------------------------------------------------------------------------------------
sub db_connect($$$){
my $data_source=shift;
my $user=shift;
my $password=shift;
print "...establishing connection to $data_source...\n";
my $db_handle=DBI->connect($data_source,$user,$password) ||
die "Error opening database: $DBI::errstr\n";
print "...connection established...\n";
return $db_handle;
}
#-------------------------------------------------------------------------------
# Disconnect from a database with the handle $db_handle
#-------------------------------------------------------------------------------
sub db_disconnect($){
$db_handle=shift;
print "...disconnecting from $db_handle...\n";
$db_handle->disconnect || die "Failed to disconnect\n";
print "...disconnected...\n";
}

#-------------------------------------------------------------------------------
# Build CSI daily price data table
#-------------------------------------------------------------------------------
sub setup_csiFutures_table($$){
my ($db_handle,$statement_handle,$symbol);
$db_handle=shift;
$table=shift;

# define the table statement
$statement_handle=$db_handle->prepare("CREATE TABLE $table (
db_update_timestamp TIMESTAMP,

csiNumber INT NOT NULL,
deliveryCode INT NOT NULL,
date DATE NOT NULL,
open DECIMAL(20,10) NOT NULL,
high DECIMAL(20,10) NOT NULL,
low DECIMAL(20,10) NOT NULL,
close DECIMAL(20,10) NOT NULL,
volume INT NOT NULL,
openInterest INT NOT NULL,
total_volume INT NOT NULL,
total_openInterest INT NOT NULL,
PRIMARY KEY (csiNumber,deliveryCode,date)) TYPE=INNODB");

# execute the statement using the statement handle
$statement_handle->execute();

# finish the statement execution
$statement_handle->finish();
print "...statement execution complete...\n";

}

################################################################################
# BULK - SINGLE TABLE LOADING #
################################################################################

#-------------------------------------------------------------------------------
# Bulk loading of CSI daily futures data employing LOAD DATA
#-------------------------------------------------------------------------------
sub load_data_csiFutures{
my ($db_handle, $input_directory, $input_file, $table_name)=@_;
my $sql = "LOAD DATA INFILE '$input_directory/$input_file' IGNORE INTO TABLE $table_name FIELDS TERMINATED BY '|' (csiNumber,deliveryCode,date,open,high,low,close,volume,openInterest,total_volume,total_openInterest);";
my $count=$db_handle->do($sql);
# print row count if no error occurred
if($count){ $count+=0; print "$count daily futures records were updated in $table_name\n";}
}
#-------------------------------------------------------------------------------------------


################################################################################
# BULK - ALL TABLE LOADING #
################################################################################

#-------------------------------------------------------------------------------
# iterate over all files in the folder and update the database tables with daily
# data (Source: CSI)
#-------------------------------------------------------------------------------
sub iterate_csi_data{
my ($db_handle,$output_directory,$table_name)=@_;

opendir(DIR,$output_directory) or die "Can't open $output_directory: $!";
while( $file=readdir DIR){
next if ($file =~ /^\.\.?$/); # skip the parent directory
print "<|$file|=|$table_name|>\n";
load_data_csiFutures($db_handle, $output_directory, $file, $table_name);
}
close(FILE);
}

################################################################################
# MAIN #
################################################################################

# chg this for home!!!!!!!!!!!!!!!!
my $db_handle=db_connect('dbi:mysql:daily_futures:IP:Port','root','password');

my $output_directory="M://MarketData/Daily/CSI";
my $table_name="futures";

setup_csiFutures_table($db_handle,$table_name);
iterate_csi_data($db_handle,$output_directory,$table_name);
db_disconnect($db_handle);

 


...WARNING: I am an optimal f'er

dgn2


Total Posts: 2047
Joined: May 2004
 
Posted: 2007-04-12 06:58
...all the analytics and report generation are still works in progress (implemented in Matlab), but I will perhaps start another thread to discuss some of the market specific stuff.

...WARNING: I am an optimal f'er

dgn2


Total Posts: 2047
Joined: May 2004
 
Posted: 2007-09-27 23:48

I want to revive this thread and do a quick poll of the backtesting futures traders among us. I am building a generic futures ‘backtest engine’, first for low frequency systems, then for high frequency systems. The high frequency systems are the ultimate objective, but it is easier to test futures rolling mechanisms on lots of daily data across many instruments so that is where I am starting. What I am wondering is, what kind of algorithms do trend followers use for rolling their positions? Ideally I would like something generic that does not have specific parameters for specific markets, but I recognize that this may be out of reach. 


...WARNING: I am an optimal f'er

Tradenator


Total Posts: 1576
Joined: Sep 2006
 
Posted: 2007-09-28 00:25

Regardless of whether you follow a trend or not, there are many recipes to trigger rolls.  I have used volume and volume+open interest, for trading once a day.  Also have a look at changes in open interest, with or without volume levels.  Currently, we roll N days prior to the last trade.  You could also roll on the Nth business day of the month a la GSCI for commodities.  Beware that volume in the far contract can limit you to a small window of a couple of days to choose from for some markets (I'm thinking bond and equity index futures here).  You might consider backwardation and contango too (what is the roll yield doing, and are you long or short in it).

Rolling on volume follows the liquidity well enough, and usually away from delivery.  Having a hard limit of a couple of days prior to last trade would be a good safety net to build in.


dgn2


Total Posts: 2047
Joined: May 2004
 
Posted: 2007-09-28 01:17

Thanks Tradenator. I have read about many different ways of rolling (CSI published some stuff, for instance), but I am wondering whether N days before the last trade day requires different Ns for different contracts and if so how do I decide what N should be for each contract. The problem with volume-based rolls seems to be that if you use a hard threshold (say x% of total) then you may get a spike in a contract and end up rolling into something then rolling back again. I realize that experimenting myself is the best thing to do, but I am a little short on time these days so I am looking for some guidance about what people have found best.

EDIT: Also the reason I mentioned trend-following specifically is that I have read that trends sometimes appear only in certain contracts so one may not want to roll into another contract.


...WARNING: I am an optimal f'er

Patrik
Founding Member

Total Posts: 1333
Joined: Mar 2004
 
Posted: 2007-09-28 01:58
fyi, during the past year there's been quite a good market in commodities for selling indices whose purpose is to try to outsmart the "standard" indices in terms of rolls. there's a wide range of them - I've seen a lot of them at my shop and other shops have their own variations. it could probably be useful fr you to get some of these term sheets to see the type of things that are around.

(this may be highly commod related though, I know very little about financial contract rolls but so far the impression I have is that it's much less of an event than commod rolls)

Capital Structure Demolition LLC Radiation

Johnny
Founding Member

Total Posts: 4333
Joined: May 2004
 
Posted: 2007-09-28 10:25

For cash settled futures I think rolling a few days before expiry is fine. The trickier contracts are the physically settled futures where the basis can (does) change rapidly approaching expiry. It's very common to see delivery squeezes (or the opposite). Often this is predictable from the point of view of a trend follower. If there's been a big trend upwards in some contract then all the trend followers will have it and all the trend followers will want to sell this month to buy the next. That kind of thing.


small pig, big pig

dgn2


Total Posts: 2047
Joined: May 2004
 
Posted: 2007-09-28 11:18

Thanks Patrik. I will take a look at how those rolls are done.

I will try the N days before expiry to start with the roll set relatively close to expiry because most of what I am looking at to start is cash settled. Thanks Johnny.


...WARNING: I am an optimal f'er

Tradenator


Total Posts: 1576
Joined: Sep 2006
 
Posted: 2007-09-28 11:28

Here is what I mean by certain roll strategies...and I don't use CSI's algorithms as I cannot reproduce their proprietary results.

Roll on volume = roll when the 'next' contract's volume exceeds the 'near' one.  You can smooth this, or look for two consecutive days, etc, to ensure a valid signal.  This follows the liquidity.  Beware that the liquidity effectively skips over some months in some markets.  The variations with open interest go along the same vibe here.

Roll N days prior - we use one N for all (commodity) markets currently.  Do a backtest, dial in N to meet your risk/reward criteria.  Using one N for all markets reduces the risk of curve fitting.  If you vary N, make sure you test out of sample, thoroughly.  As Johnny wrote, the basis is important, but not just with trend followers.  There are some commercials out there unable to deliver who are forced to cover shorts right now.

Also of concern here is how you splice contracts into a "continuation series".  For financial futures, if you splice returns then you conveniently construct an excess return index.  Commodities are  more complicated.  Splicing returns removes the carry rate as well as the financing component.  Splicing prices (and back-adjusting them to align contracts) preserves the carry rate, at the expense of including cash.  I'm interested in opinions on which is better, if there are any.  We use both in commodities, for different purposes.

EDIT: some new commodity index products are mentioned in other threads.  The feedback I have (from one client) is that sitting long a couple of months out was not a good thing recently.  I haven't looked at this in a few months myself, since I prefer a more active approach anyway.


dgn2


Total Posts: 2047
Joined: May 2004
 
Posted: 2007-09-28 12:34

Once again Tradenator, thanks.

I have not used the CSI algorithms thus far because I would like to create my own so that I can ensure that I understand exactly what I am assuming. I have played around with creating my own adjustments and I am leaning towards using a return index for longer-term signal generation, but the actual unadjusted price for determining backtest P&L. If you create a bunch of holding period returns you can chain contracts by taking the cumulative product of the HPRs.

I am going to work some more on this over the weekend and I will post whatever I test. Thanks.


...WARNING: I am an optimal f'er

Tradenator


Total Posts: 1576
Joined: Sep 2006
 
Posted: 2007-09-28 12:39

It's refreshing to be able to offer someone else some help for a change.  Gmail me if you need to take anything offline.

Paul1, you still here?  What did you end up going with?


svquant


Total Posts: 113
Joined: Apr 2007
 
Posted: 2007-09-29 02:00
Just wanted to add some observations and what is done in practice from my own trading and knowledge of what some CTAs & Hedge Funds are doing with respect to futures.

1) A lot of people do use fixed roll dates as mentioned in the earlier posts. But you will need to keep it flexible since some rolls are N days before the Y-months before the delivery month. For some cash settled futures and many financial futures this can be the delivery month for some other type of contracts (like softs) this maybe the month before the delivery month so you do not run into some of the first notification and other issues (mentioned earlier).

2) So how are N & Y from above chosen? Some is just knowledge that is passed on from one CTA to another, other times one is eyeballing over a few years the volume, open interest and determining a good selection. So it is a bit like rolling on V or OI but more fixed which can be good since there can be V or IO spikes that cause a roll but have no real price dynamics impacts from a directional fund point of view. Of course you will then need to keep in mind and follow any contract changes that could impact N & Y.

3) N & Y are in general chosen by intrument group. For example if you are trading CME FX all contracts will have the same N & Y, Same thing with the energy complex.

4) Some CTAs & funds skip months in contracts that are listed for all 12 months. Example is WTI where some funds do not roll each month but perhaps every other month, eg only active in 6 of the 12 per year.

5) Many people backtest and trade on continuous series made from linking contracts. As mentioned CSI documentation discusses this in detail. While not perfect it works very well in practice for low frequency systems. When creating the continuous series many people (and CSI software) can add the actual active contract date as a field in the time series. Thus you can know when a rollover occurs and adjust for transaction costs during the backtest.

6) If you are going to calculate a return series and then back it into an index (this is similar to ratio back adjusting as discussed by CSI folks) need to determine what you want to do with the open, high, low if this is based off the close. Will calculations like True Range be what you expect them to be with this type of adjustment? This is similar to not being able to use %-returns when one creates gap back adjusted time series. No answer is right or wrong - each one has limitations and you need to know what they are so you do not suffer from GIGO in the models.

7) In my own work I typically have the following fields for daily future time series:
date
adjusted open
adjusted high
adjusted low
adjusted close (adjusted is gap back adjusted for use)
unadjusted close
close-close % return
active contract year & month

Well perhaps this post is long enough, but happy to expand on anything if needed. Hope this has been useful and has not caused you to recode any of your weekend work Smiley

Marc


dgn2


Total Posts: 2047
Joined: May 2004
 
Posted: 2007-10-05 18:54

6) If you are going to calculate a return series and then back it into an index (this is similar to ratio back adjusting as discussed by CSI folks) need to determine what you want to do with the open, high, low if this is based off the close. Will calculations like True Range be what you expect them to be with this type of adjustment? This is similar to not being able to use %-returns when one creates gap back adjusted time series. No answer is right or wrong - each one has limitations and you need to know what they are so you do not suffer from GIGO in the models.

That is a good point svquant. I do focus a lot on the highs and lows at different time scales so this part of what I am trying to figure out at the moment.


...WARNING: I am an optimal f'er

jungle
Chief Rhythm Officer
CSD LLC
Total Posts: 3162
Joined: Jul 2004
 
Posted: 2008-05-14 17:46

I have a program that downloads data from CSI.  The program runs fine on my PC (which has UA installed).  However, when I try to run the program on a different PC (which also has UA installed), I get the error message:

System.Runtime.InteropServices.COMException (0x80080005): Retrieving the COM class factory for component with CLSID {6F2F99A3-6600-11D3-B331-525400E8C92C} failed due to the following error: 80080005.   

EDIT / UPDATE: Without having made any changes, other than simply re-publishing and re-installing, the code now appears to work.  Confused  I would still welcome any comments! 


Tradenator


Total Posts: 1576
Joined: Sep 2006
 
Posted: 2008-05-15 01:11
I suspect this was not a UA thing.  What language was used?  My python scripting and previous VBA code never did this writing to csv files.

jungle
Chief Rhythm Officer
CSD LLC
Total Posts: 3162
Joined: Jul 2004
 
Posted: 2008-05-15 15:28

AFAIK, the exception is being thrown because the program can't find a CSI file it requires.  There is no problem finding that file when the program runs locally.  CSI's response, "I have heard interop stuff sometimes requires some kind maintenance," was not particularly illuminating...


tristanreid


Total Posts: 1677
Joined: Aug 2005
 
Posted: 2008-05-15 17:20

That's a registry issue. The COM object wasn't registered properly. Sometimes happens when you install something using one account and log in with a different account, or if you installed something but then your permissions on the box changed, or if you copied an install from one machine to another, or if something overwrote the object registration in the registry.

-t.


the only reason it would be easier to program in C is that you can't easily express complex problems in C, so you don't. -comp.lang.lisp

jungle
Chief Rhythm Officer
CSD LLC
Total Posts: 3162
Joined: Jul 2004
 
Posted: 2008-05-16 23:11

The only useful (?) info I got out of CSI was to check if uncdbsvr.dll was registered properly; I ran Regsvr32 to ensure it was, and that still didn't fix the problem. 

I then installed Visual Studio on the remote machine, rebuilt the solution there, and uninstalled CS UA 2.10.6 and installed 2.9.3, that being the version that worked fine with the code on the local machine.

Now, when I run the code I get the CSI error message (i.e. NOT a .NET unhandled exception error) "Startup incomplete", which presumably means the API class hasn't been properly instantiated (?).  But I don't get this error message consistently --- sometimes it appears, sometimes it doesn't.  Neither opening UA via System.Diagnostics.Process(...) nor opening UA manually, prior to running the code, seem to help. 
 


tristanreid


Total Posts: 1677
Joined: Aug 2005
 
Posted: 2008-05-16 23:36

I thought it was now working after you reinstalled?

One thing to check: if you open regedit and search for the CLSID (from your earlier post), is it in there? 

-t.


the only reason it would be easier to program in C is that you can't easily express complex problems in C, so you don't. -comp.lang.lisp

jungle
Chief Rhythm Officer
CSD LLC
Total Posts: 3162
Joined: Jul 2004
 
Posted: 2008-05-16 23:45

It works fine on the local PC, doesn't work consistently on the remote PC. 

The CLSID is in the registry.


Tradenator


Total Posts: 1576
Joined: Sep 2006
 
Posted: 2008-05-17 00:45
They mention a registry removal tool on the CSI site, could it be that you have more than one CLSID and it was looking at the wrong one?  (Is that even possible?)

jungle
Chief Rhythm Officer
CSD LLC
Total Posts: 3162
Joined: Jul 2004
 
Posted: 2008-06-12 20:02

New CSI problem: creating a rolling n-th month series does NOT work if you use a fixed expiration date, at least according to CSI tech support.  Does anyone know if this is true?  What I'm trying to do appears to work in some cases, but not others.   


EDIT: Rolling on volume/open interest is not feasible here because open interest in the n+1-th contract is greater than that of the n-th contract I want.


"Alors, c'est bien foutu, les systeme". Alphandery

Dizzy


Total Posts: 245
Joined: May 2006
 
Posted: 2008-06-12 20:35
I seem to remember having had a problem similar to that. Try switching between the FORTRAN and C++ rolling engine and see if anything changes.

Excess return -> stack underflow.

jungle
Chief Rhythm Officer
CSD LLC
Total Posts: 3162
Joined: Jul 2004
 
Posted: 2008-06-12 20:44
Thanks, Dizzy, I tried that --- they recommended that to me a while back, so I changed that setting, but it still isn't helping. 
Previous Thread :: Next Thread 
Page 2 of 4Goto to page: 1, [2], 3, 4 Prev Next