quantproject-developers Mailing List for QuantProject (Page 117)
Brought to you by:
glauco_1
You can subscribe to this list here.
| 2003 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
(7) |
Nov
(103) |
Dec
(67) |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 2004 |
Jan
(52) |
Feb
(9) |
Mar
(69) |
Apr
(53) |
May
(80) |
Jun
(23) |
Jul
(24) |
Aug
(112) |
Sep
(9) |
Oct
|
Nov
(58) |
Dec
(93) |
| 2005 |
Jan
(90) |
Feb
(93) |
Mar
(61) |
Apr
(56) |
May
(37) |
Jun
(61) |
Jul
(55) |
Aug
(68) |
Sep
(25) |
Oct
(46) |
Nov
(41) |
Dec
(37) |
| 2006 |
Jan
(33) |
Feb
(7) |
Mar
(19) |
Apr
(27) |
May
(73) |
Jun
(49) |
Jul
(83) |
Aug
(66) |
Sep
(45) |
Oct
(16) |
Nov
(15) |
Dec
(7) |
| 2007 |
Jan
(14) |
Feb
(33) |
Mar
|
Apr
(21) |
May
|
Jun
(34) |
Jul
(18) |
Aug
(100) |
Sep
(39) |
Oct
(55) |
Nov
(12) |
Dec
(2) |
| 2008 |
Jan
(120) |
Feb
(133) |
Mar
(129) |
Apr
(104) |
May
(42) |
Jun
(2) |
Jul
(52) |
Aug
(99) |
Sep
(134) |
Oct
|
Nov
(137) |
Dec
(48) |
| 2009 |
Jan
(48) |
Feb
(55) |
Mar
(61) |
Apr
(3) |
May
(2) |
Jun
(1) |
Jul
|
Aug
(51) |
Sep
|
Oct
(7) |
Nov
|
Dec
|
| 2010 |
Jan
(7) |
Feb
(1) |
Mar
(145) |
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
(8) |
Dec
|
| 2011 |
Jan
(78) |
Feb
(1) |
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
(88) |
Sep
(6) |
Oct
(1) |
Nov
|
Dec
|
| 2012 |
Jan
|
Feb
(1) |
Mar
|
Apr
(6) |
May
(5) |
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
(1) |
| 2013 |
Jan
|
Feb
|
Mar
|
Apr
(1) |
May
(2) |
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
(2) |
| 2014 |
Jan
|
Feb
|
Mar
|
Apr
|
May
(1) |
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
|
From: Glauco S. <gla...@us...> - 2005-02-06 18:27:12
|
Update of /cvsroot/quantproject/QuantProject In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv8083 Modified Files: QuantProject.suo Log Message: - Commission concept has been introduced - EndOfDayTransaction(s) are used instead of TimedTransaction(s) Index: QuantProject.suo =================================================================== RCS file: /cvsroot/quantproject/QuantProject/QuantProject.suo,v retrieving revision 1.47 retrieving revision 1.48 diff -C2 -d -r1.47 -r1.48 Binary files /tmp/cvsWjZjv1 and /tmp/cvsS2O7gB differ |
|
From: Glauco S. <gla...@us...> - 2005-02-06 18:26:45
|
Update of /cvsroot/quantproject/QuantProject/b4_Business/a1_Financial/a2_Accounting In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv7934/b4_Business/a1_Financial/a2_Accounting Modified Files: Account.cs Log Message: - Commission concept has been introduced - EndOfDayTransaction(s) are used instead of TimedTransaction(s) Index: Account.cs =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b4_Business/a1_Financial/a2_Accounting/Account.cs,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** Account.cs 9 Jan 2005 19:39:51 -0000 1.13 --- Account.cs 6 Feb 2005 18:26:32 -0000 1.14 *************** *** 35,38 **** --- 35,39 ---- using QuantProject.Business.Financial.Accounting.Reporting; using QuantProject.Business.Financial.Accounting.Transactions; + using QuantProject.Business.Financial.Accounting.Commissions; using QuantProject.Business.Financial.Instruments; using QuantProject.Business.Financial.Ordering; *************** *** 193,201 **** private void updateCash( Transaction transaction ) { ! cashAmount += transaction.CashFlow(); } ! public void Add( TimedTransaction transaction ) { this.Transactions.Add( transaction ); this.updateCash( transaction ); --- 194,207 ---- private void updateCash( Transaction transaction ) { ! cashAmount += transaction.CashFlow() - transaction.Commission.Value; } ! protected virtual Commission getCommission( Transaction transaction ) ! { ! return new Commission( transaction ); ! } ! public void Add( EndOfDayTransaction transaction ) { + transaction.Commission = this.getCommission( transaction ); this.Transactions.Add( transaction ); this.updateCash( transaction ); *************** *** 203,214 **** //this.accountReport.AddRecord( this ); } ! public void Add( EndOfDayTransaction transaction ) ! { ! this.Transactions.Add( transaction ); ! this.updateCash( transaction ); ! this.Portfolio.Update( transaction ); ! //this.accountReport.AddRecord( this ); ! } ! // public double GetMarketValue( EndOfDayDateTime endOfDayDateTime ) --- 209,220 ---- //this.accountReport.AddRecord( this ); } ! // public void Add( Transaction transaction ) ! // { ! // this.Transactions.Add( transaction ); ! // this.updateCash( transaction ); ! // this.Portfolio.Update( transaction ); ! // //this.accountReport.AddRecord( this ); ! // } ! // // public double GetMarketValue( EndOfDayDateTime endOfDayDateTime ) |
|
From: Glauco S. <gla...@us...> - 2005-02-06 18:24:27
|
Update of /cvsroot/quantproject/QuantProject/b4_Business/a1_Financial/a2_Accounting In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv7202/b4_Business/a1_Financial/a2_Accounting Modified Files: Transaction.cs Log Message: The Commission property has been added Index: Transaction.cs =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b4_Business/a1_Financial/a2_Accounting/Transaction.cs,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** Transaction.cs 13 Oct 2003 21:58:42 -0000 1.1.1.1 --- Transaction.cs 6 Feb 2005 18:24:05 -0000 1.2 *************** *** 23,26 **** --- 23,27 ---- using System; using QuantProject.Business.Financial.Instruments; + using QuantProject.Business.Financial.Accounting.Commissions; namespace QuantProject.Business.Financial.Accounting *************** *** 37,40 **** --- 38,42 ---- private long quantity; private double instrumentPrice; + private Commission commission; public TransactionType Type *************** *** 70,74 **** } ! public double InstrumentPrice { get { return instrumentPrice; } --- 72,88 ---- } ! public Commission Commission ! { ! get ! { ! return this.commission; ! } ! set ! { ! this.commission = value; ! } ! } ! ! public double InstrumentPrice { get { return instrumentPrice; } |
|
From: Glauco S. <gla...@us...> - 2005-02-06 18:23:39
|
Update of /cvsroot/quantproject/QuantProject/b4_Business/a1_Financial/a2_Accounting/Transactions In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv7036/b4_Business/a1_Financial/a2_Accounting/Transactions Modified Files: TransactionHistory.cs Log Message: EndOfDayTransaction(s) are used instead of TimedTransaction(s) Index: TransactionHistory.cs =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b4_Business/a1_Financial/a2_Accounting/Transactions/TransactionHistory.cs,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** TransactionHistory.cs 29 Nov 2004 14:49:19 -0000 1.1 --- TransactionHistory.cs 6 Feb 2005 18:23:30 -0000 1.2 *************** *** 66,73 **** } ! public void Add( TimedTransaction transaction ) ! { ! base.MultiAdd( transaction.ExtendedDateTime.DateTime , transaction ); ! } public void Add( EndOfDayTransaction transaction ) --- 66,73 ---- } ! // public void Add( TimedTransaction transaction ) ! // { ! // base.MultiAdd( transaction.ExtendedDateTime.DateTime , transaction ); ! // } public void Add( EndOfDayTransaction transaction ) |
|
From: Glauco S. <gla...@us...> - 2005-02-06 18:23:39
|
Update of /cvsroot/quantproject/QuantProject/b4_Business/a3_Testing In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv7036/b4_Business/a3_Testing Modified Files: Tester.cs Log Message: EndOfDayTransaction(s) are used instead of TimedTransaction(s) Index: Tester.cs =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b4_Business/a3_Testing/Tester.cs,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** Tester.cs 9 Jan 2005 23:48:58 -0000 1.7 --- Tester.cs 6 Feb 2005 18:23:30 -0000 1.8 *************** *** 27,30 **** --- 27,31 ---- using QuantProject.ADT.Histories; using QuantProject.ADT.Optimizing; + using QuantProject.Business.Financial.Accounting.Transactions; using QuantProject.Business.Financial.Accounting; using QuantProject.Business.Financial.Ordering; *************** *** 88,92 **** foreach (Order order in orders ) { ! TimedTransaction transaction = this.OrderManager.GetTransaction( order , dataStreamer ); this.Account.Add( transaction ); --- 89,93 ---- foreach (Order order in orders ) { ! EndOfDayTransaction transaction = this.OrderManager.GetTransaction( order , dataStreamer ); this.Account.Add( transaction ); |
|
From: Glauco S. <gla...@us...> - 2005-02-06 18:20:32
|
Update of /cvsroot/quantproject/QuantProject/b4_Business/a1_Financial/a3_Ordering In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv6465/b4_Business/a1_Financial/a3_Ordering Modified Files: OrderManager.cs Log Message: EndOfDayTransaction(s) are used instead of TimedTransaction(s) Index: OrderManager.cs =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b4_Business/a1_Financial/a3_Ordering/OrderManager.cs,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** OrderManager.cs 9 Jan 2005 23:28:30 -0000 1.4 --- OrderManager.cs 6 Feb 2005 18:20:22 -0000 1.5 *************** *** 75,87 **** } ! public TimedTransaction GetTransaction( Order order , IDataStreamer dataStreamer ) { double instrumentPrice = dataStreamer.GetCurrentBid( order.Instrument.Key ); ! TimedTransaction transaction = new TimedTransaction( getTransactionType( order ) , order.Instrument , order.Quantity , instrumentPrice , ! order.EndOfDayDateTime.GetNearestExtendedDateTime() ); return transaction; } --- 75,87 ---- } ! public EndOfDayTransaction GetTransaction( Order order , IDataStreamer dataStreamer ) { double instrumentPrice = dataStreamer.GetCurrentBid( order.Instrument.Key ); ! EndOfDayTransaction transaction = new EndOfDayTransaction( getTransactionType( order ) , order.Instrument , order.Quantity , instrumentPrice , ! order.EndOfDayDateTime ); return transaction; } |
|
From: Glauco S. <gla...@us...> - 2005-02-06 18:19:22
|
Update of /cvsroot/quantproject/QuantProject/b7_Scripts/TickerSelectionTesting In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv6114/b7_Scripts/TickerSelectionTesting Modified Files: RunEfficientCTCPortfolio.cs Log Message: A couple of lines have been commented, to avoid warnings Index: RunEfficientCTCPortfolio.cs =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b7_Scripts/TickerSelectionTesting/RunEfficientCTCPortfolio.cs,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** RunEfficientCTCPortfolio.cs 4 Feb 2005 00:13:28 -0000 1.2 --- RunEfficientCTCPortfolio.cs 6 Feb 2005 18:19:10 -0000 1.3 *************** *** 63,67 **** private EndOfDayDateTime startDateTime; private EndOfDayDateTime endDateTime; ! private int numIntervalDays;// number of days for the equity line graph private IHistoricalQuoteProvider historicalQuoteProvider = new HistoricalAdjustedQuoteProvider(); --- 63,67 ---- private EndOfDayDateTime startDateTime; private EndOfDayDateTime endDateTime; ! // private int numIntervalDays;// number of days for the equity line graph private IHistoricalQuoteProvider historicalQuoteProvider = new HistoricalAdjustedQuoteProvider(); *************** *** 84,88 **** this.endDateTime = new EndOfDayDateTime( new DateTime( 2000 , 1 , 20 ) , EndOfDaySpecificTime.MarketClose ); ! this.numIntervalDays = 3; //for report } #region Run --- 84,88 ---- this.endDateTime = new EndOfDayDateTime( new DateTime( 2000 , 1 , 20 ) , EndOfDaySpecificTime.MarketClose ); ! // this.numIntervalDays = 3; //for report } #region Run |
|
From: Glauco S. <gla...@us...> - 2005-02-06 18:18:18
|
Update of /cvsroot/quantproject/QuantProject/b91_QuantProject In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv5962/b91_QuantProject Modified Files: Main.cs Log Message: Removed a try/catch for debugging purposes (talk to Millo to decide about this). Index: Main.cs =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b91_QuantProject/Main.cs,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** Main.cs 4 Feb 2005 00:20:39 -0000 1.8 --- Main.cs 6 Feb 2005 18:18:08 -0000 1.9 *************** *** 30,35 **** //using QuantProject.ADT.Optimizing.Genetic; ! using QuantProject.Scripts.TickerSelectionTesting.EfficientPortfolios; ! using QuantProject.Scripts.WalkForwardTesting.WalkForwardOneRank; using QuantProject.Scripts.CallingReportsForRunnedScripts; --- 30,34 ---- //using QuantProject.ADT.Optimizing.Genetic; ! using QuantProject.Scripts.SimpleTesting; using QuantProject.Scripts.WalkForwardTesting.WalkForwardOneRank; using QuantProject.Scripts.CallingReportsForRunnedScripts; *************** *** 302,315 **** private void menuItemRun_Click(object sender, System.EventArgs e) { ! try ! {//call here your scripts //new RunWalkForwardOneRank().Run(); ! new RunEfficientCTCPorfolio().Run(); ! } ! catch ( Exception ex ) ! { ! string notUsed = ex.ToString(); ! //in this way qP shouldn't stop if running a single script fails ... ! } } --- 301,315 ---- private void menuItemRun_Click(object sender, System.EventArgs e) { ! // try ! // {//call here your scripts //new RunWalkForwardOneRank().Run(); ! // new RunEfficientCTCPorfolio().Run(); ! new RunOneRank().Run(); ! // } ! // catch ( Exception ex ) ! // { ! // string notUsed = ex.ToString(); ! // //in this way qP shouldn't stop if running a single script fails ... ! // } } |
|
From: Glauco S. <gla...@us...> - 2005-02-06 18:13:15
|
Update of /cvsroot/quantproject/QuantProject/b7_Scripts In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv5169/b7_Scripts Modified Files: b7_Scripts.csproj Log Message: - EndOfDayOneRank and TsOneRank are not used anymore. - RunOneRank has been added to the project. Index: b7_Scripts.csproj =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b7_Scripts/b7_Scripts.csproj,v retrieving revision 1.20 retrieving revision 1.21 diff -C2 -d -r1.20 -r1.21 *** b7_Scripts.csproj 4 Feb 2005 00:07:56 -0000 1.20 --- b7_Scripts.csproj 6 Feb 2005 18:13:05 -0000 1.21 *************** *** 134,142 **** /> <File - RelPath = "SimpleTesting\OneRank\EndOfDayOneRank.cs" - SubType = "Code" - BuildAction = "Compile" - /> - <File RelPath = "SimpleTesting\OneRank\OneRank.cs" SubType = "Code" --- 134,137 ---- *************** *** 144,148 **** /> <File ! RelPath = "SimpleTesting\OneRank\TsOneRank.cs" SubType = "Code" BuildAction = "Compile" --- 139,143 ---- /> <File ! RelPath = "SimpleTesting\OneRank\RunOneRank.cs" SubType = "Code" BuildAction = "Compile" |
|
From: Glauco S. <gla...@us...> - 2005-02-06 18:11:40
|
Update of /cvsroot/quantproject/QuantProject/b7_Scripts/SimpleTesting/OneRank In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv4792 Added Files: RunOneRank.cs Log Message: Script to test the One Rank strategy on a single ticker --- NEW FILE: RunOneRank.cs --- /* QuantProject - Quantitative Finance Library OneRank.cs Copyright (C) 2003 Glauco Siliprandi This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ using System; using QuantProject.Business.DataProviders; using QuantProject.Business.Financial.Accounting; using QuantProject.Business.Financial.Ordering; using QuantProject.Business.Scripting; using QuantProject.Business.Timing; using QuantProject.Presentation.Reporting.WindowsForm; namespace QuantProject.Scripts.SimpleTesting { /// <summary> /// Script to test the One Rank strategy on a single ticker /// </summary> public class RunOneRank : Script { private DateTime startDateTime = new DateTime( 2000 , 1 , 1 ); private DateTime endDateTime = new DateTime( 2000 , 12 , 31 ); private Account account; private IHistoricalQuoteProvider historicalQuoteProvider = new HistoricalAdjustedQuoteProvider(); /// <summary> /// Script to test the One Rank strategy on a single ticker /// </summary> public RunOneRank() { HistoricalEndOfDayTimer historicalEndOfDayTimer = new IndexBasedEndOfDayTimer( new EndOfDayDateTime( this.startDateTime , EndOfDaySpecificTime.MarketOpen ) , "MSFT" ); this.account = new Account( "MSFT" , historicalEndOfDayTimer , new HistoricalEndOfDayDataStreamer( historicalEndOfDayTimer , this.historicalQuoteProvider ) , new HistoricalEndOfDayOrderExecutor( historicalEndOfDayTimer , this.historicalQuoteProvider ) ); OneRank oneRank = new OneRank( account , this.endDateTime ); Report report = new Report( this.account , this.historicalQuoteProvider ); report.Show( "WFT One Rank" , 1 , new EndOfDayDateTime( this.endDateTime , EndOfDaySpecificTime.MarketClose ) , "MSFT" ); } } } |
|
From: Glauco S. <gla...@us...> - 2005-02-06 18:10:30
|
Update of /cvsroot/quantproject/QuantProject/b7_Scripts/SimpleTesting/OneRank In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv4628 Removed Files: EndOfDayOneRank.cs TsOneRank.cs Log Message: EndOfDayOneRank and TsOneRank are not used anymore --- TsOneRank.cs DELETED --- --- EndOfDayOneRank.cs DELETED --- |
|
From: Glauco S. <gla...@us...> - 2005-02-06 18:07:46
|
Update of /cvsroot/quantproject/QuantProject/b4_Business In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv4158/b4_Business Modified Files: b4_Business.csproj Log Message: The a1_Financial\a2_Accounting\Commissions\Commission.cs file has been added. Index: b4_Business.csproj =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b4_Business/b4_Business.csproj,v retrieving revision 1.18 retrieving revision 1.19 diff -C2 -d -r1.18 -r1.19 *** b4_Business.csproj 20 Jan 2005 01:11:32 -0000 1.18 --- b4_Business.csproj 6 Feb 2005 18:07:34 -0000 1.19 *************** *** 298,301 **** --- 298,306 ---- /> <File + RelPath = "a1_Financial\a2_Accounting\Commissions\Commission.cs" + SubType = "Code" + BuildAction = "Compile" + /> + <File RelPath = "a1_Financial\a2_Accounting\h5_Reporting\AccountReport.cs" SubType = "Code" |
|
From: Glauco S. <gl...@my...> - 2005-02-05 18:06:17
|
Tanto per cambiare... questo, l'update, non me lo tira giu'. Posso chiederti se hai usato il Tortoise? Mi sbagliero', ma c'e' qualche incompabilita'. At 12:07 AM 2/4/2005 +0000, you wrote: >Update of >/cvsroot/quantproject/QuantProject/b7_Scripts/CallingReportsForRunnedScripts >In directory >sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv6108/b7_Scripts/CallingReportsForRunnedScripts > >Added Files: > ShowReportFromFile.cs >Log Message: >Added ShowReportFromFile class to view report from file (containing at the >moment only serialized account). >The Class Position in scripts project is just temporary > >--- NEW FILE: ShowReportFromFile.cs --- >/* >QuantProject - Quantitative Finance Library > >ShowReportFromFile.cs >Copyright (C) 2003 >Marco Milletti > >This program is free software; you can redistribute it and/or >modify it under the terms of the GNU General Public License >as published by the Free Software Foundation; either version 2 >of the License, or (at your option) any later version. > >This program is distributed in the hope that it will be useful, >but WITHOUT ANY WARRANTY; without even the implied warranty of >MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the >GNU General Public License for more details. > >You should have received a copy of the GNU General Public License >along with this program; if not, write to the Free Software >Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. >*/ >using System; >using QuantProject.Scripts; >using QuantProject.Business.Timing; >using QuantProject.Business.Financial.Accounting; >using QuantProject.Business.DataProviders; >using QuantProject.ADT.FileManaging; >using QuantProject.Presentation.Reporting.WindowsForm; > > >namespace QuantProject.Scripts.CallingReportsForRunnedScripts >{ > public class ShowReportFromFile > { > public ShowReportFromFile() > { > > } > > > public static void ShowReportFromSerializedAccount(string > serializedAccountFullPath) > { > try > { > Account account = > >(Account)ObjectArchiver.Extract(serializedAccountFullPath); > > Report report = new Report(account, new > HistoricalAdjustedQuoteProvider()); > report.Show("CtcPortfolio",3, > new EndOfDayDateTime(new > DateTime(2000,1,20), EndOfDaySpecificTime.MarketClose), "^MIBTEL"); > > } > catch(System.Exception ex) > { > >System.Windows.Forms.MessageBox.Show(ex.ToString()); > } > } > } >} > > > >------------------------------------------------------- >This SF.Net email is sponsored by: IntelliVIEW -- Interactive Reporting >Tool for open source databases. Create drag-&-drop reports. Save time >by over 75%! Publish reports on the web. Export to DOC, XLS, RTF, etc. >Download a FREE copy at http://www.intelliview.com/go/osdn_nl >_______________________________________________ >Quantproject-developers mailing list >Qua...@li... >https://lists.sourceforge.net/lists/listinfo/quantproject-developers |
|
From: Glauco S. <gl...@my...> - 2005-02-05 17:45:49
|
Ciao Millo, magari sbaglio, ma mi sa che "runned" non esista... :-) At 11:59 PM 2/3/2005 +0000, you wrote: >Update of >/cvsroot/quantproject/QuantProject/b7_Scripts/CallingReportsForRunnedScripts >In directory >sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv3600/CallingReportsForRunnedScripts > >Log Message: >Directory >/cvsroot/quantproject/QuantProject/b7_Scripts/CallingReportsForRunnedScripts >added to the repository > > > > >------------------------------------------------------- >This SF.Net email is sponsored by: IntelliVIEW -- Interactive Reporting >Tool for open source databases. Create drag-&-drop reports. Save time >by over 75%! Publish reports on the web. Export to DOC, XLS, RTF, etc. >Download a FREE copy at http://www.intelliview.com/go/osdn_nl >_______________________________________________ >Quantproject-developers mailing list >Qua...@li... >https://lists.sourceforge.net/lists/listinfo/quantproject-developers |
|
From: Marco M. <mi...@us...> - 2005-02-04 00:20:49
|
Update of /cvsroot/quantproject/QuantProject/b91_QuantProject In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv9557/b91_QuantProject Modified Files: Main.cs Log Message: The main method now runs a form from which it is now possible to choose what to do from a main menu. The main menu now contains at "BackTest" item: - "run" sub-item, to run user's scripts; - "savedTests"-->AccountViewer sub-item, to view saved (serialized) accounts (work is in progress); - "savedTests"-->ShowReportFromAccount sub-item, to run a Report using a saved (serialized) account. Index: Main.cs =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b91_QuantProject/Main.cs,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** Main.cs 3 Feb 2005 00:30:39 -0000 1.7 --- Main.cs 4 Feb 2005 00:20:39 -0000 1.8 *************** *** 28,32 **** --- 28,39 ---- using QuantProject.Scripts; using QuantProject.Scripts.TickerSelectionTesting.EfficientPortfolios; + //using QuantProject.ADT.Optimizing.Genetic; + + using QuantProject.Scripts.TickerSelectionTesting.EfficientPortfolios; + using QuantProject.Scripts.WalkForwardTesting.WalkForwardOneRank; + using QuantProject.Scripts.CallingReportsForRunnedScripts; + + namespace QuantProject.Principale *************** *** 48,55 **** private System.Windows.Forms.MenuItem menuItem10; private System.Windows.Forms.MenuItem menuItem11; - private System.Windows.Forms.MenuItem menuItem12; private System.Windows.Forms.MenuItem menuItem13; private System.Windows.Forms.MenuItem menuItem14; private System.Windows.Forms.MenuItem menuItem9; /// <summary> /// Required designer variable. --- 55,65 ---- private System.Windows.Forms.MenuItem menuItem10; private System.Windows.Forms.MenuItem menuItem11; private System.Windows.Forms.MenuItem menuItem13; private System.Windows.Forms.MenuItem menuItem14; private System.Windows.Forms.MenuItem menuItem9; + private System.Windows.Forms.MenuItem menuItemRun; + private System.Windows.Forms.MenuItem menuItemSavedTests; + private System.Windows.Forms.MenuItem menuItemAccountViewer; + private System.Windows.Forms.MenuItem menuItemShowReportFromAccount; /// <summary> /// Required designer variable. *************** *** 96,100 **** this.menuItem9 = new System.Windows.Forms.MenuItem(); this.menuItem11 = new System.Windows.Forms.MenuItem(); ! this.menuItem12 = new System.Windows.Forms.MenuItem(); this.menuItem13 = new System.Windows.Forms.MenuItem(); this.menuItem14 = new System.Windows.Forms.MenuItem(); --- 106,112 ---- this.menuItem9 = new System.Windows.Forms.MenuItem(); this.menuItem11 = new System.Windows.Forms.MenuItem(); ! this.menuItemRun = new System.Windows.Forms.MenuItem(); ! this.menuItemSavedTests = new System.Windows.Forms.MenuItem(); ! this.menuItemAccountViewer = new System.Windows.Forms.MenuItem(); this.menuItem13 = new System.Windows.Forms.MenuItem(); this.menuItem14 = new System.Windows.Forms.MenuItem(); *************** *** 106,109 **** --- 118,122 ---- this.menuItem6 = new System.Windows.Forms.MenuItem(); this.menuItem7 = new System.Windows.Forms.MenuItem(); + this.menuItemShowReportFromAccount = new System.Windows.Forms.MenuItem(); // // mainMenu1 *************** *** 138,149 **** this.menuItem11.Index = 1; this.menuItem11.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] { ! this.menuItem12}); this.menuItem11.Text = "BackTest"; // ! // menuItem12 // ! this.menuItem12.Index = 0; ! this.menuItem12.Text = "Go"; ! this.menuItem12.Click += new System.EventHandler(this.menuItem12_Click); // // menuItem13 --- 151,177 ---- this.menuItem11.Index = 1; this.menuItem11.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] { ! this.menuItemRun, ! this.menuItemSavedTests}); this.menuItem11.Text = "BackTest"; // ! // menuItemRun // ! this.menuItemRun.Index = 0; ! this.menuItemRun.Text = "Run"; ! this.menuItemRun.Click += new System.EventHandler(this.menuItemRun_Click); ! // ! // menuItemSavedTests ! // ! this.menuItemSavedTests.Index = 1; ! this.menuItemSavedTests.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] { ! this.menuItemAccountViewer, ! this.menuItemShowReportFromAccount}); ! this.menuItemSavedTests.Text = "Saved Tests"; ! // ! // menuItemAccountViewer ! // ! this.menuItemAccountViewer.Index = 0; ! this.menuItemAccountViewer.Text = "Account viewer"; ! this.menuItemAccountViewer.Click += new System.EventHandler(this.menuItemAccountViewer_Click); // // menuItem13 *************** *** 195,198 **** --- 223,232 ---- this.menuItem7.Text = ""; // + // menuItemShowReportFromAccount + // + this.menuItemShowReportFromAccount.Index = 1; + this.menuItemShowReportFromAccount.Text = "Show report from account"; + this.menuItemShowReportFromAccount.Click += new System.EventHandler(this.menuItemShowReportFromAccount_Click); + // // Principale // *************** *** 201,205 **** this.Menu = this.mainMenu1; this.Name = "Principale"; ! this.Text = "Principale"; } --- 235,239 ---- this.Menu = this.mainMenu1; this.Name = "Principale"; ! this.Text = "Main"; } *************** *** 212,219 **** } - private void menuItem12_Click(object sender, System.EventArgs e) - { - } - private void menuItem10_Click(object sender, System.EventArgs e) { --- 246,249 ---- *************** *** 226,237 **** //try { ! // new RunMSFTsimpleTest().Run(); // new RunMSFTsimpleTest_2().Run(); //new RunOneRankWithExcelReport().Run(); ! // new RunOneRankWithWindowsReport().Run(); //new RunMSFTwalkForward().Run(); //new RunMultiTestOneRank().Run(); //new RunEfficientCTOPorfolio().Run(); ! new RunWalkForwardOneRank().Run(); } //catch ( Exception ex ) --- 256,282 ---- //try { ! //new RunMSFTsimpleTest().Run(); // new RunMSFTsimpleTest_2().Run(); //new RunOneRankWithExcelReport().Run(); ! ! //new RunOneRankWithWindowsReport().Run(); ! //new RunBestTwoIndipendent().Run(); ! //Principale.geneticOptimizerTest(); ! //new RunEfficientCTOPorfolio().Run(); ! //new RunEfficientCTCPorfolio().Run(); ! //new RunEfficientPorfolio().Run(); ! Application.Run(new Principale()); ! // new RunMSFTwalkForward().Run(); ! ! // new RunOneRankWithWindowsReport().Run(); //new RunMSFTwalkForward().Run(); + //new RunMultiTestOneRank().Run(); + + //new RunWalkForwardOneRank().Run(); + //new RunEfficientCTOPorfolio().Run(); ! //new RunWalkForwardOneRank().Run(); ! } //catch ( Exception ex ) *************** *** 240,248 **** } } ! private void menuItem14_Click(object sender, System.EventArgs e) { } } } --- 285,328 ---- } } ! /* ! private static void geneticOptimizerTest() ! { ! IGenomeManager genomeManagerTest = new GenomeManagerTest(5,1,10); ! GeneticOptimizer GO = new GeneticOptimizer(genomeManagerTest); ! GO.KeepOnRunningUntilConvergenceIsReached = true; ! GO.Run(true); ! System.Console.WriteLine("\n\nThe best solution found is: " + (string)GO.BestGenome.Meaning + ! " with {0} generations", GO.GenerationCounter); ! } ! */ private void menuItem14_Click(object sender, System.EventArgs e) { } + private void menuItemRun_Click(object sender, System.EventArgs e) + { + try + {//call here your scripts + //new RunWalkForwardOneRank().Run(); + new RunEfficientCTCPorfolio().Run(); + } + catch ( Exception ex ) + { + string notUsed = ex.ToString(); + //in this way qP shouldn't stop if running a single script fails ... + } + } + + private void menuItemAccountViewer_Click(object sender, System.EventArgs e) + { + AccountViewer accountViewer = new AccountViewer(); + accountViewer.Show(); + } + + private void menuItemShowReportFromAccount_Click(object sender, System.EventArgs e) + { + ShowReportFromFile.ShowReportFromSerializedAccount("C:\\CtcPortfolio.qP"); + } + } } |
|
From: Marco M. <mi...@us...> - 2005-02-04 00:13:37
|
Update of /cvsroot/quantproject/QuantProject/b7_Scripts/TickerSelectionTesting In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv7733/b7_Scripts/TickerSelectionTesting Modified Files: RunEfficientCTCPortfolio.cs Log Message: Updated script Index: RunEfficientCTCPortfolio.cs =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b7_Scripts/TickerSelectionTesting/RunEfficientCTCPortfolio.cs,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** RunEfficientCTCPortfolio.cs 30 Jan 2005 19:53:12 -0000 1.1 --- RunEfficientCTCPortfolio.cs 4 Feb 2005 00:13:28 -0000 1.2 *************** *** 81,87 **** this.reportTable = new ReportTable( "Summary_Reports" ); this.startDateTime = new EndOfDayDateTime( ! new DateTime( 2003 , 1 , 1 ) , EndOfDaySpecificTime.MarketOpen ); this.endDateTime = new EndOfDayDateTime( ! new DateTime( 2003 , 1 , 31 ) , EndOfDaySpecificTime.MarketClose ); this.numIntervalDays = 3; //for report } --- 81,87 ---- this.reportTable = new ReportTable( "Summary_Reports" ); this.startDateTime = new EndOfDayDateTime( ! new DateTime( 2000 , 1 , 1 ) , EndOfDaySpecificTime.MarketOpen ); this.endDateTime = new EndOfDayDateTime( ! new DateTime( 2000 , 1 , 20 ) , EndOfDaySpecificTime.MarketClose ); this.numIntervalDays = 3; //for report } *************** *** 161,166 **** this.endOfDayTimer.Stop(); report = new Report( this.account , this.historicalQuoteProvider ); ! report.Show("CTC_Portfolio" , this.numIntervalDays , this.endDateTime , "^MIBTEL" ); ! //ObjectArchiver.Archive(this.account, "CtcPortfolioAccount.qP","C:\\"); } --- 161,166 ---- this.endOfDayTimer.Stop(); report = new Report( this.account , this.historicalQuoteProvider ); ! //report.Show("CTC_Portfolio" , this.numIntervalDays , this.endDateTime , "^MIBTEL" ); ! ObjectArchiver.Archive(this.account,"C:\\CtcPortfolio.qP"); } |
|
From: Marco M. <mi...@us...> - 2005-02-04 00:12:35
|
Update of /cvsroot/quantproject/QuantProject/b3_Data/DataTables In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv7384/b3_Data/DataTables Modified Files: Quotes.cs Log Message: Added new constructor in order to achieve deserialization Index: Quotes.cs =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b3_Data/DataTables/Quotes.cs,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** Quotes.cs 30 Jan 2005 19:57:37 -0000 1.11 --- Quotes.cs 4 Feb 2005 00:12:25 -0000 1.12 *************** *** 7,10 **** --- 7,11 ---- using QuantProject.DataAccess; using QuantProject.DataAccess.Tables; + using System.Runtime.Serialization; namespace QuantProject.Data.DataTables *************** *** 49,52 **** --- 50,57 ---- QuantProject.DataAccess.Tables.Quotes.GetEndDate( ticker ) ); } + public Quotes(SerializationInfo info, StreamingContext context) + : base(info, context) + { + } private void fillDataTable( string ticker , DateTime startDate , DateTime endDate ) { |
|
From: Marco M. <mi...@us...> - 2005-02-04 00:12:35
|
Update of /cvsroot/quantproject/QuantProject/b4_Business/a1_Financial/a2_Accounting In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv7384/b4_Business/a1_Financial/a2_Accounting Modified Files: Portfolio.cs Log Message: Added new constructor in order to achieve deserialization Index: Portfolio.cs =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b4_Business/a1_Financial/a2_Accounting/Portfolio.cs,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** Portfolio.cs 9 Jan 2005 23:35:47 -0000 1.5 --- Portfolio.cs 4 Feb 2005 00:12:25 -0000 1.6 *************** *** 22,25 **** --- 22,26 ---- using System; + using System.Runtime.Serialization; using System.Collections; using System.Diagnostics; *************** *** 41,44 **** --- 42,49 ---- { } + public Portfolio(SerializationInfo info, StreamingContext context) + : base(info, context) + { + } public Position GetPosition( Instrument instrument ) |
|
From: Marco M. <mi...@us...> - 2005-02-04 00:10:35
|
Update of /cvsroot/quantproject/QuantProject/b4_Business/a07_DataProviders In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv6857/b4_Business/a07_DataProviders Modified Files: HistoricalEndOfDayDataStreamer.cs Log Message: Added [field:NonSerialized] attribute to event in order to achieve deserialization Index: HistoricalEndOfDayDataStreamer.cs =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b4_Business/a07_DataProviders/HistoricalEndOfDayDataStreamer.cs,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** HistoricalEndOfDayDataStreamer.cs 30 Jan 2005 19:57:38 -0000 1.4 --- HistoricalEndOfDayDataStreamer.cs 4 Feb 2005 00:10:25 -0000 1.5 *************** *** 106,110 **** this.tickers.Add( ticker , 1 ); } ! public event NewQuoteEventHandler NewQuote; --- 106,110 ---- this.tickers.Add( ticker , 1 ); } ! [field:NonSerialized] public event NewQuoteEventHandler NewQuote; |
|
From: Marco M. <mi...@us...> - 2005-02-04 00:10:35
|
Update of /cvsroot/quantproject/QuantProject/b5_Presentation In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv6857/b5_Presentation Modified Files: b5_Presentation.csproj Log Message: Added [field:NonSerialized] attribute to event in order to achieve deserialization Index: b5_Presentation.csproj =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b5_Presentation/b5_Presentation.csproj,v retrieving revision 1.18 retrieving revision 1.19 diff -C2 -d -r1.18 -r1.19 *** b5_Presentation.csproj 3 Feb 2005 00:30:39 -0000 1.18 --- b5_Presentation.csproj 4 Feb 2005 00:10:26 -0000 1.19 *************** *** 188,191 **** --- 188,196 ---- /> <File + RelPath = "Reporting\WindowsForm\Report.resx" + DependentUpon = "Report.cs" + BuildAction = "EmbeddedResource" + /> + <File RelPath = "Reporting\WindowsForm\ReportGrid.cs" SubType = "Component" |
|
From: Marco M. <mi...@us...> - 2005-02-04 00:10:34
|
Update of /cvsroot/quantproject/QuantProject/b4_Business/a1_Financial/a3_Ordering In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv6857/b4_Business/a1_Financial/a3_Ordering Modified Files: HistoricalEndOfDayOrderExecutor.cs Log Message: Added [field:NonSerialized] attribute to event in order to achieve deserialization Index: HistoricalEndOfDayOrderExecutor.cs =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b4_Business/a1_Financial/a3_Ordering/HistoricalEndOfDayOrderExecutor.cs,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** HistoricalEndOfDayOrderExecutor.cs 30 Jan 2005 19:57:38 -0000 1.4 --- HistoricalEndOfDayOrderExecutor.cs 4 Feb 2005 00:10:25 -0000 1.5 *************** *** 48,52 **** this.historicalQuoteProvider = historicalQuoteProvider; } ! public event OrderFilledEventHandler OrderFilled; --- 48,52 ---- this.historicalQuoteProvider = historicalQuoteProvider; } ! [field:NonSerialized] public event OrderFilledEventHandler OrderFilled; |
|
From: Marco M. <mi...@us...> - 2005-02-04 00:10:34
|
Update of /cvsroot/quantproject/QuantProject/b4_Business/a05_Timing In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv6857/b4_Business/a05_Timing Modified Files: HistoricalEndOfDayTimer.cs Log Message: Added [field:NonSerialized] attribute to event in order to achieve deserialization Index: HistoricalEndOfDayTimer.cs =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b4_Business/a05_Timing/HistoricalEndOfDayTimer.cs,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** HistoricalEndOfDayTimer.cs 30 Jan 2005 19:57:38 -0000 1.6 --- HistoricalEndOfDayTimer.cs 4 Feb 2005 00:10:24 -0000 1.7 *************** *** 53,61 **** // set { this.endDateTime = value; } // } ! public event MarketOpenEventHandler MarketOpen; ! public event FiveMinutesBeforeMarketCloseEventHandler FiveMinutesBeforeMarketClose; ! public event MarketCloseEventHandler MarketClose; ! public event OneHourAfterMarketCloseEventHandler OneHourAfterMarketClose; public HistoricalEndOfDayTimer( EndOfDayDateTime startDateTime ) --- 53,64 ---- // set { this.endDateTime = value; } // } ! [field:NonSerialized] public event MarketOpenEventHandler MarketOpen; ! [field:NonSerialized] ! public event FiveMinutesBeforeMarketCloseEventHandler FiveMinutesBeforeMarketClose; ! [field:NonSerialized] ! public event MarketCloseEventHandler MarketClose; ! [field:NonSerialized] ! public event OneHourAfterMarketCloseEventHandler OneHourAfterMarketClose; public HistoricalEndOfDayTimer( EndOfDayDateTime startDateTime ) |
|
From: Marco M. <mi...@us...> - 2005-02-04 00:08:09
|
Update of /cvsroot/quantproject/QuantProject/b7_Scripts In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv6108/b7_Scripts Modified Files: b7_Scripts.csproj Log Message: Added ShowReportFromFile class to view report from file (containing at the moment only serialized account). The Class Position in scripts project is just temporary Index: b7_Scripts.csproj =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b7_Scripts/b7_Scripts.csproj,v retrieving revision 1.19 retrieving revision 1.20 diff -C2 -d -r1.19 -r1.20 *** b7_Scripts.csproj 30 Jan 2005 19:53:13 -0000 1.19 --- b7_Scripts.csproj 4 Feb 2005 00:07:56 -0000 1.20 *************** *** 117,120 **** --- 117,125 ---- BuildAction = "Compile" /> + <File + RelPath = "CallingReportsForRunnedScripts\ShowReportFromFile.cs" + SubType = "Code" + BuildAction = "Compile" + /> <Folder RelPath = "MultiTesting\MultiTestOneRank\" /> <File |
|
From: Marco M. <mi...@us...> - 2005-02-04 00:08:06
|
Update of /cvsroot/quantproject/QuantProject/b7_Scripts/CallingReportsForRunnedScripts In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv6108/b7_Scripts/CallingReportsForRunnedScripts Added Files: ShowReportFromFile.cs Log Message: Added ShowReportFromFile class to view report from file (containing at the moment only serialized account). The Class Position in scripts project is just temporary --- NEW FILE: ShowReportFromFile.cs --- /* QuantProject - Quantitative Finance Library ShowReportFromFile.cs Copyright (C) 2003 Marco Milletti This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ using System; using QuantProject.Scripts; using QuantProject.Business.Timing; using QuantProject.Business.Financial.Accounting; using QuantProject.Business.DataProviders; using QuantProject.ADT.FileManaging; using QuantProject.Presentation.Reporting.WindowsForm; namespace QuantProject.Scripts.CallingReportsForRunnedScripts { public class ShowReportFromFile { public ShowReportFromFile() { } public static void ShowReportFromSerializedAccount(string serializedAccountFullPath) { try { Account account = (Account)ObjectArchiver.Extract(serializedAccountFullPath); Report report = new Report(account, new HistoricalAdjustedQuoteProvider()); report.Show("CtcPortfolio",3, new EndOfDayDateTime(new DateTime(2000,1,20), EndOfDaySpecificTime.MarketClose), "^MIBTEL"); } catch(System.Exception ex) { System.Windows.Forms.MessageBox.Show(ex.ToString()); } } } } |
|
From: Marco M. <mi...@us...> - 2005-02-04 00:03:04
|
Update of /cvsroot/quantproject/QuantProject/b1_ADT/FileManaging In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv4618/b1_ADT/FileManaging Modified Files: ObjectArchiver.cs Log Message: Fixed bugs and simplified code Index: ObjectArchiver.cs =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b1_ADT/FileManaging/ObjectArchiver.cs,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** ObjectArchiver.cs 30 Jan 2005 19:55:36 -0000 1.1 --- ObjectArchiver.cs 4 Feb 2005 00:02:53 -0000 1.2 *************** *** 34,110 **** public class ObjectArchiver { ! private static Stream stream; ! private static BinaryFormatter formatter; ! private static Object archive; ! private static string fileName; ! private static string directoryPath; public static void Archive(Object objectToArchive, ! string fileName, ! string directoryPath) { ! ! try ! { ! ObjectArchiver.archive = objectToArchive; ! ObjectArchiver.setDiskPosition(fileName, directoryPath); ! ObjectArchiver.setVariables(); ! ObjectArchiver.formatter.Serialize(ObjectArchiver.stream, ! objectToArchive); ! } ! catch(Exception ex) ! { ! System.Windows.Forms.MessageBox.Show(ex.ToString()); ! } ! ! finally ! { ! ObjectArchiver.stream.Close(); } ! ! ! } ! ! private static void setDiskPosition(string fileName, ! string directoryPath) ! { ! ObjectArchiver.fileName = fileName; ! ObjectArchiver.directoryPath = directoryPath; ! ! } ! private static void setVariables() ! { ! ObjectArchiver.stream = new FileStream( ! ObjectArchiver.directoryPath + ! ObjectArchiver.fileName, ! FileMode.Create, ! FileAccess.Write, ! FileShare.None); ! ObjectArchiver.formatter = new BinaryFormatter(); ! } ! ! public static object Extract(string fileName, ! string directoryPath) { ! try ! { ! ObjectArchiver.setDiskPosition(fileName, directoryPath); ! ObjectArchiver.setVariables(); ! return ObjectArchiver.formatter.Deserialize(ObjectArchiver.stream); ! } ! catch(Exception ex) ! { ! System.Windows.Forms.MessageBox.Show(ex.ToString()); ! return new Object(); //just to avoid compiling error ! //throw new Exception("Extracting object failed!"); ! } ! finally ! { ! ObjectArchiver.stream.Close(); ! } } - } --- 34,82 ---- public class ObjectArchiver { ! private static Stream stream; ! private static BinaryFormatter formatter = ! new BinaryFormatter(); public static void Archive(Object objectToArchive, ! string fullPath) { ! try ! { ! ObjectArchiver.stream = new FileStream( ! fullPath, ! FileMode.Create, ! FileAccess.Write, ! FileShare.None); ! ! ObjectArchiver.formatter.Serialize(ObjectArchiver.stream, ! objectToArchive); } ! finally ! { ! ObjectArchiver.stream.Close(); ! } } ! ! ! public static object Extract(string fullPath) { ! object returnValue = null; ! ! try ! { ! ObjectArchiver.stream = new FileStream( ! fullPath, ! FileMode.Open, ! FileAccess.Read, ! FileShare.None); ! returnValue = ObjectArchiver.formatter.Deserialize(stream); ! } ! finally ! { ! ObjectArchiver.stream.Close(); ! } ! return returnValue; } } |