← Zurück

ошибка при запуске BasketStrategy

код:

            BasketStrategy quote = new BasketStrategy(BasketStrategyFinishModes.All);
            quote.ChildStrategies.Add(quoter_1);
            quote.ChildStrategies.Add(quoter_2);
            this.ChildStrategies.Add(quote);

ошибка:

2012/10/10 19:54:34.203|Error |BS_SPBFUT006GJ|System.InvalidOperationException: Инструмент не инициализирован. at StockSharp.Algo.Strategies.Strategy.OnStarted() at StockSharp.Algo.Strategies.BasketStrategy.OnStarted() at StockSharp.Algo.Strategies.Strategy.#=qPumxDV5SBHuCYTq_cqUWVTizHkIhg6MP_9mOGwi1SYU=(ProcessStates #=qeRNChQaniV4oK7zWNidypQ==) В чем может быть дело?

War dieses Thema hilfreich?

Thema teilen

Kommentare (3)

Anmelden oder Konto erstellen, Melden Sie sich an oder registrieren Sie sich, um einen Kommentar zu hinterlassen

Alexander
Alexander

В том, что вы не инициализировали инструмент у BasketStrategy, как и написано в ошибке.

Ant.On.
Ant.On. Autor

спасибо за ответ! кстати, в примере про дельта хеджирование инструмент вроде тоже не инициализируется.. вообще какой он должен быть для BasketStrategy, если каждая дочерняя со своим работает? Возникла другая проблема (возможно не только с BasketStrategy) при добавлении дочерней стратегии в стратегию, где Trader=RealTimeEmulationTrader<QuikTrader> возникает такой exception. S# версия 4.1.3

System.ArgumentException was unhandled Message=An item with the same key has already been added. Source=mscorlib StackTrace: at System.ThrowHelper.ThrowArgumentException(ExceptionResource resource) at System.Collections.Generic.Dictionary2.Insert(TKey key, TValue value, Boolean add) at System.Collections.Generic.Dictionary2.Add(TKey key, TValue value) at Ecng.Collections.SynchronizedDictionary2.Add(TKey key, TValue value) at Ecng.Collections.CachedSynchronizedDictionary2.Add(TKey key, TValue value) at StockSharp.Algo.Slippage.SlippageManager.Register(Order order, Decimal estimatedPrice) at StockSharp.Algo.Slippage.SlippageManager.Register(Order order) at StockSharp.Algo.Strategies.Strategy.#=qAF$cAaWD8w6Sf0n2jICfhn3SnIpbRRHW0JdqTYJw4BU=.#=q6LA44T$FSqxi6oZ3W2ppWZVAK415i9fMe2wqeMO4F28=() at StockSharp.Algo.Strategies.Strategy.#=qfgs3t3F0QJo2uAeiNU2Ttpv2pumAF4y2coQRpub6uDk=.#=qg_9r_6HVmeb3crTgbQEYyZG1aCymBtmmqXvLAMXxG1s=() at StockSharp.Algo.Strategies.Strategy.#=qDi$TOxQqFULo7BC_ufyNgU4LgLgC6leIVgzHqovrf2Y=.#=qGOiRqrNYsm05dsneYckP8g==(Action #=qZ1RO65PUdyczAFAlB5vbMg==) at StockSharp.Algo.Strategies.Strategy.#=qE_CXVx3b6gFmJBM42_6QlA==(Action #=qWIPEEA7aG$_X1GVNHJoYng==) at StockSharp.Algo.Strategies.Strategy.AddOrder(Order order) at Ecng.Collections.CollectionHelper.ForEach(IEnumerable1 source, Action1 action) at StockSharp.Algo.Strategies.Strategy.#=qItQ_g_CJFenTf_DUQIRiSZ75O5671OlCK3jDT_6AHjs=.OnAdded(Strategy #=qLIZqpJfr9DarPEyQ3YDiyg==) at Ecng.Collections.BaseCollection2.Add(TItem item) at Ecng.Collections.SynchronizedCollection2.Add(TItem item) at Robostock.PairTrader.PutOnPT() in c:\tmp\AlgoTrading\S# 4.1.3 Src\Robostock\Robostock\PairTrader.cs:line 110 at Robostock.MainWindow.trade_Click(Object sender, RoutedEventArgs e) in c:\tmp\AlgoTrading\S# 4.1.3 Src\Robostock\Robostock\MainWindow.xaml.cs:line 201 at System.Windows.RoutedEventHandlerInfo.InvokeHandler(Object target, RoutedEventArgs routedEventArgs) at System.Windows.EventRoute.InvokeHandlersImpl(Object source, RoutedEventArgs args, Boolean reRaised) at System.Windows.UIElement.RaiseEventImpl(DependencyObject sender, RoutedEventArgs args) at System.Windows.UIElement.RaiseEvent(RoutedEventArgs e) at System.Windows.Controls.Primitives.ButtonBase.OnClick() at System.Windows.Controls.Button.OnClick() at System.Windows.Controls.Primitives.ButtonBase.OnMouseLeftButtonUp(MouseButtonEventArgs e) at System.Windows.UIElement.OnMouseLeftButtonUpThunk(Object sender, MouseButtonEventArgs e) at System.Windows.Input.MouseButtonEventArgs.InvokeEventHandler(Delegate genericHandler, Object genericTarget) at System.Windows.RoutedEventArgs.InvokeHandler(Delegate handler, Object target) at System.Windows.RoutedEventHandlerInfo.InvokeHandler(Object target, RoutedEventArgs routedEventArgs) at System.Windows.EventRoute.InvokeHandlersImpl(Object source, RoutedEventArgs args, Boolean reRaised) at System.Windows.UIElement.ReRaiseEventAs(DependencyObject sender, RoutedEventArgs args, RoutedEvent newEvent) at System.Windows.UIElement.OnMouseUpThunk(Object sender, MouseButtonEventArgs e) at System.Windows.Input.MouseButtonEventArgs.InvokeEventHandler(Delegate genericHandler, Object genericTarget) at System.Windows.RoutedEventArgs.InvokeHandler(Delegate handler, Object target) at System.Windows.RoutedEventHandlerInfo.InvokeHandler(Object target, RoutedEventArgs routedEventArgs) at System.Windows.EventRoute.InvokeHandlersImpl(Object source, RoutedEventArgs args, Boolean reRaised) at System.Windows.UIElement.RaiseEventImpl(DependencyObject sender, RoutedEventArgs args) at System.Windows.UIElement.RaiseTrustedEvent(RoutedEventArgs args) at System.Windows.UIElement.RaiseEvent(RoutedEventArgs args, Boolean trusted) at System.Windows.Input.InputManager.ProcessStagingArea() at System.Windows.Input.InputManager.ProcessInput(InputEventArgs input) at System.Windows.Input.InputProviderSite.ReportInput(InputReport inputReport) at System.Windows.Interop.HwndMouseInputProvider.ReportInput(IntPtr hwnd, InputMode mode, Int32 timestamp, RawMouseActions actions, Int32 x, Int32 y, Int32 wheel) at System.Windows.Interop.HwndMouseInputProvider.FilterMessage(IntPtr hwnd, WindowMessage msg, IntPtr wParam, IntPtr lParam, Boolean& handled) at System.Windows.Interop.HwndSource.InputFilterMessage(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled) at MS.Win32.HwndWrapper.WndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled) at MS.Win32.HwndSubclass.DispatcherCallbackOperation(Object o) at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs) at MS.Internal.Threading.ExceptionFilterHelper.TryCatchWhen(Object source, Delegate method, Object args, Int32 numArgs, Delegate catchHandler) at System.Windows.Threading.Dispatcher.InvokeImpl(DispatcherPriority priority, TimeSpan timeout, Delegate method, Object args, Int32 numArgs) at MS.Win32.HwndSubclass.SubclassWndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam) at MS.Win32.UnsafeNativeMethods.DispatchMessage(MSG& msg) at System.Windows.Threading.Dispatcher.PushFrameImpl(DispatcherFrame frame) at System.Windows.Threading.Dispatcher.PushFrame(DispatcherFrame frame) at System.Windows.Application.RunDispatcher(Object ignore) at System.Windows.Application.RunInternal(Window window) at System.Windows.Application.Run(Window window) at System.Windows.Application.Run() at Robostock.App.Main() in c:\tmp\AlgoTrading\S# 4.1.3 Src\Robostock\Robostock\obj\x86\Debug\App.g.cs:line 0 at System.AppDomain._nExecuteAssembly(RuntimeAssembly assembly, String[] args) at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args) at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly() at System.Threading.ThreadHelper.ThreadStart_Context(Object state) at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean ignoreSyncCtx) at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state) at System.Threading.ThreadHelper.ThreadStart() InnerException: такая ошибка связана именно с тем что вместо трейдера Эмулятор. Как-нибудь можно обойти это? Заранее спасибо!

Alexander
Alexander

последняя версия - 4.1.5