← 返回

Ошибка при попытке сохранить ордера и сделки с помощью SettingsStorage

Нужно сохранять ордера и сделки для среднесрочной стратегии Пробую делать вот так:


            storage = new SettingsStorage();
            
            var orderDictionary = new Dictionary<Order, IEnumerable<MyTrade>>();
            foreach (var order in Orders)
            {
                orderDictionary.Add(order, order.GetTrades());
            }
            if (storage.ContainsKey("Orders"))
                storage["Orders"] = orderDictionary;
            else
                storage.Add("Orders", orderDictionary);

            var xmlSerializer = new XmlSerializer<SettingsStorage>();
            xmlSerializer.Serialize(storage, Name + "_settings.xml");

xmlSerializer.Serialize выбрасывает Exception

"Resolution of the dependency failed, type = \"Ecng.Serialization.IStorage\", name = \"(none)\".\r\n
Exception occurred while: while resolving.\r\n
Exception is: InvalidOperationException - The current type, Ecng.Serialization.IStorage, is an interface and cannot be constructed. Are you missing a type mapping?\r\n
-----------------------------------------------\r\n
At the time of the exception, the container was:\r\n
\r\n
Resolving Ecng.Serialization.IStorage,(none)\r\n"

Exeption snaphsot: http://i.imgur.com/cIwbBMA.png

Данный способ подсмотрел вот тут: http://stocksharp.com/posts/m/26336/

Подскажите, пожалуйста, как с этим справиться?

本主题对您有帮助吗?

分享主题

评论 (0)

登录创建账户, 登录或注册以发表评论

暂无评论,成为第一个评论者!