// ************************************************************
        // CONSTRUCTOR
        // ************************************************************


        public HistoricalDataRequest(IDtoken Id_, List <string> Fields_, DateTime StartDate_, DateTime EndDate_,
                                     TimeUnit Periodicity_, string Source_)

            : base(Id_: Id_, Fields_: Fields_, StartDate_: StartDate_,
                   EndDate_: EndDate_, Periodicity_: Periodicity_, Source_: Source_)
        {
        }
Exemple #2
0
        // ************************************************************
        // METHODS -- TO GET EOD PRICES
        // ************************************************************

        public myFrame EndOfDay(IDtoken IdToken, List <string> LocalFields, DateTime StartDate, DateTime EndDate, TimeUnit Periodicity, String Source)
        {
            // 1. Formulate Request
            HistoricalDataRequest myRequest = new HistoricalDataRequest(IdToken, LocalFields, StartDate, EndDate, Periodicity, Source);

            // 2. Send request to Database Helper
            myFrame localData = _myDBhelper.GetEODPrices(myRequest);

            // 3. Return
            return(localData);
        }
        public Dictionary <string, string> GetExternalIdentifiers(DBID DBID_)
        {
            myDB_Connector dbCom   = new myDB_Connector();
            IDtoken        refLine = dbCom.Reference(DBID_);

            Dictionary <string, string> result = new Dictionary <string, string>();

            foreach (string s in refLine.GetExternalIdentifiers())
            {
                result[s] = (string)refLine[s];
            }


            return(result);
        }
Exemple #4
0
        public static IDtoken GenerateDBID(DBID ReferenceDBID, string Bloomberg = "", string Reuters = "", string Sophis = "",
                                           string MSD  = "", string MarketMap = "", string Markit = "",
                                           string FRED = "", string Yahoo     = "", string Google = "", string ISIN = "")
        {
            Dictionary <string, string> _extIds = new Dictionary <string, string>()
            {
                { "Bloomberg", Bloomberg.ToUpper() }, // Careful with the upper/lower case...
                { "Reuters", Reuters },
                { "Sophis", Sophis },
                { "MSD", MSD },
                { "MarketMap", MarketMap },
                { "Markit", Markit },
                { "FRED", FRED },
                { "Yahoo", Yahoo },
                { "Google", Google },
                { "ISIN", ISIN }
            };


            // Create container for potential matching lines
            // List<IDtoken> results = new List<IDtoken>();

            // Load Reference Manager (singleton)
            ReferenceManager _referenceManager = ReferenceManager.Factory;

            // Get a new DBID from Reference Manager (= max of column DBID + 1)
            DBID newDBID = _referenceManager.GetNewDBID();

            // Replace DBID from existing token
            IDtoken refToken = TokenFactory.New(ReferenceDBID);

            // New token for output
            IDtoken newToken = new IDtoken();

            newToken.SetDBID(newDBID);

            // Replace all sources
            foreach (string source in _extIds.Keys)
            {
                newToken[source] = _extIds[source];
            }

            // Return the new token
            return(newToken);
        }
        public void InsertReferenceLine(IDtoken newRefLine)
        {
            // Loop through the ref table in memory
            foreach (IDtoken line in referenceTable)
            {
                //Console.WriteLine("item:{0}", (int)line.DBID);
                if ((int)line["DBID"] == newRefLine.DBID)
                {
                    throw new System.ArgumentException("ReferenceManager", "DBID to be inserted is already in use.");
                }
            }

            referenceTable.Add(newRefLine);
            _SQLconnector.Insert <IDtoken>(newRefLine, new List <IDtoken>()
            {
                newRefLine
            }, includeDate: false);
        }
        public GenericDataRequest(IDtoken Id_, List <string> Fields_, DateTime StartDate_, DateTime EndDate_,
                                  TimeUnit Periodicity_ = TimeUnit.Days, string Source_ = "Bloomberg")
        {
            // Set the id token
            id = Id_;

            // Set the fields requested
            fields = Fields_;

            // Set start and end dates
            startDate = StartDate_;
            endDate   = EndDate_;

            // Set the data periodicity/frequency (optional)
            periodicity = Periodicity_;

            // Set the favorite source
            source = Source_;
        }
Exemple #7
0
 private string MapDatabase(IDtoken identification)
 {
     return("myDB");
 }
Exemple #8
0
 private string MapTable(IDtoken id)
 {
     return(id.HistoryTable);
 }
        public HistoricalDataRequest(IDtoken Id_)

            : this(Id_ : Id_, Fields_ : new List <string>(), StartDate_ : new DateTime(2013, 12, 31),
                   EndDate_ : DateTime.Today, Periodicity_ : TimeUnit.Days, Source_ : "Bloomberg")
        {
        }
        public HistoricalDataRequest(IDtoken Id_, DateTime StartDate_, DateTime EndDate_)

            : this(Id_ : Id_, Fields_ : new List <string>(), StartDate_ : StartDate_,
                   EndDate_ : EndDate_, Periodicity_ : TimeUnit.Days, Source_ : "Bloomberg")
        {
        }
Exemple #11
0
 public myFrame EndOfDay(IDtoken IdToken)
 {
     return(EndOfDay(IdToken, new List <string>(), new DateTime(2013, 12, 31), DateTime.Today, TimeUnit.Days, ""));
 }
Exemple #12
0
 public myFrame EndOfDay(IDtoken IdToken, List <string> LocalFields)
 {
     return(EndOfDay(IdToken, LocalFields, new DateTime(2013, 12, 31), DateTime.Today, TimeUnit.Days, ""));
 }
Exemple #13
0
 public myFrame EndOfDay(IDtoken IdToken, DateTime ObsDate)
 {
     return(EndOfDay(IdToken, new List <string>(), ObsDate, ObsDate, TimeUnit.Days, ""));
 }
Exemple #14
0
 public myFrame EndOfDay(IDtoken IdToken, List <string> LocalFields, DateTime StartDate)
 {
     return(EndOfDay(IdToken, LocalFields, StartDate, DateTime.Today, TimeUnit.Days, ""));
 }
Exemple #15
0
 public myFrame EndOfDay(IDtoken IdToken, List <string> LocalFields, DateTime StartDate, DateTime EndDate, TimeUnit Periodicity)
 {
     return(EndOfDay(IdToken, LocalFields, StartDate, EndDate, Periodicity, ""));
 }
Exemple #16
0
        public FundamentalDataRequest(IDtoken Id_, DateTime StartDate_)

            : this(Id_ : Id_, Fields_ : new List <string>(), StartDate_ : StartDate_,
                   EndDate_ : DateTime.Today, Periodicity_ : TimeUnit.Days, Source_ : "Bloomberg")
        {
        }