Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CrossDataTable #39

Closed
GoogleCodeExporter opened this issue Dec 25, 2015 · 5 comments
Closed

CrossDataTable #39

GoogleCodeExporter opened this issue Dec 25, 2015 · 5 comments

Comments

@GoogleCodeExporter
Copy link
Contributor

Hi Maas,
is possible for you to re-add the CrossDataTable function in?:
MassOne.Finance.YahooFinance.Support.ExchangeRAteCalculator


function:

        /// <summary>
        /// Returns a data table where every available currency is value converted to each other
        /// </summary>
        /// <param name="firstColumnName">The text in the left edge of the column header</param>
        /// <param name="items">The exchange items. Every exchange item must have the same base currency.</param>
        /// <returns></returns>
        /// <remarks></remarks>
        public static System.Data.DataTable CrossDataTable(IEnumerable<Support.ExchangeRateData> items, string firstColumnName = "")
        {
            System.Data.DataTable dt = new System.Data.DataTable();
            if (items != null)
            {
                dt.Columns.Add(firstColumnName, typeof(string));
                foreach (Support.ExchangeRateData curX in items)
                {
                    if (curX != null)
                        dt.Columns.Add(curX.CurrencyRelation.DepCurrency.ID, typeof(double));
                }
                foreach (Support.ExchangeRateData curY in items)
                {
                    if (curY != null)
                    {
                        System.Data.DataRow row = dt.NewRow();
                        row[0] = curY.CurrencyRelation.DepCurrency.ID;
                        foreach (Support.ExchangeRateData curX in items)
                        {
                            if (curX != null)
                                row[curX.CurrencyRelation.DepCurrency.ID] = Math.Round(Support.ExchangeRateCalculator.ConvertCurrency(1, curY, curX), 4);
                        }
                        dt.Rows.Add(row);
                    }
                }
            }
            return dt;
        }

Regards, Angel

Original issue reported on code.google.com by i...@advancedcomputing.ch on 21 Mar 2012 at 5:15

@GoogleCodeExporter
Copy link
Contributor Author

Is it such a problem for you to implement these few lines of code in your 
library?
I want to remove the DataTable support in whole lib.

greetz

Maas

Original comment by Maas...@gmail.com on 22 Mar 2012 at 2:44

  • Changed state: Started

@GoogleCodeExporter
Copy link
Contributor Author

No problem, ... done.

Angel

Original comment by i...@advancedcomputing.ch on 22 Mar 2012 at 5:04

@GoogleCodeExporter
Copy link
Contributor Author

Did you often used the other DataTable converter functions?

Maas

Original comment by Maas...@gmail.com on 22 Mar 2012 at 5:44

@GoogleCodeExporter
Copy link
Contributor Author

Hi maas, no I've used only this funct.
Thanks

Angel

Original comment by i...@advancedcomputing.ch on 22 Mar 2012 at 10:07

@GoogleCodeExporter
Copy link
Contributor Author

Original comment by Maas...@gmail.com on 30 Apr 2012 at 12:48

  • Changed state: Done

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant