public IMarketProvider GetCbr() { string connection = "Host = localhost; Username =postgres; Password =roman; Database =MIR"; #region mapping mir_cbr DataProvider.Input.MirReader.Mapping mapping2 = new DataProvider.Input.MirReader.Mapping(); mapping2.AI = new Dictionary <Enum, string>() { #region Финансовые инструменты { FinType.Equity, "12" }, { FinType.Bond, "13" }, { FinType.Fund, "14" }, { FinType.Certificate, "15" }, { FinType.DepositaryReceipt, "16" }, { FinType.Default, "20" }, { TimeSeriesAttribute.Close, "3" }, { ScalarAttribute.Name, "4" }, { ScalarAttribute.Nominal, "9" }, { ScalarAttribute.MatDate, "11" }, { ScalarAttribute.Currency, "8" }, { Currencies.CHF, "CHF" }, { Currencies.EUR, "EUR" }, { Currencies.USD, "USD" } #endregion }; mapping2.TKE = new Dictionary <KeyValuePair <Type, string>, Enum>() { #region Валюта { new KeyValuePair <Type, string>(typeof(Currencies), "CHF"), Currencies.CHF }, { new KeyValuePair <Type, string>(typeof(Currencies), "EUR"), Currencies.EUR }, { new KeyValuePair <Type, string>(typeof(Currencies), "GBP"), Currencies.GBP }, { new KeyValuePair <Type, string>(typeof(Currencies), "RUB"), Currencies.RUB }, { new KeyValuePair <Type, string>(typeof(Currencies), "RUR"), Currencies.RUB }, { new KeyValuePair <Type, string>(typeof(Currencies), "USD"), Currencies.USD }, #endregion #region Фин.инструменты { new KeyValuePair <Type, string>(typeof(FinType), "CERTIFICATE"), FinType.Certificate }, { new KeyValuePair <Type, string>(typeof(FinType), "DEPOSITARY RECEIPT"), FinType.DepositaryReceipt }, { new KeyValuePair <Type, string>(typeof(FinType), "BOND"), FinType.Bond }, { new KeyValuePair <Type, string>(typeof(FinType), "EQUITY"), FinType.Equity }, { new KeyValuePair <Type, string>(typeof(FinType), "FUND"), FinType.Fund }, { new KeyValuePair <Type, string>(typeof(FinType), "FX_RATE"), FinType.FxRate }, { new KeyValuePair <Type, string>(typeof(FinType), "PERCENT_CURVE"), FinType.PercentCurve }, #endregion }; mapping2.ET = new Dictionary <Enum, Type>() { { ScalarAttribute.DetailedType, typeof(FinTypeDetailedLevel) }, { ScalarAttribute.Currency, typeof(Currencies) }, { ScalarAttribute.FinType, typeof(FinType) }, }; Dictionary <string, object> sq2 = new Dictionary <string, object>() { { DataProvider.Input.MirReader.Provider.QUOTE, "CBR" }, { DataProvider.Input.MirReader.Provider.SCALAR, "CBR" }, }; #endregion DataProvider.Input.MirReader.Provider CbrProvider = new DataProvider.Input.MirReader.Provider(connection, mapping2); CbrProvider.SetParams(sq2); return(CbrProvider); }
public IMarketProvider GetMoex() { string connection = ConfigurationManager.AppSettings["mirconnection"]; #region mapping mir_moex DataProvider.Input.MirReader.Mapping mapping = new DataProvider.Input.MirReader.Mapping(); mapping.AI = new Dictionary <Enum, string>() { #region Финансовые инструменты { FinType.Equity, "12" }, { FinType.Bond, "13" }, { FinType.Fund, "14" }, { FinType.Certificate, "15" }, { FinType.DepositaryReceipt, "16" }, { FinType.Default, "20" }, { TimeSeriesAttribute.Close, "3" }, { ScalarAttribute.Name, "4" }, { ScalarAttribute.Nominal, "9" }, { ScalarAttribute.MatDate, "11" }, { ScalarAttribute.Currency, "8" }, { ScalarAttribute.DetailedType, "6" }, #endregion }; mapping.TKE = new Dictionary <KeyValuePair <Type, string>, Enum>() { #region Валюта { new KeyValuePair <Type, string>(typeof(Currencies), "CHF"), Currencies.CHF }, { new KeyValuePair <Type, string>(typeof(Currencies), "EUR"), Currencies.EUR }, { new KeyValuePair <Type, string>(typeof(Currencies), "GBP"), Currencies.GBP }, { new KeyValuePair <Type, string>(typeof(Currencies), "RUB"), Currencies.RUB }, { new KeyValuePair <Type, string>(typeof(Currencies), "RUR"), Currencies.RUB }, { new KeyValuePair <Type, string>(typeof(Currencies), "USD"), Currencies.USD }, #endregion #region Фин.инструменты { new KeyValuePair <Type, string>(typeof(FinType), "CERTIFICATE"), FinType.Certificate }, { new KeyValuePair <Type, string>(typeof(FinType), "DEPOSITARY RECEIPT"), FinType.DepositaryReceipt }, { new KeyValuePair <Type, string>(typeof(FinType), "BOND"), FinType.Bond }, { new KeyValuePair <Type, string>(typeof(FinType), "EQUITY"), FinType.Equity }, { new KeyValuePair <Type, string>(typeof(FinType), "FUND"), FinType.Fund }, { new KeyValuePair <Type, string>(typeof(FinType), "FX_RATE"), FinType.FxRate }, { new KeyValuePair <Type, string>(typeof(FinType), "PERCENT_CURVE"), FinType.PercentCurve }, #endregion #region Детализированный уровень { new KeyValuePair <Type, string>(typeof(FinTypeDetailedLevel), "ORDINARY_EQUITY"), FinTypeDetailedLevel.OrdinaryStock }, { new KeyValuePair <Type, string>(typeof(FinTypeDetailedLevel), "CORPORATE_BOND"), FinTypeDetailedLevel.CorporateBond }, { new KeyValuePair <Type, string>(typeof(FinTypeDetailedLevel), "ETF"), FinTypeDetailedLevel.ETF }, { new KeyValuePair <Type, string>(typeof(FinTypeDetailedLevel), "PREFERRED_EQUITY"), FinTypeDetailedLevel.PreferredStock }, { new KeyValuePair <Type, string>(typeof(FinTypeDetailedLevel), "FEDERAL_LOAN_BOND"), FinTypeDetailedLevel.FederalLoanBond }, { new KeyValuePair <Type, string>(typeof(FinTypeDetailedLevel), "PIE_OF_CLOSED_MUTUAL_FUND"), FinTypeDetailedLevel.PieOfClosedMutualFund }, { new KeyValuePair <Type, string>(typeof(FinTypeDetailedLevel), "PIE_OF_INTERVAL_MUTUAL_FUND"), FinTypeDetailedLevel.PieOfIntervalMutualFund }, { new KeyValuePair <Type, string>(typeof(FinTypeDetailedLevel), "REGIONAL_BOND"), FinTypeDetailedLevel.RegionalBond }, { new KeyValuePair <Type, string>(typeof(FinTypeDetailedLevel), "PIE_OF_OPENED_MUTUAL_FUND"), FinTypeDetailedLevel.PieOfOpenedMutualFund }, { new KeyValuePair <Type, string>(typeof(FinTypeDetailedLevel), "MFO_BOND"), FinTypeDetailedLevel.MfoBond }, { new KeyValuePair <Type, string>(typeof(FinTypeDetailedLevel), "EXCHANGE_TRADED_BOND"), FinTypeDetailedLevel.ExchangeTradedBond }, { new KeyValuePair <Type, string>(typeof(FinTypeDetailedLevel), "MORTGAGE_CERTIFICATE"), FinTypeDetailedLevel.MortgageCertificate }, { new KeyValuePair <Type, string>(typeof(FinTypeDetailedLevel), "MUNICIPAL_BOND"), FinTypeDetailedLevel.MunicipalBond }, { new KeyValuePair <Type, string>(typeof(FinTypeDetailedLevel), "CLEARING_PARTICIPATION_CERTIFICATE"), FinTypeDetailedLevel.ClearingParticipationCertificate }, { new KeyValuePair <Type, string>(typeof(FinTypeDetailedLevel), "DEPOSITARY_RECEIPT"), FinTypeDetailedLevel.DepositaryReceipt }, #endregion }; mapping.ET = new Dictionary <Enum, Type>() { { ScalarAttribute.DetailedType, typeof(FinTypeDetailedLevel) }, { ScalarAttribute.Currency, typeof(Currencies) }, { ScalarAttribute.FinType, typeof(FinType) }, }; Dictionary <string, object> sq = new Dictionary <string, object>() { { DataProvider.Input.MirReader.Provider.QUOTE, "MOEX" }, { DataProvider.Input.MirReader.Provider.SCALAR, "MOEX" }, }; #endregion DataProvider.Input.MirReader.Provider MoexProvider = new DataProvider.Input.MirReader.Provider(connection, mapping); MoexProvider.SetParams(sq); return(MoexProvider); }