albert95  | Pour ce post, je vais être un peu long, parce que le sujet me paraît complexe et il me semble quil nécessite quelques explications sur ma démarche.
   Je remercie par avance ceux et celles qui voudront bien prendre le temps de lire et essayer de mapporter des solutions.
   Jai deux questions à poser :
   A/ comment fonctionne 
   _datere = new RE("^([\\d]+)-([\\w]+)-([\\d]+)" ); 
 stringbuffer.append("http://chart.yahoo.com/table.csv?s=" );
     B/ comment créer une interopérabilité avec un package non standard ? 
       A/ comment fonctionne la chaîne de caractères 
   suite à la recommendation de esox_ch, j'ai travaillé sur regex.
      Je commence à comprendre lutilisation de regex avec la liste des classes prédéfinies et les Méta caractères
   _datere = new RE("^([\\d]+)-([\\w]+)-([\\d]+)" ); 
   http://cyberzoide.developpez.com/java/regex/regex.pdf
   Jai un code en exemple où il est écrit (1/YahooUSHistoricLoader)
  :
  Citation :
 
 
 private static RE getDateRE()
     {
         if(_datere == null)
             try
             {
                 _datere = new RE("^([\\d]+)-([\\w]+)-([\\d]+)" );
             }
             catch(RESyntaxException resyntaxexception)
             {
                 System.err.println(resyntaxexception);
             }
         return _datere;
     }
 
   |  
 
   Quoique, il semble quen principe, il devrait y avoir    
  Citation :
 
 
 Pattern
 Représentation compilée dun motif.
 et
 Matcher
 Moteur de recherche dun motif dans une chaîne de
 caractères.
 
   |  
 
   Il ny a rien de tout cela dans                   Citation :
 
      _datere = new RE("^([\\d]+)-([\\w]+)-([\\d]+)" );
 stringbuffer.append("http://chart.yahoo.com/table.csv?s=" );
 
   |  
 
   Dans ce code qui me sert dexemple, tiré dun.jar décompilé qui fonctionne, je ne comprends pas le fonctionnement de        
  Citation :
 
 
  stringbuffer.append("http://chart.yahoo.com/table.csv?s=" );
 
   |  
 
   Si StringBuffer.append() Ajoute à la fin une chaîne représentant la valeur de l'argument
 et si ladresse URL est une chaîne de caractères, alors ce code 1/YahooUSHistoricLoader devrait fonctionner avec sa super classe 2/BaseYahooLoader
     B/ comment créer une interopérabilité avec un package non standard ? 
   je ne peux pas vérifier cette procédure, parce que 2/ BaseYahooLoader fait appel à un package non standard : import robotrader.market.HistoricData;
 je ne sais pas comment les rendre inter-opérables.   Il nest pas nécessaire de créer un CLASSPATH puisque le .jar fonctionne sans rien ajouter  au CLASSPATH, mais alors, comment ça marche ??
   http://robotrader.sourceforge.net/
   Robotrader est une petite merveille, à la fois pour la programmation java, mais aussi pour lapplication en back-test des stratégies de trading
   1/YahooUSHistoricLoader
  
  Citation :
 
 
   import java.io.File;
 import java.io.PrintStream;
 import java.text.SimpleDateFormat;
 import java.util.List;
 import org.apache.regexp.RE;
 import org.apache.regexp.RESyntaxException;
   // Referenced classes of package robotrader.quotedb.web:
 //            BaseYahooLoader
   public class YahooUSHistoricLoader extends BaseYahooLoader
 {
       public YahooUSHistoricLoader()
     {
     }
       public static void main(String args[])
     {
         String s = "MSFT";
         String s1 = "20021231";
         String s2 = "20030115";
         YahooUSHistoricLoader yahooushistoricloader = new YahooUSHistoricLoader();
         System.out.println("url: " + yahooushistoricloader.makeUrlString(s, s1, s2));
         try
         {
             File file = new File("conf/msft.www58454.tmp" );
             List list = yahooushistoricloader.parseFile("MSFT", file);
             System.out.println("nbr quotes loaded: " + list.size());
         }
         catch(Exception exception)
         {
             exception.printStackTrace();
         }
     }
       protected String makeUrlString(String s, String s1, String s2)
     {
         StringBuffer stringbuffer = new StringBuffer();
         stringbuffer.append("http://chart.yahoo.com/table.csv?s=" );
         stringbuffer.append(s);
         stringbuffer.append("&a=" );
         stringbuffer.append(BaseYahooLoader.zeroBased(s1.substring(4, 6)));
         stringbuffer.append("&b=" );
         stringbuffer.append(BaseYahooLoader.zeroBased(s1.substring(6, 8)));
         stringbuffer.append("&c=" );
         stringbuffer.append(s1.substring(0, 4));
         stringbuffer.append("&d=" );
         stringbuffer.append(BaseYahooLoader.zeroBased(s2.substring(4, 6)));
         stringbuffer.append("&e=" );
         stringbuffer.append(BaseYahooLoader.zeroBased(s2.substring(6, 8)));
         stringbuffer.append("&f=" );
         stringbuffer.append(s2.substring(0, 4));
         stringbuffer.append("&g=d&y=0&z=" );
         stringbuffer.append(s);
         stringbuffer.append("&ignore=.csv" );
         return stringbuffer.toString();
     }
       private static RE getDateRE()
     {
         if(_datere == null)
             try
             {
                 _datere = new RE("^([\\d]+)-([\\w]+)-([\\d]+)" );
             }
             catch(RESyntaxException resyntaxexception)
             {
                 System.err.println(resyntaxexception);
             }
         return _datere;
     }
       protected String transformDate(String s)
     {
         if(getDateRE().match(s))
         {
             StringBuffer stringbuffer = new StringBuffer();
             String s1 = getDateRE().getParen(1);
             if(s1.length() == 1)
                 stringbuffer.append("0" );
             stringbuffer.append(s1);
             String s2 = getDateRE().getParen(2);
             if(s2.equals("Jan" ))
                 stringbuffer.append("01" );
             else
             if(s2.equals("Feb" ))
                 stringbuffer.append("02" );
             else
             if(s2.equals("Mar" ))
                 stringbuffer.append("03" );
             else
             if(s2.equals("Apr" ))
                 stringbuffer.append("04" );
             else
             if(s2.equals("May" ))
                 stringbuffer.append("05" );
             else
             if(s2.equals("Jun" ))
                 stringbuffer.append("06" );
             else
             if(s2.equals("Jul" ))
                 stringbuffer.append("07" );
             else
             if(s2.equals("Aug" ))
                 stringbuffer.append("08" );
             else
             if(s2.equals("Sep" ))
                 stringbuffer.append("09" );
             else
             if(s2.equals("Oct" ))
                 stringbuffer.append("10" );
             else
             if(s2.equals("Nov" ))
                 stringbuffer.append("11" );
             else
             if(s2.equals("Dec" ))
                 stringbuffer.append("12" );
             String s3 = getDateRE().getParen(3);
             stringbuffer.append(s3);
             return stringbuffer.toString();
         } else
         {
             return null;
         }
     }
       public String toString()
     {
         return "Yahoo US";
     }
       private static RE _re;
     private static RE _datere;
     private static SimpleDateFormat _yahoodf = new SimpleDateFormat("ddMMyy" );
   }
 
   |  
 
   2/ BaseYahooLoader
  
  Citation :
 
 
   import java.io.*;
 import java.net.URL;
 import java.text.SimpleDateFormat;
 import java.util.ArrayList;
 import java.util.List;
 import org.apache.regexp.RE;
 import org.apache.regexp.RESyntaxException;
 import robotrader.market.HistoricData;
   // Referenced classes of package robotrader.quotedb.web:
 //            IQuotesLoader, HttpLoader
   public abstract class BaseYahooLoader
     implements IQuotesLoader
 {
       public BaseYahooLoader()
     {
     }
       protected abstract String makeUrlString(String s, String s1, String s2);
       protected static final String zeroBased(String s)
     {
         return Integer.toString(Integer.parseInt(s) - 1);
     }
       public final List loadQuotes(String s, String s1, String s2)
     {
         String s3 = makeUrlString(s, s1, s2);
         try
         {
             File file = HttpLoader.load(new URL(s3));
             return parseFile(s, file);
         }
         catch(Exception exception)
         {
             exception.printStackTrace();
         }
         return null;
     }
       protected final List parseFile(String s, File file)
         throws IOException
     {
         BufferedReader bufferedreader = new BufferedReader(new FileReader(file));
         String s1 = bufferedreader.readLine();
         if(s1 == null)
             throw new IOException("empty file found : " + file.getPath());
         ArrayList arraylist = new ArrayList();
         while((s1 = bufferedreader.readLine()) != null)           {
             HistoricData historicdata = parseLine(s, s1);
             if(historicdata != null)
                 arraylist.add(0, historicdata);
         }
         return arraylist;
     }
       protected final HistoricData parseLine(String s, String s1)
     {
         s1.trim();
         if(getRE().match(s1))
             try
             {
                 HistoricData historicdata = new HistoricData(s, _yahoodf.parse(transformDate(getRE().getParen(1))), Float.parseFloat(getRE().getParen(2)), Float.parseFloat(getRE().getParen(3)), Float.parseFloat(getRE().getParen(4)), Float.parseFloat(getRE().getParen(5)), Float.parseFloat(getRE().getParen(6)));
                 return historicdata;
             }
             catch(Exception exception)
             {
                 System.out.println("error at line :" + s1);
                 exception.printStackTrace();
                 return null;
             }
         else
             return null;
     }
       private static final RE getRE()
     {
         if(_re == null)
             try
             {
                 _re = new RE("^([^,]+),([\\d.]+),([\\d.]+),([\\d.]+),([\\d.]+),([\\d]+)" );
             }
             catch(RESyntaxException resyntaxexception)
             {
                 System.err.println(resyntaxexception);
             }
         return _re;
     }
       protected abstract String transformDate(String s);
       public final String getStatus()
     {
         if(HttpLoader.getContentLength() == 0)
             return "connecting";
         if(HttpLoader.getContentLength() < 0)
             return "loading... " + HttpLoader.getLoaded() + " bytes so far...";
         else
             return "loading: " + HttpLoader.getLoaded() + "/" + HttpLoader.getContentLength();
     }
       private static SimpleDateFormat _yahoodf = new SimpleDateFormat("ddMMyy" );
     private static RE _re;
   }
  
 
   |  
 
     Voilà, j'espère ne pas avoir été trop long et si vous pouviez maider, je vous en serais très reconnaissant
     albert
    
     |