diff --git a/Samples/Bitfinex/SampleBitfinex/App.xaml b/Samples/Bitfinex/SampleBitfinex/App.xaml
new file mode 100644
index 000000000..82e13189f
--- /dev/null
+++ b/Samples/Bitfinex/SampleBitfinex/App.xaml
@@ -0,0 +1,8 @@
+
+
+
+
+
diff --git a/Samples/Bitfinex/SampleBitfinex/App.xaml.cs b/Samples/Bitfinex/SampleBitfinex/App.xaml.cs
new file mode 100644
index 000000000..cf9e59f05
--- /dev/null
+++ b/Samples/Bitfinex/SampleBitfinex/App.xaml.cs
@@ -0,0 +1,14 @@
+namespace SampleBitfinex
+{
+ using System.Windows;
+ using System.Windows.Threading;
+
+ public partial class App
+ {
+ private void ApplicationDispatcherUnhandledException(object sender, DispatcherUnhandledExceptionEventArgs e)
+ {
+ MessageBox.Show(MainWindow, e.Exception.ToString());
+ e.Handled = true;
+ }
+ }
+}
\ No newline at end of file
diff --git a/Samples/Bitfinex/SampleBitfinex/MainWindow.xaml b/Samples/Bitfinex/SampleBitfinex/MainWindow.xaml
new file mode 100644
index 000000000..6c357d2e6
--- /dev/null
+++ b/Samples/Bitfinex/SampleBitfinex/MainWindow.xaml
@@ -0,0 +1,35 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/Samples/Bitfinex/SampleBitfinex/MainWindow.xaml.cs b/Samples/Bitfinex/SampleBitfinex/MainWindow.xaml.cs
new file mode 100644
index 000000000..71e47c096
--- /dev/null
+++ b/Samples/Bitfinex/SampleBitfinex/MainWindow.xaml.cs
@@ -0,0 +1,214 @@
+namespace SampleBitfinex
+{
+ using System;
+ using System.ComponentModel;
+ using System.Windows;
+
+ using Ecng.Common;
+ using Ecng.Xaml;
+
+ using StockSharp.BusinessEntities;
+ using StockSharp.Bitfinex;
+ using StockSharp.Logging;
+ using StockSharp.Localization;
+
+ public partial class MainWindow
+ {
+ private bool _isConnected;
+
+ public BitfinexTrader Trader;
+
+ private readonly SecuritiesWindow _securitiesWindow = new SecuritiesWindow();
+ private readonly TradesWindow _tradesWindow = new TradesWindow();
+ private readonly MyTradesWindow _myTradesWindow = new MyTradesWindow();
+ private readonly OrdersWindow _ordersWindow = new OrdersWindow();
+ private readonly PortfoliosWindow _portfoliosWindow = new PortfoliosWindow();
+
+ private readonly LogManager _logManager = new LogManager();
+
+ public MainWindow()
+ {
+ InitializeComponent();
+
+ Title = Title.Put("Bitfinex");
+
+ _ordersWindow.MakeHideable();
+ _myTradesWindow.MakeHideable();
+ _tradesWindow.MakeHideable();
+ _securitiesWindow.MakeHideable();
+ _portfoliosWindow.MakeHideable();
+
+ Instance = this;
+
+ _logManager.Sources.Add(MemoryStatistics.Instance);
+ _logManager.Listeners.Add(new FileLogListener { LogDirectory = "StockSharp_Bitfinex" });
+ }
+
+ protected override void OnClosing(CancelEventArgs e)
+ {
+ _ordersWindow.DeleteHideable();
+ _myTradesWindow.DeleteHideable();
+ _tradesWindow.DeleteHideable();
+ _securitiesWindow.DeleteHideable();
+ _portfoliosWindow.DeleteHideable();
+
+ _securitiesWindow.Close();
+ _tradesWindow.Close();
+ _myTradesWindow.Close();
+ _ordersWindow.Close();
+ _portfoliosWindow.Close();
+
+ if (Trader != null)
+ Trader.Dispose();
+
+ base.OnClosing(e);
+ }
+
+ public static MainWindow Instance { get; private set; }
+
+ private void ConnectClick(object sender, RoutedEventArgs e)
+ {
+ if (!_isConnected)
+ {
+ if (Key.Text.IsEmpty())
+ {
+ MessageBox.Show(this, LocalizedStrings.Str3689);
+ return;
+ }
+ else if (Secret.Password.IsEmpty())
+ {
+ MessageBox.Show(this, LocalizedStrings.Str3690);
+ return;
+ }
+
+ if (Trader == null)
+ {
+ // create connector
+ Trader = new BitfinexTrader();// { LogLevel = LogLevels.Debug };
+
+ _logManager.Sources.Add(Trader);
+
+ Trader.Restored += () => this.GuiAsync(() =>
+ {
+ // update gui labes
+ ChangeConnectStatus(true);
+ MessageBox.Show(this, LocalizedStrings.Str2958);
+ });
+
+ // subscribe on connection successfully event
+ Trader.Connected += () =>
+ {
+ // set flag (connection is established)
+ _isConnected = true;
+
+ // update gui labes
+ this.GuiAsync(() => ChangeConnectStatus(true));
+ };
+ Trader.Disconnected += () => this.GuiAsync(() => ChangeConnectStatus(false));
+
+ // subscribe on connection error event
+ Trader.ConnectionError += error => this.GuiAsync(() =>
+ {
+ // update gui labes
+ ChangeConnectStatus(false);
+
+ MessageBox.Show(this, error.ToString(), LocalizedStrings.Str2959);
+ });
+
+ // subscribe on error event
+ Trader.Error += error =>
+ this.GuiAsync(() => MessageBox.Show(this, error.ToString(), LocalizedStrings.Str2955));
+
+ // subscribe on error of market data subscription event
+ Trader.MarketDataSubscriptionFailed += (security, msg, error) =>
+ this.GuiAsync(() => MessageBox.Show(this, error.ToString(), LocalizedStrings.Str2956Params.Put(msg.DataType, security)));
+
+ Trader.NewSecurity += _securitiesWindow.SecurityPicker.Securities.Add;
+ Trader.NewMyTrade += _myTradesWindow.TradeGrid.Trades.Add;
+ Trader.NewTrade += _tradesWindow.TradeGrid.Trades.Add;
+ Trader.NewOrder += _ordersWindow.OrderGrid.Orders.Add;
+
+ Trader.NewPortfolio += _portfoliosWindow.PortfolioGrid.Portfolios.Add;
+ Trader.NewPosition += _portfoliosWindow.PortfolioGrid.Positions.Add;
+
+ // subscribe on error of order registration event
+ Trader.OrderRegisterFailed += _ordersWindow.OrderGrid.AddRegistrationFail;
+ // subscribe on error of order cancelling event
+ Trader.OrderCancelFailed += OrderFailed;
+
+ Trader.MassOrderCancelFailed += (transId, error) =>
+ this.GuiAsync(() => MessageBox.Show(this, error.ToString(), LocalizedStrings.Str716));
+
+ // set market data provider
+ _securitiesWindow.SecurityPicker.MarketDataProvider = Trader;
+
+ ShowSecurities.IsEnabled = ShowTrades.IsEnabled =
+ ShowMyTrades.IsEnabled = ShowOrders.IsEnabled =
+ ShowPortfolios.IsEnabled = true;
+ }
+
+ Trader.Key = Key.Text;
+ Trader.Secret = Secret.Password;
+
+ // clear password box for security reason
+ //Secret.Clear();
+
+ Trader.Connect();
+ }
+ else
+ {
+ Trader.Disconnect();
+ }
+ }
+
+ private void OrderFailed(OrderFail fail)
+ {
+ this.GuiAsync(() =>
+ {
+ MessageBox.Show(this, fail.Error.ToString(), LocalizedStrings.Str153);
+ });
+ }
+
+ private void ChangeConnectStatus(bool isConnected)
+ {
+ _isConnected = isConnected;
+ ConnectBtn.Content = isConnected ? LocalizedStrings.Disconnect : LocalizedStrings.Connect;
+ }
+
+ private void ShowSecuritiesClick(object sender, RoutedEventArgs e)
+ {
+ ShowOrHide(_securitiesWindow);
+ }
+
+ private void ShowTradesClick(object sender, RoutedEventArgs e)
+ {
+ ShowOrHide(_tradesWindow);
+ }
+
+ private void ShowMyTradesClick(object sender, RoutedEventArgs e)
+ {
+ ShowOrHide(_myTradesWindow);
+ }
+
+ private void ShowOrdersClick(object sender, RoutedEventArgs e)
+ {
+ ShowOrHide(_ordersWindow);
+ }
+
+ private void ShowPortfoliosClick(object sender, RoutedEventArgs e)
+ {
+ ShowOrHide(_portfoliosWindow);
+ }
+
+ private static void ShowOrHide(Window window)
+ {
+ if (window == null)
+ throw new ArgumentNullException(nameof(window));
+
+ if (window.Visibility == Visibility.Visible)
+ window.Hide();
+ else
+ window.Show();
+ }
+ }
+}
diff --git a/Samples/Bitfinex/SampleBitfinex/MyTradesWindow.xaml b/Samples/Bitfinex/SampleBitfinex/MyTradesWindow.xaml
new file mode 100644
index 000000000..4dd62265f
--- /dev/null
+++ b/Samples/Bitfinex/SampleBitfinex/MyTradesWindow.xaml
@@ -0,0 +1,8 @@
+
+
+
\ No newline at end of file
diff --git a/Samples/Bitfinex/SampleBitfinex/MyTradesWindow.xaml.cs b/Samples/Bitfinex/SampleBitfinex/MyTradesWindow.xaml.cs
new file mode 100644
index 000000000..54e44ddfd
--- /dev/null
+++ b/Samples/Bitfinex/SampleBitfinex/MyTradesWindow.xaml.cs
@@ -0,0 +1,10 @@
+namespace SampleBitfinex
+{
+ public partial class MyTradesWindow
+ {
+ public MyTradesWindow()
+ {
+ InitializeComponent();
+ }
+ }
+}
\ No newline at end of file
diff --git a/Samples/Bitfinex/SampleBitfinex/OrdersWindow.xaml b/Samples/Bitfinex/SampleBitfinex/OrdersWindow.xaml
new file mode 100644
index 000000000..ca9ef9645
--- /dev/null
+++ b/Samples/Bitfinex/SampleBitfinex/OrdersWindow.xaml
@@ -0,0 +1,16 @@
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/Samples/Bitfinex/SampleBitfinex/OrdersWindow.xaml.cs b/Samples/Bitfinex/SampleBitfinex/OrdersWindow.xaml.cs
new file mode 100644
index 000000000..f90868e1c
--- /dev/null
+++ b/Samples/Bitfinex/SampleBitfinex/OrdersWindow.xaml.cs
@@ -0,0 +1,49 @@
+namespace SampleBitfinex
+{
+ using System.Windows;
+
+ using Ecng.Common;
+ using Ecng.Xaml;
+
+ using StockSharp.Algo;
+ using StockSharp.BusinessEntities;
+ using StockSharp.Localization;
+ using StockSharp.Xaml;
+
+ public partial class OrdersWindow
+ {
+ public OrdersWindow()
+ {
+ InitializeComponent();
+ }
+
+ private static IConnector Connector => MainWindow.Instance.Trader;
+
+ private void OrderGrid_OnOrderCanceling(Order order)
+ {
+ Connector.CancelOrder(order);
+ }
+
+ private void OrderGrid_OnOrderReRegistering(Order order)
+ {
+ var window = new OrderWindow
+ {
+ Title = LocalizedStrings.Str2976Params.Put(order.TransactionId),
+ SecurityProvider = Connector,
+ MarketDataProvider = Connector,
+ Portfolios = new PortfolioDataSource(Connector),
+ Order = order.ReRegisterClone(newVolume: order.Balance),
+ };
+
+ if (window.ShowModal(this))
+ {
+ Connector.ReRegisterOrder(order, window.Order);
+ }
+ }
+
+ private void CancelAll_OnClick(object sender, RoutedEventArgs e)
+ {
+ Connector.CancelOrders();
+ }
+ }
+}
\ No newline at end of file
diff --git a/Samples/Bitfinex/SampleBitfinex/PortfoliosWindow.xaml b/Samples/Bitfinex/SampleBitfinex/PortfoliosWindow.xaml
new file mode 100644
index 000000000..493e38e54
--- /dev/null
+++ b/Samples/Bitfinex/SampleBitfinex/PortfoliosWindow.xaml
@@ -0,0 +1,8 @@
+
+
+
\ No newline at end of file
diff --git a/Samples/Bitfinex/SampleBitfinex/PortfoliosWindow.xaml.cs b/Samples/Bitfinex/SampleBitfinex/PortfoliosWindow.xaml.cs
new file mode 100644
index 000000000..7dfc54f88
--- /dev/null
+++ b/Samples/Bitfinex/SampleBitfinex/PortfoliosWindow.xaml.cs
@@ -0,0 +1,10 @@
+namespace SampleBitfinex
+{
+ public partial class PortfoliosWindow
+ {
+ public PortfoliosWindow()
+ {
+ InitializeComponent();
+ }
+ }
+}
\ No newline at end of file
diff --git a/Samples/Bitfinex/SampleBitfinex/Properties/AssemblyInfo.cs b/Samples/Bitfinex/SampleBitfinex/Properties/AssemblyInfo.cs
new file mode 100644
index 000000000..b7ecc7f21
--- /dev/null
+++ b/Samples/Bitfinex/SampleBitfinex/Properties/AssemblyInfo.cs
@@ -0,0 +1,20 @@
+using System.Reflection;
+using System.Runtime.InteropServices;
+using System.Windows;
+
+// General Information about an assembly is controlled through the following
+// set of attributes. Change these attribute values to modify the information
+// associated with an assembly.
+[assembly: AssemblyTitle("SampleBitfinex")]
+[assembly: AssemblyDescription("")]
+
+[assembly: Guid("AAA73471-8AAD-4CE2-8385-ECCE764967CB")]
+
+[assembly:ThemeInfo(
+ ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located
+ //(used if a resource is not found in the page,
+ // or application resource dictionaries)
+ ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located
+ //(used if a resource is not found in the page,
+ // app, or any theme specific resource dictionaries)
+)]
diff --git a/Samples/Bitfinex/SampleBitfinex/Properties/Resources.Designer.cs b/Samples/Bitfinex/SampleBitfinex/Properties/Resources.Designer.cs
new file mode 100644
index 000000000..fb8ad22fe
--- /dev/null
+++ b/Samples/Bitfinex/SampleBitfinex/Properties/Resources.Designer.cs
@@ -0,0 +1,63 @@
+//------------------------------------------------------------------------------
+//
+// This code was generated by a tool.
+// Runtime Version:4.0.30319.18449
+//
+// Changes to this file may cause incorrect behavior and will be lost if
+// the code is regenerated.
+//
+//------------------------------------------------------------------------------
+
+namespace SampleBitfinex.Properties {
+ using System;
+
+
+ ///
+ /// A strongly-typed resource class, for looking up localized strings, etc.
+ ///
+ // This class was auto-generated by the StronglyTypedResourceBuilder
+ // class via a tool like ResGen or Visual Studio.
+ // To add or remove a member, edit your .ResX file then rerun ResGen
+ // with the /str option, or rebuild your VS project.
+ [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")]
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
+ [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
+ internal class Resources {
+
+ private static global::System.Resources.ResourceManager resourceMan;
+
+ private static global::System.Globalization.CultureInfo resourceCulture;
+
+ [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
+ internal Resources() {
+ }
+
+ ///
+ /// Returns the cached ResourceManager instance used by this class.
+ ///
+ [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
+ internal static global::System.Resources.ResourceManager ResourceManager {
+ get {
+ if (object.ReferenceEquals(resourceMan, null)) {
+ global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("SampleBitfinex.Properties.Resources", typeof(Resources).Assembly);
+ resourceMan = temp;
+ }
+ return resourceMan;
+ }
+ }
+
+ ///
+ /// Overrides the current thread's CurrentUICulture property for all
+ /// resource lookups using this strongly typed resource class.
+ ///
+ [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
+ internal static global::System.Globalization.CultureInfo Culture {
+ get {
+ return resourceCulture;
+ }
+ set {
+ resourceCulture = value;
+ }
+ }
+ }
+}
diff --git a/Samples/Bitfinex/SampleBitfinex/Properties/Resources.resx b/Samples/Bitfinex/SampleBitfinex/Properties/Resources.resx
new file mode 100644
index 000000000..13b775f1d
--- /dev/null
+++ b/Samples/Bitfinex/SampleBitfinex/Properties/Resources.resx
@@ -0,0 +1,117 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ text/microsoft-resx
+
+
+ 2.0
+
+
+ System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
+ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
\ No newline at end of file
diff --git a/Samples/Bitfinex/SampleBitfinex/Properties/Settings.Designer.cs b/Samples/Bitfinex/SampleBitfinex/Properties/Settings.Designer.cs
new file mode 100644
index 000000000..df52d018e
--- /dev/null
+++ b/Samples/Bitfinex/SampleBitfinex/Properties/Settings.Designer.cs
@@ -0,0 +1,26 @@
+//------------------------------------------------------------------------------
+//
+// This code was generated by a tool.
+// Runtime Version:4.0.30319.18449
+//
+// Changes to this file may cause incorrect behavior and will be lost if
+// the code is regenerated.
+//
+//------------------------------------------------------------------------------
+
+namespace SampleBitfinex.Properties {
+
+
+ [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
+ [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "12.0.0.0")]
+ internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase {
+
+ private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
+
+ public static Settings Default {
+ get {
+ return defaultInstance;
+ }
+ }
+ }
+}
diff --git a/Samples/Bitfinex/SampleBitfinex/Properties/Settings.settings b/Samples/Bitfinex/SampleBitfinex/Properties/Settings.settings
new file mode 100644
index 000000000..9010101f8
--- /dev/null
+++ b/Samples/Bitfinex/SampleBitfinex/Properties/Settings.settings
@@ -0,0 +1,7 @@
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/Samples/Bitfinex/SampleBitfinex/QuotesWindow.xaml b/Samples/Bitfinex/SampleBitfinex/QuotesWindow.xaml
new file mode 100644
index 000000000..8996a36da
--- /dev/null
+++ b/Samples/Bitfinex/SampleBitfinex/QuotesWindow.xaml
@@ -0,0 +1,7 @@
+
+
+
\ No newline at end of file
diff --git a/Samples/Bitfinex/SampleBitfinex/QuotesWindow.xaml.cs b/Samples/Bitfinex/SampleBitfinex/QuotesWindow.xaml.cs
new file mode 100644
index 000000000..2e46547e3
--- /dev/null
+++ b/Samples/Bitfinex/SampleBitfinex/QuotesWindow.xaml.cs
@@ -0,0 +1,10 @@
+namespace SampleBitfinex
+{
+ public partial class QuotesWindow
+ {
+ public QuotesWindow()
+ {
+ InitializeComponent();
+ }
+ }
+}
\ No newline at end of file
diff --git a/Samples/Bitfinex/SampleBitfinex/SampleBitfinex.csproj b/Samples/Bitfinex/SampleBitfinex/SampleBitfinex.csproj
new file mode 100644
index 000000000..e7d406b39
--- /dev/null
+++ b/Samples/Bitfinex/SampleBitfinex/SampleBitfinex.csproj
@@ -0,0 +1,281 @@
+
+
+
+ Debug
+ AnyCPU
+ 9.0.30729
+ 2.0
+ {1CC3B6EC-70A3-4B6C-A120-74BB46D8BB0F}
+ WinExe
+ Properties
+ SampleBitfinex
+ SampleBitfinex
+ v4.5.1
+ 512
+ {60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}
+ 4
+ ..\..\..\References\stocksharp.ico
+
+
+ 3.5
+
+ publish\
+ true
+ Disk
+ false
+ Foreground
+ 7
+ Days
+ false
+ false
+ true
+ 0
+ 1.0.0.%2a
+ false
+ false
+ true
+
+
+
+
+
+
+
+
+
+
+
+ true
+ full
+ false
+ bin\Debug\
+ DEBUG;TRACE
+ prompt
+ 4
+ AnyCPU
+ AllRules.ruleset
+ false
+
+
+ pdbonly
+ true
+ bin\Release\
+ TRACE
+ prompt
+ 4
+ AnyCPU
+ AllRules.ruleset
+ false
+
+
+
+ ..\..\..\References\Ecng.Localization.dll
+
+
+ ..\..\..\References\Ecng.Common.dll
+
+
+ ..\..\..\References\MoreLinq.dll
+
+
+
+
+
+
+
+
+
+
+ ..\..\..\References\Ecng.Collections.dll
+
+
+ ..\..\..\References\Ecng.ComponentModel.dll
+
+
+ ..\..\..\References\Ecng.Serialization.dll
+
+
+ ..\..\..\References\Ecng.Xaml.dll
+
+
+ ..\..\..\References\DevExpress.Data.v17.2.dll
+
+
+ ..\..\..\References\DevExpress.Xpf.Core.v17.2.dll
+
+
+ ..\..\..\References\DevExpress.Xpf.Grid.v17.2.dll
+
+
+ ..\..\..\References\DevExpress.Xpf.Grid.v17.2.Core.dll
+
+
+ ..\..\..\References\DevExpress.Xpf.Themes.Office2016White.v17.2.dll
+
+
+
+
+ MSBuild:Compile
+ Designer
+ MSBuild:Compile
+ Designer
+
+
+ Properties\StockSharpAssemblyInfo.cs
+
+
+ App.xaml
+ Code
+
+
+
+
+ MainWindow.xaml
+
+
+ MyTradesWindow.xaml
+
+
+ OrdersWindow.xaml
+
+
+ PortfoliosWindow.xaml
+
+
+
+ True
+ True
+ Resources.resx
+
+
+ True
+ Settings.settings
+ True
+
+
+ QuotesWindow.xaml
+
+
+ SecuritiesWindow.xaml
+
+
+ TradesWindow.xaml
+
+
+ ResXFileCodeGenerator
+ Resources.Designer.cs
+
+
+
+ SettingsSingleFileGenerator
+ Settings.Designer.cs
+
+
+
+
+
+ MSBuild:Compile
+ Designer
+ MSBuild:Compile
+ Designer
+
+
+ Designer
+ MSBuild:Compile
+ MSBuild:Compile
+ Designer
+
+
+ MSBuild:Compile
+ Designer
+ MSBuild:Compile
+ Designer
+
+
+ MSBuild:Compile
+ Designer
+
+
+ MSBuild:Compile
+ Designer
+ MSBuild:Compile
+ Designer
+
+
+ MSBuild:Compile
+ Designer
+ MSBuild:Compile
+ Designer
+
+
+ MSBuild:Compile
+ Designer
+ MSBuild:Compile
+ Designer
+
+
+
+
+ False
+ .NET Framework 3.5 SP1 Client Profile
+ false
+
+
+ False
+ .NET Framework 3.5 SP1
+ true
+
+
+ False
+ Windows Installer 3.1
+ true
+
+
+
+
+ {5D5F59F8-2136-42D1-90B5-B6C41D4C3964}
+ Bitfinex
+
+
+ {2A5C6FAD-106C-4A4A-B602-77A6B1034CA2}
+ Algo
+
+
+ {DCE69DB8-53CA-4B7F-9368-02F175A31074}
+ BusinessEntities
+
+
+ {A98A81CE-75A1-4FAB-9C02-E6EEF4B51F4F}
+ Localization
+
+
+ {C4476ADD-A3D5-41BB-9D43-55D865863B78}
+ Logging
+
+
+ {B47F9C23-A4BD-46A9-BF27-54CB3D653503}
+ Messages
+
+
+ {c449d618-dea4-41c3-ba86-9f827c7421dc}
+ Xaml.Charting
+
+
+ {64E4D6F0-36B6-4904-9BA7-FFFBE5FF71D8}
+ Xaml
+
+
+
+
+ stocksharp.ico
+
+
+
+
+
\ No newline at end of file
diff --git a/Samples/Bitfinex/SampleBitfinex/SampleBitfinex.licenseheader b/Samples/Bitfinex/SampleBitfinex/SampleBitfinex.licenseheader
new file mode 100644
index 000000000..a1db37839
--- /dev/null
+++ b/Samples/Bitfinex/SampleBitfinex/SampleBitfinex.licenseheader
@@ -0,0 +1,45 @@
+extensions: designer.cs generated.cs
+extensions: .cs .cpp .h
+#region S# License
+/******************************************************************************************
+NOTICE!!! This program and source code is owned and licensed by
+StockSharp Algo Trading, LLC, www.stocksharp.com
+Viewing or use of this code requires your acceptance of the license
+agreement found at https://github.com/StockSharp/StockSharp/blob/master/LICENSE
+Removal of this comment is a violation of the license agreement.
+
+Project: %Namespace%.%Project%
+File: %FileName%
+Created: %CreationYear%, %CreationMonth%, %CreationDay%, %CreationTime%
+
+Copyright 2010 by StockSharp Algo Trading, LLC
+*******************************************************************************************/
+#endregion S# License
+extensions: .aspx .ascx
+<%--
+NOTICE!!! This program and source code is owned and licensed by
+StockSharp Algo Trading, LLC, www.stocksharp.com
+Viewing or use of this code requires your acceptance of the license
+agreement found at https://github.com/StockSharp/StockSharp/blob/master/LICENSE
+Removal of this comment is a violation of the license agreement.
+
+Project: %Namespace%.%Project%
+File: %FileName%
+Created: %CreationYear%, %CreationMonth%, %CreationDay%, %CreationTime%
+
+Copyright 2010 by StockSharp Algo Trading, LLC
+--%>
+extensions: .xml .config .xsd
+
\ No newline at end of file
diff --git a/Samples/Bitfinex/SampleBitfinex/SampleBitfinexPublic.csproj b/Samples/Bitfinex/SampleBitfinex/SampleBitfinexPublic.csproj
new file mode 100644
index 000000000..bddfce729
--- /dev/null
+++ b/Samples/Bitfinex/SampleBitfinex/SampleBitfinexPublic.csproj
@@ -0,0 +1,275 @@
+
+
+
+ Debug
+ AnyCPU
+ 9.0.30729
+ 2.0
+ {F85DE217-9B3A-4436-AEDD-E83910F100C1}
+ WinExe
+ Properties
+ SampleBitfinex
+ SampleBitfinex
+ v4.5.1
+ 512
+ {60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}
+ 4
+ ..\..\..\References\stocksharp.ico
+
+
+ 3.5
+
+ publish\
+ true
+ Disk
+ false
+ Foreground
+ 7
+ Days
+ false
+ false
+ true
+ 0
+ 1.0.0.%2a
+ false
+ false
+ true
+
+
+
+ true
+ full
+ false
+ bin\Debug\
+ DEBUG;TRACE
+ prompt
+ 4
+ AnyCPU
+ AllRules.ruleset
+ false
+
+
+ pdbonly
+ true
+ bin\Release\
+ TRACE
+ prompt
+ 4
+ AnyCPU
+ AllRules.ruleset
+ false
+
+
+
+ ..\..\..\References\StockSharp.Bitfinex.dll
+
+
+
+
+
+
+
+
+
+
+ ..\..\..\References\Ecng.Localization.dll
+
+
+ ..\..\..\References\Ecng.Common.dll
+
+
+ ..\..\..\References\MoreLinq.dll
+
+
+ ..\..\..\References\Ecng.Collections.dll
+
+
+ ..\..\..\References\Ecng.ComponentModel.dll
+
+
+ ..\..\..\References\Ecng.Serialization.dll
+
+
+ ..\..\..\References\Ecng.Xaml.dll
+
+
+ ..\..\..\References\Xceed.Wpf.Toolkit.dll
+
+
+ ..\..\..\References\DevExpress.Data.v17.2.dll
+
+
+ ..\..\..\References\DevExpress.Xpf.Core.v17.2.dll
+
+
+ ..\..\..\References\DevExpress.Xpf.Grid.v17.2.dll
+
+
+ ..\..\..\References\DevExpress.Xpf.Grid.v17.2.Core.dll
+
+
+ ..\..\..\References\DevExpress.Xpf.LayoutControl.v17.2.dll
+
+
+
+
+ MSBuild:Compile
+ Designer
+ MSBuild:Compile
+ Designer
+
+
+ Properties\StockSharpAssemblyInfo.cs
+
+
+ App.xaml
+ Code
+
+
+
+
+ MainWindow.xaml
+
+
+ MyTradesWindow.xaml
+
+
+ OrdersWindow.xaml
+
+
+ PortfoliosWindow.xaml
+
+
+
+ True
+ True
+ Resources.resx
+
+
+ True
+ Settings.settings
+ True
+
+
+ QuotesWindow.xaml
+
+
+ SecuritiesWindow.xaml
+
+
+ TradesWindow.xaml
+
+
+ ResXFileCodeGenerator
+ Resources.Designer.cs
+
+
+
+ SettingsSingleFileGenerator
+ Settings.Designer.cs
+
+
+
+
+
+ MSBuild:Compile
+ Designer
+ MSBuild:Compile
+ Designer
+
+
+ Designer
+ MSBuild:Compile
+ MSBuild:Compile
+ Designer
+
+
+ MSBuild:Compile
+ Designer
+ MSBuild:Compile
+ Designer
+
+
+ MSBuild:Compile
+ Designer
+
+
+ MSBuild:Compile
+ Designer
+ MSBuild:Compile
+ Designer
+
+
+ MSBuild:Compile
+ Designer
+ MSBuild:Compile
+ Designer
+
+
+ MSBuild:Compile
+ Designer
+ MSBuild:Compile
+ Designer
+
+
+
+
+ False
+ .NET Framework 3.5 SP1 Client Profile
+ false
+
+
+ False
+ .NET Framework 3.5 SP1
+ true
+
+
+ False
+ Windows Installer 3.1
+ true
+
+
+
+
+ stocksharp.ico
+
+
+
+
+ {AF225452-1CF1-48A2-B381-C02BEBE643D7}
+ Bitfinex
+
+
+ {64e4d6f0-36b6-4904-9ba7-fffbe5ff71d8}
+ Xaml
+
+
+ {2A5C6FAD-106C-4A4A-B602-77A6B1034CA2}
+ Algo
+
+
+ {DCE69DB8-53CA-4B7F-9368-02F175A31074}
+ BusinessEntities
+
+
+ {A98A81CE-75A1-4FAB-9C02-E6EEF4B51F4F}
+ Localization
+
+
+ {C4476ADD-A3D5-41BB-9D43-55D865863B78}
+ Logging
+
+
+ {b47f9c23-a4bd-46a9-bf27-54cb3d653503}
+ Messages
+
+
+
+
+
\ No newline at end of file
diff --git a/Samples/Bitfinex/SampleBitfinex/SecuritiesWindow.xaml b/Samples/Bitfinex/SampleBitfinex/SecuritiesWindow.xaml
new file mode 100644
index 000000000..2c5d27978
--- /dev/null
+++ b/Samples/Bitfinex/SampleBitfinex/SecuritiesWindow.xaml
@@ -0,0 +1,25 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/Samples/Bitfinex/SampleBitfinex/SecuritiesWindow.xaml.cs b/Samples/Bitfinex/SampleBitfinex/SecuritiesWindow.xaml.cs
new file mode 100644
index 000000000..7a1b36b09
--- /dev/null
+++ b/Samples/Bitfinex/SampleBitfinex/SecuritiesWindow.xaml.cs
@@ -0,0 +1,126 @@
+namespace SampleBitfinex
+{
+ using System;
+ using System.Linq;
+ using System.Windows;
+
+ using Ecng.Collections;
+ using Ecng.Xaml;
+
+ using MoreLinq;
+
+ using StockSharp.BusinessEntities;
+ using StockSharp.Xaml;
+ using StockSharp.Localization;
+
+ public partial class SecuritiesWindow
+ {
+ private readonly SynchronizedDictionary _quotesWindows = new SynchronizedDictionary();
+ private bool _initialized;
+
+ public SecuritiesWindow()
+ {
+ InitializeComponent();
+ }
+
+ protected override void OnClosed(EventArgs e)
+ {
+ _quotesWindows.SyncDo(d => d.Values.ForEach(w =>
+ {
+ w.DeleteHideable();
+ w.Close();
+ }));
+
+ var trader = MainWindow.Instance.Trader;
+ if (trader != null)
+ {
+ if (_initialized)
+ trader.MarketDepthChanged -= TraderOnMarketDepthChanged;
+ }
+
+ base.OnClosed(e);
+ }
+
+ private void SecurityPicker_OnSecuritySelected(Security security)
+ {
+ Quotes.IsEnabled = NewOrder.IsEnabled = Depth.IsEnabled = security != null;
+ }
+
+ private void NewOrderClick(object sender, RoutedEventArgs e)
+ {
+ var newOrder = new OrderWindow
+ {
+ Order = new Order { Security = SecurityPicker.SelectedSecurity },
+ SecurityProvider = MainWindow.Instance.Trader,
+ MarketDataProvider = MainWindow.Instance.Trader,
+ Portfolios = new PortfolioDataSource(MainWindow.Instance.Trader),
+ };
+
+ if (newOrder.ShowModal(this))
+ MainWindow.Instance.Trader.RegisterOrder(newOrder.Order);
+ }
+
+ private void DepthClick(object sender, RoutedEventArgs e)
+ {
+ var trader = MainWindow.Instance.Trader;
+
+ foreach (var security in SecurityPicker.SelectedSecurities)
+ {
+ var window = _quotesWindows.SafeAdd(security, s =>
+ {
+ // начинаем получать котировки стакана
+ trader.RegisterMarketDepth(security);
+
+ // создаем окно со стаканом
+ var wnd = new QuotesWindow
+ {
+ Title = security.Id + " " + LocalizedStrings.MarketDepth
+ };
+ wnd.MakeHideable();
+ return wnd;
+ });
+
+ if (window.Visibility == Visibility.Visible)
+ window.Hide();
+ else
+ {
+ window.Show();
+ window.DepthCtrl.UpdateDepth(trader.GetMarketDepth(security));
+ }
+
+ if (!_initialized)
+ {
+ trader.MarketDepthChanged += TraderOnMarketDepthChanged;
+ _initialized = true;
+ }
+ }
+ }
+
+ private void QuotesClick(object sender, RoutedEventArgs e)
+ {
+ var trader = MainWindow.Instance.Trader;
+
+ foreach (var security in SecurityPicker.SelectedSecurities)
+ {
+ if (trader.RegisteredSecurities.Contains(security))
+ {
+ trader.UnRegisterSecurity(security);
+ trader.UnRegisterTrades(security);
+ }
+ else
+ {
+ trader.RegisterSecurity(security);
+ trader.RegisterTrades(security);
+ }
+ }
+ }
+
+ private void TraderOnMarketDepthChanged(MarketDepth depth)
+ {
+ var wnd = _quotesWindows.TryGetValue(depth.Security);
+
+ if (wnd != null)
+ wnd.DepthCtrl.UpdateDepth(depth);
+ }
+ }
+}
\ No newline at end of file
diff --git a/Samples/Bitfinex/SampleBitfinex/TradesWindow.xaml b/Samples/Bitfinex/SampleBitfinex/TradesWindow.xaml
new file mode 100644
index 000000000..1b105def5
--- /dev/null
+++ b/Samples/Bitfinex/SampleBitfinex/TradesWindow.xaml
@@ -0,0 +1,7 @@
+
+
+
\ No newline at end of file
diff --git a/Samples/Bitfinex/SampleBitfinex/TradesWindow.xaml.cs b/Samples/Bitfinex/SampleBitfinex/TradesWindow.xaml.cs
new file mode 100644
index 000000000..2f0fc47bb
--- /dev/null
+++ b/Samples/Bitfinex/SampleBitfinex/TradesWindow.xaml.cs
@@ -0,0 +1,10 @@
+namespace SampleBitfinex
+{
+ public partial class TradesWindow
+ {
+ public TradesWindow()
+ {
+ InitializeComponent();
+ }
+ }
+}
\ No newline at end of file
diff --git a/Samples/Bitfinex/SampleBitfinex/app.config b/Samples/Bitfinex/SampleBitfinex/app.config
new file mode 100644
index 000000000..884f9844f
--- /dev/null
+++ b/Samples/Bitfinex/SampleBitfinex/app.config
@@ -0,0 +1,3 @@
+
+
+
diff --git a/Samples/Bithumb/SampleBithumb/App.xaml b/Samples/Bithumb/SampleBithumb/App.xaml
new file mode 100644
index 000000000..aa8b33a17
--- /dev/null
+++ b/Samples/Bithumb/SampleBithumb/App.xaml
@@ -0,0 +1,8 @@
+
+
+
+
+
diff --git a/Samples/Bithumb/SampleBithumb/App.xaml.cs b/Samples/Bithumb/SampleBithumb/App.xaml.cs
new file mode 100644
index 000000000..27c094783
--- /dev/null
+++ b/Samples/Bithumb/SampleBithumb/App.xaml.cs
@@ -0,0 +1,14 @@
+namespace SampleBithumb
+{
+ using System.Windows;
+ using System.Windows.Threading;
+
+ public partial class App
+ {
+ private void ApplicationDispatcherUnhandledException(object sender, DispatcherUnhandledExceptionEventArgs e)
+ {
+ MessageBox.Show(MainWindow, e.Exception.ToString());
+ e.Handled = true;
+ }
+ }
+}
\ No newline at end of file
diff --git a/Samples/Bithumb/SampleBithumb/MainWindow.xaml b/Samples/Bithumb/SampleBithumb/MainWindow.xaml
new file mode 100644
index 000000000..381337cb1
--- /dev/null
+++ b/Samples/Bithumb/SampleBithumb/MainWindow.xaml
@@ -0,0 +1,35 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/Samples/Bithumb/SampleBithumb/MainWindow.xaml.cs b/Samples/Bithumb/SampleBithumb/MainWindow.xaml.cs
new file mode 100644
index 000000000..2d1059d04
--- /dev/null
+++ b/Samples/Bithumb/SampleBithumb/MainWindow.xaml.cs
@@ -0,0 +1,214 @@
+namespace SampleBithumb
+{
+ using System;
+ using System.ComponentModel;
+ using System.Windows;
+
+ using Ecng.Common;
+ using Ecng.Xaml;
+
+ using StockSharp.BusinessEntities;
+ using StockSharp.Bithumb;
+ using StockSharp.Logging;
+ using StockSharp.Localization;
+
+ public partial class MainWindow
+ {
+ private bool _isConnected;
+
+ public BithumbTrader Trader;
+
+ private readonly SecuritiesWindow _securitiesWindow = new SecuritiesWindow();
+ private readonly TradesWindow _tradesWindow = new TradesWindow();
+ private readonly MyTradesWindow _myTradesWindow = new MyTradesWindow();
+ private readonly OrdersWindow _ordersWindow = new OrdersWindow();
+ private readonly PortfoliosWindow _portfoliosWindow = new PortfoliosWindow();
+
+ private readonly LogManager _logManager = new LogManager();
+
+ public MainWindow()
+ {
+ InitializeComponent();
+
+ Title = Title.Put("Bithumb");
+
+ _ordersWindow.MakeHideable();
+ _myTradesWindow.MakeHideable();
+ _tradesWindow.MakeHideable();
+ _securitiesWindow.MakeHideable();
+ _portfoliosWindow.MakeHideable();
+
+ Instance = this;
+
+ _logManager.Sources.Add(MemoryStatistics.Instance);
+ _logManager.Listeners.Add(new FileLogListener { LogDirectory = "StockSharp_Bithumb" });
+ }
+
+ protected override void OnClosing(CancelEventArgs e)
+ {
+ _ordersWindow.DeleteHideable();
+ _myTradesWindow.DeleteHideable();
+ _tradesWindow.DeleteHideable();
+ _securitiesWindow.DeleteHideable();
+ _portfoliosWindow.DeleteHideable();
+
+ _securitiesWindow.Close();
+ _tradesWindow.Close();
+ _myTradesWindow.Close();
+ _ordersWindow.Close();
+ _portfoliosWindow.Close();
+
+ if (Trader != null)
+ Trader.Dispose();
+
+ base.OnClosing(e);
+ }
+
+ public static MainWindow Instance { get; private set; }
+
+ private void ConnectClick(object sender, RoutedEventArgs e)
+ {
+ if (!_isConnected)
+ {
+ if (Key.Text.IsEmpty())
+ {
+ MessageBox.Show(this, LocalizedStrings.Str3689);
+ return;
+ }
+ else if (Secret.Password.IsEmpty())
+ {
+ MessageBox.Show(this, LocalizedStrings.Str3690);
+ return;
+ }
+
+ if (Trader == null)
+ {
+ // create connector
+ Trader = new BithumbTrader();// { LogLevel = LogLevels.Debug };
+
+ _logManager.Sources.Add(Trader);
+
+ Trader.Restored += () => this.GuiAsync(() =>
+ {
+ // update gui labes
+ ChangeConnectStatus(true);
+ MessageBox.Show(this, LocalizedStrings.Str2958);
+ });
+
+ // subscribe on connection successfully event
+ Trader.Connected += () =>
+ {
+ // set flag (connection is established)
+ _isConnected = true;
+
+ // update gui labes
+ this.GuiAsync(() => ChangeConnectStatus(true));
+ };
+ Trader.Disconnected += () => this.GuiAsync(() => ChangeConnectStatus(false));
+
+ // subscribe on connection error event
+ Trader.ConnectionError += error => this.GuiAsync(() =>
+ {
+ // update gui labes
+ ChangeConnectStatus(false);
+
+ MessageBox.Show(this, error.ToString(), LocalizedStrings.Str2959);
+ });
+
+ // subscribe on error event
+ Trader.Error += error =>
+ this.GuiAsync(() => MessageBox.Show(this, error.ToString(), LocalizedStrings.Str2955));
+
+ // subscribe on error of market data subscription event
+ Trader.MarketDataSubscriptionFailed += (security, msg, error) =>
+ this.GuiAsync(() => MessageBox.Show(this, error.ToString(), LocalizedStrings.Str2956Params.Put(msg.DataType, security)));
+
+ Trader.NewSecurity += _securitiesWindow.SecurityPicker.Securities.Add;
+ Trader.NewMyTrade += _myTradesWindow.TradeGrid.Trades.Add;
+ Trader.NewTrade += _tradesWindow.TradeGrid.Trades.Add;
+ Trader.NewOrder += _ordersWindow.OrderGrid.Orders.Add;
+
+ Trader.NewPortfolio += _portfoliosWindow.PortfolioGrid.Portfolios.Add;
+ Trader.NewPosition += _portfoliosWindow.PortfolioGrid.Positions.Add;
+
+ // subscribe on error of order registration event
+ Trader.OrderRegisterFailed += _ordersWindow.OrderGrid.AddRegistrationFail;
+ // subscribe on error of order cancelling event
+ Trader.OrderCancelFailed += OrderFailed;
+
+ Trader.MassOrderCancelFailed += (transId, error) =>
+ this.GuiAsync(() => MessageBox.Show(this, error.ToString(), LocalizedStrings.Str716));
+
+ // set market data provider
+ _securitiesWindow.SecurityPicker.MarketDataProvider = Trader;
+
+ ShowSecurities.IsEnabled = ShowTrades.IsEnabled =
+ ShowMyTrades.IsEnabled = ShowOrders.IsEnabled =
+ ShowPortfolios.IsEnabled = true;
+ }
+
+ Trader.Key = Key.Text;
+ Trader.Secret = Secret.Password;
+
+ // clear password box for security reason
+ //Secret.Clear();
+
+ Trader.Connect();
+ }
+ else
+ {
+ Trader.Disconnect();
+ }
+ }
+
+ private void OrderFailed(OrderFail fail)
+ {
+ this.GuiAsync(() =>
+ {
+ MessageBox.Show(this, fail.Error.ToString(), LocalizedStrings.Str153);
+ });
+ }
+
+ private void ChangeConnectStatus(bool isConnected)
+ {
+ _isConnected = isConnected;
+ ConnectBtn.Content = isConnected ? LocalizedStrings.Disconnect : LocalizedStrings.Connect;
+ }
+
+ private void ShowSecuritiesClick(object sender, RoutedEventArgs e)
+ {
+ ShowOrHide(_securitiesWindow);
+ }
+
+ private void ShowTradesClick(object sender, RoutedEventArgs e)
+ {
+ ShowOrHide(_tradesWindow);
+ }
+
+ private void ShowMyTradesClick(object sender, RoutedEventArgs e)
+ {
+ ShowOrHide(_myTradesWindow);
+ }
+
+ private void ShowOrdersClick(object sender, RoutedEventArgs e)
+ {
+ ShowOrHide(_ordersWindow);
+ }
+
+ private void ShowPortfoliosClick(object sender, RoutedEventArgs e)
+ {
+ ShowOrHide(_portfoliosWindow);
+ }
+
+ private static void ShowOrHide(Window window)
+ {
+ if (window == null)
+ throw new ArgumentNullException(nameof(window));
+
+ if (window.Visibility == Visibility.Visible)
+ window.Hide();
+ else
+ window.Show();
+ }
+ }
+}
diff --git a/Samples/Bithumb/SampleBithumb/MyTradesWindow.xaml b/Samples/Bithumb/SampleBithumb/MyTradesWindow.xaml
new file mode 100644
index 000000000..1c0826a26
--- /dev/null
+++ b/Samples/Bithumb/SampleBithumb/MyTradesWindow.xaml
@@ -0,0 +1,8 @@
+
+
+
\ No newline at end of file
diff --git a/Samples/Bithumb/SampleBithumb/MyTradesWindow.xaml.cs b/Samples/Bithumb/SampleBithumb/MyTradesWindow.xaml.cs
new file mode 100644
index 000000000..a342f6ee7
--- /dev/null
+++ b/Samples/Bithumb/SampleBithumb/MyTradesWindow.xaml.cs
@@ -0,0 +1,10 @@
+namespace SampleBithumb
+{
+ public partial class MyTradesWindow
+ {
+ public MyTradesWindow()
+ {
+ InitializeComponent();
+ }
+ }
+}
\ No newline at end of file
diff --git a/Samples/Bithumb/SampleBithumb/OrdersWindow.xaml b/Samples/Bithumb/SampleBithumb/OrdersWindow.xaml
new file mode 100644
index 000000000..a44bda080
--- /dev/null
+++ b/Samples/Bithumb/SampleBithumb/OrdersWindow.xaml
@@ -0,0 +1,16 @@
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/Samples/Bithumb/SampleBithumb/OrdersWindow.xaml.cs b/Samples/Bithumb/SampleBithumb/OrdersWindow.xaml.cs
new file mode 100644
index 000000000..50a5429be
--- /dev/null
+++ b/Samples/Bithumb/SampleBithumb/OrdersWindow.xaml.cs
@@ -0,0 +1,49 @@
+namespace SampleBithumb
+{
+ using System.Windows;
+
+ using Ecng.Common;
+ using Ecng.Xaml;
+
+ using StockSharp.Algo;
+ using StockSharp.BusinessEntities;
+ using StockSharp.Localization;
+ using StockSharp.Xaml;
+
+ public partial class OrdersWindow
+ {
+ public OrdersWindow()
+ {
+ InitializeComponent();
+ }
+
+ private static IConnector Connector => MainWindow.Instance.Trader;
+
+ private void OrderGrid_OnOrderCanceling(Order order)
+ {
+ Connector.CancelOrder(order);
+ }
+
+ private void OrderGrid_OnOrderReRegistering(Order order)
+ {
+ var window = new OrderWindow
+ {
+ Title = LocalizedStrings.Str2976Params.Put(order.TransactionId),
+ SecurityProvider = Connector,
+ MarketDataProvider = Connector,
+ Portfolios = new PortfolioDataSource(Connector),
+ Order = order.ReRegisterClone(newVolume: order.Balance),
+ };
+
+ if (window.ShowModal(this))
+ {
+ Connector.ReRegisterOrder(order, window.Order);
+ }
+ }
+
+ private void CancelAll_OnClick(object sender, RoutedEventArgs e)
+ {
+ Connector.CancelOrders();
+ }
+ }
+}
\ No newline at end of file
diff --git a/Samples/Bithumb/SampleBithumb/PortfoliosWindow.xaml b/Samples/Bithumb/SampleBithumb/PortfoliosWindow.xaml
new file mode 100644
index 000000000..d81c507f6
--- /dev/null
+++ b/Samples/Bithumb/SampleBithumb/PortfoliosWindow.xaml
@@ -0,0 +1,8 @@
+
+
+
\ No newline at end of file
diff --git a/Samples/Bithumb/SampleBithumb/PortfoliosWindow.xaml.cs b/Samples/Bithumb/SampleBithumb/PortfoliosWindow.xaml.cs
new file mode 100644
index 000000000..57f9907dd
--- /dev/null
+++ b/Samples/Bithumb/SampleBithumb/PortfoliosWindow.xaml.cs
@@ -0,0 +1,10 @@
+namespace SampleBithumb
+{
+ public partial class PortfoliosWindow
+ {
+ public PortfoliosWindow()
+ {
+ InitializeComponent();
+ }
+ }
+}
\ No newline at end of file
diff --git a/Samples/Bithumb/SampleBithumb/Properties/AssemblyInfo.cs b/Samples/Bithumb/SampleBithumb/Properties/AssemblyInfo.cs
new file mode 100644
index 000000000..e30196988
--- /dev/null
+++ b/Samples/Bithumb/SampleBithumb/Properties/AssemblyInfo.cs
@@ -0,0 +1,20 @@
+using System.Reflection;
+using System.Runtime.InteropServices;
+using System.Windows;
+
+// General Information about an assembly is controlled through the following
+// set of attributes. Change these attribute values to modify the information
+// associated with an assembly.
+[assembly: AssemblyTitle("SampleBithumb")]
+[assembly: AssemblyDescription("")]
+
+[assembly: Guid("6BEA0137-3272-4206-BCAF-2B4F263D51A4")]
+
+[assembly:ThemeInfo(
+ ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located
+ //(used if a resource is not found in the page,
+ // or application resource dictionaries)
+ ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located
+ //(used if a resource is not found in the page,
+ // app, or any theme specific resource dictionaries)
+)]
diff --git a/Samples/Bithumb/SampleBithumb/Properties/Resources.Designer.cs b/Samples/Bithumb/SampleBithumb/Properties/Resources.Designer.cs
new file mode 100644
index 000000000..57e23b02b
--- /dev/null
+++ b/Samples/Bithumb/SampleBithumb/Properties/Resources.Designer.cs
@@ -0,0 +1,63 @@
+//------------------------------------------------------------------------------
+//
+// This code was generated by a tool.
+// Runtime Version:4.0.30319.18449
+//
+// Changes to this file may cause incorrect behavior and will be lost if
+// the code is regenerated.
+//
+//------------------------------------------------------------------------------
+
+namespace SampleBithumb.Properties {
+ using System;
+
+
+ ///
+ /// A strongly-typed resource class, for looking up localized strings, etc.
+ ///
+ // This class was auto-generated by the StronglyTypedResourceBuilder
+ // class via a tool like ResGen or Visual Studio.
+ // To add or remove a member, edit your .ResX file then rerun ResGen
+ // with the /str option, or rebuild your VS project.
+ [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")]
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
+ [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
+ internal class Resources {
+
+ private static global::System.Resources.ResourceManager resourceMan;
+
+ private static global::System.Globalization.CultureInfo resourceCulture;
+
+ [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
+ internal Resources() {
+ }
+
+ ///
+ /// Returns the cached ResourceManager instance used by this class.
+ ///
+ [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
+ internal static global::System.Resources.ResourceManager ResourceManager {
+ get {
+ if (object.ReferenceEquals(resourceMan, null)) {
+ global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("SampleBithumb.Properties.Resources", typeof(Resources).Assembly);
+ resourceMan = temp;
+ }
+ return resourceMan;
+ }
+ }
+
+ ///
+ /// Overrides the current thread's CurrentUICulture property for all
+ /// resource lookups using this strongly typed resource class.
+ ///
+ [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
+ internal static global::System.Globalization.CultureInfo Culture {
+ get {
+ return resourceCulture;
+ }
+ set {
+ resourceCulture = value;
+ }
+ }
+ }
+}
diff --git a/Samples/Bithumb/SampleBithumb/Properties/Resources.resx b/Samples/Bithumb/SampleBithumb/Properties/Resources.resx
new file mode 100644
index 000000000..13b775f1d
--- /dev/null
+++ b/Samples/Bithumb/SampleBithumb/Properties/Resources.resx
@@ -0,0 +1,117 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ text/microsoft-resx
+
+
+ 2.0
+
+
+ System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
+ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
\ No newline at end of file
diff --git a/Samples/Bithumb/SampleBithumb/Properties/Settings.Designer.cs b/Samples/Bithumb/SampleBithumb/Properties/Settings.Designer.cs
new file mode 100644
index 000000000..0ed921a20
--- /dev/null
+++ b/Samples/Bithumb/SampleBithumb/Properties/Settings.Designer.cs
@@ -0,0 +1,26 @@
+//------------------------------------------------------------------------------
+//
+// This code was generated by a tool.
+// Runtime Version:4.0.30319.18449
+//
+// Changes to this file may cause incorrect behavior and will be lost if
+// the code is regenerated.
+//
+//------------------------------------------------------------------------------
+
+namespace SampleBithumb.Properties {
+
+
+ [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
+ [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "12.0.0.0")]
+ internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase {
+
+ private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
+
+ public static Settings Default {
+ get {
+ return defaultInstance;
+ }
+ }
+ }
+}
diff --git a/Samples/Bithumb/SampleBithumb/Properties/Settings.settings b/Samples/Bithumb/SampleBithumb/Properties/Settings.settings
new file mode 100644
index 000000000..9010101f8
--- /dev/null
+++ b/Samples/Bithumb/SampleBithumb/Properties/Settings.settings
@@ -0,0 +1,7 @@
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/Samples/Bithumb/SampleBithumb/QuotesWindow.xaml b/Samples/Bithumb/SampleBithumb/QuotesWindow.xaml
new file mode 100644
index 000000000..33f9c5766
--- /dev/null
+++ b/Samples/Bithumb/SampleBithumb/QuotesWindow.xaml
@@ -0,0 +1,7 @@
+
+
+
\ No newline at end of file
diff --git a/Samples/Bithumb/SampleBithumb/QuotesWindow.xaml.cs b/Samples/Bithumb/SampleBithumb/QuotesWindow.xaml.cs
new file mode 100644
index 000000000..bec4b9fea
--- /dev/null
+++ b/Samples/Bithumb/SampleBithumb/QuotesWindow.xaml.cs
@@ -0,0 +1,10 @@
+namespace SampleBithumb
+{
+ public partial class QuotesWindow
+ {
+ public QuotesWindow()
+ {
+ InitializeComponent();
+ }
+ }
+}
\ No newline at end of file
diff --git a/Samples/Bithumb/SampleBithumb/SampleBithumb.csproj b/Samples/Bithumb/SampleBithumb/SampleBithumb.csproj
new file mode 100644
index 000000000..22e132b8e
--- /dev/null
+++ b/Samples/Bithumb/SampleBithumb/SampleBithumb.csproj
@@ -0,0 +1,281 @@
+
+
+
+ Debug
+ AnyCPU
+ 9.0.30729
+ 2.0
+ {90B10F70-D343-4189-87DC-37E48FA1133C}
+ WinExe
+ Properties
+ SampleBithumb
+ SampleBithumb
+ v4.5.1
+ 512
+ {60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}
+ 4
+ ..\..\..\References\stocksharp.ico
+
+
+ 3.5
+
+ publish\
+ true
+ Disk
+ false
+ Foreground
+ 7
+ Days
+ false
+ false
+ true
+ 0
+ 1.0.0.%2a
+ false
+ false
+ true
+
+
+
+
+
+
+
+
+
+
+
+ true
+ full
+ false
+ bin\Debug\
+ DEBUG;TRACE
+ prompt
+ 4
+ AnyCPU
+ AllRules.ruleset
+ false
+
+
+ pdbonly
+ true
+ bin\Release\
+ TRACE
+ prompt
+ 4
+ AnyCPU
+ AllRules.ruleset
+ false
+
+
+
+ ..\..\..\References\Ecng.Localization.dll
+
+
+ ..\..\..\References\Ecng.Common.dll
+
+
+ ..\..\..\References\MoreLinq.dll
+
+
+
+
+
+
+
+
+
+
+ ..\..\..\References\Ecng.Collections.dll
+
+
+ ..\..\..\References\Ecng.ComponentModel.dll
+
+
+ ..\..\..\References\Ecng.Serialization.dll
+
+
+ ..\..\..\References\Ecng.Xaml.dll
+
+
+ ..\..\..\References\DevExpress.Data.v17.2.dll
+
+
+ ..\..\..\References\DevExpress.Xpf.Core.v17.2.dll
+
+
+ ..\..\..\References\DevExpress.Xpf.Grid.v17.2.dll
+
+
+ ..\..\..\References\DevExpress.Xpf.Grid.v17.2.Core.dll
+
+
+ ..\..\..\References\DevExpress.Xpf.Themes.Office2016White.v17.2.dll
+
+
+
+
+ MSBuild:Compile
+ Designer
+ MSBuild:Compile
+ Designer
+
+
+ Properties\StockSharpAssemblyInfo.cs
+
+
+ App.xaml
+ Code
+
+
+
+
+ MainWindow.xaml
+
+
+ MyTradesWindow.xaml
+
+
+ OrdersWindow.xaml
+
+
+ PortfoliosWindow.xaml
+
+
+
+ True
+ True
+ Resources.resx
+
+
+ True
+ Settings.settings
+ True
+
+
+ QuotesWindow.xaml
+
+
+ SecuritiesWindow.xaml
+
+
+ TradesWindow.xaml
+
+
+ ResXFileCodeGenerator
+ Resources.Designer.cs
+
+
+
+ SettingsSingleFileGenerator
+ Settings.Designer.cs
+
+
+
+
+
+ MSBuild:Compile
+ Designer
+ MSBuild:Compile
+ Designer
+
+
+ Designer
+ MSBuild:Compile
+ MSBuild:Compile
+ Designer
+
+
+ MSBuild:Compile
+ Designer
+ MSBuild:Compile
+ Designer
+
+
+ MSBuild:Compile
+ Designer
+
+
+ MSBuild:Compile
+ Designer
+ MSBuild:Compile
+ Designer
+
+
+ MSBuild:Compile
+ Designer
+ MSBuild:Compile
+ Designer
+
+
+ MSBuild:Compile
+ Designer
+ MSBuild:Compile
+ Designer
+
+
+
+
+ False
+ .NET Framework 3.5 SP1 Client Profile
+ false
+
+
+ False
+ .NET Framework 3.5 SP1
+ true
+
+
+ False
+ Windows Installer 3.1
+ true
+
+
+
+
+ {4FD21E37-BD2D-4AEF-8297-CEA4C7EBEF01}
+ Bithumb
+
+
+ {2A5C6FAD-106C-4A4A-B602-77A6B1034CA2}
+ Algo
+
+
+ {DCE69DB8-53CA-4B7F-9368-02F175A31074}
+ BusinessEntities
+
+
+ {A98A81CE-75A1-4FAB-9C02-E6EEF4B51F4F}
+ Localization
+
+
+ {C4476ADD-A3D5-41BB-9D43-55D865863B78}
+ Logging
+
+
+ {B47F9C23-A4BD-46A9-BF27-54CB3D653503}
+ Messages
+
+
+ {c449d618-dea4-41c3-ba86-9f827c7421dc}
+ Xaml.Charting
+
+
+ {64E4D6F0-36B6-4904-9BA7-FFFBE5FF71D8}
+ Xaml
+
+
+
+
+ stocksharp.ico
+
+
+
+
+
\ No newline at end of file
diff --git a/Samples/Bithumb/SampleBithumb/SampleBithumb.licenseheader b/Samples/Bithumb/SampleBithumb/SampleBithumb.licenseheader
new file mode 100644
index 000000000..a1db37839
--- /dev/null
+++ b/Samples/Bithumb/SampleBithumb/SampleBithumb.licenseheader
@@ -0,0 +1,45 @@
+extensions: designer.cs generated.cs
+extensions: .cs .cpp .h
+#region S# License
+/******************************************************************************************
+NOTICE!!! This program and source code is owned and licensed by
+StockSharp Algo Trading, LLC, www.stocksharp.com
+Viewing or use of this code requires your acceptance of the license
+agreement found at https://github.com/StockSharp/StockSharp/blob/master/LICENSE
+Removal of this comment is a violation of the license agreement.
+
+Project: %Namespace%.%Project%
+File: %FileName%
+Created: %CreationYear%, %CreationMonth%, %CreationDay%, %CreationTime%
+
+Copyright 2010 by StockSharp Algo Trading, LLC
+*******************************************************************************************/
+#endregion S# License
+extensions: .aspx .ascx
+<%--
+NOTICE!!! This program and source code is owned and licensed by
+StockSharp Algo Trading, LLC, www.stocksharp.com
+Viewing or use of this code requires your acceptance of the license
+agreement found at https://github.com/StockSharp/StockSharp/blob/master/LICENSE
+Removal of this comment is a violation of the license agreement.
+
+Project: %Namespace%.%Project%
+File: %FileName%
+Created: %CreationYear%, %CreationMonth%, %CreationDay%, %CreationTime%
+
+Copyright 2010 by StockSharp Algo Trading, LLC
+--%>
+extensions: .xml .config .xsd
+
\ No newline at end of file
diff --git a/Samples/Bithumb/SampleBithumb/SampleBithumbPublic.csproj b/Samples/Bithumb/SampleBithumb/SampleBithumbPublic.csproj
new file mode 100644
index 000000000..5817cd623
--- /dev/null
+++ b/Samples/Bithumb/SampleBithumb/SampleBithumbPublic.csproj
@@ -0,0 +1,275 @@
+
+
+
+ Debug
+ AnyCPU
+ 9.0.30729
+ 2.0
+ {0D7BD2D3-FBA0-491F-BC45-860AF15F549B}
+ WinExe
+ Properties
+ SampleBithumb
+ SampleBithumb
+ v4.5.1
+ 512
+ {60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}
+ 4
+ ..\..\..\References\stocksharp.ico
+
+
+ 3.5
+
+ publish\
+ true
+ Disk
+ false
+ Foreground
+ 7
+ Days
+ false
+ false
+ true
+ 0
+ 1.0.0.%2a
+ false
+ false
+ true
+
+
+
+ true
+ full
+ false
+ bin\Debug\
+ DEBUG;TRACE
+ prompt
+ 4
+ AnyCPU
+ AllRules.ruleset
+ false
+
+
+ pdbonly
+ true
+ bin\Release\
+ TRACE
+ prompt
+ 4
+ AnyCPU
+ AllRules.ruleset
+ false
+
+
+
+ ..\..\..\References\StockSharp.Bithumb.dll
+
+
+
+
+
+
+
+
+
+
+ ..\..\..\References\Ecng.Localization.dll
+
+
+ ..\..\..\References\Ecng.Common.dll
+
+
+ ..\..\..\References\MoreLinq.dll
+
+
+ ..\..\..\References\Ecng.Collections.dll
+
+
+ ..\..\..\References\Ecng.ComponentModel.dll
+
+
+ ..\..\..\References\Ecng.Serialization.dll
+
+
+ ..\..\..\References\Ecng.Xaml.dll
+
+
+ ..\..\..\References\Xceed.Wpf.Toolkit.dll
+
+
+ ..\..\..\References\DevExpress.Data.v17.2.dll
+
+
+ ..\..\..\References\DevExpress.Xpf.Core.v17.2.dll
+
+
+ ..\..\..\References\DevExpress.Xpf.Grid.v17.2.dll
+
+
+ ..\..\..\References\DevExpress.Xpf.Grid.v17.2.Core.dll
+
+
+ ..\..\..\References\DevExpress.Xpf.LayoutControl.v17.2.dll
+
+
+
+
+ MSBuild:Compile
+ Designer
+ MSBuild:Compile
+ Designer
+
+
+ Properties\StockSharpAssemblyInfo.cs
+
+
+ App.xaml
+ Code
+
+
+
+
+ MainWindow.xaml
+
+
+ MyTradesWindow.xaml
+
+
+ OrdersWindow.xaml
+
+
+ PortfoliosWindow.xaml
+
+
+
+ True
+ True
+ Resources.resx
+
+
+ True
+ Settings.settings
+ True
+
+
+ QuotesWindow.xaml
+
+
+ SecuritiesWindow.xaml
+
+
+ TradesWindow.xaml
+
+
+ ResXFileCodeGenerator
+ Resources.Designer.cs
+
+
+
+ SettingsSingleFileGenerator
+ Settings.Designer.cs
+
+
+
+
+
+ MSBuild:Compile
+ Designer
+ MSBuild:Compile
+ Designer
+
+
+ Designer
+ MSBuild:Compile
+ MSBuild:Compile
+ Designer
+
+
+ MSBuild:Compile
+ Designer
+ MSBuild:Compile
+ Designer
+
+
+ MSBuild:Compile
+ Designer
+
+
+ MSBuild:Compile
+ Designer
+ MSBuild:Compile
+ Designer
+
+
+ MSBuild:Compile
+ Designer
+ MSBuild:Compile
+ Designer
+
+
+ MSBuild:Compile
+ Designer
+ MSBuild:Compile
+ Designer
+
+
+
+
+ False
+ .NET Framework 3.5 SP1 Client Profile
+ false
+
+
+ False
+ .NET Framework 3.5 SP1
+ true
+
+
+ False
+ Windows Installer 3.1
+ true
+
+
+
+
+ stocksharp.ico
+
+
+
+
+ {AF225452-1CF1-48A2-B381-C02BEBE643D7}
+ Bithumb
+
+
+ {64e4d6f0-36b6-4904-9ba7-fffbe5ff71d8}
+ Xaml
+
+
+ {2A5C6FAD-106C-4A4A-B602-77A6B1034CA2}
+ Algo
+
+
+ {DCE69DB8-53CA-4B7F-9368-02F175A31074}
+ BusinessEntities
+
+
+ {A98A81CE-75A1-4FAB-9C02-E6EEF4B51F4F}
+ Localization
+
+
+ {C4476ADD-A3D5-41BB-9D43-55D865863B78}
+ Logging
+
+
+ {b47f9c23-a4bd-46a9-bf27-54cb3d653503}
+ Messages
+
+
+
+
+
\ No newline at end of file
diff --git a/Samples/Bithumb/SampleBithumb/SecuritiesWindow.xaml b/Samples/Bithumb/SampleBithumb/SecuritiesWindow.xaml
new file mode 100644
index 000000000..73f8fdd0d
--- /dev/null
+++ b/Samples/Bithumb/SampleBithumb/SecuritiesWindow.xaml
@@ -0,0 +1,25 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/Samples/Bithumb/SampleBithumb/SecuritiesWindow.xaml.cs b/Samples/Bithumb/SampleBithumb/SecuritiesWindow.xaml.cs
new file mode 100644
index 000000000..c69db30db
--- /dev/null
+++ b/Samples/Bithumb/SampleBithumb/SecuritiesWindow.xaml.cs
@@ -0,0 +1,126 @@
+namespace SampleBithumb
+{
+ using System;
+ using System.Linq;
+ using System.Windows;
+
+ using Ecng.Collections;
+ using Ecng.Xaml;
+
+ using MoreLinq;
+
+ using StockSharp.BusinessEntities;
+ using StockSharp.Xaml;
+ using StockSharp.Localization;
+
+ public partial class SecuritiesWindow
+ {
+ private readonly SynchronizedDictionary _quotesWindows = new SynchronizedDictionary();
+ private bool _initialized;
+
+ public SecuritiesWindow()
+ {
+ InitializeComponent();
+ }
+
+ protected override void OnClosed(EventArgs e)
+ {
+ _quotesWindows.SyncDo(d => d.Values.ForEach(w =>
+ {
+ w.DeleteHideable();
+ w.Close();
+ }));
+
+ var trader = MainWindow.Instance.Trader;
+ if (trader != null)
+ {
+ if (_initialized)
+ trader.MarketDepthChanged -= TraderOnMarketDepthChanged;
+ }
+
+ base.OnClosed(e);
+ }
+
+ private void SecurityPicker_OnSecuritySelected(Security security)
+ {
+ Quotes.IsEnabled = NewOrder.IsEnabled = Depth.IsEnabled = security != null;
+ }
+
+ private void NewOrderClick(object sender, RoutedEventArgs e)
+ {
+ var newOrder = new OrderWindow
+ {
+ Order = new Order { Security = SecurityPicker.SelectedSecurity },
+ SecurityProvider = MainWindow.Instance.Trader,
+ MarketDataProvider = MainWindow.Instance.Trader,
+ Portfolios = new PortfolioDataSource(MainWindow.Instance.Trader),
+ };
+
+ if (newOrder.ShowModal(this))
+ MainWindow.Instance.Trader.RegisterOrder(newOrder.Order);
+ }
+
+ private void DepthClick(object sender, RoutedEventArgs e)
+ {
+ var trader = MainWindow.Instance.Trader;
+
+ foreach (var security in SecurityPicker.SelectedSecurities)
+ {
+ var window = _quotesWindows.SafeAdd(security, s =>
+ {
+ // начинаем получать котировки стакана
+ trader.RegisterMarketDepth(security);
+
+ // создаем окно со стаканом
+ var wnd = new QuotesWindow
+ {
+ Title = security.Id + " " + LocalizedStrings.MarketDepth
+ };
+ wnd.MakeHideable();
+ return wnd;
+ });
+
+ if (window.Visibility == Visibility.Visible)
+ window.Hide();
+ else
+ {
+ window.Show();
+ window.DepthCtrl.UpdateDepth(trader.GetMarketDepth(security));
+ }
+
+ if (!_initialized)
+ {
+ trader.MarketDepthChanged += TraderOnMarketDepthChanged;
+ _initialized = true;
+ }
+ }
+ }
+
+ private void QuotesClick(object sender, RoutedEventArgs e)
+ {
+ var trader = MainWindow.Instance.Trader;
+
+ foreach (var security in SecurityPicker.SelectedSecurities)
+ {
+ if (trader.RegisteredSecurities.Contains(security))
+ {
+ trader.UnRegisterSecurity(security);
+ trader.UnRegisterTrades(security);
+ }
+ else
+ {
+ trader.RegisterSecurity(security);
+ trader.RegisterTrades(security);
+ }
+ }
+ }
+
+ private void TraderOnMarketDepthChanged(MarketDepth depth)
+ {
+ var wnd = _quotesWindows.TryGetValue(depth.Security);
+
+ if (wnd != null)
+ wnd.DepthCtrl.UpdateDepth(depth);
+ }
+ }
+}
\ No newline at end of file
diff --git a/Samples/Bithumb/SampleBithumb/TradesWindow.xaml b/Samples/Bithumb/SampleBithumb/TradesWindow.xaml
new file mode 100644
index 000000000..074c2680d
--- /dev/null
+++ b/Samples/Bithumb/SampleBithumb/TradesWindow.xaml
@@ -0,0 +1,7 @@
+
+
+
\ No newline at end of file
diff --git a/Samples/Bithumb/SampleBithumb/TradesWindow.xaml.cs b/Samples/Bithumb/SampleBithumb/TradesWindow.xaml.cs
new file mode 100644
index 000000000..714cd244d
--- /dev/null
+++ b/Samples/Bithumb/SampleBithumb/TradesWindow.xaml.cs
@@ -0,0 +1,10 @@
+namespace SampleBithumb
+{
+ public partial class TradesWindow
+ {
+ public TradesWindow()
+ {
+ InitializeComponent();
+ }
+ }
+}
\ No newline at end of file
diff --git a/Samples/Bithumb/SampleBithumb/app.config b/Samples/Bithumb/SampleBithumb/app.config
new file mode 100644
index 000000000..884f9844f
--- /dev/null
+++ b/Samples/Bithumb/SampleBithumb/app.config
@@ -0,0 +1,3 @@
+
+
+
diff --git a/Samples/Bittrex/SampleBittrex/App.xaml b/Samples/Bittrex/SampleBittrex/App.xaml
new file mode 100644
index 000000000..543a59fee
--- /dev/null
+++ b/Samples/Bittrex/SampleBittrex/App.xaml
@@ -0,0 +1,8 @@
+
+
+
+
+
diff --git a/Samples/Bittrex/SampleBittrex/App.xaml.cs b/Samples/Bittrex/SampleBittrex/App.xaml.cs
new file mode 100644
index 000000000..95bbf3ff5
--- /dev/null
+++ b/Samples/Bittrex/SampleBittrex/App.xaml.cs
@@ -0,0 +1,14 @@
+namespace SampleBittrex
+{
+ using System.Windows;
+ using System.Windows.Threading;
+
+ public partial class App
+ {
+ private void ApplicationDispatcherUnhandledException(object sender, DispatcherUnhandledExceptionEventArgs e)
+ {
+ MessageBox.Show(MainWindow, e.Exception.ToString());
+ e.Handled = true;
+ }
+ }
+}
\ No newline at end of file
diff --git a/Samples/Bittrex/SampleBittrex/MainWindow.xaml b/Samples/Bittrex/SampleBittrex/MainWindow.xaml
new file mode 100644
index 000000000..d202b1326
--- /dev/null
+++ b/Samples/Bittrex/SampleBittrex/MainWindow.xaml
@@ -0,0 +1,35 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/Samples/Bittrex/SampleBittrex/MainWindow.xaml.cs b/Samples/Bittrex/SampleBittrex/MainWindow.xaml.cs
new file mode 100644
index 000000000..916c377c5
--- /dev/null
+++ b/Samples/Bittrex/SampleBittrex/MainWindow.xaml.cs
@@ -0,0 +1,214 @@
+namespace SampleBittrex
+{
+ using System;
+ using System.ComponentModel;
+ using System.Windows;
+
+ using Ecng.Common;
+ using Ecng.Xaml;
+
+ using StockSharp.BusinessEntities;
+ using StockSharp.Bittrex;
+ using StockSharp.Logging;
+ using StockSharp.Localization;
+
+ public partial class MainWindow
+ {
+ private bool _isConnected;
+
+ public BittrexTrader Trader;
+
+ private readonly SecuritiesWindow _securitiesWindow = new SecuritiesWindow();
+ private readonly TradesWindow _tradesWindow = new TradesWindow();
+ private readonly MyTradesWindow _myTradesWindow = new MyTradesWindow();
+ private readonly OrdersWindow _ordersWindow = new OrdersWindow();
+ private readonly PortfoliosWindow _portfoliosWindow = new PortfoliosWindow();
+
+ private readonly LogManager _logManager = new LogManager();
+
+ public MainWindow()
+ {
+ InitializeComponent();
+
+ Title = Title.Put("Bittrex");
+
+ _ordersWindow.MakeHideable();
+ _myTradesWindow.MakeHideable();
+ _tradesWindow.MakeHideable();
+ _securitiesWindow.MakeHideable();
+ _portfoliosWindow.MakeHideable();
+
+ Instance = this;
+
+ _logManager.Sources.Add(MemoryStatistics.Instance);
+ _logManager.Listeners.Add(new FileLogListener { LogDirectory = "StockSharp_Bittrex" });
+ }
+
+ protected override void OnClosing(CancelEventArgs e)
+ {
+ _ordersWindow.DeleteHideable();
+ _myTradesWindow.DeleteHideable();
+ _tradesWindow.DeleteHideable();
+ _securitiesWindow.DeleteHideable();
+ _portfoliosWindow.DeleteHideable();
+
+ _securitiesWindow.Close();
+ _tradesWindow.Close();
+ _myTradesWindow.Close();
+ _ordersWindow.Close();
+ _portfoliosWindow.Close();
+
+ if (Trader != null)
+ Trader.Dispose();
+
+ base.OnClosing(e);
+ }
+
+ public static MainWindow Instance { get; private set; }
+
+ private void ConnectClick(object sender, RoutedEventArgs e)
+ {
+ if (!_isConnected)
+ {
+ if (Key.Text.IsEmpty())
+ {
+ MessageBox.Show(this, LocalizedStrings.Str3689);
+ return;
+ }
+ else if (Secret.Password.IsEmpty())
+ {
+ MessageBox.Show(this, LocalizedStrings.Str3690);
+ return;
+ }
+
+ if (Trader == null)
+ {
+ // create connector
+ Trader = new BittrexTrader();// { LogLevel = LogLevels.Debug };
+
+ _logManager.Sources.Add(Trader);
+
+ Trader.Restored += () => this.GuiAsync(() =>
+ {
+ // update gui labes
+ ChangeConnectStatus(true);
+ MessageBox.Show(this, LocalizedStrings.Str2958);
+ });
+
+ // subscribe on connection successfully event
+ Trader.Connected += () =>
+ {
+ // set flag (connection is established)
+ _isConnected = true;
+
+ // update gui labes
+ this.GuiAsync(() => ChangeConnectStatus(true));
+ };
+ Trader.Disconnected += () => this.GuiAsync(() => ChangeConnectStatus(false));
+
+ // subscribe on connection error event
+ Trader.ConnectionError += error => this.GuiAsync(() =>
+ {
+ // update gui labes
+ ChangeConnectStatus(false);
+
+ MessageBox.Show(this, error.ToString(), LocalizedStrings.Str2959);
+ });
+
+ // subscribe on error event
+ Trader.Error += error =>
+ this.GuiAsync(() => MessageBox.Show(this, error.ToString(), LocalizedStrings.Str2955));
+
+ // subscribe on error of market data subscription event
+ Trader.MarketDataSubscriptionFailed += (security, msg, error) =>
+ this.GuiAsync(() => MessageBox.Show(this, error.ToString(), LocalizedStrings.Str2956Params.Put(msg.DataType, security)));
+
+ Trader.NewSecurity += _securitiesWindow.SecurityPicker.Securities.Add;
+ Trader.NewMyTrade += _myTradesWindow.TradeGrid.Trades.Add;
+ Trader.NewTrade += _tradesWindow.TradeGrid.Trades.Add;
+ Trader.NewOrder += _ordersWindow.OrderGrid.Orders.Add;
+
+ Trader.NewPortfolio += _portfoliosWindow.PortfolioGrid.Portfolios.Add;
+ Trader.NewPosition += _portfoliosWindow.PortfolioGrid.Positions.Add;
+
+ // subscribe on error of order registration event
+ Trader.OrderRegisterFailed += _ordersWindow.OrderGrid.AddRegistrationFail;
+ // subscribe on error of order cancelling event
+ Trader.OrderCancelFailed += OrderFailed;
+
+ Trader.MassOrderCancelFailed += (transId, error) =>
+ this.GuiAsync(() => MessageBox.Show(this, error.ToString(), LocalizedStrings.Str716));
+
+ // set market data provider
+ _securitiesWindow.SecurityPicker.MarketDataProvider = Trader;
+
+ ShowSecurities.IsEnabled = ShowTrades.IsEnabled =
+ ShowMyTrades.IsEnabled = ShowOrders.IsEnabled =
+ ShowPortfolios.IsEnabled = true;
+ }
+
+ Trader.Key = Key.Text;
+ Trader.Secret = Secret.Password;
+
+ // clear password box for security reason
+ //Secret.Clear();
+
+ Trader.Connect();
+ }
+ else
+ {
+ Trader.Disconnect();
+ }
+ }
+
+ private void OrderFailed(OrderFail fail)
+ {
+ this.GuiAsync(() =>
+ {
+ MessageBox.Show(this, fail.Error.ToString(), LocalizedStrings.Str153);
+ });
+ }
+
+ private void ChangeConnectStatus(bool isConnected)
+ {
+ _isConnected = isConnected;
+ ConnectBtn.Content = isConnected ? LocalizedStrings.Disconnect : LocalizedStrings.Connect;
+ }
+
+ private void ShowSecuritiesClick(object sender, RoutedEventArgs e)
+ {
+ ShowOrHide(_securitiesWindow);
+ }
+
+ private void ShowTradesClick(object sender, RoutedEventArgs e)
+ {
+ ShowOrHide(_tradesWindow);
+ }
+
+ private void ShowMyTradesClick(object sender, RoutedEventArgs e)
+ {
+ ShowOrHide(_myTradesWindow);
+ }
+
+ private void ShowOrdersClick(object sender, RoutedEventArgs e)
+ {
+ ShowOrHide(_ordersWindow);
+ }
+
+ private void ShowPortfoliosClick(object sender, RoutedEventArgs e)
+ {
+ ShowOrHide(_portfoliosWindow);
+ }
+
+ private static void ShowOrHide(Window window)
+ {
+ if (window == null)
+ throw new ArgumentNullException(nameof(window));
+
+ if (window.Visibility == Visibility.Visible)
+ window.Hide();
+ else
+ window.Show();
+ }
+ }
+}
diff --git a/Samples/Bittrex/SampleBittrex/MyTradesWindow.xaml b/Samples/Bittrex/SampleBittrex/MyTradesWindow.xaml
new file mode 100644
index 000000000..4329636a9
--- /dev/null
+++ b/Samples/Bittrex/SampleBittrex/MyTradesWindow.xaml
@@ -0,0 +1,8 @@
+
+
+
\ No newline at end of file
diff --git a/Samples/Bittrex/SampleBittrex/MyTradesWindow.xaml.cs b/Samples/Bittrex/SampleBittrex/MyTradesWindow.xaml.cs
new file mode 100644
index 000000000..16c563894
--- /dev/null
+++ b/Samples/Bittrex/SampleBittrex/MyTradesWindow.xaml.cs
@@ -0,0 +1,10 @@
+namespace SampleBittrex
+{
+ public partial class MyTradesWindow
+ {
+ public MyTradesWindow()
+ {
+ InitializeComponent();
+ }
+ }
+}
\ No newline at end of file
diff --git a/Samples/Bittrex/SampleBittrex/OrdersWindow.xaml b/Samples/Bittrex/SampleBittrex/OrdersWindow.xaml
new file mode 100644
index 000000000..cf07d757a
--- /dev/null
+++ b/Samples/Bittrex/SampleBittrex/OrdersWindow.xaml
@@ -0,0 +1,16 @@
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/Samples/Bittrex/SampleBittrex/OrdersWindow.xaml.cs b/Samples/Bittrex/SampleBittrex/OrdersWindow.xaml.cs
new file mode 100644
index 000000000..68bd33917
--- /dev/null
+++ b/Samples/Bittrex/SampleBittrex/OrdersWindow.xaml.cs
@@ -0,0 +1,49 @@
+namespace SampleBittrex
+{
+ using System.Windows;
+
+ using Ecng.Common;
+ using Ecng.Xaml;
+
+ using StockSharp.Algo;
+ using StockSharp.BusinessEntities;
+ using StockSharp.Localization;
+ using StockSharp.Xaml;
+
+ public partial class OrdersWindow
+ {
+ public OrdersWindow()
+ {
+ InitializeComponent();
+ }
+
+ private static IConnector Connector => MainWindow.Instance.Trader;
+
+ private void OrderGrid_OnOrderCanceling(Order order)
+ {
+ Connector.CancelOrder(order);
+ }
+
+ private void OrderGrid_OnOrderReRegistering(Order order)
+ {
+ var window = new OrderWindow
+ {
+ Title = LocalizedStrings.Str2976Params.Put(order.TransactionId),
+ SecurityProvider = Connector,
+ MarketDataProvider = Connector,
+ Portfolios = new PortfolioDataSource(Connector),
+ Order = order.ReRegisterClone(newVolume: order.Balance),
+ };
+
+ if (window.ShowModal(this))
+ {
+ Connector.ReRegisterOrder(order, window.Order);
+ }
+ }
+
+ private void CancelAll_OnClick(object sender, RoutedEventArgs e)
+ {
+ Connector.CancelOrders();
+ }
+ }
+}
\ No newline at end of file
diff --git a/Samples/Bittrex/SampleBittrex/PortfoliosWindow.xaml b/Samples/Bittrex/SampleBittrex/PortfoliosWindow.xaml
new file mode 100644
index 000000000..add3df121
--- /dev/null
+++ b/Samples/Bittrex/SampleBittrex/PortfoliosWindow.xaml
@@ -0,0 +1,8 @@
+
+
+
\ No newline at end of file
diff --git a/Samples/Bittrex/SampleBittrex/PortfoliosWindow.xaml.cs b/Samples/Bittrex/SampleBittrex/PortfoliosWindow.xaml.cs
new file mode 100644
index 000000000..e755ebd97
--- /dev/null
+++ b/Samples/Bittrex/SampleBittrex/PortfoliosWindow.xaml.cs
@@ -0,0 +1,10 @@
+namespace SampleBittrex
+{
+ public partial class PortfoliosWindow
+ {
+ public PortfoliosWindow()
+ {
+ InitializeComponent();
+ }
+ }
+}
\ No newline at end of file
diff --git a/Samples/Bittrex/SampleBittrex/Properties/AssemblyInfo.cs b/Samples/Bittrex/SampleBittrex/Properties/AssemblyInfo.cs
new file mode 100644
index 000000000..0f5efacf4
--- /dev/null
+++ b/Samples/Bittrex/SampleBittrex/Properties/AssemblyInfo.cs
@@ -0,0 +1,20 @@
+using System.Reflection;
+using System.Runtime.InteropServices;
+using System.Windows;
+
+// General Information about an assembly is controlled through the following
+// set of attributes. Change these attribute values to modify the information
+// associated with an assembly.
+[assembly: AssemblyTitle("SampleBittrex")]
+[assembly: AssemblyDescription("")]
+
+[assembly: Guid("037B853E-A898-4CC5-AC7B-A3EAD7173011")]
+
+[assembly:ThemeInfo(
+ ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located
+ //(used if a resource is not found in the page,
+ // or application resource dictionaries)
+ ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located
+ //(used if a resource is not found in the page,
+ // app, or any theme specific resource dictionaries)
+)]
diff --git a/Samples/Bittrex/SampleBittrex/Properties/Resources.Designer.cs b/Samples/Bittrex/SampleBittrex/Properties/Resources.Designer.cs
new file mode 100644
index 000000000..b14cc9b73
--- /dev/null
+++ b/Samples/Bittrex/SampleBittrex/Properties/Resources.Designer.cs
@@ -0,0 +1,63 @@
+//------------------------------------------------------------------------------
+//
+// This code was generated by a tool.
+// Runtime Version:4.0.30319.18449
+//
+// Changes to this file may cause incorrect behavior and will be lost if
+// the code is regenerated.
+//
+//------------------------------------------------------------------------------
+
+namespace SampleBittrex.Properties {
+ using System;
+
+
+ ///
+ /// A strongly-typed resource class, for looking up localized strings, etc.
+ ///
+ // This class was auto-generated by the StronglyTypedResourceBuilder
+ // class via a tool like ResGen or Visual Studio.
+ // To add or remove a member, edit your .ResX file then rerun ResGen
+ // with the /str option, or rebuild your VS project.
+ [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")]
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
+ [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
+ internal class Resources {
+
+ private static global::System.Resources.ResourceManager resourceMan;
+
+ private static global::System.Globalization.CultureInfo resourceCulture;
+
+ [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
+ internal Resources() {
+ }
+
+ ///
+ /// Returns the cached ResourceManager instance used by this class.
+ ///
+ [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
+ internal static global::System.Resources.ResourceManager ResourceManager {
+ get {
+ if (object.ReferenceEquals(resourceMan, null)) {
+ global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("SampleBittrex.Properties.Resources", typeof(Resources).Assembly);
+ resourceMan = temp;
+ }
+ return resourceMan;
+ }
+ }
+
+ ///
+ /// Overrides the current thread's CurrentUICulture property for all
+ /// resource lookups using this strongly typed resource class.
+ ///
+ [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
+ internal static global::System.Globalization.CultureInfo Culture {
+ get {
+ return resourceCulture;
+ }
+ set {
+ resourceCulture = value;
+ }
+ }
+ }
+}
diff --git a/Samples/Bittrex/SampleBittrex/Properties/Resources.resx b/Samples/Bittrex/SampleBittrex/Properties/Resources.resx
new file mode 100644
index 000000000..13b775f1d
--- /dev/null
+++ b/Samples/Bittrex/SampleBittrex/Properties/Resources.resx
@@ -0,0 +1,117 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ text/microsoft-resx
+
+
+ 2.0
+
+
+ System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
+ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
\ No newline at end of file
diff --git a/Samples/Bittrex/SampleBittrex/Properties/Settings.Designer.cs b/Samples/Bittrex/SampleBittrex/Properties/Settings.Designer.cs
new file mode 100644
index 000000000..1bc8fdd68
--- /dev/null
+++ b/Samples/Bittrex/SampleBittrex/Properties/Settings.Designer.cs
@@ -0,0 +1,26 @@
+//------------------------------------------------------------------------------
+//
+// This code was generated by a tool.
+// Runtime Version:4.0.30319.18449
+//
+// Changes to this file may cause incorrect behavior and will be lost if
+// the code is regenerated.
+//
+//------------------------------------------------------------------------------
+
+namespace SampleBittrex.Properties {
+
+
+ [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
+ [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "12.0.0.0")]
+ internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase {
+
+ private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
+
+ public static Settings Default {
+ get {
+ return defaultInstance;
+ }
+ }
+ }
+}
diff --git a/Samples/Bittrex/SampleBittrex/Properties/Settings.settings b/Samples/Bittrex/SampleBittrex/Properties/Settings.settings
new file mode 100644
index 000000000..9010101f8
--- /dev/null
+++ b/Samples/Bittrex/SampleBittrex/Properties/Settings.settings
@@ -0,0 +1,7 @@
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/Samples/Bittrex/SampleBittrex/QuotesWindow.xaml b/Samples/Bittrex/SampleBittrex/QuotesWindow.xaml
new file mode 100644
index 000000000..46f10c1b6
--- /dev/null
+++ b/Samples/Bittrex/SampleBittrex/QuotesWindow.xaml
@@ -0,0 +1,7 @@
+
+
+
\ No newline at end of file
diff --git a/Samples/Bittrex/SampleBittrex/QuotesWindow.xaml.cs b/Samples/Bittrex/SampleBittrex/QuotesWindow.xaml.cs
new file mode 100644
index 000000000..d976d1b45
--- /dev/null
+++ b/Samples/Bittrex/SampleBittrex/QuotesWindow.xaml.cs
@@ -0,0 +1,10 @@
+namespace SampleBittrex
+{
+ public partial class QuotesWindow
+ {
+ public QuotesWindow()
+ {
+ InitializeComponent();
+ }
+ }
+}
\ No newline at end of file
diff --git a/Samples/Bittrex/SampleBittrex/SampleBittrex.csproj b/Samples/Bittrex/SampleBittrex/SampleBittrex.csproj
new file mode 100644
index 000000000..965ed2f1c
--- /dev/null
+++ b/Samples/Bittrex/SampleBittrex/SampleBittrex.csproj
@@ -0,0 +1,281 @@
+
+
+
+ Debug
+ AnyCPU
+ 9.0.30729
+ 2.0
+ {46C6966D-B765-4406-99CA-16EFEFF1FA92}
+ WinExe
+ Properties
+ SampleBittrex
+ SampleBittrex
+ v4.5.1
+ 512
+ {60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}
+ 4
+ ..\..\..\References\stocksharp.ico
+
+
+ 3.5
+
+ publish\
+ true
+ Disk
+ false
+ Foreground
+ 7
+ Days
+ false
+ false
+ true
+ 0
+ 1.0.0.%2a
+ false
+ false
+ true
+
+
+
+
+
+
+
+
+
+
+
+ true
+ full
+ false
+ bin\Debug\
+ DEBUG;TRACE
+ prompt
+ 4
+ AnyCPU
+ AllRules.ruleset
+ false
+
+
+ pdbonly
+ true
+ bin\Release\
+ TRACE
+ prompt
+ 4
+ AnyCPU
+ AllRules.ruleset
+ false
+
+
+
+ ..\..\..\References\Ecng.Localization.dll
+
+
+ ..\..\..\References\Ecng.Common.dll
+
+
+ ..\..\..\References\MoreLinq.dll
+
+
+
+
+
+
+
+
+
+
+ ..\..\..\References\Ecng.Collections.dll
+
+
+ ..\..\..\References\Ecng.ComponentModel.dll
+
+
+ ..\..\..\References\Ecng.Serialization.dll
+
+
+ ..\..\..\References\Ecng.Xaml.dll
+
+
+ ..\..\..\References\DevExpress.Data.v17.2.dll
+
+
+ ..\..\..\References\DevExpress.Xpf.Core.v17.2.dll
+
+
+ ..\..\..\References\DevExpress.Xpf.Grid.v17.2.dll
+
+
+ ..\..\..\References\DevExpress.Xpf.Grid.v17.2.Core.dll
+
+
+ ..\..\..\References\DevExpress.Xpf.Themes.Office2016White.v17.2.dll
+
+
+
+
+ MSBuild:Compile
+ Designer
+ MSBuild:Compile
+ Designer
+
+
+ Properties\StockSharpAssemblyInfo.cs
+
+
+ App.xaml
+ Code
+
+
+
+
+ MainWindow.xaml
+
+
+ MyTradesWindow.xaml
+
+
+ OrdersWindow.xaml
+
+
+ PortfoliosWindow.xaml
+
+
+
+ True
+ True
+ Resources.resx
+
+
+ True
+ Settings.settings
+ True
+
+
+ QuotesWindow.xaml
+
+
+ SecuritiesWindow.xaml
+
+
+ TradesWindow.xaml
+
+
+ ResXFileCodeGenerator
+ Resources.Designer.cs
+
+
+
+ SettingsSingleFileGenerator
+ Settings.Designer.cs
+
+
+
+
+
+ MSBuild:Compile
+ Designer
+ MSBuild:Compile
+ Designer
+
+
+ Designer
+ MSBuild:Compile
+ MSBuild:Compile
+ Designer
+
+
+ MSBuild:Compile
+ Designer
+ MSBuild:Compile
+ Designer
+
+
+ MSBuild:Compile
+ Designer
+
+
+ MSBuild:Compile
+ Designer
+ MSBuild:Compile
+ Designer
+
+
+ MSBuild:Compile
+ Designer
+ MSBuild:Compile
+ Designer
+
+
+ MSBuild:Compile
+ Designer
+ MSBuild:Compile
+ Designer
+
+
+
+
+ False
+ .NET Framework 3.5 SP1 Client Profile
+ false
+
+
+ False
+ .NET Framework 3.5 SP1
+ true
+
+
+ False
+ Windows Installer 3.1
+ true
+
+
+
+
+ {302f3c2a-eb95-4af7-be22-e7be567b2dab}
+ Bittrex
+
+
+ {2A5C6FAD-106C-4A4A-B602-77A6B1034CA2}
+ Algo
+
+
+ {DCE69DB8-53CA-4B7F-9368-02F175A31074}
+ BusinessEntities
+
+
+ {A98A81CE-75A1-4FAB-9C02-E6EEF4B51F4F}
+ Localization
+
+
+ {C4476ADD-A3D5-41BB-9D43-55D865863B78}
+ Logging
+
+
+ {B47F9C23-A4BD-46A9-BF27-54CB3D653503}
+ Messages
+
+
+ {c449d618-dea4-41c3-ba86-9f827c7421dc}
+ Xaml.Charting
+
+
+ {64E4D6F0-36B6-4904-9BA7-FFFBE5FF71D8}
+ Xaml
+
+
+
+
+ stocksharp.ico
+
+
+
+
+
\ No newline at end of file
diff --git a/Samples/Bittrex/SampleBittrex/SampleBittrex.licenseheader b/Samples/Bittrex/SampleBittrex/SampleBittrex.licenseheader
new file mode 100644
index 000000000..a1db37839
--- /dev/null
+++ b/Samples/Bittrex/SampleBittrex/SampleBittrex.licenseheader
@@ -0,0 +1,45 @@
+extensions: designer.cs generated.cs
+extensions: .cs .cpp .h
+#region S# License
+/******************************************************************************************
+NOTICE!!! This program and source code is owned and licensed by
+StockSharp Algo Trading, LLC, www.stocksharp.com
+Viewing or use of this code requires your acceptance of the license
+agreement found at https://github.com/StockSharp/StockSharp/blob/master/LICENSE
+Removal of this comment is a violation of the license agreement.
+
+Project: %Namespace%.%Project%
+File: %FileName%
+Created: %CreationYear%, %CreationMonth%, %CreationDay%, %CreationTime%
+
+Copyright 2010 by StockSharp Algo Trading, LLC
+*******************************************************************************************/
+#endregion S# License
+extensions: .aspx .ascx
+<%--
+NOTICE!!! This program and source code is owned and licensed by
+StockSharp Algo Trading, LLC, www.stocksharp.com
+Viewing or use of this code requires your acceptance of the license
+agreement found at https://github.com/StockSharp/StockSharp/blob/master/LICENSE
+Removal of this comment is a violation of the license agreement.
+
+Project: %Namespace%.%Project%
+File: %FileName%
+Created: %CreationYear%, %CreationMonth%, %CreationDay%, %CreationTime%
+
+Copyright 2010 by StockSharp Algo Trading, LLC
+--%>
+extensions: .xml .config .xsd
+
\ No newline at end of file
diff --git a/Samples/Bittrex/SampleBittrex/SampleBittrexPublic.csproj b/Samples/Bittrex/SampleBittrex/SampleBittrexPublic.csproj
new file mode 100644
index 000000000..798ca5c02
--- /dev/null
+++ b/Samples/Bittrex/SampleBittrex/SampleBittrexPublic.csproj
@@ -0,0 +1,275 @@
+
+
+
+ Debug
+ AnyCPU
+ 9.0.30729
+ 2.0
+ {1EBD80DA-A248-4994-B6B3-E28BCA3C4B9B}
+ WinExe
+ Properties
+ SampleBittrex
+ SampleBittrex
+ v4.5.1
+ 512
+ {60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}
+ 4
+ ..\..\..\References\stocksharp.ico
+
+
+ 3.5
+
+ publish\
+ true
+ Disk
+ false
+ Foreground
+ 7
+ Days
+ false
+ false
+ true
+ 0
+ 1.0.0.%2a
+ false
+ false
+ true
+
+
+
+ true
+ full
+ false
+ bin\Debug\
+ DEBUG;TRACE
+ prompt
+ 4
+ AnyCPU
+ AllRules.ruleset
+ false
+
+
+ pdbonly
+ true
+ bin\Release\
+ TRACE
+ prompt
+ 4
+ AnyCPU
+ AllRules.ruleset
+ false
+
+
+
+ ..\..\..\References\StockSharp.Bittrex.dll
+
+
+
+
+
+
+
+
+
+
+ ..\..\..\References\Ecng.Localization.dll
+
+
+ ..\..\..\References\Ecng.Common.dll
+
+
+ ..\..\..\References\MoreLinq.dll
+
+
+ ..\..\..\References\Ecng.Collections.dll
+
+
+ ..\..\..\References\Ecng.ComponentModel.dll
+
+
+ ..\..\..\References\Ecng.Serialization.dll
+
+
+ ..\..\..\References\Ecng.Xaml.dll
+
+
+ ..\..\..\References\Xceed.Wpf.Toolkit.dll
+
+
+ ..\..\..\References\DevExpress.Data.v17.2.dll
+
+
+ ..\..\..\References\DevExpress.Xpf.Core.v17.2.dll
+
+
+ ..\..\..\References\DevExpress.Xpf.Grid.v17.2.dll
+
+
+ ..\..\..\References\DevExpress.Xpf.Grid.v17.2.Core.dll
+
+
+ ..\..\..\References\DevExpress.Xpf.LayoutControl.v17.2.dll
+
+
+
+
+ MSBuild:Compile
+ Designer
+ MSBuild:Compile
+ Designer
+
+
+ Properties\StockSharpAssemblyInfo.cs
+
+
+ App.xaml
+ Code
+
+
+
+
+ MainWindow.xaml
+
+
+ MyTradesWindow.xaml
+
+
+ OrdersWindow.xaml
+
+
+ PortfoliosWindow.xaml
+
+
+
+ True
+ True
+ Resources.resx
+
+
+ True
+ Settings.settings
+ True
+
+
+ QuotesWindow.xaml
+
+
+ SecuritiesWindow.xaml
+
+
+ TradesWindow.xaml
+
+
+ ResXFileCodeGenerator
+ Resources.Designer.cs
+
+
+
+ SettingsSingleFileGenerator
+ Settings.Designer.cs
+
+
+
+
+
+ MSBuild:Compile
+ Designer
+ MSBuild:Compile
+ Designer
+
+
+ Designer
+ MSBuild:Compile
+ MSBuild:Compile
+ Designer
+
+
+ MSBuild:Compile
+ Designer
+ MSBuild:Compile
+ Designer
+
+
+ MSBuild:Compile
+ Designer
+
+
+ MSBuild:Compile
+ Designer
+ MSBuild:Compile
+ Designer
+
+
+ MSBuild:Compile
+ Designer
+ MSBuild:Compile
+ Designer
+
+
+ MSBuild:Compile
+ Designer
+ MSBuild:Compile
+ Designer
+
+
+
+
+ False
+ .NET Framework 3.5 SP1 Client Profile
+ false
+
+
+ False
+ .NET Framework 3.5 SP1
+ true
+
+
+ False
+ Windows Installer 3.1
+ true
+
+
+
+
+ stocksharp.ico
+
+
+
+
+ {AF225452-1CF1-48A2-B381-C02BEBE643D7}
+ Bittrex
+
+
+ {64e4d6f0-36b6-4904-9ba7-fffbe5ff71d8}
+ Xaml
+
+
+ {2A5C6FAD-106C-4A4A-B602-77A6B1034CA2}
+ Algo
+
+
+ {DCE69DB8-53CA-4B7F-9368-02F175A31074}
+ BusinessEntities
+
+
+ {A98A81CE-75A1-4FAB-9C02-E6EEF4B51F4F}
+ Localization
+
+
+ {C4476ADD-A3D5-41BB-9D43-55D865863B78}
+ Logging
+
+
+ {b47f9c23-a4bd-46a9-bf27-54cb3d653503}
+ Messages
+
+
+
+
+
\ No newline at end of file
diff --git a/Samples/Bittrex/SampleBittrex/SecuritiesWindow.xaml b/Samples/Bittrex/SampleBittrex/SecuritiesWindow.xaml
new file mode 100644
index 000000000..0e0c12f03
--- /dev/null
+++ b/Samples/Bittrex/SampleBittrex/SecuritiesWindow.xaml
@@ -0,0 +1,25 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/Samples/Bittrex/SampleBittrex/SecuritiesWindow.xaml.cs b/Samples/Bittrex/SampleBittrex/SecuritiesWindow.xaml.cs
new file mode 100644
index 000000000..a70104582
--- /dev/null
+++ b/Samples/Bittrex/SampleBittrex/SecuritiesWindow.xaml.cs
@@ -0,0 +1,126 @@
+namespace SampleBittrex
+{
+ using System;
+ using System.Linq;
+ using System.Windows;
+
+ using Ecng.Collections;
+ using Ecng.Xaml;
+
+ using MoreLinq;
+
+ using StockSharp.BusinessEntities;
+ using StockSharp.Xaml;
+ using StockSharp.Localization;
+
+ public partial class SecuritiesWindow
+ {
+ private readonly SynchronizedDictionary _quotesWindows = new SynchronizedDictionary();
+ private bool _initialized;
+
+ public SecuritiesWindow()
+ {
+ InitializeComponent();
+ }
+
+ protected override void OnClosed(EventArgs e)
+ {
+ _quotesWindows.SyncDo(d => d.Values.ForEach(w =>
+ {
+ w.DeleteHideable();
+ w.Close();
+ }));
+
+ var trader = MainWindow.Instance.Trader;
+ if (trader != null)
+ {
+ if (_initialized)
+ trader.MarketDepthChanged -= TraderOnMarketDepthChanged;
+ }
+
+ base.OnClosed(e);
+ }
+
+ private void SecurityPicker_OnSecuritySelected(Security security)
+ {
+ Quotes.IsEnabled = NewOrder.IsEnabled = Depth.IsEnabled = security != null;
+ }
+
+ private void NewOrderClick(object sender, RoutedEventArgs e)
+ {
+ var newOrder = new OrderWindow
+ {
+ Order = new Order { Security = SecurityPicker.SelectedSecurity },
+ SecurityProvider = MainWindow.Instance.Trader,
+ MarketDataProvider = MainWindow.Instance.Trader,
+ Portfolios = new PortfolioDataSource(MainWindow.Instance.Trader),
+ };
+
+ if (newOrder.ShowModal(this))
+ MainWindow.Instance.Trader.RegisterOrder(newOrder.Order);
+ }
+
+ private void DepthClick(object sender, RoutedEventArgs e)
+ {
+ var trader = MainWindow.Instance.Trader;
+
+ foreach (var security in SecurityPicker.SelectedSecurities)
+ {
+ var window = _quotesWindows.SafeAdd(security, s =>
+ {
+ // начинаем получать котировки стакана
+ trader.RegisterMarketDepth(security);
+
+ // создаем окно со стаканом
+ var wnd = new QuotesWindow
+ {
+ Title = security.Id + " " + LocalizedStrings.MarketDepth
+ };
+ wnd.MakeHideable();
+ return wnd;
+ });
+
+ if (window.Visibility == Visibility.Visible)
+ window.Hide();
+ else
+ {
+ window.Show();
+ window.DepthCtrl.UpdateDepth(trader.GetMarketDepth(security));
+ }
+
+ if (!_initialized)
+ {
+ trader.MarketDepthChanged += TraderOnMarketDepthChanged;
+ _initialized = true;
+ }
+ }
+ }
+
+ private void QuotesClick(object sender, RoutedEventArgs e)
+ {
+ var trader = MainWindow.Instance.Trader;
+
+ foreach (var security in SecurityPicker.SelectedSecurities)
+ {
+ if (trader.RegisteredSecurities.Contains(security))
+ {
+ trader.UnRegisterSecurity(security);
+ trader.UnRegisterTrades(security);
+ }
+ else
+ {
+ trader.RegisterSecurity(security);
+ trader.RegisterTrades(security);
+ }
+ }
+ }
+
+ private void TraderOnMarketDepthChanged(MarketDepth depth)
+ {
+ var wnd = _quotesWindows.TryGetValue(depth.Security);
+
+ if (wnd != null)
+ wnd.DepthCtrl.UpdateDepth(depth);
+ }
+ }
+}
\ No newline at end of file
diff --git a/Samples/Bittrex/SampleBittrex/TradesWindow.xaml b/Samples/Bittrex/SampleBittrex/TradesWindow.xaml
new file mode 100644
index 000000000..82b0a2bd3
--- /dev/null
+++ b/Samples/Bittrex/SampleBittrex/TradesWindow.xaml
@@ -0,0 +1,7 @@
+
+
+
\ No newline at end of file
diff --git a/Samples/Bittrex/SampleBittrex/TradesWindow.xaml.cs b/Samples/Bittrex/SampleBittrex/TradesWindow.xaml.cs
new file mode 100644
index 000000000..266b4955e
--- /dev/null
+++ b/Samples/Bittrex/SampleBittrex/TradesWindow.xaml.cs
@@ -0,0 +1,10 @@
+namespace SampleBittrex
+{
+ public partial class TradesWindow
+ {
+ public TradesWindow()
+ {
+ InitializeComponent();
+ }
+ }
+}
\ No newline at end of file
diff --git a/Samples/Bittrex/SampleBittrex/app.config b/Samples/Bittrex/SampleBittrex/app.config
new file mode 100644
index 000000000..884f9844f
--- /dev/null
+++ b/Samples/Bittrex/SampleBittrex/app.config
@@ -0,0 +1,3 @@
+
+
+
diff --git a/Samples/Coinbase/SampleCoinbase/App.xaml b/Samples/Coinbase/SampleCoinbase/App.xaml
new file mode 100644
index 000000000..a3a9eb7ce
--- /dev/null
+++ b/Samples/Coinbase/SampleCoinbase/App.xaml
@@ -0,0 +1,8 @@
+
+
+
+
+
diff --git a/Samples/Coinbase/SampleCoinbase/App.xaml.cs b/Samples/Coinbase/SampleCoinbase/App.xaml.cs
new file mode 100644
index 000000000..a1e4049d6
--- /dev/null
+++ b/Samples/Coinbase/SampleCoinbase/App.xaml.cs
@@ -0,0 +1,14 @@
+namespace SampleCoinbase
+{
+ using System.Windows;
+ using System.Windows.Threading;
+
+ public partial class App
+ {
+ private void ApplicationDispatcherUnhandledException(object sender, DispatcherUnhandledExceptionEventArgs e)
+ {
+ MessageBox.Show(MainWindow, e.Exception.ToString());
+ e.Handled = true;
+ }
+ }
+}
\ No newline at end of file
diff --git a/Samples/Coinbase/SampleCoinbase/MainWindow.xaml b/Samples/Coinbase/SampleCoinbase/MainWindow.xaml
new file mode 100644
index 000000000..67550073a
--- /dev/null
+++ b/Samples/Coinbase/SampleCoinbase/MainWindow.xaml
@@ -0,0 +1,35 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/Samples/Coinbase/SampleCoinbase/MainWindow.xaml.cs b/Samples/Coinbase/SampleCoinbase/MainWindow.xaml.cs
new file mode 100644
index 000000000..52bdeb710
--- /dev/null
+++ b/Samples/Coinbase/SampleCoinbase/MainWindow.xaml.cs
@@ -0,0 +1,214 @@
+namespace SampleCoinbase
+{
+ using System;
+ using System.ComponentModel;
+ using System.Windows;
+
+ using Ecng.Common;
+ using Ecng.Xaml;
+
+ using StockSharp.BusinessEntities;
+ using StockSharp.Coinbase;
+ using StockSharp.Logging;
+ using StockSharp.Localization;
+
+ public partial class MainWindow
+ {
+ private bool _isConnected;
+
+ public CoinbaseTrader Trader;
+
+ private readonly SecuritiesWindow _securitiesWindow = new SecuritiesWindow();
+ private readonly TradesWindow _tradesWindow = new TradesWindow();
+ private readonly MyTradesWindow _myTradesWindow = new MyTradesWindow();
+ private readonly OrdersWindow _ordersWindow = new OrdersWindow();
+ private readonly PortfoliosWindow _portfoliosWindow = new PortfoliosWindow();
+
+ private readonly LogManager _logManager = new LogManager();
+
+ public MainWindow()
+ {
+ InitializeComponent();
+
+ Title = Title.Put("Coinbase");
+
+ _ordersWindow.MakeHideable();
+ _myTradesWindow.MakeHideable();
+ _tradesWindow.MakeHideable();
+ _securitiesWindow.MakeHideable();
+ _portfoliosWindow.MakeHideable();
+
+ Instance = this;
+
+ _logManager.Sources.Add(MemoryStatistics.Instance);
+ _logManager.Listeners.Add(new FileLogListener { LogDirectory = "StockSharp_Coinbase" });
+ }
+
+ protected override void OnClosing(CancelEventArgs e)
+ {
+ _ordersWindow.DeleteHideable();
+ _myTradesWindow.DeleteHideable();
+ _tradesWindow.DeleteHideable();
+ _securitiesWindow.DeleteHideable();
+ _portfoliosWindow.DeleteHideable();
+
+ _securitiesWindow.Close();
+ _tradesWindow.Close();
+ _myTradesWindow.Close();
+ _ordersWindow.Close();
+ _portfoliosWindow.Close();
+
+ if (Trader != null)
+ Trader.Dispose();
+
+ base.OnClosing(e);
+ }
+
+ public static MainWindow Instance { get; private set; }
+
+ private void ConnectClick(object sender, RoutedEventArgs e)
+ {
+ if (!_isConnected)
+ {
+ if (Key.Text.IsEmpty())
+ {
+ MessageBox.Show(this, LocalizedStrings.Str3689);
+ return;
+ }
+ else if (Secret.Password.IsEmpty())
+ {
+ MessageBox.Show(this, LocalizedStrings.Str3690);
+ return;
+ }
+
+ if (Trader == null)
+ {
+ // create connector
+ Trader = new CoinbaseTrader();// { LogLevel = LogLevels.Debug };
+
+ _logManager.Sources.Add(Trader);
+
+ Trader.Restored += () => this.GuiAsync(() =>
+ {
+ // update gui labes
+ ChangeConnectStatus(true);
+ MessageBox.Show(this, LocalizedStrings.Str2958);
+ });
+
+ // subscribe on connection successfully event
+ Trader.Connected += () =>
+ {
+ // set flag (connection is established)
+ _isConnected = true;
+
+ // update gui labes
+ this.GuiAsync(() => ChangeConnectStatus(true));
+ };
+ Trader.Disconnected += () => this.GuiAsync(() => ChangeConnectStatus(false));
+
+ // subscribe on connection error event
+ Trader.ConnectionError += error => this.GuiAsync(() =>
+ {
+ // update gui labes
+ ChangeConnectStatus(false);
+
+ MessageBox.Show(this, error.ToString(), LocalizedStrings.Str2959);
+ });
+
+ // subscribe on error event
+ Trader.Error += error =>
+ this.GuiAsync(() => MessageBox.Show(this, error.ToString(), LocalizedStrings.Str2955));
+
+ // subscribe on error of market data subscription event
+ Trader.MarketDataSubscriptionFailed += (security, msg, error) =>
+ this.GuiAsync(() => MessageBox.Show(this, error.ToString(), LocalizedStrings.Str2956Params.Put(msg.DataType, security)));
+
+ Trader.NewSecurity += _securitiesWindow.SecurityPicker.Securities.Add;
+ Trader.NewMyTrade += _myTradesWindow.TradeGrid.Trades.Add;
+ Trader.NewTrade += _tradesWindow.TradeGrid.Trades.Add;
+ Trader.NewOrder += _ordersWindow.OrderGrid.Orders.Add;
+
+ Trader.NewPortfolio += _portfoliosWindow.PortfolioGrid.Portfolios.Add;
+ Trader.NewPosition += _portfoliosWindow.PortfolioGrid.Positions.Add;
+
+ // subscribe on error of order registration event
+ Trader.OrderRegisterFailed += _ordersWindow.OrderGrid.AddRegistrationFail;
+ // subscribe on error of order cancelling event
+ Trader.OrderCancelFailed += OrderFailed;
+
+ Trader.MassOrderCancelFailed += (transId, error) =>
+ this.GuiAsync(() => MessageBox.Show(this, error.ToString(), LocalizedStrings.Str716));
+
+ // set market data provider
+ _securitiesWindow.SecurityPicker.MarketDataProvider = Trader;
+
+ ShowSecurities.IsEnabled = ShowTrades.IsEnabled =
+ ShowMyTrades.IsEnabled = ShowOrders.IsEnabled =
+ ShowPortfolios.IsEnabled = true;
+ }
+
+ Trader.Key = Key.Text;
+ Trader.Secret = Secret.Password;
+
+ // clear password box for security reason
+ //Secret.Clear();
+
+ Trader.Connect();
+ }
+ else
+ {
+ Trader.Disconnect();
+ }
+ }
+
+ private void OrderFailed(OrderFail fail)
+ {
+ this.GuiAsync(() =>
+ {
+ MessageBox.Show(this, fail.Error.ToString(), LocalizedStrings.Str153);
+ });
+ }
+
+ private void ChangeConnectStatus(bool isConnected)
+ {
+ _isConnected = isConnected;
+ ConnectBtn.Content = isConnected ? LocalizedStrings.Disconnect : LocalizedStrings.Connect;
+ }
+
+ private void ShowSecuritiesClick(object sender, RoutedEventArgs e)
+ {
+ ShowOrHide(_securitiesWindow);
+ }
+
+ private void ShowTradesClick(object sender, RoutedEventArgs e)
+ {
+ ShowOrHide(_tradesWindow);
+ }
+
+ private void ShowMyTradesClick(object sender, RoutedEventArgs e)
+ {
+ ShowOrHide(_myTradesWindow);
+ }
+
+ private void ShowOrdersClick(object sender, RoutedEventArgs e)
+ {
+ ShowOrHide(_ordersWindow);
+ }
+
+ private void ShowPortfoliosClick(object sender, RoutedEventArgs e)
+ {
+ ShowOrHide(_portfoliosWindow);
+ }
+
+ private static void ShowOrHide(Window window)
+ {
+ if (window == null)
+ throw new ArgumentNullException(nameof(window));
+
+ if (window.Visibility == Visibility.Visible)
+ window.Hide();
+ else
+ window.Show();
+ }
+ }
+}
diff --git a/Samples/Coinbase/SampleCoinbase/MyTradesWindow.xaml b/Samples/Coinbase/SampleCoinbase/MyTradesWindow.xaml
new file mode 100644
index 000000000..50e4eb2f9
--- /dev/null
+++ b/Samples/Coinbase/SampleCoinbase/MyTradesWindow.xaml
@@ -0,0 +1,8 @@
+
+
+
\ No newline at end of file
diff --git a/Samples/Coinbase/SampleCoinbase/MyTradesWindow.xaml.cs b/Samples/Coinbase/SampleCoinbase/MyTradesWindow.xaml.cs
new file mode 100644
index 000000000..234283d49
--- /dev/null
+++ b/Samples/Coinbase/SampleCoinbase/MyTradesWindow.xaml.cs
@@ -0,0 +1,10 @@
+namespace SampleCoinbase
+{
+ public partial class MyTradesWindow
+ {
+ public MyTradesWindow()
+ {
+ InitializeComponent();
+ }
+ }
+}
\ No newline at end of file
diff --git a/Samples/Coinbase/SampleCoinbase/OrdersWindow.xaml b/Samples/Coinbase/SampleCoinbase/OrdersWindow.xaml
new file mode 100644
index 000000000..2efc006ae
--- /dev/null
+++ b/Samples/Coinbase/SampleCoinbase/OrdersWindow.xaml
@@ -0,0 +1,16 @@
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/Samples/Coinbase/SampleCoinbase/OrdersWindow.xaml.cs b/Samples/Coinbase/SampleCoinbase/OrdersWindow.xaml.cs
new file mode 100644
index 000000000..6f769c02b
--- /dev/null
+++ b/Samples/Coinbase/SampleCoinbase/OrdersWindow.xaml.cs
@@ -0,0 +1,49 @@
+namespace SampleCoinbase
+{
+ using System.Windows;
+
+ using Ecng.Common;
+ using Ecng.Xaml;
+
+ using StockSharp.Algo;
+ using StockSharp.BusinessEntities;
+ using StockSharp.Localization;
+ using StockSharp.Xaml;
+
+ public partial class OrdersWindow
+ {
+ public OrdersWindow()
+ {
+ InitializeComponent();
+ }
+
+ private static IConnector Connector => MainWindow.Instance.Trader;
+
+ private void OrderGrid_OnOrderCanceling(Order order)
+ {
+ Connector.CancelOrder(order);
+ }
+
+ private void OrderGrid_OnOrderReRegistering(Order order)
+ {
+ var window = new OrderWindow
+ {
+ Title = LocalizedStrings.Str2976Params.Put(order.TransactionId),
+ SecurityProvider = Connector,
+ MarketDataProvider = Connector,
+ Portfolios = new PortfolioDataSource(Connector),
+ Order = order.ReRegisterClone(newVolume: order.Balance),
+ };
+
+ if (window.ShowModal(this))
+ {
+ Connector.ReRegisterOrder(order, window.Order);
+ }
+ }
+
+ private void CancelAll_OnClick(object sender, RoutedEventArgs e)
+ {
+ Connector.CancelOrders();
+ }
+ }
+}
\ No newline at end of file
diff --git a/Samples/Coinbase/SampleCoinbase/PortfoliosWindow.xaml b/Samples/Coinbase/SampleCoinbase/PortfoliosWindow.xaml
new file mode 100644
index 000000000..d16eb9a38
--- /dev/null
+++ b/Samples/Coinbase/SampleCoinbase/PortfoliosWindow.xaml
@@ -0,0 +1,8 @@
+
+
+
\ No newline at end of file
diff --git a/Samples/Coinbase/SampleCoinbase/PortfoliosWindow.xaml.cs b/Samples/Coinbase/SampleCoinbase/PortfoliosWindow.xaml.cs
new file mode 100644
index 000000000..22f0c994b
--- /dev/null
+++ b/Samples/Coinbase/SampleCoinbase/PortfoliosWindow.xaml.cs
@@ -0,0 +1,10 @@
+namespace SampleCoinbase
+{
+ public partial class PortfoliosWindow
+ {
+ public PortfoliosWindow()
+ {
+ InitializeComponent();
+ }
+ }
+}
\ No newline at end of file
diff --git a/Samples/Coinbase/SampleCoinbase/Properties/AssemblyInfo.cs b/Samples/Coinbase/SampleCoinbase/Properties/AssemblyInfo.cs
new file mode 100644
index 000000000..084f25a49
--- /dev/null
+++ b/Samples/Coinbase/SampleCoinbase/Properties/AssemblyInfo.cs
@@ -0,0 +1,20 @@
+using System.Reflection;
+using System.Runtime.InteropServices;
+using System.Windows;
+
+// General Information about an assembly is controlled through the following
+// set of attributes. Change these attribute values to modify the information
+// associated with an assembly.
+[assembly: AssemblyTitle("SampleCoinbase")]
+[assembly: AssemblyDescription("")]
+
+[assembly: Guid("8BBADE31-482A-409F-8EC6-5E1F85802A3F")]
+
+[assembly:ThemeInfo(
+ ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located
+ //(used if a resource is not found in the page,
+ // or application resource dictionaries)
+ ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located
+ //(used if a resource is not found in the page,
+ // app, or any theme specific resource dictionaries)
+)]
diff --git a/Samples/Coinbase/SampleCoinbase/Properties/Resources.Designer.cs b/Samples/Coinbase/SampleCoinbase/Properties/Resources.Designer.cs
new file mode 100644
index 000000000..168bc2da9
--- /dev/null
+++ b/Samples/Coinbase/SampleCoinbase/Properties/Resources.Designer.cs
@@ -0,0 +1,63 @@
+//------------------------------------------------------------------------------
+//
+// This code was generated by a tool.
+// Runtime Version:4.0.30319.18449
+//
+// Changes to this file may cause incorrect behavior and will be lost if
+// the code is regenerated.
+//
+//------------------------------------------------------------------------------
+
+namespace SampleCoinbase.Properties {
+ using System;
+
+
+ ///
+ /// A strongly-typed resource class, for looking up localized strings, etc.
+ ///
+ // This class was auto-generated by the StronglyTypedResourceBuilder
+ // class via a tool like ResGen or Visual Studio.
+ // To add or remove a member, edit your .ResX file then rerun ResGen
+ // with the /str option, or rebuild your VS project.
+ [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")]
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
+ [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
+ internal class Resources {
+
+ private static global::System.Resources.ResourceManager resourceMan;
+
+ private static global::System.Globalization.CultureInfo resourceCulture;
+
+ [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
+ internal Resources() {
+ }
+
+ ///
+ /// Returns the cached ResourceManager instance used by this class.
+ ///
+ [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
+ internal static global::System.Resources.ResourceManager ResourceManager {
+ get {
+ if (object.ReferenceEquals(resourceMan, null)) {
+ global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("SampleCoinbase.Properties.Resources", typeof(Resources).Assembly);
+ resourceMan = temp;
+ }
+ return resourceMan;
+ }
+ }
+
+ ///
+ /// Overrides the current thread's CurrentUICulture property for all
+ /// resource lookups using this strongly typed resource class.
+ ///
+ [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
+ internal static global::System.Globalization.CultureInfo Culture {
+ get {
+ return resourceCulture;
+ }
+ set {
+ resourceCulture = value;
+ }
+ }
+ }
+}
diff --git a/Samples/Coinbase/SampleCoinbase/Properties/Resources.resx b/Samples/Coinbase/SampleCoinbase/Properties/Resources.resx
new file mode 100644
index 000000000..13b775f1d
--- /dev/null
+++ b/Samples/Coinbase/SampleCoinbase/Properties/Resources.resx
@@ -0,0 +1,117 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ text/microsoft-resx
+
+
+ 2.0
+
+
+ System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
+ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
\ No newline at end of file
diff --git a/Samples/Coinbase/SampleCoinbase/Properties/Settings.Designer.cs b/Samples/Coinbase/SampleCoinbase/Properties/Settings.Designer.cs
new file mode 100644
index 000000000..02e9c0eb9
--- /dev/null
+++ b/Samples/Coinbase/SampleCoinbase/Properties/Settings.Designer.cs
@@ -0,0 +1,26 @@
+//------------------------------------------------------------------------------
+//
+// This code was generated by a tool.
+// Runtime Version:4.0.30319.18449
+//
+// Changes to this file may cause incorrect behavior and will be lost if
+// the code is regenerated.
+//
+//------------------------------------------------------------------------------
+
+namespace SampleCoinbase.Properties {
+
+
+ [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
+ [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "12.0.0.0")]
+ internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase {
+
+ private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
+
+ public static Settings Default {
+ get {
+ return defaultInstance;
+ }
+ }
+ }
+}
diff --git a/Samples/Coinbase/SampleCoinbase/Properties/Settings.settings b/Samples/Coinbase/SampleCoinbase/Properties/Settings.settings
new file mode 100644
index 000000000..9010101f8
--- /dev/null
+++ b/Samples/Coinbase/SampleCoinbase/Properties/Settings.settings
@@ -0,0 +1,7 @@
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/Samples/Coinbase/SampleCoinbase/QuotesWindow.xaml b/Samples/Coinbase/SampleCoinbase/QuotesWindow.xaml
new file mode 100644
index 000000000..33d43b3de
--- /dev/null
+++ b/Samples/Coinbase/SampleCoinbase/QuotesWindow.xaml
@@ -0,0 +1,7 @@
+
+
+
\ No newline at end of file
diff --git a/Samples/Coinbase/SampleCoinbase/QuotesWindow.xaml.cs b/Samples/Coinbase/SampleCoinbase/QuotesWindow.xaml.cs
new file mode 100644
index 000000000..1db47d267
--- /dev/null
+++ b/Samples/Coinbase/SampleCoinbase/QuotesWindow.xaml.cs
@@ -0,0 +1,10 @@
+namespace SampleCoinbase
+{
+ public partial class QuotesWindow
+ {
+ public QuotesWindow()
+ {
+ InitializeComponent();
+ }
+ }
+}
\ No newline at end of file
diff --git a/Samples/Coinbase/SampleCoinbase/SampleCoinbase.csproj b/Samples/Coinbase/SampleCoinbase/SampleCoinbase.csproj
new file mode 100644
index 000000000..583b0654f
--- /dev/null
+++ b/Samples/Coinbase/SampleCoinbase/SampleCoinbase.csproj
@@ -0,0 +1,281 @@
+
+
+
+ Debug
+ AnyCPU
+ 9.0.30729
+ 2.0
+ {D03FB418-C3A0-4B2D-BA53-37481D166B8C}
+ WinExe
+ Properties
+ SampleCoinbase
+ SampleCoinbase
+ v4.5.1
+ 512
+ {60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}
+ 4
+ ..\..\..\References\stocksharp.ico
+
+
+ 3.5
+
+ publish\
+ true
+ Disk
+ false
+ Foreground
+ 7
+ Days
+ false
+ false
+ true
+ 0
+ 1.0.0.%2a
+ false
+ false
+ true
+
+
+
+
+
+
+
+
+
+
+
+ true
+ full
+ false
+ bin\Debug\
+ DEBUG;TRACE
+ prompt
+ 4
+ AnyCPU
+ AllRules.ruleset
+ false
+
+
+ pdbonly
+ true
+ bin\Release\
+ TRACE
+ prompt
+ 4
+ AnyCPU
+ AllRules.ruleset
+ false
+
+
+
+ ..\..\..\References\Ecng.Localization.dll
+
+
+ ..\..\..\References\Ecng.Common.dll
+
+
+ ..\..\..\References\MoreLinq.dll
+
+
+
+
+
+
+
+
+
+
+ ..\..\..\References\Ecng.Collections.dll
+
+
+ ..\..\..\References\Ecng.ComponentModel.dll
+
+
+ ..\..\..\References\Ecng.Serialization.dll
+
+
+ ..\..\..\References\Ecng.Xaml.dll
+
+
+ ..\..\..\References\DevExpress.Data.v17.2.dll
+
+
+ ..\..\..\References\DevExpress.Xpf.Core.v17.2.dll
+
+
+ ..\..\..\References\DevExpress.Xpf.Grid.v17.2.dll
+
+
+ ..\..\..\References\DevExpress.Xpf.Grid.v17.2.Core.dll
+
+
+ ..\..\..\References\DevExpress.Xpf.Themes.Office2016White.v17.2.dll
+
+
+
+
+ MSBuild:Compile
+ Designer
+ MSBuild:Compile
+ Designer
+
+
+ Properties\StockSharpAssemblyInfo.cs
+
+
+ App.xaml
+ Code
+
+
+
+
+ MainWindow.xaml
+
+
+ MyTradesWindow.xaml
+
+
+ OrdersWindow.xaml
+
+
+ PortfoliosWindow.xaml
+
+
+
+ True
+ True
+ Resources.resx
+
+
+ True
+ Settings.settings
+ True
+
+
+ QuotesWindow.xaml
+
+
+ SecuritiesWindow.xaml
+
+
+ TradesWindow.xaml
+
+
+ ResXFileCodeGenerator
+ Resources.Designer.cs
+
+
+
+ SettingsSingleFileGenerator
+ Settings.Designer.cs
+
+
+
+
+
+ MSBuild:Compile
+ Designer
+ MSBuild:Compile
+ Designer
+
+
+ Designer
+ MSBuild:Compile
+ MSBuild:Compile
+ Designer
+
+
+ MSBuild:Compile
+ Designer
+ MSBuild:Compile
+ Designer
+
+
+ MSBuild:Compile
+ Designer
+
+
+ MSBuild:Compile
+ Designer
+ MSBuild:Compile
+ Designer
+
+
+ MSBuild:Compile
+ Designer
+ MSBuild:Compile
+ Designer
+
+
+ MSBuild:Compile
+ Designer
+ MSBuild:Compile
+ Designer
+
+
+
+
+ False
+ .NET Framework 3.5 SP1 Client Profile
+ false
+
+
+ False
+ .NET Framework 3.5 SP1
+ true
+
+
+ False
+ Windows Installer 3.1
+ true
+
+
+
+
+ {AB948D64-73B2-4BDC-972C-337E51A67265}
+ Coinbase
+
+
+ {2A5C6FAD-106C-4A4A-B602-77A6B1034CA2}
+ Algo
+
+
+ {DCE69DB8-53CA-4B7F-9368-02F175A31074}
+ BusinessEntities
+
+
+ {A98A81CE-75A1-4FAB-9C02-E6EEF4B51F4F}
+ Localization
+
+
+ {C4476ADD-A3D5-41BB-9D43-55D865863B78}
+ Logging
+
+
+ {B47F9C23-A4BD-46A9-BF27-54CB3D653503}
+ Messages
+
+
+ {c449d618-dea4-41c3-ba86-9f827c7421dc}
+ Xaml.Charting
+
+
+ {64E4D6F0-36B6-4904-9BA7-FFFBE5FF71D8}
+ Xaml
+
+
+
+
+ stocksharp.ico
+
+
+
+
+
\ No newline at end of file
diff --git a/Samples/Coinbase/SampleCoinbase/SampleCoinbase.licenseheader b/Samples/Coinbase/SampleCoinbase/SampleCoinbase.licenseheader
new file mode 100644
index 000000000..a1db37839
--- /dev/null
+++ b/Samples/Coinbase/SampleCoinbase/SampleCoinbase.licenseheader
@@ -0,0 +1,45 @@
+extensions: designer.cs generated.cs
+extensions: .cs .cpp .h
+#region S# License
+/******************************************************************************************
+NOTICE!!! This program and source code is owned and licensed by
+StockSharp Algo Trading, LLC, www.stocksharp.com
+Viewing or use of this code requires your acceptance of the license
+agreement found at https://github.com/StockSharp/StockSharp/blob/master/LICENSE
+Removal of this comment is a violation of the license agreement.
+
+Project: %Namespace%.%Project%
+File: %FileName%
+Created: %CreationYear%, %CreationMonth%, %CreationDay%, %CreationTime%
+
+Copyright 2010 by StockSharp Algo Trading, LLC
+*******************************************************************************************/
+#endregion S# License
+extensions: .aspx .ascx
+<%--
+NOTICE!!! This program and source code is owned and licensed by
+StockSharp Algo Trading, LLC, www.stocksharp.com
+Viewing or use of this code requires your acceptance of the license
+agreement found at https://github.com/StockSharp/StockSharp/blob/master/LICENSE
+Removal of this comment is a violation of the license agreement.
+
+Project: %Namespace%.%Project%
+File: %FileName%
+Created: %CreationYear%, %CreationMonth%, %CreationDay%, %CreationTime%
+
+Copyright 2010 by StockSharp Algo Trading, LLC
+--%>
+extensions: .xml .config .xsd
+
\ No newline at end of file
diff --git a/Samples/Coinbase/SampleCoinbase/SampleCoinbasePublic.csproj b/Samples/Coinbase/SampleCoinbase/SampleCoinbasePublic.csproj
new file mode 100644
index 000000000..986e6051b
--- /dev/null
+++ b/Samples/Coinbase/SampleCoinbase/SampleCoinbasePublic.csproj
@@ -0,0 +1,275 @@
+
+
+
+ Debug
+ AnyCPU
+ 9.0.30729
+ 2.0
+ {3CC23B3C-E1E1-49F4-B71A-12D833B77191}
+ WinExe
+ Properties
+ SampleCoinbase
+ SampleCoinbase
+ v4.5.1
+ 512
+ {60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}
+ 4
+ ..\..\..\References\stocksharp.ico
+
+
+ 3.5
+
+ publish\
+ true
+ Disk
+ false
+ Foreground
+ 7
+ Days
+ false
+ false
+ true
+ 0
+ 1.0.0.%2a
+ false
+ false
+ true
+
+
+
+ true
+ full
+ false
+ bin\Debug\
+ DEBUG;TRACE
+ prompt
+ 4
+ AnyCPU
+ AllRules.ruleset
+ false
+
+
+ pdbonly
+ true
+ bin\Release\
+ TRACE
+ prompt
+ 4
+ AnyCPU
+ AllRules.ruleset
+ false
+
+
+
+ ..\..\..\References\StockSharp.Coinbase.dll
+
+
+
+
+
+
+
+
+
+
+ ..\..\..\References\Ecng.Localization.dll
+
+
+ ..\..\..\References\Ecng.Common.dll
+
+
+ ..\..\..\References\MoreLinq.dll
+
+
+ ..\..\..\References\Ecng.Collections.dll
+
+
+ ..\..\..\References\Ecng.ComponentModel.dll
+
+
+ ..\..\..\References\Ecng.Serialization.dll
+
+
+ ..\..\..\References\Ecng.Xaml.dll
+
+
+ ..\..\..\References\Xceed.Wpf.Toolkit.dll
+
+
+ ..\..\..\References\DevExpress.Data.v17.2.dll
+
+
+ ..\..\..\References\DevExpress.Xpf.Core.v17.2.dll
+
+
+ ..\..\..\References\DevExpress.Xpf.Grid.v17.2.dll
+
+
+ ..\..\..\References\DevExpress.Xpf.Grid.v17.2.Core.dll
+
+
+ ..\..\..\References\DevExpress.Xpf.LayoutControl.v17.2.dll
+
+
+
+
+ MSBuild:Compile
+ Designer
+ MSBuild:Compile
+ Designer
+
+
+ Properties\StockSharpAssemblyInfo.cs
+
+
+ App.xaml
+ Code
+
+
+
+
+ MainWindow.xaml
+
+
+ MyTradesWindow.xaml
+
+
+ OrdersWindow.xaml
+
+
+ PortfoliosWindow.xaml
+
+
+
+ True
+ True
+ Resources.resx
+
+
+ True
+ Settings.settings
+ True
+
+
+ QuotesWindow.xaml
+
+
+ SecuritiesWindow.xaml
+
+
+ TradesWindow.xaml
+
+
+ ResXFileCodeGenerator
+ Resources.Designer.cs
+
+
+
+ SettingsSingleFileGenerator
+ Settings.Designer.cs
+
+
+
+
+
+ MSBuild:Compile
+ Designer
+ MSBuild:Compile
+ Designer
+
+
+ Designer
+ MSBuild:Compile
+ MSBuild:Compile
+ Designer
+
+
+ MSBuild:Compile
+ Designer
+ MSBuild:Compile
+ Designer
+
+
+ MSBuild:Compile
+ Designer
+
+
+ MSBuild:Compile
+ Designer
+ MSBuild:Compile
+ Designer
+
+
+ MSBuild:Compile
+ Designer
+ MSBuild:Compile
+ Designer
+
+
+ MSBuild:Compile
+ Designer
+ MSBuild:Compile
+ Designer
+
+
+
+
+ False
+ .NET Framework 3.5 SP1 Client Profile
+ false
+
+
+ False
+ .NET Framework 3.5 SP1
+ true
+
+
+ False
+ Windows Installer 3.1
+ true
+
+
+
+
+ stocksharp.ico
+
+
+
+
+ {AF225452-1CF1-48A2-B381-C02BEBE643D7}
+ Coinbase
+
+
+ {64e4d6f0-36b6-4904-9ba7-fffbe5ff71d8}
+ Xaml
+
+
+ {2A5C6FAD-106C-4A4A-B602-77A6B1034CA2}
+ Algo
+
+
+ {DCE69DB8-53CA-4B7F-9368-02F175A31074}
+ BusinessEntities
+
+
+ {A98A81CE-75A1-4FAB-9C02-E6EEF4B51F4F}
+ Localization
+
+
+ {C4476ADD-A3D5-41BB-9D43-55D865863B78}
+ Logging
+
+
+ {b47f9c23-a4bd-46a9-bf27-54cb3d653503}
+ Messages
+
+
+
+
+
\ No newline at end of file
diff --git a/Samples/Coinbase/SampleCoinbase/SecuritiesWindow.xaml b/Samples/Coinbase/SampleCoinbase/SecuritiesWindow.xaml
new file mode 100644
index 000000000..ad6de9412
--- /dev/null
+++ b/Samples/Coinbase/SampleCoinbase/SecuritiesWindow.xaml
@@ -0,0 +1,25 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/Samples/Coinbase/SampleCoinbase/SecuritiesWindow.xaml.cs b/Samples/Coinbase/SampleCoinbase/SecuritiesWindow.xaml.cs
new file mode 100644
index 000000000..db2617268
--- /dev/null
+++ b/Samples/Coinbase/SampleCoinbase/SecuritiesWindow.xaml.cs
@@ -0,0 +1,126 @@
+namespace SampleCoinbase
+{
+ using System;
+ using System.Linq;
+ using System.Windows;
+
+ using Ecng.Collections;
+ using Ecng.Xaml;
+
+ using MoreLinq;
+
+ using StockSharp.BusinessEntities;
+ using StockSharp.Xaml;
+ using StockSharp.Localization;
+
+ public partial class SecuritiesWindow
+ {
+ private readonly SynchronizedDictionary _quotesWindows = new SynchronizedDictionary();
+ private bool _initialized;
+
+ public SecuritiesWindow()
+ {
+ InitializeComponent();
+ }
+
+ protected override void OnClosed(EventArgs e)
+ {
+ _quotesWindows.SyncDo(d => d.Values.ForEach(w =>
+ {
+ w.DeleteHideable();
+ w.Close();
+ }));
+
+ var trader = MainWindow.Instance.Trader;
+ if (trader != null)
+ {
+ if (_initialized)
+ trader.MarketDepthChanged -= TraderOnMarketDepthChanged;
+ }
+
+ base.OnClosed(e);
+ }
+
+ private void SecurityPicker_OnSecuritySelected(Security security)
+ {
+ Quotes.IsEnabled = NewOrder.IsEnabled = Depth.IsEnabled = security != null;
+ }
+
+ private void NewOrderClick(object sender, RoutedEventArgs e)
+ {
+ var newOrder = new OrderWindow
+ {
+ Order = new Order { Security = SecurityPicker.SelectedSecurity },
+ SecurityProvider = MainWindow.Instance.Trader,
+ MarketDataProvider = MainWindow.Instance.Trader,
+ Portfolios = new PortfolioDataSource(MainWindow.Instance.Trader),
+ };
+
+ if (newOrder.ShowModal(this))
+ MainWindow.Instance.Trader.RegisterOrder(newOrder.Order);
+ }
+
+ private void DepthClick(object sender, RoutedEventArgs e)
+ {
+ var trader = MainWindow.Instance.Trader;
+
+ foreach (var security in SecurityPicker.SelectedSecurities)
+ {
+ var window = _quotesWindows.SafeAdd(security, s =>
+ {
+ // начинаем получать котировки стакана
+ trader.RegisterMarketDepth(security);
+
+ // создаем окно со стаканом
+ var wnd = new QuotesWindow
+ {
+ Title = security.Id + " " + LocalizedStrings.MarketDepth
+ };
+ wnd.MakeHideable();
+ return wnd;
+ });
+
+ if (window.Visibility == Visibility.Visible)
+ window.Hide();
+ else
+ {
+ window.Show();
+ window.DepthCtrl.UpdateDepth(trader.GetMarketDepth(security));
+ }
+
+ if (!_initialized)
+ {
+ trader.MarketDepthChanged += TraderOnMarketDepthChanged;
+ _initialized = true;
+ }
+ }
+ }
+
+ private void QuotesClick(object sender, RoutedEventArgs e)
+ {
+ var trader = MainWindow.Instance.Trader;
+
+ foreach (var security in SecurityPicker.SelectedSecurities)
+ {
+ if (trader.RegisteredSecurities.Contains(security))
+ {
+ trader.UnRegisterSecurity(security);
+ trader.UnRegisterTrades(security);
+ }
+ else
+ {
+ trader.RegisterSecurity(security);
+ trader.RegisterTrades(security);
+ }
+ }
+ }
+
+ private void TraderOnMarketDepthChanged(MarketDepth depth)
+ {
+ var wnd = _quotesWindows.TryGetValue(depth.Security);
+
+ if (wnd != null)
+ wnd.DepthCtrl.UpdateDepth(depth);
+ }
+ }
+}
\ No newline at end of file
diff --git a/Samples/Coinbase/SampleCoinbase/TradesWindow.xaml b/Samples/Coinbase/SampleCoinbase/TradesWindow.xaml
new file mode 100644
index 000000000..e08b5f6f9
--- /dev/null
+++ b/Samples/Coinbase/SampleCoinbase/TradesWindow.xaml
@@ -0,0 +1,7 @@
+
+
+
\ No newline at end of file
diff --git a/Samples/Coinbase/SampleCoinbase/TradesWindow.xaml.cs b/Samples/Coinbase/SampleCoinbase/TradesWindow.xaml.cs
new file mode 100644
index 000000000..1536c9a96
--- /dev/null
+++ b/Samples/Coinbase/SampleCoinbase/TradesWindow.xaml.cs
@@ -0,0 +1,10 @@
+namespace SampleCoinbase
+{
+ public partial class TradesWindow
+ {
+ public TradesWindow()
+ {
+ InitializeComponent();
+ }
+ }
+}
\ No newline at end of file
diff --git a/Samples/Coinbase/SampleCoinbase/app.config b/Samples/Coinbase/SampleCoinbase/app.config
new file mode 100644
index 000000000..884f9844f
--- /dev/null
+++ b/Samples/Coinbase/SampleCoinbase/app.config
@@ -0,0 +1,3 @@
+
+
+
diff --git a/Samples/Coincheck/SampleCoincheck/App.xaml b/Samples/Coincheck/SampleCoincheck/App.xaml
new file mode 100644
index 000000000..e42d0a096
--- /dev/null
+++ b/Samples/Coincheck/SampleCoincheck/App.xaml
@@ -0,0 +1,8 @@
+
+
+
+
+
diff --git a/Samples/Coincheck/SampleCoincheck/App.xaml.cs b/Samples/Coincheck/SampleCoincheck/App.xaml.cs
new file mode 100644
index 000000000..910417983
--- /dev/null
+++ b/Samples/Coincheck/SampleCoincheck/App.xaml.cs
@@ -0,0 +1,14 @@
+namespace SampleCoincheck
+{
+ using System.Windows;
+ using System.Windows.Threading;
+
+ public partial class App
+ {
+ private void ApplicationDispatcherUnhandledException(object sender, DispatcherUnhandledExceptionEventArgs e)
+ {
+ MessageBox.Show(MainWindow, e.Exception.ToString());
+ e.Handled = true;
+ }
+ }
+}
\ No newline at end of file
diff --git a/Samples/Coincheck/SampleCoincheck/MainWindow.xaml b/Samples/Coincheck/SampleCoincheck/MainWindow.xaml
new file mode 100644
index 000000000..15ed7f0fb
--- /dev/null
+++ b/Samples/Coincheck/SampleCoincheck/MainWindow.xaml
@@ -0,0 +1,35 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/Samples/Coincheck/SampleCoincheck/MainWindow.xaml.cs b/Samples/Coincheck/SampleCoincheck/MainWindow.xaml.cs
new file mode 100644
index 000000000..f1a183a2d
--- /dev/null
+++ b/Samples/Coincheck/SampleCoincheck/MainWindow.xaml.cs
@@ -0,0 +1,214 @@
+namespace SampleCoincheck
+{
+ using System;
+ using System.ComponentModel;
+ using System.Windows;
+
+ using Ecng.Common;
+ using Ecng.Xaml;
+
+ using StockSharp.BusinessEntities;
+ using StockSharp.Coincheck;
+ using StockSharp.Logging;
+ using StockSharp.Localization;
+
+ public partial class MainWindow
+ {
+ private bool _isConnected;
+
+ public CoincheckTrader Trader;
+
+ private readonly SecuritiesWindow _securitiesWindow = new SecuritiesWindow();
+ private readonly TradesWindow _tradesWindow = new TradesWindow();
+ private readonly MyTradesWindow _myTradesWindow = new MyTradesWindow();
+ private readonly OrdersWindow _ordersWindow = new OrdersWindow();
+ private readonly PortfoliosWindow _portfoliosWindow = new PortfoliosWindow();
+
+ private readonly LogManager _logManager = new LogManager();
+
+ public MainWindow()
+ {
+ InitializeComponent();
+
+ Title = Title.Put("Coincheck");
+
+ _ordersWindow.MakeHideable();
+ _myTradesWindow.MakeHideable();
+ _tradesWindow.MakeHideable();
+ _securitiesWindow.MakeHideable();
+ _portfoliosWindow.MakeHideable();
+
+ Instance = this;
+
+ _logManager.Sources.Add(MemoryStatistics.Instance);
+ _logManager.Listeners.Add(new FileLogListener { LogDirectory = "StockSharp_Coincheck" });
+ }
+
+ protected override void OnClosing(CancelEventArgs e)
+ {
+ _ordersWindow.DeleteHideable();
+ _myTradesWindow.DeleteHideable();
+ _tradesWindow.DeleteHideable();
+ _securitiesWindow.DeleteHideable();
+ _portfoliosWindow.DeleteHideable();
+
+ _securitiesWindow.Close();
+ _tradesWindow.Close();
+ _myTradesWindow.Close();
+ _ordersWindow.Close();
+ _portfoliosWindow.Close();
+
+ if (Trader != null)
+ Trader.Dispose();
+
+ base.OnClosing(e);
+ }
+
+ public static MainWindow Instance { get; private set; }
+
+ private void ConnectClick(object sender, RoutedEventArgs e)
+ {
+ if (!_isConnected)
+ {
+ if (Key.Text.IsEmpty())
+ {
+ MessageBox.Show(this, LocalizedStrings.Str3689);
+ return;
+ }
+ else if (Secret.Password.IsEmpty())
+ {
+ MessageBox.Show(this, LocalizedStrings.Str3690);
+ return;
+ }
+
+ if (Trader == null)
+ {
+ // create connector
+ Trader = new CoincheckTrader();// { LogLevel = LogLevels.Debug };
+
+ _logManager.Sources.Add(Trader);
+
+ Trader.Restored += () => this.GuiAsync(() =>
+ {
+ // update gui labes
+ ChangeConnectStatus(true);
+ MessageBox.Show(this, LocalizedStrings.Str2958);
+ });
+
+ // subscribe on connection successfully event
+ Trader.Connected += () =>
+ {
+ // set flag (connection is established)
+ _isConnected = true;
+
+ // update gui labes
+ this.GuiAsync(() => ChangeConnectStatus(true));
+ };
+ Trader.Disconnected += () => this.GuiAsync(() => ChangeConnectStatus(false));
+
+ // subscribe on connection error event
+ Trader.ConnectionError += error => this.GuiAsync(() =>
+ {
+ // update gui labes
+ ChangeConnectStatus(false);
+
+ MessageBox.Show(this, error.ToString(), LocalizedStrings.Str2959);
+ });
+
+ // subscribe on error event
+ Trader.Error += error =>
+ this.GuiAsync(() => MessageBox.Show(this, error.ToString(), LocalizedStrings.Str2955));
+
+ // subscribe on error of market data subscription event
+ Trader.MarketDataSubscriptionFailed += (security, msg, error) =>
+ this.GuiAsync(() => MessageBox.Show(this, error.ToString(), LocalizedStrings.Str2956Params.Put(msg.DataType, security)));
+
+ Trader.NewSecurity += _securitiesWindow.SecurityPicker.Securities.Add;
+ Trader.NewMyTrade += _myTradesWindow.TradeGrid.Trades.Add;
+ Trader.NewTrade += _tradesWindow.TradeGrid.Trades.Add;
+ Trader.NewOrder += _ordersWindow.OrderGrid.Orders.Add;
+
+ Trader.NewPortfolio += _portfoliosWindow.PortfolioGrid.Portfolios.Add;
+ Trader.NewPosition += _portfoliosWindow.PortfolioGrid.Positions.Add;
+
+ // subscribe on error of order registration event
+ Trader.OrderRegisterFailed += _ordersWindow.OrderGrid.AddRegistrationFail;
+ // subscribe on error of order cancelling event
+ Trader.OrderCancelFailed += OrderFailed;
+
+ Trader.MassOrderCancelFailed += (transId, error) =>
+ this.GuiAsync(() => MessageBox.Show(this, error.ToString(), LocalizedStrings.Str716));
+
+ // set market data provider
+ _securitiesWindow.SecurityPicker.MarketDataProvider = Trader;
+
+ ShowSecurities.IsEnabled = ShowTrades.IsEnabled =
+ ShowMyTrades.IsEnabled = ShowOrders.IsEnabled =
+ ShowPortfolios.IsEnabled = true;
+ }
+
+ Trader.Key = Key.Text;
+ Trader.Secret = Secret.Password;
+
+ // clear password box for security reason
+ //Secret.Clear();
+
+ Trader.Connect();
+ }
+ else
+ {
+ Trader.Disconnect();
+ }
+ }
+
+ private void OrderFailed(OrderFail fail)
+ {
+ this.GuiAsync(() =>
+ {
+ MessageBox.Show(this, fail.Error.ToString(), LocalizedStrings.Str153);
+ });
+ }
+
+ private void ChangeConnectStatus(bool isConnected)
+ {
+ _isConnected = isConnected;
+ ConnectBtn.Content = isConnected ? LocalizedStrings.Disconnect : LocalizedStrings.Connect;
+ }
+
+ private void ShowSecuritiesClick(object sender, RoutedEventArgs e)
+ {
+ ShowOrHide(_securitiesWindow);
+ }
+
+ private void ShowTradesClick(object sender, RoutedEventArgs e)
+ {
+ ShowOrHide(_tradesWindow);
+ }
+
+ private void ShowMyTradesClick(object sender, RoutedEventArgs e)
+ {
+ ShowOrHide(_myTradesWindow);
+ }
+
+ private void ShowOrdersClick(object sender, RoutedEventArgs e)
+ {
+ ShowOrHide(_ordersWindow);
+ }
+
+ private void ShowPortfoliosClick(object sender, RoutedEventArgs e)
+ {
+ ShowOrHide(_portfoliosWindow);
+ }
+
+ private static void ShowOrHide(Window window)
+ {
+ if (window == null)
+ throw new ArgumentNullException(nameof(window));
+
+ if (window.Visibility == Visibility.Visible)
+ window.Hide();
+ else
+ window.Show();
+ }
+ }
+}
diff --git a/Samples/Coincheck/SampleCoincheck/MyTradesWindow.xaml b/Samples/Coincheck/SampleCoincheck/MyTradesWindow.xaml
new file mode 100644
index 000000000..b0a43476f
--- /dev/null
+++ b/Samples/Coincheck/SampleCoincheck/MyTradesWindow.xaml
@@ -0,0 +1,8 @@
+
+
+
\ No newline at end of file
diff --git a/Samples/Coincheck/SampleCoincheck/MyTradesWindow.xaml.cs b/Samples/Coincheck/SampleCoincheck/MyTradesWindow.xaml.cs
new file mode 100644
index 000000000..f0d1e95ef
--- /dev/null
+++ b/Samples/Coincheck/SampleCoincheck/MyTradesWindow.xaml.cs
@@ -0,0 +1,10 @@
+namespace SampleCoincheck
+{
+ public partial class MyTradesWindow
+ {
+ public MyTradesWindow()
+ {
+ InitializeComponent();
+ }
+ }
+}
\ No newline at end of file
diff --git a/Samples/Coincheck/SampleCoincheck/OrdersWindow.xaml b/Samples/Coincheck/SampleCoincheck/OrdersWindow.xaml
new file mode 100644
index 000000000..e80446e47
--- /dev/null
+++ b/Samples/Coincheck/SampleCoincheck/OrdersWindow.xaml
@@ -0,0 +1,16 @@
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/Samples/Coincheck/SampleCoincheck/OrdersWindow.xaml.cs b/Samples/Coincheck/SampleCoincheck/OrdersWindow.xaml.cs
new file mode 100644
index 000000000..cdd14aa8c
--- /dev/null
+++ b/Samples/Coincheck/SampleCoincheck/OrdersWindow.xaml.cs
@@ -0,0 +1,49 @@
+namespace SampleCoincheck
+{
+ using System.Windows;
+
+ using Ecng.Common;
+ using Ecng.Xaml;
+
+ using StockSharp.Algo;
+ using StockSharp.BusinessEntities;
+ using StockSharp.Localization;
+ using StockSharp.Xaml;
+
+ public partial class OrdersWindow
+ {
+ public OrdersWindow()
+ {
+ InitializeComponent();
+ }
+
+ private static IConnector Connector => MainWindow.Instance.Trader;
+
+ private void OrderGrid_OnOrderCanceling(Order order)
+ {
+ Connector.CancelOrder(order);
+ }
+
+ private void OrderGrid_OnOrderReRegistering(Order order)
+ {
+ var window = new OrderWindow
+ {
+ Title = LocalizedStrings.Str2976Params.Put(order.TransactionId),
+ SecurityProvider = Connector,
+ MarketDataProvider = Connector,
+ Portfolios = new PortfolioDataSource(Connector),
+ Order = order.ReRegisterClone(newVolume: order.Balance),
+ };
+
+ if (window.ShowModal(this))
+ {
+ Connector.ReRegisterOrder(order, window.Order);
+ }
+ }
+
+ private void CancelAll_OnClick(object sender, RoutedEventArgs e)
+ {
+ Connector.CancelOrders();
+ }
+ }
+}
\ No newline at end of file
diff --git a/Samples/Coincheck/SampleCoincheck/PortfoliosWindow.xaml b/Samples/Coincheck/SampleCoincheck/PortfoliosWindow.xaml
new file mode 100644
index 000000000..9bdadbd39
--- /dev/null
+++ b/Samples/Coincheck/SampleCoincheck/PortfoliosWindow.xaml
@@ -0,0 +1,8 @@
+
+
+
\ No newline at end of file
diff --git a/Samples/Coincheck/SampleCoincheck/PortfoliosWindow.xaml.cs b/Samples/Coincheck/SampleCoincheck/PortfoliosWindow.xaml.cs
new file mode 100644
index 000000000..581fd9648
--- /dev/null
+++ b/Samples/Coincheck/SampleCoincheck/PortfoliosWindow.xaml.cs
@@ -0,0 +1,10 @@
+namespace SampleCoincheck
+{
+ public partial class PortfoliosWindow
+ {
+ public PortfoliosWindow()
+ {
+ InitializeComponent();
+ }
+ }
+}
\ No newline at end of file
diff --git a/Samples/Coincheck/SampleCoincheck/Properties/AssemblyInfo.cs b/Samples/Coincheck/SampleCoincheck/Properties/AssemblyInfo.cs
new file mode 100644
index 000000000..094963e16
--- /dev/null
+++ b/Samples/Coincheck/SampleCoincheck/Properties/AssemblyInfo.cs
@@ -0,0 +1,20 @@
+using System.Reflection;
+using System.Runtime.InteropServices;
+using System.Windows;
+
+// General Information about an assembly is controlled through the following
+// set of attributes. Change these attribute values to modify the information
+// associated with an assembly.
+[assembly: AssemblyTitle("SampleCoincheck")]
+[assembly: AssemblyDescription("")]
+
+[assembly: Guid("0B0D7B3C-93E3-460B-83BD-8E3E8E9736B6")]
+
+[assembly:ThemeInfo(
+ ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located
+ //(used if a resource is not found in the page,
+ // or application resource dictionaries)
+ ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located
+ //(used if a resource is not found in the page,
+ // app, or any theme specific resource dictionaries)
+)]
diff --git a/Samples/Coincheck/SampleCoincheck/Properties/Resources.Designer.cs b/Samples/Coincheck/SampleCoincheck/Properties/Resources.Designer.cs
new file mode 100644
index 000000000..7de16aef4
--- /dev/null
+++ b/Samples/Coincheck/SampleCoincheck/Properties/Resources.Designer.cs
@@ -0,0 +1,63 @@
+//------------------------------------------------------------------------------
+//
+// This code was generated by a tool.
+// Runtime Version:4.0.30319.18449
+//
+// Changes to this file may cause incorrect behavior and will be lost if
+// the code is regenerated.
+//
+//------------------------------------------------------------------------------
+
+namespace SampleCoincheck.Properties {
+ using System;
+
+
+ ///
+ /// A strongly-typed resource class, for looking up localized strings, etc.
+ ///
+ // This class was auto-generated by the StronglyTypedResourceBuilder
+ // class via a tool like ResGen or Visual Studio.
+ // To add or remove a member, edit your .ResX file then rerun ResGen
+ // with the /str option, or rebuild your VS project.
+ [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")]
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
+ [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
+ internal class Resources {
+
+ private static global::System.Resources.ResourceManager resourceMan;
+
+ private static global::System.Globalization.CultureInfo resourceCulture;
+
+ [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
+ internal Resources() {
+ }
+
+ ///
+ /// Returns the cached ResourceManager instance used by this class.
+ ///
+ [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
+ internal static global::System.Resources.ResourceManager ResourceManager {
+ get {
+ if (object.ReferenceEquals(resourceMan, null)) {
+ global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("SampleCoincheck.Properties.Resources", typeof(Resources).Assembly);
+ resourceMan = temp;
+ }
+ return resourceMan;
+ }
+ }
+
+ ///
+ /// Overrides the current thread's CurrentUICulture property for all
+ /// resource lookups using this strongly typed resource class.
+ ///
+ [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
+ internal static global::System.Globalization.CultureInfo Culture {
+ get {
+ return resourceCulture;
+ }
+ set {
+ resourceCulture = value;
+ }
+ }
+ }
+}
diff --git a/Samples/Coincheck/SampleCoincheck/Properties/Resources.resx b/Samples/Coincheck/SampleCoincheck/Properties/Resources.resx
new file mode 100644
index 000000000..13b775f1d
--- /dev/null
+++ b/Samples/Coincheck/SampleCoincheck/Properties/Resources.resx
@@ -0,0 +1,117 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ text/microsoft-resx
+
+
+ 2.0
+
+
+ System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
+ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
\ No newline at end of file
diff --git a/Samples/Coincheck/SampleCoincheck/Properties/Settings.Designer.cs b/Samples/Coincheck/SampleCoincheck/Properties/Settings.Designer.cs
new file mode 100644
index 000000000..b913f9f72
--- /dev/null
+++ b/Samples/Coincheck/SampleCoincheck/Properties/Settings.Designer.cs
@@ -0,0 +1,26 @@
+//------------------------------------------------------------------------------
+//
+// This code was generated by a tool.
+// Runtime Version:4.0.30319.18449
+//
+// Changes to this file may cause incorrect behavior and will be lost if
+// the code is regenerated.
+//
+//------------------------------------------------------------------------------
+
+namespace SampleCoincheck.Properties {
+
+
+ [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
+ [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "12.0.0.0")]
+ internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase {
+
+ private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
+
+ public static Settings Default {
+ get {
+ return defaultInstance;
+ }
+ }
+ }
+}
diff --git a/Samples/Coincheck/SampleCoincheck/Properties/Settings.settings b/Samples/Coincheck/SampleCoincheck/Properties/Settings.settings
new file mode 100644
index 000000000..9010101f8
--- /dev/null
+++ b/Samples/Coincheck/SampleCoincheck/Properties/Settings.settings
@@ -0,0 +1,7 @@
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/Samples/Coincheck/SampleCoincheck/QuotesWindow.xaml b/Samples/Coincheck/SampleCoincheck/QuotesWindow.xaml
new file mode 100644
index 000000000..6e569a3b6
--- /dev/null
+++ b/Samples/Coincheck/SampleCoincheck/QuotesWindow.xaml
@@ -0,0 +1,7 @@
+
+
+
\ No newline at end of file
diff --git a/Samples/Coincheck/SampleCoincheck/QuotesWindow.xaml.cs b/Samples/Coincheck/SampleCoincheck/QuotesWindow.xaml.cs
new file mode 100644
index 000000000..d12f7c923
--- /dev/null
+++ b/Samples/Coincheck/SampleCoincheck/QuotesWindow.xaml.cs
@@ -0,0 +1,10 @@
+namespace SampleCoincheck
+{
+ public partial class QuotesWindow
+ {
+ public QuotesWindow()
+ {
+ InitializeComponent();
+ }
+ }
+}
\ No newline at end of file
diff --git a/Samples/Coincheck/SampleCoincheck/SampleCoincheck.csproj b/Samples/Coincheck/SampleCoincheck/SampleCoincheck.csproj
new file mode 100644
index 000000000..b1dc35364
--- /dev/null
+++ b/Samples/Coincheck/SampleCoincheck/SampleCoincheck.csproj
@@ -0,0 +1,281 @@
+
+
+
+ Debug
+ AnyCPU
+ 9.0.30729
+ 2.0
+ {BF1D8F6E-D307-4649-A293-EAB1BAC24ACC}
+ WinExe
+ Properties
+ SampleCoincheck
+ SampleCoincheck
+ v4.5.1
+ 512
+ {60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}
+ 4
+ ..\..\..\References\stocksharp.ico
+
+
+ 3.5
+
+ publish\
+ true
+ Disk
+ false
+ Foreground
+ 7
+ Days
+ false
+ false
+ true
+ 0
+ 1.0.0.%2a
+ false
+ false
+ true
+
+
+
+
+
+
+
+
+
+
+
+ true
+ full
+ false
+ bin\Debug\
+ DEBUG;TRACE
+ prompt
+ 4
+ AnyCPU
+ AllRules.ruleset
+ false
+
+
+ pdbonly
+ true
+ bin\Release\
+ TRACE
+ prompt
+ 4
+ AnyCPU
+ AllRules.ruleset
+ false
+
+
+
+ ..\..\..\References\Ecng.Localization.dll
+
+
+ ..\..\..\References\Ecng.Common.dll
+
+
+ ..\..\..\References\MoreLinq.dll
+
+
+
+
+
+
+
+
+
+
+ ..\..\..\References\Ecng.Collections.dll
+
+
+ ..\..\..\References\Ecng.ComponentModel.dll
+
+
+ ..\..\..\References\Ecng.Serialization.dll
+
+
+ ..\..\..\References\Ecng.Xaml.dll
+
+
+ ..\..\..\References\DevExpress.Data.v17.2.dll
+
+
+ ..\..\..\References\DevExpress.Xpf.Core.v17.2.dll
+
+
+ ..\..\..\References\DevExpress.Xpf.Grid.v17.2.dll
+
+
+ ..\..\..\References\DevExpress.Xpf.Grid.v17.2.Core.dll
+
+
+ ..\..\..\References\DevExpress.Xpf.Themes.Office2016White.v17.2.dll
+
+
+
+
+ MSBuild:Compile
+ Designer
+ MSBuild:Compile
+ Designer
+
+
+ Properties\StockSharpAssemblyInfo.cs
+
+
+ App.xaml
+ Code
+
+
+
+
+ MainWindow.xaml
+
+
+ MyTradesWindow.xaml
+
+
+ OrdersWindow.xaml
+
+
+ PortfoliosWindow.xaml
+
+
+
+ True
+ True
+ Resources.resx
+
+
+ True
+ Settings.settings
+ True
+
+
+ QuotesWindow.xaml
+
+
+ SecuritiesWindow.xaml
+
+
+ TradesWindow.xaml
+
+
+ ResXFileCodeGenerator
+ Resources.Designer.cs
+
+
+
+ SettingsSingleFileGenerator
+ Settings.Designer.cs
+
+
+
+
+
+ MSBuild:Compile
+ Designer
+ MSBuild:Compile
+ Designer
+
+
+ Designer
+ MSBuild:Compile
+ MSBuild:Compile
+ Designer
+
+
+ MSBuild:Compile
+ Designer
+ MSBuild:Compile
+ Designer
+
+
+ MSBuild:Compile
+ Designer
+
+
+ MSBuild:Compile
+ Designer
+ MSBuild:Compile
+ Designer
+
+
+ MSBuild:Compile
+ Designer
+ MSBuild:Compile
+ Designer
+
+
+ MSBuild:Compile
+ Designer
+ MSBuild:Compile
+ Designer
+
+
+
+
+ False
+ .NET Framework 3.5 SP1 Client Profile
+ false
+
+
+ False
+ .NET Framework 3.5 SP1
+ true
+
+
+ False
+ Windows Installer 3.1
+ true
+
+
+
+
+ {1d19f91c-214c-44cd-9064-a22bd89d7ab1}
+ Coincheck
+
+
+ {2A5C6FAD-106C-4A4A-B602-77A6B1034CA2}
+ Algo
+
+
+ {DCE69DB8-53CA-4B7F-9368-02F175A31074}
+ BusinessEntities
+
+
+ {A98A81CE-75A1-4FAB-9C02-E6EEF4B51F4F}
+ Localization
+
+
+ {C4476ADD-A3D5-41BB-9D43-55D865863B78}
+ Logging
+
+
+ {B47F9C23-A4BD-46A9-BF27-54CB3D653503}
+ Messages
+
+
+ {c449d618-dea4-41c3-ba86-9f827c7421dc}
+ Xaml.Charting
+
+
+ {64E4D6F0-36B6-4904-9BA7-FFFBE5FF71D8}
+ Xaml
+
+
+
+
+ stocksharp.ico
+
+
+
+
+
\ No newline at end of file
diff --git a/Samples/Coincheck/SampleCoincheck/SampleCoincheck.licenseheader b/Samples/Coincheck/SampleCoincheck/SampleCoincheck.licenseheader
new file mode 100644
index 000000000..a1db37839
--- /dev/null
+++ b/Samples/Coincheck/SampleCoincheck/SampleCoincheck.licenseheader
@@ -0,0 +1,45 @@
+extensions: designer.cs generated.cs
+extensions: .cs .cpp .h
+#region S# License
+/******************************************************************************************
+NOTICE!!! This program and source code is owned and licensed by
+StockSharp Algo Trading, LLC, www.stocksharp.com
+Viewing or use of this code requires your acceptance of the license
+agreement found at https://github.com/StockSharp/StockSharp/blob/master/LICENSE
+Removal of this comment is a violation of the license agreement.
+
+Project: %Namespace%.%Project%
+File: %FileName%
+Created: %CreationYear%, %CreationMonth%, %CreationDay%, %CreationTime%
+
+Copyright 2010 by StockSharp Algo Trading, LLC
+*******************************************************************************************/
+#endregion S# License
+extensions: .aspx .ascx
+<%--
+NOTICE!!! This program and source code is owned and licensed by
+StockSharp Algo Trading, LLC, www.stocksharp.com
+Viewing or use of this code requires your acceptance of the license
+agreement found at https://github.com/StockSharp/StockSharp/blob/master/LICENSE
+Removal of this comment is a violation of the license agreement.
+
+Project: %Namespace%.%Project%
+File: %FileName%
+Created: %CreationYear%, %CreationMonth%, %CreationDay%, %CreationTime%
+
+Copyright 2010 by StockSharp Algo Trading, LLC
+--%>
+extensions: .xml .config .xsd
+
\ No newline at end of file
diff --git a/Samples/Coincheck/SampleCoincheck/SampleCoincheckPublic.csproj b/Samples/Coincheck/SampleCoincheck/SampleCoincheckPublic.csproj
new file mode 100644
index 000000000..8f0a08b42
--- /dev/null
+++ b/Samples/Coincheck/SampleCoincheck/SampleCoincheckPublic.csproj
@@ -0,0 +1,275 @@
+
+
+
+ Debug
+ AnyCPU
+ 9.0.30729
+ 2.0
+ {BE0E333A-4AE4-4629-B776-D2DEE25264BD}
+ WinExe
+ Properties
+ SampleCoincheck
+ SampleCoincheck
+ v4.5.1
+ 512
+ {60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}
+ 4
+ ..\..\..\References\stocksharp.ico
+
+
+ 3.5
+
+ publish\
+ true
+ Disk
+ false
+ Foreground
+ 7
+ Days
+ false
+ false
+ true
+ 0
+ 1.0.0.%2a
+ false
+ false
+ true
+
+
+
+ true
+ full
+ false
+ bin\Debug\
+ DEBUG;TRACE
+ prompt
+ 4
+ AnyCPU
+ AllRules.ruleset
+ false
+
+
+ pdbonly
+ true
+ bin\Release\
+ TRACE
+ prompt
+ 4
+ AnyCPU
+ AllRules.ruleset
+ false
+
+
+
+ ..\..\..\References\StockSharp.Coincheck.dll
+
+
+
+
+
+
+
+
+
+
+ ..\..\..\References\Ecng.Localization.dll
+
+
+ ..\..\..\References\Ecng.Common.dll
+
+
+ ..\..\..\References\MoreLinq.dll
+
+
+ ..\..\..\References\Ecng.Collections.dll
+
+
+ ..\..\..\References\Ecng.ComponentModel.dll
+
+
+ ..\..\..\References\Ecng.Serialization.dll
+
+
+ ..\..\..\References\Ecng.Xaml.dll
+
+
+ ..\..\..\References\Xceed.Wpf.Toolkit.dll
+
+
+ ..\..\..\References\DevExpress.Data.v17.2.dll
+
+
+ ..\..\..\References\DevExpress.Xpf.Core.v17.2.dll
+
+
+ ..\..\..\References\DevExpress.Xpf.Grid.v17.2.dll
+
+
+ ..\..\..\References\DevExpress.Xpf.Grid.v17.2.Core.dll
+
+
+ ..\..\..\References\DevExpress.Xpf.LayoutControl.v17.2.dll
+
+
+
+
+ MSBuild:Compile
+ Designer
+ MSBuild:Compile
+ Designer
+
+
+ Properties\StockSharpAssemblyInfo.cs
+
+
+ App.xaml
+ Code
+
+
+
+
+ MainWindow.xaml
+
+
+ MyTradesWindow.xaml
+
+
+ OrdersWindow.xaml
+
+
+ PortfoliosWindow.xaml
+
+
+
+ True
+ True
+ Resources.resx
+
+
+ True
+ Settings.settings
+ True
+
+
+ QuotesWindow.xaml
+
+
+ SecuritiesWindow.xaml
+
+
+ TradesWindow.xaml
+
+
+ ResXFileCodeGenerator
+ Resources.Designer.cs
+
+
+
+ SettingsSingleFileGenerator
+ Settings.Designer.cs
+
+
+
+
+
+ MSBuild:Compile
+ Designer
+ MSBuild:Compile
+ Designer
+
+
+ Designer
+ MSBuild:Compile
+ MSBuild:Compile
+ Designer
+
+
+ MSBuild:Compile
+ Designer
+ MSBuild:Compile
+ Designer
+
+
+ MSBuild:Compile
+ Designer
+
+
+ MSBuild:Compile
+ Designer
+ MSBuild:Compile
+ Designer
+
+
+ MSBuild:Compile
+ Designer
+ MSBuild:Compile
+ Designer
+
+
+ MSBuild:Compile
+ Designer
+ MSBuild:Compile
+ Designer
+
+
+
+
+ False
+ .NET Framework 3.5 SP1 Client Profile
+ false
+
+
+ False
+ .NET Framework 3.5 SP1
+ true
+
+
+ False
+ Windows Installer 3.1
+ true
+
+
+
+
+ stocksharp.ico
+
+
+
+
+ {AF225452-1CF1-48A2-B381-C02BEBE643D7}
+ Coincheck
+
+
+ {64e4d6f0-36b6-4904-9ba7-fffbe5ff71d8}
+ Xaml
+
+
+ {2A5C6FAD-106C-4A4A-B602-77A6B1034CA2}
+ Algo
+
+
+ {DCE69DB8-53CA-4B7F-9368-02F175A31074}
+ BusinessEntities
+
+
+ {A98A81CE-75A1-4FAB-9C02-E6EEF4B51F4F}
+ Localization
+
+
+ {C4476ADD-A3D5-41BB-9D43-55D865863B78}
+ Logging
+
+
+ {b47f9c23-a4bd-46a9-bf27-54cb3d653503}
+ Messages
+
+
+
+
+
\ No newline at end of file
diff --git a/Samples/Coincheck/SampleCoincheck/SecuritiesWindow.xaml b/Samples/Coincheck/SampleCoincheck/SecuritiesWindow.xaml
new file mode 100644
index 000000000..48f5a0000
--- /dev/null
+++ b/Samples/Coincheck/SampleCoincheck/SecuritiesWindow.xaml
@@ -0,0 +1,25 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/Samples/Coincheck/SampleCoincheck/SecuritiesWindow.xaml.cs b/Samples/Coincheck/SampleCoincheck/SecuritiesWindow.xaml.cs
new file mode 100644
index 000000000..bdf227a35
--- /dev/null
+++ b/Samples/Coincheck/SampleCoincheck/SecuritiesWindow.xaml.cs
@@ -0,0 +1,126 @@
+namespace SampleCoincheck
+{
+ using System;
+ using System.Linq;
+ using System.Windows;
+
+ using Ecng.Collections;
+ using Ecng.Xaml;
+
+ using MoreLinq;
+
+ using StockSharp.BusinessEntities;
+ using StockSharp.Xaml;
+ using StockSharp.Localization;
+
+ public partial class SecuritiesWindow
+ {
+ private readonly SynchronizedDictionary _quotesWindows = new SynchronizedDictionary();
+ private bool _initialized;
+
+ public SecuritiesWindow()
+ {
+ InitializeComponent();
+ }
+
+ protected override void OnClosed(EventArgs e)
+ {
+ _quotesWindows.SyncDo(d => d.Values.ForEach(w =>
+ {
+ w.DeleteHideable();
+ w.Close();
+ }));
+
+ var trader = MainWindow.Instance.Trader;
+ if (trader != null)
+ {
+ if (_initialized)
+ trader.MarketDepthChanged -= TraderOnMarketDepthChanged;
+ }
+
+ base.OnClosed(e);
+ }
+
+ private void SecurityPicker_OnSecuritySelected(Security security)
+ {
+ Quotes.IsEnabled = NewOrder.IsEnabled = Depth.IsEnabled = security != null;
+ }
+
+ private void NewOrderClick(object sender, RoutedEventArgs e)
+ {
+ var newOrder = new OrderWindow
+ {
+ Order = new Order { Security = SecurityPicker.SelectedSecurity },
+ SecurityProvider = MainWindow.Instance.Trader,
+ MarketDataProvider = MainWindow.Instance.Trader,
+ Portfolios = new PortfolioDataSource(MainWindow.Instance.Trader),
+ };
+
+ if (newOrder.ShowModal(this))
+ MainWindow.Instance.Trader.RegisterOrder(newOrder.Order);
+ }
+
+ private void DepthClick(object sender, RoutedEventArgs e)
+ {
+ var trader = MainWindow.Instance.Trader;
+
+ foreach (var security in SecurityPicker.SelectedSecurities)
+ {
+ var window = _quotesWindows.SafeAdd(security, s =>
+ {
+ // начинаем получать котировки стакана
+ trader.RegisterMarketDepth(security);
+
+ // создаем окно со стаканом
+ var wnd = new QuotesWindow
+ {
+ Title = security.Id + " " + LocalizedStrings.MarketDepth
+ };
+ wnd.MakeHideable();
+ return wnd;
+ });
+
+ if (window.Visibility == Visibility.Visible)
+ window.Hide();
+ else
+ {
+ window.Show();
+ window.DepthCtrl.UpdateDepth(trader.GetMarketDepth(security));
+ }
+
+ if (!_initialized)
+ {
+ trader.MarketDepthChanged += TraderOnMarketDepthChanged;
+ _initialized = true;
+ }
+ }
+ }
+
+ private void QuotesClick(object sender, RoutedEventArgs e)
+ {
+ var trader = MainWindow.Instance.Trader;
+
+ foreach (var security in SecurityPicker.SelectedSecurities)
+ {
+ if (trader.RegisteredSecurities.Contains(security))
+ {
+ trader.UnRegisterSecurity(security);
+ trader.UnRegisterTrades(security);
+ }
+ else
+ {
+ trader.RegisterSecurity(security);
+ trader.RegisterTrades(security);
+ }
+ }
+ }
+
+ private void TraderOnMarketDepthChanged(MarketDepth depth)
+ {
+ var wnd = _quotesWindows.TryGetValue(depth.Security);
+
+ if (wnd != null)
+ wnd.DepthCtrl.UpdateDepth(depth);
+ }
+ }
+}
\ No newline at end of file
diff --git a/Samples/Coincheck/SampleCoincheck/TradesWindow.xaml b/Samples/Coincheck/SampleCoincheck/TradesWindow.xaml
new file mode 100644
index 000000000..73c5e773a
--- /dev/null
+++ b/Samples/Coincheck/SampleCoincheck/TradesWindow.xaml
@@ -0,0 +1,7 @@
+
+
+
\ No newline at end of file
diff --git a/Samples/Coincheck/SampleCoincheck/TradesWindow.xaml.cs b/Samples/Coincheck/SampleCoincheck/TradesWindow.xaml.cs
new file mode 100644
index 000000000..2a5e0f8ac
--- /dev/null
+++ b/Samples/Coincheck/SampleCoincheck/TradesWindow.xaml.cs
@@ -0,0 +1,10 @@
+namespace SampleCoincheck
+{
+ public partial class TradesWindow
+ {
+ public TradesWindow()
+ {
+ InitializeComponent();
+ }
+ }
+}
\ No newline at end of file
diff --git a/Samples/Coincheck/SampleCoincheck/app.config b/Samples/Coincheck/SampleCoincheck/app.config
new file mode 100644
index 000000000..884f9844f
--- /dev/null
+++ b/Samples/Coincheck/SampleCoincheck/app.config
@@ -0,0 +1,3 @@
+
+
+
diff --git a/Samples/Gdax/SampleGdax/App.xaml b/Samples/Gdax/SampleGdax/App.xaml
new file mode 100644
index 000000000..19eac52d5
--- /dev/null
+++ b/Samples/Gdax/SampleGdax/App.xaml
@@ -0,0 +1,8 @@
+
+
+
+
+
diff --git a/Samples/Gdax/SampleGdax/App.xaml.cs b/Samples/Gdax/SampleGdax/App.xaml.cs
new file mode 100644
index 000000000..3940d1597
--- /dev/null
+++ b/Samples/Gdax/SampleGdax/App.xaml.cs
@@ -0,0 +1,14 @@
+namespace SampleGdax
+{
+ using System.Windows;
+ using System.Windows.Threading;
+
+ public partial class App
+ {
+ private void ApplicationDispatcherUnhandledException(object sender, DispatcherUnhandledExceptionEventArgs e)
+ {
+ MessageBox.Show(MainWindow, e.Exception.ToString());
+ e.Handled = true;
+ }
+ }
+}
\ No newline at end of file
diff --git a/Samples/Gdax/SampleGdax/MainWindow.xaml b/Samples/Gdax/SampleGdax/MainWindow.xaml
new file mode 100644
index 000000000..9314f6c4e
--- /dev/null
+++ b/Samples/Gdax/SampleGdax/MainWindow.xaml
@@ -0,0 +1,35 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/Samples/Gdax/SampleGdax/MainWindow.xaml.cs b/Samples/Gdax/SampleGdax/MainWindow.xaml.cs
new file mode 100644
index 000000000..ec68f17d5
--- /dev/null
+++ b/Samples/Gdax/SampleGdax/MainWindow.xaml.cs
@@ -0,0 +1,214 @@
+namespace SampleGdax
+{
+ using System;
+ using System.ComponentModel;
+ using System.Windows;
+
+ using Ecng.Common;
+ using Ecng.Xaml;
+
+ using StockSharp.BusinessEntities;
+ using StockSharp.Gdax;
+ using StockSharp.Logging;
+ using StockSharp.Localization;
+
+ public partial class MainWindow
+ {
+ private bool _isConnected;
+
+ public GdaxTrader Trader;
+
+ private readonly SecuritiesWindow _securitiesWindow = new SecuritiesWindow();
+ private readonly TradesWindow _tradesWindow = new TradesWindow();
+ private readonly MyTradesWindow _myTradesWindow = new MyTradesWindow();
+ private readonly OrdersWindow _ordersWindow = new OrdersWindow();
+ private readonly PortfoliosWindow _portfoliosWindow = new PortfoliosWindow();
+
+ private readonly LogManager _logManager = new LogManager();
+
+ public MainWindow()
+ {
+ InitializeComponent();
+
+ Title = Title.Put("Gdax");
+
+ _ordersWindow.MakeHideable();
+ _myTradesWindow.MakeHideable();
+ _tradesWindow.MakeHideable();
+ _securitiesWindow.MakeHideable();
+ _portfoliosWindow.MakeHideable();
+
+ Instance = this;
+
+ _logManager.Sources.Add(MemoryStatistics.Instance);
+ _logManager.Listeners.Add(new FileLogListener { LogDirectory = "StockSharp_Gdax" });
+ }
+
+ protected override void OnClosing(CancelEventArgs e)
+ {
+ _ordersWindow.DeleteHideable();
+ _myTradesWindow.DeleteHideable();
+ _tradesWindow.DeleteHideable();
+ _securitiesWindow.DeleteHideable();
+ _portfoliosWindow.DeleteHideable();
+
+ _securitiesWindow.Close();
+ _tradesWindow.Close();
+ _myTradesWindow.Close();
+ _ordersWindow.Close();
+ _portfoliosWindow.Close();
+
+ if (Trader != null)
+ Trader.Dispose();
+
+ base.OnClosing(e);
+ }
+
+ public static MainWindow Instance { get; private set; }
+
+ private void ConnectClick(object sender, RoutedEventArgs e)
+ {
+ if (!_isConnected)
+ {
+ if (Key.Text.IsEmpty())
+ {
+ MessageBox.Show(this, LocalizedStrings.Str3689);
+ return;
+ }
+ else if (Secret.Password.IsEmpty())
+ {
+ MessageBox.Show(this, LocalizedStrings.Str3690);
+ return;
+ }
+
+ if (Trader == null)
+ {
+ // create connector
+ Trader = new GdaxTrader();// { LogLevel = LogLevels.Debug };
+
+ _logManager.Sources.Add(Trader);
+
+ Trader.Restored += () => this.GuiAsync(() =>
+ {
+ // update gui labes
+ ChangeConnectStatus(true);
+ MessageBox.Show(this, LocalizedStrings.Str2958);
+ });
+
+ // subscribe on connection successfully event
+ Trader.Connected += () =>
+ {
+ // set flag (connection is established)
+ _isConnected = true;
+
+ // update gui labes
+ this.GuiAsync(() => ChangeConnectStatus(true));
+ };
+ Trader.Disconnected += () => this.GuiAsync(() => ChangeConnectStatus(false));
+
+ // subscribe on connection error event
+ Trader.ConnectionError += error => this.GuiAsync(() =>
+ {
+ // update gui labes
+ ChangeConnectStatus(false);
+
+ MessageBox.Show(this, error.ToString(), LocalizedStrings.Str2959);
+ });
+
+ // subscribe on error event
+ Trader.Error += error =>
+ this.GuiAsync(() => MessageBox.Show(this, error.ToString(), LocalizedStrings.Str2955));
+
+ // subscribe on error of market data subscription event
+ Trader.MarketDataSubscriptionFailed += (security, msg, error) =>
+ this.GuiAsync(() => MessageBox.Show(this, error.ToString(), LocalizedStrings.Str2956Params.Put(msg.DataType, security)));
+
+ Trader.NewSecurity += _securitiesWindow.SecurityPicker.Securities.Add;
+ Trader.NewMyTrade += _myTradesWindow.TradeGrid.Trades.Add;
+ Trader.NewTrade += _tradesWindow.TradeGrid.Trades.Add;
+ Trader.NewOrder += _ordersWindow.OrderGrid.Orders.Add;
+
+ Trader.NewPortfolio += _portfoliosWindow.PortfolioGrid.Portfolios.Add;
+ Trader.NewPosition += _portfoliosWindow.PortfolioGrid.Positions.Add;
+
+ // subscribe on error of order registration event
+ Trader.OrderRegisterFailed += _ordersWindow.OrderGrid.AddRegistrationFail;
+ // subscribe on error of order cancelling event
+ Trader.OrderCancelFailed += OrderFailed;
+
+ Trader.MassOrderCancelFailed += (transId, error) =>
+ this.GuiAsync(() => MessageBox.Show(this, error.ToString(), LocalizedStrings.Str716));
+
+ // set market data provider
+ _securitiesWindow.SecurityPicker.MarketDataProvider = Trader;
+
+ ShowSecurities.IsEnabled = ShowTrades.IsEnabled =
+ ShowMyTrades.IsEnabled = ShowOrders.IsEnabled =
+ ShowPortfolios.IsEnabled = true;
+ }
+
+ Trader.Key = Key.Text;
+ Trader.Secret = Secret.Password;
+
+ // clear password box for security reason
+ //Secret.Clear();
+
+ Trader.Connect();
+ }
+ else
+ {
+ Trader.Disconnect();
+ }
+ }
+
+ private void OrderFailed(OrderFail fail)
+ {
+ this.GuiAsync(() =>
+ {
+ MessageBox.Show(this, fail.Error.ToString(), LocalizedStrings.Str153);
+ });
+ }
+
+ private void ChangeConnectStatus(bool isConnected)
+ {
+ _isConnected = isConnected;
+ ConnectBtn.Content = isConnected ? LocalizedStrings.Disconnect : LocalizedStrings.Connect;
+ }
+
+ private void ShowSecuritiesClick(object sender, RoutedEventArgs e)
+ {
+ ShowOrHide(_securitiesWindow);
+ }
+
+ private void ShowTradesClick(object sender, RoutedEventArgs e)
+ {
+ ShowOrHide(_tradesWindow);
+ }
+
+ private void ShowMyTradesClick(object sender, RoutedEventArgs e)
+ {
+ ShowOrHide(_myTradesWindow);
+ }
+
+ private void ShowOrdersClick(object sender, RoutedEventArgs e)
+ {
+ ShowOrHide(_ordersWindow);
+ }
+
+ private void ShowPortfoliosClick(object sender, RoutedEventArgs e)
+ {
+ ShowOrHide(_portfoliosWindow);
+ }
+
+ private static void ShowOrHide(Window window)
+ {
+ if (window == null)
+ throw new ArgumentNullException(nameof(window));
+
+ if (window.Visibility == Visibility.Visible)
+ window.Hide();
+ else
+ window.Show();
+ }
+ }
+}
diff --git a/Samples/Gdax/SampleGdax/MyTradesWindow.xaml b/Samples/Gdax/SampleGdax/MyTradesWindow.xaml
new file mode 100644
index 000000000..35e1f00c6
--- /dev/null
+++ b/Samples/Gdax/SampleGdax/MyTradesWindow.xaml
@@ -0,0 +1,8 @@
+
+
+
\ No newline at end of file
diff --git a/Samples/Gdax/SampleGdax/MyTradesWindow.xaml.cs b/Samples/Gdax/SampleGdax/MyTradesWindow.xaml.cs
new file mode 100644
index 000000000..b4a000e8d
--- /dev/null
+++ b/Samples/Gdax/SampleGdax/MyTradesWindow.xaml.cs
@@ -0,0 +1,10 @@
+namespace SampleGdax
+{
+ public partial class MyTradesWindow
+ {
+ public MyTradesWindow()
+ {
+ InitializeComponent();
+ }
+ }
+}
\ No newline at end of file
diff --git a/Samples/Gdax/SampleGdax/OrdersWindow.xaml b/Samples/Gdax/SampleGdax/OrdersWindow.xaml
new file mode 100644
index 000000000..d283c28c6
--- /dev/null
+++ b/Samples/Gdax/SampleGdax/OrdersWindow.xaml
@@ -0,0 +1,16 @@
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/Samples/Gdax/SampleGdax/OrdersWindow.xaml.cs b/Samples/Gdax/SampleGdax/OrdersWindow.xaml.cs
new file mode 100644
index 000000000..2deb8f2bc
--- /dev/null
+++ b/Samples/Gdax/SampleGdax/OrdersWindow.xaml.cs
@@ -0,0 +1,49 @@
+namespace SampleGdax
+{
+ using System.Windows;
+
+ using Ecng.Common;
+ using Ecng.Xaml;
+
+ using StockSharp.Algo;
+ using StockSharp.BusinessEntities;
+ using StockSharp.Localization;
+ using StockSharp.Xaml;
+
+ public partial class OrdersWindow
+ {
+ public OrdersWindow()
+ {
+ InitializeComponent();
+ }
+
+ private static IConnector Connector => MainWindow.Instance.Trader;
+
+ private void OrderGrid_OnOrderCanceling(Order order)
+ {
+ Connector.CancelOrder(order);
+ }
+
+ private void OrderGrid_OnOrderReRegistering(Order order)
+ {
+ var window = new OrderWindow
+ {
+ Title = LocalizedStrings.Str2976Params.Put(order.TransactionId),
+ SecurityProvider = Connector,
+ MarketDataProvider = Connector,
+ Portfolios = new PortfolioDataSource(Connector),
+ Order = order.ReRegisterClone(newVolume: order.Balance),
+ };
+
+ if (window.ShowModal(this))
+ {
+ Connector.ReRegisterOrder(order, window.Order);
+ }
+ }
+
+ private void CancelAll_OnClick(object sender, RoutedEventArgs e)
+ {
+ Connector.CancelOrders();
+ }
+ }
+}
\ No newline at end of file
diff --git a/Samples/Gdax/SampleGdax/PortfoliosWindow.xaml b/Samples/Gdax/SampleGdax/PortfoliosWindow.xaml
new file mode 100644
index 000000000..8267cd514
--- /dev/null
+++ b/Samples/Gdax/SampleGdax/PortfoliosWindow.xaml
@@ -0,0 +1,8 @@
+
+
+
\ No newline at end of file
diff --git a/Samples/Gdax/SampleGdax/PortfoliosWindow.xaml.cs b/Samples/Gdax/SampleGdax/PortfoliosWindow.xaml.cs
new file mode 100644
index 000000000..8aac5c3e2
--- /dev/null
+++ b/Samples/Gdax/SampleGdax/PortfoliosWindow.xaml.cs
@@ -0,0 +1,10 @@
+namespace SampleGdax
+{
+ public partial class PortfoliosWindow
+ {
+ public PortfoliosWindow()
+ {
+ InitializeComponent();
+ }
+ }
+}
\ No newline at end of file
diff --git a/Samples/Gdax/SampleGdax/Properties/AssemblyInfo.cs b/Samples/Gdax/SampleGdax/Properties/AssemblyInfo.cs
new file mode 100644
index 000000000..71494023c
--- /dev/null
+++ b/Samples/Gdax/SampleGdax/Properties/AssemblyInfo.cs
@@ -0,0 +1,20 @@
+using System.Reflection;
+using System.Runtime.InteropServices;
+using System.Windows;
+
+// General Information about an assembly is controlled through the following
+// set of attributes. Change these attribute values to modify the information
+// associated with an assembly.
+[assembly: AssemblyTitle("SampleGdax")]
+[assembly: AssemblyDescription("")]
+
+[assembly: Guid("5210DEC5-BF1D-422E-8B59-224DB3CE911F")]
+
+[assembly:ThemeInfo(
+ ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located
+ //(used if a resource is not found in the page,
+ // or application resource dictionaries)
+ ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located
+ //(used if a resource is not found in the page,
+ // app, or any theme specific resource dictionaries)
+)]
diff --git a/Samples/Gdax/SampleGdax/Properties/Resources.Designer.cs b/Samples/Gdax/SampleGdax/Properties/Resources.Designer.cs
new file mode 100644
index 000000000..2099681df
--- /dev/null
+++ b/Samples/Gdax/SampleGdax/Properties/Resources.Designer.cs
@@ -0,0 +1,63 @@
+//------------------------------------------------------------------------------
+//
+// This code was generated by a tool.
+// Runtime Version:4.0.30319.18449
+//
+// Changes to this file may cause incorrect behavior and will be lost if
+// the code is regenerated.
+//
+//------------------------------------------------------------------------------
+
+namespace SampleGdax.Properties {
+ using System;
+
+
+ ///
+ /// A strongly-typed resource class, for looking up localized strings, etc.
+ ///
+ // This class was auto-generated by the StronglyTypedResourceBuilder
+ // class via a tool like ResGen or Visual Studio.
+ // To add or remove a member, edit your .ResX file then rerun ResGen
+ // with the /str option, or rebuild your VS project.
+ [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")]
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
+ [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
+ internal class Resources {
+
+ private static global::System.Resources.ResourceManager resourceMan;
+
+ private static global::System.Globalization.CultureInfo resourceCulture;
+
+ [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
+ internal Resources() {
+ }
+
+ ///
+ /// Returns the cached ResourceManager instance used by this class.
+ ///
+ [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
+ internal static global::System.Resources.ResourceManager ResourceManager {
+ get {
+ if (object.ReferenceEquals(resourceMan, null)) {
+ global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("SampleGdax.Properties.Resources", typeof(Resources).Assembly);
+ resourceMan = temp;
+ }
+ return resourceMan;
+ }
+ }
+
+ ///
+ /// Overrides the current thread's CurrentUICulture property for all
+ /// resource lookups using this strongly typed resource class.
+ ///
+ [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
+ internal static global::System.Globalization.CultureInfo Culture {
+ get {
+ return resourceCulture;
+ }
+ set {
+ resourceCulture = value;
+ }
+ }
+ }
+}
diff --git a/Samples/Gdax/SampleGdax/Properties/Resources.resx b/Samples/Gdax/SampleGdax/Properties/Resources.resx
new file mode 100644
index 000000000..13b775f1d
--- /dev/null
+++ b/Samples/Gdax/SampleGdax/Properties/Resources.resx
@@ -0,0 +1,117 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ text/microsoft-resx
+
+
+ 2.0
+
+
+ System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
+ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
\ No newline at end of file
diff --git a/Samples/Gdax/SampleGdax/Properties/Settings.Designer.cs b/Samples/Gdax/SampleGdax/Properties/Settings.Designer.cs
new file mode 100644
index 000000000..e9590f83e
--- /dev/null
+++ b/Samples/Gdax/SampleGdax/Properties/Settings.Designer.cs
@@ -0,0 +1,26 @@
+//------------------------------------------------------------------------------
+//
+// This code was generated by a tool.
+// Runtime Version:4.0.30319.18449
+//
+// Changes to this file may cause incorrect behavior and will be lost if
+// the code is regenerated.
+//
+//------------------------------------------------------------------------------
+
+namespace SampleGdax.Properties {
+
+
+ [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
+ [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "12.0.0.0")]
+ internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase {
+
+ private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
+
+ public static Settings Default {
+ get {
+ return defaultInstance;
+ }
+ }
+ }
+}
diff --git a/Samples/Gdax/SampleGdax/Properties/Settings.settings b/Samples/Gdax/SampleGdax/Properties/Settings.settings
new file mode 100644
index 000000000..9010101f8
--- /dev/null
+++ b/Samples/Gdax/SampleGdax/Properties/Settings.settings
@@ -0,0 +1,7 @@
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/Samples/Gdax/SampleGdax/QuotesWindow.xaml b/Samples/Gdax/SampleGdax/QuotesWindow.xaml
new file mode 100644
index 000000000..b1171dcd8
--- /dev/null
+++ b/Samples/Gdax/SampleGdax/QuotesWindow.xaml
@@ -0,0 +1,7 @@
+
+
+
\ No newline at end of file
diff --git a/Samples/Gdax/SampleGdax/QuotesWindow.xaml.cs b/Samples/Gdax/SampleGdax/QuotesWindow.xaml.cs
new file mode 100644
index 000000000..6c53cfd46
--- /dev/null
+++ b/Samples/Gdax/SampleGdax/QuotesWindow.xaml.cs
@@ -0,0 +1,10 @@
+namespace SampleGdax
+{
+ public partial class QuotesWindow
+ {
+ public QuotesWindow()
+ {
+ InitializeComponent();
+ }
+ }
+}
\ No newline at end of file
diff --git a/Samples/Gdax/SampleGdax/SampleGdax.csproj b/Samples/Gdax/SampleGdax/SampleGdax.csproj
new file mode 100644
index 000000000..c98d8424f
--- /dev/null
+++ b/Samples/Gdax/SampleGdax/SampleGdax.csproj
@@ -0,0 +1,281 @@
+
+
+
+ Debug
+ AnyCPU
+ 9.0.30729
+ 2.0
+ {9A8925EB-B6E7-4AFA-A4BB-7A2DF17069AB}
+ WinExe
+ Properties
+ SampleGdax
+ SampleGdax
+ v4.5.1
+ 512
+ {60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}
+ 4
+ ..\..\..\References\stocksharp.ico
+
+
+ 3.5
+
+ publish\
+ true
+ Disk
+ false
+ Foreground
+ 7
+ Days
+ false
+ false
+ true
+ 0
+ 1.0.0.%2a
+ false
+ false
+ true
+
+
+
+
+
+
+
+
+
+
+
+ true
+ full
+ false
+ bin\Debug\
+ DEBUG;TRACE
+ prompt
+ 4
+ AnyCPU
+ AllRules.ruleset
+ false
+
+
+ pdbonly
+ true
+ bin\Release\
+ TRACE
+ prompt
+ 4
+ AnyCPU
+ AllRules.ruleset
+ false
+
+
+
+ ..\..\..\References\Ecng.Localization.dll
+
+
+ ..\..\..\References\Ecng.Common.dll
+
+
+ ..\..\..\References\MoreLinq.dll
+
+
+
+
+
+
+
+
+
+
+ ..\..\..\References\Ecng.Collections.dll
+
+
+ ..\..\..\References\Ecng.ComponentModel.dll
+
+
+ ..\..\..\References\Ecng.Serialization.dll
+
+
+ ..\..\..\References\Ecng.Xaml.dll
+
+
+ ..\..\..\References\DevExpress.Data.v17.2.dll
+
+
+ ..\..\..\References\DevExpress.Xpf.Core.v17.2.dll
+
+
+ ..\..\..\References\DevExpress.Xpf.Grid.v17.2.dll
+
+
+ ..\..\..\References\DevExpress.Xpf.Grid.v17.2.Core.dll
+
+
+ ..\..\..\References\DevExpress.Xpf.Themes.Office2016White.v17.2.dll
+
+
+
+
+ MSBuild:Compile
+ Designer
+ MSBuild:Compile
+ Designer
+
+
+ Properties\StockSharpAssemblyInfo.cs
+
+
+ App.xaml
+ Code
+
+
+
+
+ MainWindow.xaml
+
+
+ MyTradesWindow.xaml
+
+
+ OrdersWindow.xaml
+
+
+ PortfoliosWindow.xaml
+
+
+
+ True
+ True
+ Resources.resx
+
+
+ True
+ Settings.settings
+ True
+
+
+ QuotesWindow.xaml
+
+
+ SecuritiesWindow.xaml
+
+
+ TradesWindow.xaml
+
+
+ ResXFileCodeGenerator
+ Resources.Designer.cs
+
+
+
+ SettingsSingleFileGenerator
+ Settings.Designer.cs
+
+
+
+
+
+ MSBuild:Compile
+ Designer
+ MSBuild:Compile
+ Designer
+
+
+ Designer
+ MSBuild:Compile
+ MSBuild:Compile
+ Designer
+
+
+ MSBuild:Compile
+ Designer
+ MSBuild:Compile
+ Designer
+
+
+ MSBuild:Compile
+ Designer
+
+
+ MSBuild:Compile
+ Designer
+ MSBuild:Compile
+ Designer
+
+
+ MSBuild:Compile
+ Designer
+ MSBuild:Compile
+ Designer
+
+
+ MSBuild:Compile
+ Designer
+ MSBuild:Compile
+ Designer
+
+
+
+
+ False
+ .NET Framework 3.5 SP1 Client Profile
+ false
+
+
+ False
+ .NET Framework 3.5 SP1
+ true
+
+
+ False
+ Windows Installer 3.1
+ true
+
+
+
+
+ {51134FC5-2DAB-4905-9E41-A3E8E754AF7C}
+ Gdax
+
+
+ {2A5C6FAD-106C-4A4A-B602-77A6B1034CA2}
+ Algo
+
+
+ {DCE69DB8-53CA-4B7F-9368-02F175A31074}
+ BusinessEntities
+
+
+ {A98A81CE-75A1-4FAB-9C02-E6EEF4B51F4F}
+ Localization
+
+
+ {C4476ADD-A3D5-41BB-9D43-55D865863B78}
+ Logging
+
+
+ {B47F9C23-A4BD-46A9-BF27-54CB3D653503}
+ Messages
+
+
+ {c449d618-dea4-41c3-ba86-9f827c7421dc}
+ Xaml.Charting
+
+
+ {64E4D6F0-36B6-4904-9BA7-FFFBE5FF71D8}
+ Xaml
+
+
+
+
+ stocksharp.ico
+
+
+
+
+
\ No newline at end of file
diff --git a/Samples/Gdax/SampleGdax/SampleGdax.licenseheader b/Samples/Gdax/SampleGdax/SampleGdax.licenseheader
new file mode 100644
index 000000000..a1db37839
--- /dev/null
+++ b/Samples/Gdax/SampleGdax/SampleGdax.licenseheader
@@ -0,0 +1,45 @@
+extensions: designer.cs generated.cs
+extensions: .cs .cpp .h
+#region S# License
+/******************************************************************************************
+NOTICE!!! This program and source code is owned and licensed by
+StockSharp Algo Trading, LLC, www.stocksharp.com
+Viewing or use of this code requires your acceptance of the license
+agreement found at https://github.com/StockSharp/StockSharp/blob/master/LICENSE
+Removal of this comment is a violation of the license agreement.
+
+Project: %Namespace%.%Project%
+File: %FileName%
+Created: %CreationYear%, %CreationMonth%, %CreationDay%, %CreationTime%
+
+Copyright 2010 by StockSharp Algo Trading, LLC
+*******************************************************************************************/
+#endregion S# License
+extensions: .aspx .ascx
+<%--
+NOTICE!!! This program and source code is owned and licensed by
+StockSharp Algo Trading, LLC, www.stocksharp.com
+Viewing or use of this code requires your acceptance of the license
+agreement found at https://github.com/StockSharp/StockSharp/blob/master/LICENSE
+Removal of this comment is a violation of the license agreement.
+
+Project: %Namespace%.%Project%
+File: %FileName%
+Created: %CreationYear%, %CreationMonth%, %CreationDay%, %CreationTime%
+
+Copyright 2010 by StockSharp Algo Trading, LLC
+--%>
+extensions: .xml .config .xsd
+
\ No newline at end of file
diff --git a/Samples/Gdax/SampleGdax/SampleGdaxPublic.csproj b/Samples/Gdax/SampleGdax/SampleGdaxPublic.csproj
new file mode 100644
index 000000000..d73f9335b
--- /dev/null
+++ b/Samples/Gdax/SampleGdax/SampleGdaxPublic.csproj
@@ -0,0 +1,275 @@
+
+
+
+ Debug
+ AnyCPU
+ 9.0.30729
+ 2.0
+ {99D0AACA-0474-4129-A3E7-75B67381489C}
+ WinExe
+ Properties
+ SampleGdax
+ SampleGdax
+ v4.5.1
+ 512
+ {60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}
+ 4
+ ..\..\..\References\stocksharp.ico
+
+
+ 3.5
+
+ publish\
+ true
+ Disk
+ false
+ Foreground
+ 7
+ Days
+ false
+ false
+ true
+ 0
+ 1.0.0.%2a
+ false
+ false
+ true
+
+
+
+ true
+ full
+ false
+ bin\Debug\
+ DEBUG;TRACE
+ prompt
+ 4
+ AnyCPU
+ AllRules.ruleset
+ false
+
+
+ pdbonly
+ true
+ bin\Release\
+ TRACE
+ prompt
+ 4
+ AnyCPU
+ AllRules.ruleset
+ false
+
+
+
+ ..\..\..\References\StockSharp.Gdax.dll
+
+
+
+
+
+
+
+
+
+
+ ..\..\..\References\Ecng.Localization.dll
+
+
+ ..\..\..\References\Ecng.Common.dll
+
+
+ ..\..\..\References\MoreLinq.dll
+
+
+ ..\..\..\References\Ecng.Collections.dll
+
+
+ ..\..\..\References\Ecng.ComponentModel.dll
+
+
+ ..\..\..\References\Ecng.Serialization.dll
+
+
+ ..\..\..\References\Ecng.Xaml.dll
+
+
+ ..\..\..\References\Xceed.Wpf.Toolkit.dll
+
+
+ ..\..\..\References\DevExpress.Data.v17.2.dll
+
+
+ ..\..\..\References\DevExpress.Xpf.Core.v17.2.dll
+
+
+ ..\..\..\References\DevExpress.Xpf.Grid.v17.2.dll
+
+
+ ..\..\..\References\DevExpress.Xpf.Grid.v17.2.Core.dll
+
+
+ ..\..\..\References\DevExpress.Xpf.LayoutControl.v17.2.dll
+
+
+
+
+ MSBuild:Compile
+ Designer
+ MSBuild:Compile
+ Designer
+
+
+ Properties\StockSharpAssemblyInfo.cs
+
+
+ App.xaml
+ Code
+
+
+
+
+ MainWindow.xaml
+
+
+ MyTradesWindow.xaml
+
+
+ OrdersWindow.xaml
+
+
+ PortfoliosWindow.xaml
+
+
+
+ True
+ True
+ Resources.resx
+
+
+ True
+ Settings.settings
+ True
+
+
+ QuotesWindow.xaml
+
+
+ SecuritiesWindow.xaml
+
+
+ TradesWindow.xaml
+
+
+ ResXFileCodeGenerator
+ Resources.Designer.cs
+
+
+
+ SettingsSingleFileGenerator
+ Settings.Designer.cs
+
+
+
+
+
+ MSBuild:Compile
+ Designer
+ MSBuild:Compile
+ Designer
+
+
+ Designer
+ MSBuild:Compile
+ MSBuild:Compile
+ Designer
+
+
+ MSBuild:Compile
+ Designer
+ MSBuild:Compile
+ Designer
+
+
+ MSBuild:Compile
+ Designer
+
+
+ MSBuild:Compile
+ Designer
+ MSBuild:Compile
+ Designer
+
+
+ MSBuild:Compile
+ Designer
+ MSBuild:Compile
+ Designer
+
+
+ MSBuild:Compile
+ Designer
+ MSBuild:Compile
+ Designer
+
+
+
+
+ False
+ .NET Framework 3.5 SP1 Client Profile
+ false
+
+
+ False
+ .NET Framework 3.5 SP1
+ true
+
+
+ False
+ Windows Installer 3.1
+ true
+
+
+
+
+ stocksharp.ico
+
+
+
+
+ {AF225452-1CF1-48A2-B381-C02BEBE643D7}
+ Gdax
+
+
+ {64e4d6f0-36b6-4904-9ba7-fffbe5ff71d8}
+ Xaml
+
+
+ {2A5C6FAD-106C-4A4A-B602-77A6B1034CA2}
+ Algo
+
+
+ {DCE69DB8-53CA-4B7F-9368-02F175A31074}
+ BusinessEntities
+
+
+ {A98A81CE-75A1-4FAB-9C02-E6EEF4B51F4F}
+ Localization
+
+
+ {C4476ADD-A3D5-41BB-9D43-55D865863B78}
+ Logging
+
+
+ {b47f9c23-a4bd-46a9-bf27-54cb3d653503}
+ Messages
+
+
+
+
+
\ No newline at end of file
diff --git a/Samples/Gdax/SampleGdax/SecuritiesWindow.xaml b/Samples/Gdax/SampleGdax/SecuritiesWindow.xaml
new file mode 100644
index 000000000..199c3774f
--- /dev/null
+++ b/Samples/Gdax/SampleGdax/SecuritiesWindow.xaml
@@ -0,0 +1,25 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/Samples/Gdax/SampleGdax/SecuritiesWindow.xaml.cs b/Samples/Gdax/SampleGdax/SecuritiesWindow.xaml.cs
new file mode 100644
index 000000000..ba1510829
--- /dev/null
+++ b/Samples/Gdax/SampleGdax/SecuritiesWindow.xaml.cs
@@ -0,0 +1,126 @@
+namespace SampleGdax
+{
+ using System;
+ using System.Linq;
+ using System.Windows;
+
+ using Ecng.Collections;
+ using Ecng.Xaml;
+
+ using MoreLinq;
+
+ using StockSharp.BusinessEntities;
+ using StockSharp.Xaml;
+ using StockSharp.Localization;
+
+ public partial class SecuritiesWindow
+ {
+ private readonly SynchronizedDictionary _quotesWindows = new SynchronizedDictionary();
+ private bool _initialized;
+
+ public SecuritiesWindow()
+ {
+ InitializeComponent();
+ }
+
+ protected override void OnClosed(EventArgs e)
+ {
+ _quotesWindows.SyncDo(d => d.Values.ForEach(w =>
+ {
+ w.DeleteHideable();
+ w.Close();
+ }));
+
+ var trader = MainWindow.Instance.Trader;
+ if (trader != null)
+ {
+ if (_initialized)
+ trader.MarketDepthChanged -= TraderOnMarketDepthChanged;
+ }
+
+ base.OnClosed(e);
+ }
+
+ private void SecurityPicker_OnSecuritySelected(Security security)
+ {
+ Quotes.IsEnabled = NewOrder.IsEnabled = Depth.IsEnabled = security != null;
+ }
+
+ private void NewOrderClick(object sender, RoutedEventArgs e)
+ {
+ var newOrder = new OrderWindow
+ {
+ Order = new Order { Security = SecurityPicker.SelectedSecurity },
+ SecurityProvider = MainWindow.Instance.Trader,
+ MarketDataProvider = MainWindow.Instance.Trader,
+ Portfolios = new PortfolioDataSource(MainWindow.Instance.Trader),
+ };
+
+ if (newOrder.ShowModal(this))
+ MainWindow.Instance.Trader.RegisterOrder(newOrder.Order);
+ }
+
+ private void DepthClick(object sender, RoutedEventArgs e)
+ {
+ var trader = MainWindow.Instance.Trader;
+
+ foreach (var security in SecurityPicker.SelectedSecurities)
+ {
+ var window = _quotesWindows.SafeAdd(security, s =>
+ {
+ // начинаем получать котировки стакана
+ trader.RegisterMarketDepth(security);
+
+ // создаем окно со стаканом
+ var wnd = new QuotesWindow
+ {
+ Title = security.Id + " " + LocalizedStrings.MarketDepth
+ };
+ wnd.MakeHideable();
+ return wnd;
+ });
+
+ if (window.Visibility == Visibility.Visible)
+ window.Hide();
+ else
+ {
+ window.Show();
+ window.DepthCtrl.UpdateDepth(trader.GetMarketDepth(security));
+ }
+
+ if (!_initialized)
+ {
+ trader.MarketDepthChanged += TraderOnMarketDepthChanged;
+ _initialized = true;
+ }
+ }
+ }
+
+ private void QuotesClick(object sender, RoutedEventArgs e)
+ {
+ var trader = MainWindow.Instance.Trader;
+
+ foreach (var security in SecurityPicker.SelectedSecurities)
+ {
+ if (trader.RegisteredSecurities.Contains(security))
+ {
+ trader.UnRegisterSecurity(security);
+ trader.UnRegisterTrades(security);
+ }
+ else
+ {
+ trader.RegisterSecurity(security);
+ trader.RegisterTrades(security);
+ }
+ }
+ }
+
+ private void TraderOnMarketDepthChanged(MarketDepth depth)
+ {
+ var wnd = _quotesWindows.TryGetValue(depth.Security);
+
+ if (wnd != null)
+ wnd.DepthCtrl.UpdateDepth(depth);
+ }
+ }
+}
\ No newline at end of file
diff --git a/Samples/Gdax/SampleGdax/TradesWindow.xaml b/Samples/Gdax/SampleGdax/TradesWindow.xaml
new file mode 100644
index 000000000..87be5b255
--- /dev/null
+++ b/Samples/Gdax/SampleGdax/TradesWindow.xaml
@@ -0,0 +1,7 @@
+
+
+
\ No newline at end of file
diff --git a/Samples/Gdax/SampleGdax/TradesWindow.xaml.cs b/Samples/Gdax/SampleGdax/TradesWindow.xaml.cs
new file mode 100644
index 000000000..88df3ec4c
--- /dev/null
+++ b/Samples/Gdax/SampleGdax/TradesWindow.xaml.cs
@@ -0,0 +1,10 @@
+namespace SampleGdax
+{
+ public partial class TradesWindow
+ {
+ public TradesWindow()
+ {
+ InitializeComponent();
+ }
+ }
+}
\ No newline at end of file
diff --git a/Samples/Gdax/SampleGdax/app.config b/Samples/Gdax/SampleGdax/app.config
new file mode 100644
index 000000000..884f9844f
--- /dev/null
+++ b/Samples/Gdax/SampleGdax/app.config
@@ -0,0 +1,3 @@
+
+
+
diff --git a/Samples/HitBtc/SampleHitBtc/App.xaml b/Samples/HitBtc/SampleHitBtc/App.xaml
new file mode 100644
index 000000000..65910090c
--- /dev/null
+++ b/Samples/HitBtc/SampleHitBtc/App.xaml
@@ -0,0 +1,8 @@
+
+
+
+
+
diff --git a/Samples/HitBtc/SampleHitBtc/App.xaml.cs b/Samples/HitBtc/SampleHitBtc/App.xaml.cs
new file mode 100644
index 000000000..c0524ffac
--- /dev/null
+++ b/Samples/HitBtc/SampleHitBtc/App.xaml.cs
@@ -0,0 +1,14 @@
+namespace SampleHitBtc
+{
+ using System.Windows;
+ using System.Windows.Threading;
+
+ public partial class App
+ {
+ private void ApplicationDispatcherUnhandledException(object sender, DispatcherUnhandledExceptionEventArgs e)
+ {
+ MessageBox.Show(MainWindow, e.Exception.ToString());
+ e.Handled = true;
+ }
+ }
+}
\ No newline at end of file
diff --git a/Samples/HitBtc/SampleHitBtc/MainWindow.xaml b/Samples/HitBtc/SampleHitBtc/MainWindow.xaml
new file mode 100644
index 000000000..3694963d4
--- /dev/null
+++ b/Samples/HitBtc/SampleHitBtc/MainWindow.xaml
@@ -0,0 +1,35 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/Samples/HitBtc/SampleHitBtc/MainWindow.xaml.cs b/Samples/HitBtc/SampleHitBtc/MainWindow.xaml.cs
new file mode 100644
index 000000000..e2c6681af
--- /dev/null
+++ b/Samples/HitBtc/SampleHitBtc/MainWindow.xaml.cs
@@ -0,0 +1,214 @@
+namespace SampleHitBtc
+{
+ using System;
+ using System.ComponentModel;
+ using System.Windows;
+
+ using Ecng.Common;
+ using Ecng.Xaml;
+
+ using StockSharp.BusinessEntities;
+ using StockSharp.HitBtc;
+ using StockSharp.Logging;
+ using StockSharp.Localization;
+
+ public partial class MainWindow
+ {
+ private bool _isConnected;
+
+ public HitBtcTrader Trader;
+
+ private readonly SecuritiesWindow _securitiesWindow = new SecuritiesWindow();
+ private readonly TradesWindow _tradesWindow = new TradesWindow();
+ private readonly MyTradesWindow _myTradesWindow = new MyTradesWindow();
+ private readonly OrdersWindow _ordersWindow = new OrdersWindow();
+ private readonly PortfoliosWindow _portfoliosWindow = new PortfoliosWindow();
+
+ private readonly LogManager _logManager = new LogManager();
+
+ public MainWindow()
+ {
+ InitializeComponent();
+
+ Title = Title.Put("HitBtc");
+
+ _ordersWindow.MakeHideable();
+ _myTradesWindow.MakeHideable();
+ _tradesWindow.MakeHideable();
+ _securitiesWindow.MakeHideable();
+ _portfoliosWindow.MakeHideable();
+
+ Instance = this;
+
+ _logManager.Sources.Add(MemoryStatistics.Instance);
+ _logManager.Listeners.Add(new FileLogListener { LogDirectory = "StockSharp_HitBtc" });
+ }
+
+ protected override void OnClosing(CancelEventArgs e)
+ {
+ _ordersWindow.DeleteHideable();
+ _myTradesWindow.DeleteHideable();
+ _tradesWindow.DeleteHideable();
+ _securitiesWindow.DeleteHideable();
+ _portfoliosWindow.DeleteHideable();
+
+ _securitiesWindow.Close();
+ _tradesWindow.Close();
+ _myTradesWindow.Close();
+ _ordersWindow.Close();
+ _portfoliosWindow.Close();
+
+ if (Trader != null)
+ Trader.Dispose();
+
+ base.OnClosing(e);
+ }
+
+ public static MainWindow Instance { get; private set; }
+
+ private void ConnectClick(object sender, RoutedEventArgs e)
+ {
+ if (!_isConnected)
+ {
+ if (Key.Text.IsEmpty())
+ {
+ MessageBox.Show(this, LocalizedStrings.Str3689);
+ return;
+ }
+ else if (Secret.Password.IsEmpty())
+ {
+ MessageBox.Show(this, LocalizedStrings.Str3690);
+ return;
+ }
+
+ if (Trader == null)
+ {
+ // create connector
+ Trader = new HitBtcTrader();// { LogLevel = LogLevels.Debug };
+
+ _logManager.Sources.Add(Trader);
+
+ Trader.Restored += () => this.GuiAsync(() =>
+ {
+ // update gui labes
+ ChangeConnectStatus(true);
+ MessageBox.Show(this, LocalizedStrings.Str2958);
+ });
+
+ // subscribe on connection successfully event
+ Trader.Connected += () =>
+ {
+ // set flag (connection is established)
+ _isConnected = true;
+
+ // update gui labes
+ this.GuiAsync(() => ChangeConnectStatus(true));
+ };
+ Trader.Disconnected += () => this.GuiAsync(() => ChangeConnectStatus(false));
+
+ // subscribe on connection error event
+ Trader.ConnectionError += error => this.GuiAsync(() =>
+ {
+ // update gui labes
+ ChangeConnectStatus(false);
+
+ MessageBox.Show(this, error.ToString(), LocalizedStrings.Str2959);
+ });
+
+ // subscribe on error event
+ Trader.Error += error =>
+ this.GuiAsync(() => MessageBox.Show(this, error.ToString(), LocalizedStrings.Str2955));
+
+ // subscribe on error of market data subscription event
+ Trader.MarketDataSubscriptionFailed += (security, msg, error) =>
+ this.GuiAsync(() => MessageBox.Show(this, error.ToString(), LocalizedStrings.Str2956Params.Put(msg.DataType, security)));
+
+ Trader.NewSecurity += _securitiesWindow.SecurityPicker.Securities.Add;
+ Trader.NewMyTrade += _myTradesWindow.TradeGrid.Trades.Add;
+ Trader.NewTrade += _tradesWindow.TradeGrid.Trades.Add;
+ Trader.NewOrder += _ordersWindow.OrderGrid.Orders.Add;
+
+ Trader.NewPortfolio += _portfoliosWindow.PortfolioGrid.Portfolios.Add;
+ Trader.NewPosition += _portfoliosWindow.PortfolioGrid.Positions.Add;
+
+ // subscribe on error of order registration event
+ Trader.OrderRegisterFailed += _ordersWindow.OrderGrid.AddRegistrationFail;
+ // subscribe on error of order cancelling event
+ Trader.OrderCancelFailed += OrderFailed;
+
+ Trader.MassOrderCancelFailed += (transId, error) =>
+ this.GuiAsync(() => MessageBox.Show(this, error.ToString(), LocalizedStrings.Str716));
+
+ // set market data provider
+ _securitiesWindow.SecurityPicker.MarketDataProvider = Trader;
+
+ ShowSecurities.IsEnabled = ShowTrades.IsEnabled =
+ ShowMyTrades.IsEnabled = ShowOrders.IsEnabled =
+ ShowPortfolios.IsEnabled = true;
+ }
+
+ Trader.Key = Key.Text;
+ Trader.Secret = Secret.Password;
+
+ // clear password box for security reason
+ //Secret.Clear();
+
+ Trader.Connect();
+ }
+ else
+ {
+ Trader.Disconnect();
+ }
+ }
+
+ private void OrderFailed(OrderFail fail)
+ {
+ this.GuiAsync(() =>
+ {
+ MessageBox.Show(this, fail.Error.ToString(), LocalizedStrings.Str153);
+ });
+ }
+
+ private void ChangeConnectStatus(bool isConnected)
+ {
+ _isConnected = isConnected;
+ ConnectBtn.Content = isConnected ? LocalizedStrings.Disconnect : LocalizedStrings.Connect;
+ }
+
+ private void ShowSecuritiesClick(object sender, RoutedEventArgs e)
+ {
+ ShowOrHide(_securitiesWindow);
+ }
+
+ private void ShowTradesClick(object sender, RoutedEventArgs e)
+ {
+ ShowOrHide(_tradesWindow);
+ }
+
+ private void ShowMyTradesClick(object sender, RoutedEventArgs e)
+ {
+ ShowOrHide(_myTradesWindow);
+ }
+
+ private void ShowOrdersClick(object sender, RoutedEventArgs e)
+ {
+ ShowOrHide(_ordersWindow);
+ }
+
+ private void ShowPortfoliosClick(object sender, RoutedEventArgs e)
+ {
+ ShowOrHide(_portfoliosWindow);
+ }
+
+ private static void ShowOrHide(Window window)
+ {
+ if (window == null)
+ throw new ArgumentNullException(nameof(window));
+
+ if (window.Visibility == Visibility.Visible)
+ window.Hide();
+ else
+ window.Show();
+ }
+ }
+}
diff --git a/Samples/HitBtc/SampleHitBtc/MyTradesWindow.xaml b/Samples/HitBtc/SampleHitBtc/MyTradesWindow.xaml
new file mode 100644
index 000000000..619ef5586
--- /dev/null
+++ b/Samples/HitBtc/SampleHitBtc/MyTradesWindow.xaml
@@ -0,0 +1,8 @@
+
+
+
\ No newline at end of file
diff --git a/Samples/HitBtc/SampleHitBtc/MyTradesWindow.xaml.cs b/Samples/HitBtc/SampleHitBtc/MyTradesWindow.xaml.cs
new file mode 100644
index 000000000..d7606fa66
--- /dev/null
+++ b/Samples/HitBtc/SampleHitBtc/MyTradesWindow.xaml.cs
@@ -0,0 +1,10 @@
+namespace SampleHitBtc
+{
+ public partial class MyTradesWindow
+ {
+ public MyTradesWindow()
+ {
+ InitializeComponent();
+ }
+ }
+}
\ No newline at end of file
diff --git a/Samples/HitBtc/SampleHitBtc/OrdersWindow.xaml b/Samples/HitBtc/SampleHitBtc/OrdersWindow.xaml
new file mode 100644
index 000000000..f2db2f325
--- /dev/null
+++ b/Samples/HitBtc/SampleHitBtc/OrdersWindow.xaml
@@ -0,0 +1,16 @@
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/Samples/HitBtc/SampleHitBtc/OrdersWindow.xaml.cs b/Samples/HitBtc/SampleHitBtc/OrdersWindow.xaml.cs
new file mode 100644
index 000000000..ab0cef46c
--- /dev/null
+++ b/Samples/HitBtc/SampleHitBtc/OrdersWindow.xaml.cs
@@ -0,0 +1,49 @@
+namespace SampleHitBtc
+{
+ using System.Windows;
+
+ using Ecng.Common;
+ using Ecng.Xaml;
+
+ using StockSharp.Algo;
+ using StockSharp.BusinessEntities;
+ using StockSharp.Localization;
+ using StockSharp.Xaml;
+
+ public partial class OrdersWindow
+ {
+ public OrdersWindow()
+ {
+ InitializeComponent();
+ }
+
+ private static IConnector Connector => MainWindow.Instance.Trader;
+
+ private void OrderGrid_OnOrderCanceling(Order order)
+ {
+ Connector.CancelOrder(order);
+ }
+
+ private void OrderGrid_OnOrderReRegistering(Order order)
+ {
+ var window = new OrderWindow
+ {
+ Title = LocalizedStrings.Str2976Params.Put(order.TransactionId),
+ SecurityProvider = Connector,
+ MarketDataProvider = Connector,
+ Portfolios = new PortfolioDataSource(Connector),
+ Order = order.ReRegisterClone(newVolume: order.Balance),
+ };
+
+ if (window.ShowModal(this))
+ {
+ Connector.ReRegisterOrder(order, window.Order);
+ }
+ }
+
+ private void CancelAll_OnClick(object sender, RoutedEventArgs e)
+ {
+ Connector.CancelOrders();
+ }
+ }
+}
\ No newline at end of file
diff --git a/Samples/HitBtc/SampleHitBtc/PortfoliosWindow.xaml b/Samples/HitBtc/SampleHitBtc/PortfoliosWindow.xaml
new file mode 100644
index 000000000..f4b73ab66
--- /dev/null
+++ b/Samples/HitBtc/SampleHitBtc/PortfoliosWindow.xaml
@@ -0,0 +1,8 @@
+
+
+
\ No newline at end of file
diff --git a/Samples/HitBtc/SampleHitBtc/PortfoliosWindow.xaml.cs b/Samples/HitBtc/SampleHitBtc/PortfoliosWindow.xaml.cs
new file mode 100644
index 000000000..6d16dc79c
--- /dev/null
+++ b/Samples/HitBtc/SampleHitBtc/PortfoliosWindow.xaml.cs
@@ -0,0 +1,10 @@
+namespace SampleHitBtc
+{
+ public partial class PortfoliosWindow
+ {
+ public PortfoliosWindow()
+ {
+ InitializeComponent();
+ }
+ }
+}
\ No newline at end of file
diff --git a/Samples/HitBtc/SampleHitBtc/Properties/AssemblyInfo.cs b/Samples/HitBtc/SampleHitBtc/Properties/AssemblyInfo.cs
new file mode 100644
index 000000000..caf75157d
--- /dev/null
+++ b/Samples/HitBtc/SampleHitBtc/Properties/AssemblyInfo.cs
@@ -0,0 +1,20 @@
+using System.Reflection;
+using System.Runtime.InteropServices;
+using System.Windows;
+
+// General Information about an assembly is controlled through the following
+// set of attributes. Change these attribute values to modify the information
+// associated with an assembly.
+[assembly: AssemblyTitle("SampleHitBtc")]
+[assembly: AssemblyDescription("")]
+
+[assembly: Guid("D5F4E91D-4C51-4A40-A72C-E431989394EB")]
+
+[assembly:ThemeInfo(
+ ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located
+ //(used if a resource is not found in the page,
+ // or application resource dictionaries)
+ ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located
+ //(used if a resource is not found in the page,
+ // app, or any theme specific resource dictionaries)
+)]
diff --git a/Samples/HitBtc/SampleHitBtc/Properties/Resources.Designer.cs b/Samples/HitBtc/SampleHitBtc/Properties/Resources.Designer.cs
new file mode 100644
index 000000000..af38af573
--- /dev/null
+++ b/Samples/HitBtc/SampleHitBtc/Properties/Resources.Designer.cs
@@ -0,0 +1,63 @@
+//------------------------------------------------------------------------------
+//
+// This code was generated by a tool.
+// Runtime Version:4.0.30319.18449
+//
+// Changes to this file may cause incorrect behavior and will be lost if
+// the code is regenerated.
+//
+//------------------------------------------------------------------------------
+
+namespace SampleHitBtc.Properties {
+ using System;
+
+
+ ///
+ /// A strongly-typed resource class, for looking up localized strings, etc.
+ ///
+ // This class was auto-generated by the StronglyTypedResourceBuilder
+ // class via a tool like ResGen or Visual Studio.
+ // To add or remove a member, edit your .ResX file then rerun ResGen
+ // with the /str option, or rebuild your VS project.
+ [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")]
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
+ [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
+ internal class Resources {
+
+ private static global::System.Resources.ResourceManager resourceMan;
+
+ private static global::System.Globalization.CultureInfo resourceCulture;
+
+ [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
+ internal Resources() {
+ }
+
+ ///
+ /// Returns the cached ResourceManager instance used by this class.
+ ///
+ [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
+ internal static global::System.Resources.ResourceManager ResourceManager {
+ get {
+ if (object.ReferenceEquals(resourceMan, null)) {
+ global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("SampleHitBtc.Properties.Resources", typeof(Resources).Assembly);
+ resourceMan = temp;
+ }
+ return resourceMan;
+ }
+ }
+
+ ///
+ /// Overrides the current thread's CurrentUICulture property for all
+ /// resource lookups using this strongly typed resource class.
+ ///
+ [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
+ internal static global::System.Globalization.CultureInfo Culture {
+ get {
+ return resourceCulture;
+ }
+ set {
+ resourceCulture = value;
+ }
+ }
+ }
+}
diff --git a/Samples/HitBtc/SampleHitBtc/Properties/Resources.resx b/Samples/HitBtc/SampleHitBtc/Properties/Resources.resx
new file mode 100644
index 000000000..13b775f1d
--- /dev/null
+++ b/Samples/HitBtc/SampleHitBtc/Properties/Resources.resx
@@ -0,0 +1,117 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ text/microsoft-resx
+
+
+ 2.0
+
+
+ System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
+ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
\ No newline at end of file
diff --git a/Samples/HitBtc/SampleHitBtc/Properties/Settings.Designer.cs b/Samples/HitBtc/SampleHitBtc/Properties/Settings.Designer.cs
new file mode 100644
index 000000000..40c325142
--- /dev/null
+++ b/Samples/HitBtc/SampleHitBtc/Properties/Settings.Designer.cs
@@ -0,0 +1,26 @@
+//------------------------------------------------------------------------------
+//
+// This code was generated by a tool.
+// Runtime Version:4.0.30319.18449
+//
+// Changes to this file may cause incorrect behavior and will be lost if
+// the code is regenerated.
+//
+//------------------------------------------------------------------------------
+
+namespace SampleHitBtc.Properties {
+
+
+ [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
+ [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "12.0.0.0")]
+ internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase {
+
+ private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
+
+ public static Settings Default {
+ get {
+ return defaultInstance;
+ }
+ }
+ }
+}
diff --git a/Samples/HitBtc/SampleHitBtc/Properties/Settings.settings b/Samples/HitBtc/SampleHitBtc/Properties/Settings.settings
new file mode 100644
index 000000000..9010101f8
--- /dev/null
+++ b/Samples/HitBtc/SampleHitBtc/Properties/Settings.settings
@@ -0,0 +1,7 @@
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/Samples/HitBtc/SampleHitBtc/QuotesWindow.xaml b/Samples/HitBtc/SampleHitBtc/QuotesWindow.xaml
new file mode 100644
index 000000000..e999b8f01
--- /dev/null
+++ b/Samples/HitBtc/SampleHitBtc/QuotesWindow.xaml
@@ -0,0 +1,7 @@
+
+
+
\ No newline at end of file
diff --git a/Samples/HitBtc/SampleHitBtc/QuotesWindow.xaml.cs b/Samples/HitBtc/SampleHitBtc/QuotesWindow.xaml.cs
new file mode 100644
index 000000000..309867fa9
--- /dev/null
+++ b/Samples/HitBtc/SampleHitBtc/QuotesWindow.xaml.cs
@@ -0,0 +1,10 @@
+namespace SampleHitBtc
+{
+ public partial class QuotesWindow
+ {
+ public QuotesWindow()
+ {
+ InitializeComponent();
+ }
+ }
+}
\ No newline at end of file
diff --git a/Samples/HitBtc/SampleHitBtc/SampleHitBtc.csproj b/Samples/HitBtc/SampleHitBtc/SampleHitBtc.csproj
new file mode 100644
index 000000000..c36989dee
--- /dev/null
+++ b/Samples/HitBtc/SampleHitBtc/SampleHitBtc.csproj
@@ -0,0 +1,281 @@
+
+
+
+ Debug
+ AnyCPU
+ 9.0.30729
+ 2.0
+ {1F167194-2CD7-4C1D-9CB3-A3EF1C7AACE0}
+ WinExe
+ Properties
+ SampleHitBtc
+ SampleHitBtc
+ v4.5.1
+ 512
+ {60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}
+ 4
+ ..\..\..\References\stocksharp.ico
+
+
+ 3.5
+
+ publish\
+ true
+ Disk
+ false
+ Foreground
+ 7
+ Days
+ false
+ false
+ true
+ 0
+ 1.0.0.%2a
+ false
+ false
+ true
+
+
+
+
+
+
+
+
+
+
+
+ true
+ full
+ false
+ bin\Debug\
+ DEBUG;TRACE
+ prompt
+ 4
+ AnyCPU
+ AllRules.ruleset
+ false
+
+
+ pdbonly
+ true
+ bin\Release\
+ TRACE
+ prompt
+ 4
+ AnyCPU
+ AllRules.ruleset
+ false
+
+
+
+ ..\..\..\References\Ecng.Localization.dll
+
+
+ ..\..\..\References\Ecng.Common.dll
+
+
+ ..\..\..\References\MoreLinq.dll
+
+
+
+
+
+
+
+
+
+
+ ..\..\..\References\Ecng.Collections.dll
+
+
+ ..\..\..\References\Ecng.ComponentModel.dll
+
+
+ ..\..\..\References\Ecng.Serialization.dll
+
+
+ ..\..\..\References\Ecng.Xaml.dll
+
+
+ ..\..\..\References\DevExpress.Data.v17.2.dll
+
+
+ ..\..\..\References\DevExpress.Xpf.Core.v17.2.dll
+
+
+ ..\..\..\References\DevExpress.Xpf.Grid.v17.2.dll
+
+
+ ..\..\..\References\DevExpress.Xpf.Grid.v17.2.Core.dll
+
+
+ ..\..\..\References\DevExpress.Xpf.Themes.Office2016White.v17.2.dll
+
+
+
+
+ MSBuild:Compile
+ Designer
+ MSBuild:Compile
+ Designer
+
+
+ Properties\StockSharpAssemblyInfo.cs
+
+
+ App.xaml
+ Code
+
+
+
+
+ MainWindow.xaml
+
+
+ MyTradesWindow.xaml
+
+
+ OrdersWindow.xaml
+
+
+ PortfoliosWindow.xaml
+
+
+
+ True
+ True
+ Resources.resx
+
+
+ True
+ Settings.settings
+ True
+
+
+ QuotesWindow.xaml
+
+
+ SecuritiesWindow.xaml
+
+
+ TradesWindow.xaml
+
+
+ ResXFileCodeGenerator
+ Resources.Designer.cs
+
+
+
+ SettingsSingleFileGenerator
+ Settings.Designer.cs
+
+
+
+
+
+ MSBuild:Compile
+ Designer
+ MSBuild:Compile
+ Designer
+
+
+ Designer
+ MSBuild:Compile
+ MSBuild:Compile
+ Designer
+
+
+ MSBuild:Compile
+ Designer
+ MSBuild:Compile
+ Designer
+
+
+ MSBuild:Compile
+ Designer
+
+
+ MSBuild:Compile
+ Designer
+ MSBuild:Compile
+ Designer
+
+
+ MSBuild:Compile
+ Designer
+ MSBuild:Compile
+ Designer
+
+
+ MSBuild:Compile
+ Designer
+ MSBuild:Compile
+ Designer
+
+
+
+
+ False
+ .NET Framework 3.5 SP1 Client Profile
+ false
+
+
+ False
+ .NET Framework 3.5 SP1
+ true
+
+
+ False
+ Windows Installer 3.1
+ true
+
+
+
+
+ {da6a7bfc-2787-48ba-a6fd-a047006b6901}
+ HitBtc
+
+
+ {2A5C6FAD-106C-4A4A-B602-77A6B1034CA2}
+ Algo
+
+
+ {DCE69DB8-53CA-4B7F-9368-02F175A31074}
+ BusinessEntities
+
+
+ {A98A81CE-75A1-4FAB-9C02-E6EEF4B51F4F}
+ Localization
+
+
+ {C4476ADD-A3D5-41BB-9D43-55D865863B78}
+ Logging
+
+
+ {B47F9C23-A4BD-46A9-BF27-54CB3D653503}
+ Messages
+
+
+ {c449d618-dea4-41c3-ba86-9f827c7421dc}
+ Xaml.Charting
+
+
+ {64E4D6F0-36B6-4904-9BA7-FFFBE5FF71D8}
+ Xaml
+
+
+
+
+ stocksharp.ico
+
+
+
+
+
\ No newline at end of file
diff --git a/Samples/HitBtc/SampleHitBtc/SampleHitBtc.licenseheader b/Samples/HitBtc/SampleHitBtc/SampleHitBtc.licenseheader
new file mode 100644
index 000000000..a1db37839
--- /dev/null
+++ b/Samples/HitBtc/SampleHitBtc/SampleHitBtc.licenseheader
@@ -0,0 +1,45 @@
+extensions: designer.cs generated.cs
+extensions: .cs .cpp .h
+#region S# License
+/******************************************************************************************
+NOTICE!!! This program and source code is owned and licensed by
+StockSharp Algo Trading, LLC, www.stocksharp.com
+Viewing or use of this code requires your acceptance of the license
+agreement found at https://github.com/StockSharp/StockSharp/blob/master/LICENSE
+Removal of this comment is a violation of the license agreement.
+
+Project: %Namespace%.%Project%
+File: %FileName%
+Created: %CreationYear%, %CreationMonth%, %CreationDay%, %CreationTime%
+
+Copyright 2010 by StockSharp Algo Trading, LLC
+*******************************************************************************************/
+#endregion S# License
+extensions: .aspx .ascx
+<%--
+NOTICE!!! This program and source code is owned and licensed by
+StockSharp Algo Trading, LLC, www.stocksharp.com
+Viewing or use of this code requires your acceptance of the license
+agreement found at https://github.com/StockSharp/StockSharp/blob/master/LICENSE
+Removal of this comment is a violation of the license agreement.
+
+Project: %Namespace%.%Project%
+File: %FileName%
+Created: %CreationYear%, %CreationMonth%, %CreationDay%, %CreationTime%
+
+Copyright 2010 by StockSharp Algo Trading, LLC
+--%>
+extensions: .xml .config .xsd
+
\ No newline at end of file
diff --git a/Samples/HitBtc/SampleHitBtc/SampleHitBtcPublic.csproj b/Samples/HitBtc/SampleHitBtc/SampleHitBtcPublic.csproj
new file mode 100644
index 000000000..811722046
--- /dev/null
+++ b/Samples/HitBtc/SampleHitBtc/SampleHitBtcPublic.csproj
@@ -0,0 +1,275 @@
+
+
+
+ Debug
+ AnyCPU
+ 9.0.30729
+ 2.0
+ {4DDA7B02-BF9D-44C6-B951-DF11BFD64E7C}
+ WinExe
+ Properties
+ SampleHitBtc
+ SampleHitBtc
+ v4.5.1
+ 512
+ {60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}
+ 4
+ ..\..\..\References\stocksharp.ico
+
+
+ 3.5
+
+ publish\
+ true
+ Disk
+ false
+ Foreground
+ 7
+ Days
+ false
+ false
+ true
+ 0
+ 1.0.0.%2a
+ false
+ false
+ true
+
+
+
+ true
+ full
+ false
+ bin\Debug\
+ DEBUG;TRACE
+ prompt
+ 4
+ AnyCPU
+ AllRules.ruleset
+ false
+
+
+ pdbonly
+ true
+ bin\Release\
+ TRACE
+ prompt
+ 4
+ AnyCPU
+ AllRules.ruleset
+ false
+
+
+
+ ..\..\..\References\StockSharp.HitBtc.dll
+
+
+
+
+
+
+
+
+
+
+ ..\..\..\References\Ecng.Localization.dll
+
+
+ ..\..\..\References\Ecng.Common.dll
+
+
+ ..\..\..\References\MoreLinq.dll
+
+
+ ..\..\..\References\Ecng.Collections.dll
+
+
+ ..\..\..\References\Ecng.ComponentModel.dll
+
+
+ ..\..\..\References\Ecng.Serialization.dll
+
+
+ ..\..\..\References\Ecng.Xaml.dll
+
+
+ ..\..\..\References\Xceed.Wpf.Toolkit.dll
+
+
+ ..\..\..\References\DevExpress.Data.v17.2.dll
+
+
+ ..\..\..\References\DevExpress.Xpf.Core.v17.2.dll
+
+
+ ..\..\..\References\DevExpress.Xpf.Grid.v17.2.dll
+
+
+ ..\..\..\References\DevExpress.Xpf.Grid.v17.2.Core.dll
+
+
+ ..\..\..\References\DevExpress.Xpf.LayoutControl.v17.2.dll
+
+
+
+
+ MSBuild:Compile
+ Designer
+ MSBuild:Compile
+ Designer
+
+
+ Properties\StockSharpAssemblyInfo.cs
+
+
+ App.xaml
+ Code
+
+
+
+
+ MainWindow.xaml
+
+
+ MyTradesWindow.xaml
+
+
+ OrdersWindow.xaml
+
+
+ PortfoliosWindow.xaml
+
+
+
+ True
+ True
+ Resources.resx
+
+
+ True
+ Settings.settings
+ True
+
+
+ QuotesWindow.xaml
+
+
+ SecuritiesWindow.xaml
+
+
+ TradesWindow.xaml
+
+
+ ResXFileCodeGenerator
+ Resources.Designer.cs
+
+
+
+ SettingsSingleFileGenerator
+ Settings.Designer.cs
+
+
+
+
+
+ MSBuild:Compile
+ Designer
+ MSBuild:Compile
+ Designer
+
+
+ Designer
+ MSBuild:Compile
+ MSBuild:Compile
+ Designer
+
+
+ MSBuild:Compile
+ Designer
+ MSBuild:Compile
+ Designer
+
+
+ MSBuild:Compile
+ Designer
+
+
+ MSBuild:Compile
+ Designer
+ MSBuild:Compile
+ Designer
+
+
+ MSBuild:Compile
+ Designer
+ MSBuild:Compile
+ Designer
+
+
+ MSBuild:Compile
+ Designer
+ MSBuild:Compile
+ Designer
+
+
+
+
+ False
+ .NET Framework 3.5 SP1 Client Profile
+ false
+
+
+ False
+ .NET Framework 3.5 SP1
+ true
+
+
+ False
+ Windows Installer 3.1
+ true
+
+
+
+
+ stocksharp.ico
+
+
+
+
+ {AF225452-1CF1-48A2-B381-C02BEBE643D7}
+ HitBtc
+
+
+ {64e4d6f0-36b6-4904-9ba7-fffbe5ff71d8}
+ Xaml
+
+
+ {2A5C6FAD-106C-4A4A-B602-77A6B1034CA2}
+ Algo
+
+
+ {DCE69DB8-53CA-4B7F-9368-02F175A31074}
+ BusinessEntities
+
+
+ {A98A81CE-75A1-4FAB-9C02-E6EEF4B51F4F}
+ Localization
+
+
+ {C4476ADD-A3D5-41BB-9D43-55D865863B78}
+ Logging
+
+
+ {b47f9c23-a4bd-46a9-bf27-54cb3d653503}
+ Messages
+
+
+
+
+
\ No newline at end of file
diff --git a/Samples/HitBtc/SampleHitBtc/SecuritiesWindow.xaml b/Samples/HitBtc/SampleHitBtc/SecuritiesWindow.xaml
new file mode 100644
index 000000000..64c9f88e0
--- /dev/null
+++ b/Samples/HitBtc/SampleHitBtc/SecuritiesWindow.xaml
@@ -0,0 +1,25 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/Samples/HitBtc/SampleHitBtc/SecuritiesWindow.xaml.cs b/Samples/HitBtc/SampleHitBtc/SecuritiesWindow.xaml.cs
new file mode 100644
index 000000000..371d4b4b1
--- /dev/null
+++ b/Samples/HitBtc/SampleHitBtc/SecuritiesWindow.xaml.cs
@@ -0,0 +1,126 @@
+namespace SampleHitBtc
+{
+ using System;
+ using System.Linq;
+ using System.Windows;
+
+ using Ecng.Collections;
+ using Ecng.Xaml;
+
+ using MoreLinq;
+
+ using StockSharp.BusinessEntities;
+ using StockSharp.Xaml;
+ using StockSharp.Localization;
+
+ public partial class SecuritiesWindow
+ {
+ private readonly SynchronizedDictionary _quotesWindows = new SynchronizedDictionary();
+ private bool _initialized;
+
+ public SecuritiesWindow()
+ {
+ InitializeComponent();
+ }
+
+ protected override void OnClosed(EventArgs e)
+ {
+ _quotesWindows.SyncDo(d => d.Values.ForEach(w =>
+ {
+ w.DeleteHideable();
+ w.Close();
+ }));
+
+ var trader = MainWindow.Instance.Trader;
+ if (trader != null)
+ {
+ if (_initialized)
+ trader.MarketDepthChanged -= TraderOnMarketDepthChanged;
+ }
+
+ base.OnClosed(e);
+ }
+
+ private void SecurityPicker_OnSecuritySelected(Security security)
+ {
+ Quotes.IsEnabled = NewOrder.IsEnabled = Depth.IsEnabled = security != null;
+ }
+
+ private void NewOrderClick(object sender, RoutedEventArgs e)
+ {
+ var newOrder = new OrderWindow
+ {
+ Order = new Order { Security = SecurityPicker.SelectedSecurity },
+ SecurityProvider = MainWindow.Instance.Trader,
+ MarketDataProvider = MainWindow.Instance.Trader,
+ Portfolios = new PortfolioDataSource(MainWindow.Instance.Trader),
+ };
+
+ if (newOrder.ShowModal(this))
+ MainWindow.Instance.Trader.RegisterOrder(newOrder.Order);
+ }
+
+ private void DepthClick(object sender, RoutedEventArgs e)
+ {
+ var trader = MainWindow.Instance.Trader;
+
+ foreach (var security in SecurityPicker.SelectedSecurities)
+ {
+ var window = _quotesWindows.SafeAdd(security, s =>
+ {
+ // начинаем получать котировки стакана
+ trader.RegisterMarketDepth(security);
+
+ // создаем окно со стаканом
+ var wnd = new QuotesWindow
+ {
+ Title = security.Id + " " + LocalizedStrings.MarketDepth
+ };
+ wnd.MakeHideable();
+ return wnd;
+ });
+
+ if (window.Visibility == Visibility.Visible)
+ window.Hide();
+ else
+ {
+ window.Show();
+ window.DepthCtrl.UpdateDepth(trader.GetMarketDepth(security));
+ }
+
+ if (!_initialized)
+ {
+ trader.MarketDepthChanged += TraderOnMarketDepthChanged;
+ _initialized = true;
+ }
+ }
+ }
+
+ private void QuotesClick(object sender, RoutedEventArgs e)
+ {
+ var trader = MainWindow.Instance.Trader;
+
+ foreach (var security in SecurityPicker.SelectedSecurities)
+ {
+ if (trader.RegisteredSecurities.Contains(security))
+ {
+ trader.UnRegisterSecurity(security);
+ trader.UnRegisterTrades(security);
+ }
+ else
+ {
+ trader.RegisterSecurity(security);
+ trader.RegisterTrades(security);
+ }
+ }
+ }
+
+ private void TraderOnMarketDepthChanged(MarketDepth depth)
+ {
+ var wnd = _quotesWindows.TryGetValue(depth.Security);
+
+ if (wnd != null)
+ wnd.DepthCtrl.UpdateDepth(depth);
+ }
+ }
+}
\ No newline at end of file
diff --git a/Samples/HitBtc/SampleHitBtc/TradesWindow.xaml b/Samples/HitBtc/SampleHitBtc/TradesWindow.xaml
new file mode 100644
index 000000000..565725150
--- /dev/null
+++ b/Samples/HitBtc/SampleHitBtc/TradesWindow.xaml
@@ -0,0 +1,7 @@
+
+
+
\ No newline at end of file
diff --git a/Samples/HitBtc/SampleHitBtc/TradesWindow.xaml.cs b/Samples/HitBtc/SampleHitBtc/TradesWindow.xaml.cs
new file mode 100644
index 000000000..bcd7c2f55
--- /dev/null
+++ b/Samples/HitBtc/SampleHitBtc/TradesWindow.xaml.cs
@@ -0,0 +1,10 @@
+namespace SampleHitBtc
+{
+ public partial class TradesWindow
+ {
+ public TradesWindow()
+ {
+ InitializeComponent();
+ }
+ }
+}
\ No newline at end of file
diff --git a/Samples/HitBtc/SampleHitBtc/app.config b/Samples/HitBtc/SampleHitBtc/app.config
new file mode 100644
index 000000000..884f9844f
--- /dev/null
+++ b/Samples/HitBtc/SampleHitBtc/app.config
@@ -0,0 +1,3 @@
+
+
+
diff --git a/Samples/Kraken/SampleKraken/App.xaml b/Samples/Kraken/SampleKraken/App.xaml
new file mode 100644
index 000000000..0619f4664
--- /dev/null
+++ b/Samples/Kraken/SampleKraken/App.xaml
@@ -0,0 +1,8 @@
+
+
+
+
+
diff --git a/Samples/Kraken/SampleKraken/App.xaml.cs b/Samples/Kraken/SampleKraken/App.xaml.cs
new file mode 100644
index 000000000..357679987
--- /dev/null
+++ b/Samples/Kraken/SampleKraken/App.xaml.cs
@@ -0,0 +1,14 @@
+namespace SampleKraken
+{
+ using System.Windows;
+ using System.Windows.Threading;
+
+ public partial class App
+ {
+ private void ApplicationDispatcherUnhandledException(object sender, DispatcherUnhandledExceptionEventArgs e)
+ {
+ MessageBox.Show(MainWindow, e.Exception.ToString());
+ e.Handled = true;
+ }
+ }
+}
\ No newline at end of file
diff --git a/Samples/Kraken/SampleKraken/MainWindow.xaml b/Samples/Kraken/SampleKraken/MainWindow.xaml
new file mode 100644
index 000000000..024e9365e
--- /dev/null
+++ b/Samples/Kraken/SampleKraken/MainWindow.xaml
@@ -0,0 +1,35 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/Samples/Kraken/SampleKraken/MainWindow.xaml.cs b/Samples/Kraken/SampleKraken/MainWindow.xaml.cs
new file mode 100644
index 000000000..a09c6b414
--- /dev/null
+++ b/Samples/Kraken/SampleKraken/MainWindow.xaml.cs
@@ -0,0 +1,214 @@
+namespace SampleKraken
+{
+ using System;
+ using System.ComponentModel;
+ using System.Windows;
+
+ using Ecng.Common;
+ using Ecng.Xaml;
+
+ using StockSharp.BusinessEntities;
+ using StockSharp.Kraken;
+ using StockSharp.Logging;
+ using StockSharp.Localization;
+
+ public partial class MainWindow
+ {
+ private bool _isConnected;
+
+ public KrakenTrader Trader;
+
+ private readonly SecuritiesWindow _securitiesWindow = new SecuritiesWindow();
+ private readonly TradesWindow _tradesWindow = new TradesWindow();
+ private readonly MyTradesWindow _myTradesWindow = new MyTradesWindow();
+ private readonly OrdersWindow _ordersWindow = new OrdersWindow();
+ private readonly PortfoliosWindow _portfoliosWindow = new PortfoliosWindow();
+
+ private readonly LogManager _logManager = new LogManager();
+
+ public MainWindow()
+ {
+ InitializeComponent();
+
+ Title = Title.Put("Kraken");
+
+ _ordersWindow.MakeHideable();
+ _myTradesWindow.MakeHideable();
+ _tradesWindow.MakeHideable();
+ _securitiesWindow.MakeHideable();
+ _portfoliosWindow.MakeHideable();
+
+ Instance = this;
+
+ _logManager.Sources.Add(MemoryStatistics.Instance);
+ _logManager.Listeners.Add(new FileLogListener { LogDirectory = "StockSharp_Kraken" });
+ }
+
+ protected override void OnClosing(CancelEventArgs e)
+ {
+ _ordersWindow.DeleteHideable();
+ _myTradesWindow.DeleteHideable();
+ _tradesWindow.DeleteHideable();
+ _securitiesWindow.DeleteHideable();
+ _portfoliosWindow.DeleteHideable();
+
+ _securitiesWindow.Close();
+ _tradesWindow.Close();
+ _myTradesWindow.Close();
+ _ordersWindow.Close();
+ _portfoliosWindow.Close();
+
+ if (Trader != null)
+ Trader.Dispose();
+
+ base.OnClosing(e);
+ }
+
+ public static MainWindow Instance { get; private set; }
+
+ private void ConnectClick(object sender, RoutedEventArgs e)
+ {
+ if (!_isConnected)
+ {
+ if (Key.Text.IsEmpty())
+ {
+ MessageBox.Show(this, LocalizedStrings.Str3689);
+ return;
+ }
+ else if (Secret.Password.IsEmpty())
+ {
+ MessageBox.Show(this, LocalizedStrings.Str3690);
+ return;
+ }
+
+ if (Trader == null)
+ {
+ // create connector
+ Trader = new KrakenTrader();// { LogLevel = LogLevels.Debug };
+
+ _logManager.Sources.Add(Trader);
+
+ Trader.Restored += () => this.GuiAsync(() =>
+ {
+ // update gui labes
+ ChangeConnectStatus(true);
+ MessageBox.Show(this, LocalizedStrings.Str2958);
+ });
+
+ // subscribe on connection successfully event
+ Trader.Connected += () =>
+ {
+ // set flag (connection is established)
+ _isConnected = true;
+
+ // update gui labes
+ this.GuiAsync(() => ChangeConnectStatus(true));
+ };
+ Trader.Disconnected += () => this.GuiAsync(() => ChangeConnectStatus(false));
+
+ // subscribe on connection error event
+ Trader.ConnectionError += error => this.GuiAsync(() =>
+ {
+ // update gui labes
+ ChangeConnectStatus(false);
+
+ MessageBox.Show(this, error.ToString(), LocalizedStrings.Str2959);
+ });
+
+ // subscribe on error event
+ Trader.Error += error =>
+ this.GuiAsync(() => MessageBox.Show(this, error.ToString(), LocalizedStrings.Str2955));
+
+ // subscribe on error of market data subscription event
+ Trader.MarketDataSubscriptionFailed += (security, msg, error) =>
+ this.GuiAsync(() => MessageBox.Show(this, error.ToString(), LocalizedStrings.Str2956Params.Put(msg.DataType, security)));
+
+ Trader.NewSecurity += _securitiesWindow.SecurityPicker.Securities.Add;
+ Trader.NewMyTrade += _myTradesWindow.TradeGrid.Trades.Add;
+ Trader.NewTrade += _tradesWindow.TradeGrid.Trades.Add;
+ Trader.NewOrder += _ordersWindow.OrderGrid.Orders.Add;
+
+ Trader.NewPortfolio += _portfoliosWindow.PortfolioGrid.Portfolios.Add;
+ Trader.NewPosition += _portfoliosWindow.PortfolioGrid.Positions.Add;
+
+ // subscribe on error of order registration event
+ Trader.OrderRegisterFailed += _ordersWindow.OrderGrid.AddRegistrationFail;
+ // subscribe on error of order cancelling event
+ Trader.OrderCancelFailed += OrderFailed;
+
+ Trader.MassOrderCancelFailed += (transId, error) =>
+ this.GuiAsync(() => MessageBox.Show(this, error.ToString(), LocalizedStrings.Str716));
+
+ // set market data provider
+ _securitiesWindow.SecurityPicker.MarketDataProvider = Trader;
+
+ ShowSecurities.IsEnabled = ShowTrades.IsEnabled =
+ ShowMyTrades.IsEnabled = ShowOrders.IsEnabled =
+ ShowPortfolios.IsEnabled = true;
+ }
+
+ Trader.Key = Key.Text;
+ Trader.Secret = Secret.Password;
+
+ // clear password box for security reason
+ //Secret.Clear();
+
+ Trader.Connect();
+ }
+ else
+ {
+ Trader.Disconnect();
+ }
+ }
+
+ private void OrderFailed(OrderFail fail)
+ {
+ this.GuiAsync(() =>
+ {
+ MessageBox.Show(this, fail.Error.ToString(), LocalizedStrings.Str153);
+ });
+ }
+
+ private void ChangeConnectStatus(bool isConnected)
+ {
+ _isConnected = isConnected;
+ ConnectBtn.Content = isConnected ? LocalizedStrings.Disconnect : LocalizedStrings.Connect;
+ }
+
+ private void ShowSecuritiesClick(object sender, RoutedEventArgs e)
+ {
+ ShowOrHide(_securitiesWindow);
+ }
+
+ private void ShowTradesClick(object sender, RoutedEventArgs e)
+ {
+ ShowOrHide(_tradesWindow);
+ }
+
+ private void ShowMyTradesClick(object sender, RoutedEventArgs e)
+ {
+ ShowOrHide(_myTradesWindow);
+ }
+
+ private void ShowOrdersClick(object sender, RoutedEventArgs e)
+ {
+ ShowOrHide(_ordersWindow);
+ }
+
+ private void ShowPortfoliosClick(object sender, RoutedEventArgs e)
+ {
+ ShowOrHide(_portfoliosWindow);
+ }
+
+ private static void ShowOrHide(Window window)
+ {
+ if (window == null)
+ throw new ArgumentNullException(nameof(window));
+
+ if (window.Visibility == Visibility.Visible)
+ window.Hide();
+ else
+ window.Show();
+ }
+ }
+}
diff --git a/Samples/Kraken/SampleKraken/MyTradesWindow.xaml b/Samples/Kraken/SampleKraken/MyTradesWindow.xaml
new file mode 100644
index 000000000..1b32d6058
--- /dev/null
+++ b/Samples/Kraken/SampleKraken/MyTradesWindow.xaml
@@ -0,0 +1,8 @@
+
+
+
\ No newline at end of file
diff --git a/Samples/Kraken/SampleKraken/MyTradesWindow.xaml.cs b/Samples/Kraken/SampleKraken/MyTradesWindow.xaml.cs
new file mode 100644
index 000000000..00f1f6fef
--- /dev/null
+++ b/Samples/Kraken/SampleKraken/MyTradesWindow.xaml.cs
@@ -0,0 +1,10 @@
+namespace SampleKraken
+{
+ public partial class MyTradesWindow
+ {
+ public MyTradesWindow()
+ {
+ InitializeComponent();
+ }
+ }
+}
\ No newline at end of file
diff --git a/Samples/Kraken/SampleKraken/OrdersWindow.xaml b/Samples/Kraken/SampleKraken/OrdersWindow.xaml
new file mode 100644
index 000000000..428bebb89
--- /dev/null
+++ b/Samples/Kraken/SampleKraken/OrdersWindow.xaml
@@ -0,0 +1,16 @@
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/Samples/Kraken/SampleKraken/OrdersWindow.xaml.cs b/Samples/Kraken/SampleKraken/OrdersWindow.xaml.cs
new file mode 100644
index 000000000..6be87e08c
--- /dev/null
+++ b/Samples/Kraken/SampleKraken/OrdersWindow.xaml.cs
@@ -0,0 +1,49 @@
+namespace SampleKraken
+{
+ using System.Windows;
+
+ using Ecng.Common;
+ using Ecng.Xaml;
+
+ using StockSharp.Algo;
+ using StockSharp.BusinessEntities;
+ using StockSharp.Localization;
+ using StockSharp.Xaml;
+
+ public partial class OrdersWindow
+ {
+ public OrdersWindow()
+ {
+ InitializeComponent();
+ }
+
+ private static IConnector Connector => MainWindow.Instance.Trader;
+
+ private void OrderGrid_OnOrderCanceling(Order order)
+ {
+ Connector.CancelOrder(order);
+ }
+
+ private void OrderGrid_OnOrderReRegistering(Order order)
+ {
+ var window = new OrderWindow
+ {
+ Title = LocalizedStrings.Str2976Params.Put(order.TransactionId),
+ SecurityProvider = Connector,
+ MarketDataProvider = Connector,
+ Portfolios = new PortfolioDataSource(Connector),
+ Order = order.ReRegisterClone(newVolume: order.Balance),
+ };
+
+ if (window.ShowModal(this))
+ {
+ Connector.ReRegisterOrder(order, window.Order);
+ }
+ }
+
+ private void CancelAll_OnClick(object sender, RoutedEventArgs e)
+ {
+ Connector.CancelOrders();
+ }
+ }
+}
\ No newline at end of file
diff --git a/Samples/Kraken/SampleKraken/PortfoliosWindow.xaml b/Samples/Kraken/SampleKraken/PortfoliosWindow.xaml
new file mode 100644
index 000000000..954ba526e
--- /dev/null
+++ b/Samples/Kraken/SampleKraken/PortfoliosWindow.xaml
@@ -0,0 +1,8 @@
+
+
+
\ No newline at end of file
diff --git a/Samples/Kraken/SampleKraken/PortfoliosWindow.xaml.cs b/Samples/Kraken/SampleKraken/PortfoliosWindow.xaml.cs
new file mode 100644
index 000000000..4c4b7495c
--- /dev/null
+++ b/Samples/Kraken/SampleKraken/PortfoliosWindow.xaml.cs
@@ -0,0 +1,10 @@
+namespace SampleKraken
+{
+ public partial class PortfoliosWindow
+ {
+ public PortfoliosWindow()
+ {
+ InitializeComponent();
+ }
+ }
+}
\ No newline at end of file
diff --git a/Samples/Kraken/SampleKraken/Properties/AssemblyInfo.cs b/Samples/Kraken/SampleKraken/Properties/AssemblyInfo.cs
new file mode 100644
index 000000000..45f1e002d
--- /dev/null
+++ b/Samples/Kraken/SampleKraken/Properties/AssemblyInfo.cs
@@ -0,0 +1,20 @@
+using System.Reflection;
+using System.Runtime.InteropServices;
+using System.Windows;
+
+// General Information about an assembly is controlled through the following
+// set of attributes. Change these attribute values to modify the information
+// associated with an assembly.
+[assembly: AssemblyTitle("SampleKraken")]
+[assembly: AssemblyDescription("")]
+
+[assembly: Guid("FF95E1E6-3186-43C7-A8C6-F13144E12523")]
+
+[assembly:ThemeInfo(
+ ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located
+ //(used if a resource is not found in the page,
+ // or application resource dictionaries)
+ ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located
+ //(used if a resource is not found in the page,
+ // app, or any theme specific resource dictionaries)
+)]
diff --git a/Samples/Kraken/SampleKraken/Properties/Resources.Designer.cs b/Samples/Kraken/SampleKraken/Properties/Resources.Designer.cs
new file mode 100644
index 000000000..6f8df427d
--- /dev/null
+++ b/Samples/Kraken/SampleKraken/Properties/Resources.Designer.cs
@@ -0,0 +1,63 @@
+//------------------------------------------------------------------------------
+//
+// This code was generated by a tool.
+// Runtime Version:4.0.30319.18449
+//
+// Changes to this file may cause incorrect behavior and will be lost if
+// the code is regenerated.
+//
+//------------------------------------------------------------------------------
+
+namespace SampleKraken.Properties {
+ using System;
+
+
+ ///
+ /// A strongly-typed resource class, for looking up localized strings, etc.
+ ///
+ // This class was auto-generated by the StronglyTypedResourceBuilder
+ // class via a tool like ResGen or Visual Studio.
+ // To add or remove a member, edit your .ResX file then rerun ResGen
+ // with the /str option, or rebuild your VS project.
+ [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")]
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
+ [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
+ internal class Resources {
+
+ private static global::System.Resources.ResourceManager resourceMan;
+
+ private static global::System.Globalization.CultureInfo resourceCulture;
+
+ [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
+ internal Resources() {
+ }
+
+ ///
+ /// Returns the cached ResourceManager instance used by this class.
+ ///
+ [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
+ internal static global::System.Resources.ResourceManager ResourceManager {
+ get {
+ if (object.ReferenceEquals(resourceMan, null)) {
+ global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("SampleKraken.Properties.Resources", typeof(Resources).Assembly);
+ resourceMan = temp;
+ }
+ return resourceMan;
+ }
+ }
+
+ ///
+ /// Overrides the current thread's CurrentUICulture property for all
+ /// resource lookups using this strongly typed resource class.
+ ///
+ [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
+ internal static global::System.Globalization.CultureInfo Culture {
+ get {
+ return resourceCulture;
+ }
+ set {
+ resourceCulture = value;
+ }
+ }
+ }
+}
diff --git a/Samples/Kraken/SampleKraken/Properties/Resources.resx b/Samples/Kraken/SampleKraken/Properties/Resources.resx
new file mode 100644
index 000000000..13b775f1d
--- /dev/null
+++ b/Samples/Kraken/SampleKraken/Properties/Resources.resx
@@ -0,0 +1,117 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ text/microsoft-resx
+
+
+ 2.0
+
+
+ System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
+ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
\ No newline at end of file
diff --git a/Samples/Kraken/SampleKraken/Properties/Settings.Designer.cs b/Samples/Kraken/SampleKraken/Properties/Settings.Designer.cs
new file mode 100644
index 000000000..95df2b06b
--- /dev/null
+++ b/Samples/Kraken/SampleKraken/Properties/Settings.Designer.cs
@@ -0,0 +1,26 @@
+//------------------------------------------------------------------------------
+//
+// This code was generated by a tool.
+// Runtime Version:4.0.30319.18449
+//
+// Changes to this file may cause incorrect behavior and will be lost if
+// the code is regenerated.
+//
+//------------------------------------------------------------------------------
+
+namespace SampleKraken.Properties {
+
+
+ [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
+ [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "12.0.0.0")]
+ internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase {
+
+ private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
+
+ public static Settings Default {
+ get {
+ return defaultInstance;
+ }
+ }
+ }
+}
diff --git a/Samples/Kraken/SampleKraken/Properties/Settings.settings b/Samples/Kraken/SampleKraken/Properties/Settings.settings
new file mode 100644
index 000000000..9010101f8
--- /dev/null
+++ b/Samples/Kraken/SampleKraken/Properties/Settings.settings
@@ -0,0 +1,7 @@
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/Samples/Kraken/SampleKraken/QuotesWindow.xaml b/Samples/Kraken/SampleKraken/QuotesWindow.xaml
new file mode 100644
index 000000000..b5576c89a
--- /dev/null
+++ b/Samples/Kraken/SampleKraken/QuotesWindow.xaml
@@ -0,0 +1,7 @@
+
+
+
\ No newline at end of file
diff --git a/Samples/Kraken/SampleKraken/QuotesWindow.xaml.cs b/Samples/Kraken/SampleKraken/QuotesWindow.xaml.cs
new file mode 100644
index 000000000..d5c8d5474
--- /dev/null
+++ b/Samples/Kraken/SampleKraken/QuotesWindow.xaml.cs
@@ -0,0 +1,10 @@
+namespace SampleKraken
+{
+ public partial class QuotesWindow
+ {
+ public QuotesWindow()
+ {
+ InitializeComponent();
+ }
+ }
+}
\ No newline at end of file
diff --git a/Samples/Kraken/SampleKraken/SampleKraken.csproj b/Samples/Kraken/SampleKraken/SampleKraken.csproj
new file mode 100644
index 000000000..dd5b42ae2
--- /dev/null
+++ b/Samples/Kraken/SampleKraken/SampleKraken.csproj
@@ -0,0 +1,281 @@
+
+
+
+ Debug
+ AnyCPU
+ 9.0.30729
+ 2.0
+ {486B8178-0C58-4DF0-984E-A325896355FA}
+ WinExe
+ Properties
+ SampleKraken
+ SampleKraken
+ v4.5.1
+ 512
+ {60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}
+ 4
+ ..\..\..\References\stocksharp.ico
+
+
+ 3.5
+
+ publish\
+ true
+ Disk
+ false
+ Foreground
+ 7
+ Days
+ false
+ false
+ true
+ 0
+ 1.0.0.%2a
+ false
+ false
+ true
+
+
+
+
+
+
+
+
+
+
+
+ true
+ full
+ false
+ bin\Debug\
+ DEBUG;TRACE
+ prompt
+ 4
+ AnyCPU
+ AllRules.ruleset
+ false
+
+
+ pdbonly
+ true
+ bin\Release\
+ TRACE
+ prompt
+ 4
+ AnyCPU
+ AllRules.ruleset
+ false
+
+
+
+ ..\..\..\References\Ecng.Localization.dll
+
+
+ ..\..\..\References\Ecng.Common.dll
+
+
+ ..\..\..\References\MoreLinq.dll
+
+
+
+
+
+
+
+
+
+
+ ..\..\..\References\Ecng.Collections.dll
+
+
+ ..\..\..\References\Ecng.ComponentModel.dll
+
+
+ ..\..\..\References\Ecng.Serialization.dll
+
+
+ ..\..\..\References\Ecng.Xaml.dll
+
+
+ ..\..\..\References\DevExpress.Data.v17.2.dll
+
+
+ ..\..\..\References\DevExpress.Xpf.Core.v17.2.dll
+
+
+ ..\..\..\References\DevExpress.Xpf.Grid.v17.2.dll
+
+
+ ..\..\..\References\DevExpress.Xpf.Grid.v17.2.Core.dll
+
+
+ ..\..\..\References\DevExpress.Xpf.Themes.Office2016White.v17.2.dll
+
+
+
+
+ MSBuild:Compile
+ Designer
+ MSBuild:Compile
+ Designer
+
+
+ Properties\StockSharpAssemblyInfo.cs
+
+
+ App.xaml
+ Code
+
+
+
+
+ MainWindow.xaml
+
+
+ MyTradesWindow.xaml
+
+
+ OrdersWindow.xaml
+
+
+ PortfoliosWindow.xaml
+
+
+
+ True
+ True
+ Resources.resx
+
+
+ True
+ Settings.settings
+ True
+
+
+ QuotesWindow.xaml
+
+
+ SecuritiesWindow.xaml
+
+
+ TradesWindow.xaml
+
+
+ ResXFileCodeGenerator
+ Resources.Designer.cs
+
+
+
+ SettingsSingleFileGenerator
+ Settings.Designer.cs
+
+
+
+
+
+ MSBuild:Compile
+ Designer
+ MSBuild:Compile
+ Designer
+
+
+ Designer
+ MSBuild:Compile
+ MSBuild:Compile
+ Designer
+
+
+ MSBuild:Compile
+ Designer
+ MSBuild:Compile
+ Designer
+
+
+ MSBuild:Compile
+ Designer
+
+
+ MSBuild:Compile
+ Designer
+ MSBuild:Compile
+ Designer
+
+
+ MSBuild:Compile
+ Designer
+ MSBuild:Compile
+ Designer
+
+
+ MSBuild:Compile
+ Designer
+ MSBuild:Compile
+ Designer
+
+
+
+
+ False
+ .NET Framework 3.5 SP1 Client Profile
+ false
+
+
+ False
+ .NET Framework 3.5 SP1
+ true
+
+
+ False
+ Windows Installer 3.1
+ true
+
+
+
+
+ {8f90de0d-c2a2-4c86-a66e-eea01f830c70}
+ Kraken
+
+
+ {2A5C6FAD-106C-4A4A-B602-77A6B1034CA2}
+ Algo
+
+
+ {DCE69DB8-53CA-4B7F-9368-02F175A31074}
+ BusinessEntities
+
+
+ {A98A81CE-75A1-4FAB-9C02-E6EEF4B51F4F}
+ Localization
+
+
+ {C4476ADD-A3D5-41BB-9D43-55D865863B78}
+ Logging
+
+
+ {B47F9C23-A4BD-46A9-BF27-54CB3D653503}
+ Messages
+
+
+ {c449d618-dea4-41c3-ba86-9f827c7421dc}
+ Xaml.Charting
+
+
+ {64E4D6F0-36B6-4904-9BA7-FFFBE5FF71D8}
+ Xaml
+
+
+
+
+ stocksharp.ico
+
+
+
+
+
\ No newline at end of file
diff --git a/Samples/Kraken/SampleKraken/SampleKraken.licenseheader b/Samples/Kraken/SampleKraken/SampleKraken.licenseheader
new file mode 100644
index 000000000..a1db37839
--- /dev/null
+++ b/Samples/Kraken/SampleKraken/SampleKraken.licenseheader
@@ -0,0 +1,45 @@
+extensions: designer.cs generated.cs
+extensions: .cs .cpp .h
+#region S# License
+/******************************************************************************************
+NOTICE!!! This program and source code is owned and licensed by
+StockSharp Algo Trading, LLC, www.stocksharp.com
+Viewing or use of this code requires your acceptance of the license
+agreement found at https://github.com/StockSharp/StockSharp/blob/master/LICENSE
+Removal of this comment is a violation of the license agreement.
+
+Project: %Namespace%.%Project%
+File: %FileName%
+Created: %CreationYear%, %CreationMonth%, %CreationDay%, %CreationTime%
+
+Copyright 2010 by StockSharp Algo Trading, LLC
+*******************************************************************************************/
+#endregion S# License
+extensions: .aspx .ascx
+<%--
+NOTICE!!! This program and source code is owned and licensed by
+StockSharp Algo Trading, LLC, www.stocksharp.com
+Viewing or use of this code requires your acceptance of the license
+agreement found at https://github.com/StockSharp/StockSharp/blob/master/LICENSE
+Removal of this comment is a violation of the license agreement.
+
+Project: %Namespace%.%Project%
+File: %FileName%
+Created: %CreationYear%, %CreationMonth%, %CreationDay%, %CreationTime%
+
+Copyright 2010 by StockSharp Algo Trading, LLC
+--%>
+extensions: .xml .config .xsd
+
\ No newline at end of file
diff --git a/Samples/Kraken/SampleKraken/SampleKrakenPublic.csproj b/Samples/Kraken/SampleKraken/SampleKrakenPublic.csproj
new file mode 100644
index 000000000..d73b15564
--- /dev/null
+++ b/Samples/Kraken/SampleKraken/SampleKrakenPublic.csproj
@@ -0,0 +1,275 @@
+
+
+
+ Debug
+ AnyCPU
+ 9.0.30729
+ 2.0
+ {ABADFB9D-8DA3-4A21-A67F-26FDF81086D1}
+ WinExe
+ Properties
+ SampleKraken
+ SampleKraken
+ v4.5.1
+ 512
+ {60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}
+ 4
+ ..\..\..\References\stocksharp.ico
+
+
+ 3.5
+
+ publish\
+ true
+ Disk
+ false
+ Foreground
+ 7
+ Days
+ false
+ false
+ true
+ 0
+ 1.0.0.%2a
+ false
+ false
+ true
+
+
+
+ true
+ full
+ false
+ bin\Debug\
+ DEBUG;TRACE
+ prompt
+ 4
+ AnyCPU
+ AllRules.ruleset
+ false
+
+
+ pdbonly
+ true
+ bin\Release\
+ TRACE
+ prompt
+ 4
+ AnyCPU
+ AllRules.ruleset
+ false
+
+
+
+ ..\..\..\References\StockSharp.Kraken.dll
+
+
+
+
+
+
+
+
+
+
+ ..\..\..\References\Ecng.Localization.dll
+
+
+ ..\..\..\References\Ecng.Common.dll
+
+
+ ..\..\..\References\MoreLinq.dll
+
+
+ ..\..\..\References\Ecng.Collections.dll
+
+
+ ..\..\..\References\Ecng.ComponentModel.dll
+
+
+ ..\..\..\References\Ecng.Serialization.dll
+
+
+ ..\..\..\References\Ecng.Xaml.dll
+
+
+ ..\..\..\References\Xceed.Wpf.Toolkit.dll
+
+
+ ..\..\..\References\DevExpress.Data.v17.2.dll
+
+
+ ..\..\..\References\DevExpress.Xpf.Core.v17.2.dll
+
+
+ ..\..\..\References\DevExpress.Xpf.Grid.v17.2.dll
+
+
+ ..\..\..\References\DevExpress.Xpf.Grid.v17.2.Core.dll
+
+
+ ..\..\..\References\DevExpress.Xpf.LayoutControl.v17.2.dll
+
+
+
+
+ MSBuild:Compile
+ Designer
+ MSBuild:Compile
+ Designer
+
+
+ Properties\StockSharpAssemblyInfo.cs
+
+
+ App.xaml
+ Code
+
+
+
+
+ MainWindow.xaml
+
+
+ MyTradesWindow.xaml
+
+
+ OrdersWindow.xaml
+
+
+ PortfoliosWindow.xaml
+
+
+
+ True
+ True
+ Resources.resx
+
+
+ True
+ Settings.settings
+ True
+
+
+ QuotesWindow.xaml
+
+
+ SecuritiesWindow.xaml
+
+
+ TradesWindow.xaml
+
+
+ ResXFileCodeGenerator
+ Resources.Designer.cs
+
+
+
+ SettingsSingleFileGenerator
+ Settings.Designer.cs
+
+
+
+
+
+ MSBuild:Compile
+ Designer
+ MSBuild:Compile
+ Designer
+
+
+ Designer
+ MSBuild:Compile
+ MSBuild:Compile
+ Designer
+
+
+ MSBuild:Compile
+ Designer
+ MSBuild:Compile
+ Designer
+
+
+ MSBuild:Compile
+ Designer
+
+
+ MSBuild:Compile
+ Designer
+ MSBuild:Compile
+ Designer
+
+
+ MSBuild:Compile
+ Designer
+ MSBuild:Compile
+ Designer
+
+
+ MSBuild:Compile
+ Designer
+ MSBuild:Compile
+ Designer
+
+
+
+
+ False
+ .NET Framework 3.5 SP1 Client Profile
+ false
+
+
+ False
+ .NET Framework 3.5 SP1
+ true
+
+
+ False
+ Windows Installer 3.1
+ true
+
+
+
+
+ stocksharp.ico
+
+
+
+
+ {AF225452-1CF1-48A2-B381-C02BEBE643D7}
+ Kraken
+
+
+ {64e4d6f0-36b6-4904-9ba7-fffbe5ff71d8}
+ Xaml
+
+
+ {2A5C6FAD-106C-4A4A-B602-77A6B1034CA2}
+ Algo
+
+
+ {DCE69DB8-53CA-4B7F-9368-02F175A31074}
+ BusinessEntities
+
+
+ {A98A81CE-75A1-4FAB-9C02-E6EEF4B51F4F}
+ Localization
+
+
+ {C4476ADD-A3D5-41BB-9D43-55D865863B78}
+ Logging
+
+
+ {b47f9c23-a4bd-46a9-bf27-54cb3d653503}
+ Messages
+
+
+
+
+
\ No newline at end of file
diff --git a/Samples/Kraken/SampleKraken/SecuritiesWindow.xaml b/Samples/Kraken/SampleKraken/SecuritiesWindow.xaml
new file mode 100644
index 000000000..111e3e8a2
--- /dev/null
+++ b/Samples/Kraken/SampleKraken/SecuritiesWindow.xaml
@@ -0,0 +1,25 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/Samples/Kraken/SampleKraken/SecuritiesWindow.xaml.cs b/Samples/Kraken/SampleKraken/SecuritiesWindow.xaml.cs
new file mode 100644
index 000000000..c03c917c0
--- /dev/null
+++ b/Samples/Kraken/SampleKraken/SecuritiesWindow.xaml.cs
@@ -0,0 +1,126 @@
+namespace SampleKraken
+{
+ using System;
+ using System.Linq;
+ using System.Windows;
+
+ using Ecng.Collections;
+ using Ecng.Xaml;
+
+ using MoreLinq;
+
+ using StockSharp.BusinessEntities;
+ using StockSharp.Xaml;
+ using StockSharp.Localization;
+
+ public partial class SecuritiesWindow
+ {
+ private readonly SynchronizedDictionary _quotesWindows = new SynchronizedDictionary();
+ private bool _initialized;
+
+ public SecuritiesWindow()
+ {
+ InitializeComponent();
+ }
+
+ protected override void OnClosed(EventArgs e)
+ {
+ _quotesWindows.SyncDo(d => d.Values.ForEach(w =>
+ {
+ w.DeleteHideable();
+ w.Close();
+ }));
+
+ var trader = MainWindow.Instance.Trader;
+ if (trader != null)
+ {
+ if (_initialized)
+ trader.MarketDepthChanged -= TraderOnMarketDepthChanged;
+ }
+
+ base.OnClosed(e);
+ }
+
+ private void SecurityPicker_OnSecuritySelected(Security security)
+ {
+ Quotes.IsEnabled = NewOrder.IsEnabled = Depth.IsEnabled = security != null;
+ }
+
+ private void NewOrderClick(object sender, RoutedEventArgs e)
+ {
+ var newOrder = new OrderWindow
+ {
+ Order = new Order { Security = SecurityPicker.SelectedSecurity },
+ SecurityProvider = MainWindow.Instance.Trader,
+ MarketDataProvider = MainWindow.Instance.Trader,
+ Portfolios = new PortfolioDataSource(MainWindow.Instance.Trader),
+ };
+
+ if (newOrder.ShowModal(this))
+ MainWindow.Instance.Trader.RegisterOrder(newOrder.Order);
+ }
+
+ private void DepthClick(object sender, RoutedEventArgs e)
+ {
+ var trader = MainWindow.Instance.Trader;
+
+ foreach (var security in SecurityPicker.SelectedSecurities)
+ {
+ var window = _quotesWindows.SafeAdd(security, s =>
+ {
+ // начинаем получать котировки стакана
+ trader.RegisterMarketDepth(security);
+
+ // создаем окно со стаканом
+ var wnd = new QuotesWindow
+ {
+ Title = security.Id + " " + LocalizedStrings.MarketDepth
+ };
+ wnd.MakeHideable();
+ return wnd;
+ });
+
+ if (window.Visibility == Visibility.Visible)
+ window.Hide();
+ else
+ {
+ window.Show();
+ window.DepthCtrl.UpdateDepth(trader.GetMarketDepth(security));
+ }
+
+ if (!_initialized)
+ {
+ trader.MarketDepthChanged += TraderOnMarketDepthChanged;
+ _initialized = true;
+ }
+ }
+ }
+
+ private void QuotesClick(object sender, RoutedEventArgs e)
+ {
+ var trader = MainWindow.Instance.Trader;
+
+ foreach (var security in SecurityPicker.SelectedSecurities)
+ {
+ if (trader.RegisteredSecurities.Contains(security))
+ {
+ trader.UnRegisterSecurity(security);
+ trader.UnRegisterTrades(security);
+ }
+ else
+ {
+ trader.RegisterSecurity(security);
+ trader.RegisterTrades(security);
+ }
+ }
+ }
+
+ private void TraderOnMarketDepthChanged(MarketDepth depth)
+ {
+ var wnd = _quotesWindows.TryGetValue(depth.Security);
+
+ if (wnd != null)
+ wnd.DepthCtrl.UpdateDepth(depth);
+ }
+ }
+}
\ No newline at end of file
diff --git a/Samples/Kraken/SampleKraken/TradesWindow.xaml b/Samples/Kraken/SampleKraken/TradesWindow.xaml
new file mode 100644
index 000000000..514cd1654
--- /dev/null
+++ b/Samples/Kraken/SampleKraken/TradesWindow.xaml
@@ -0,0 +1,7 @@
+
+
+
\ No newline at end of file
diff --git a/Samples/Kraken/SampleKraken/TradesWindow.xaml.cs b/Samples/Kraken/SampleKraken/TradesWindow.xaml.cs
new file mode 100644
index 000000000..808fee40a
--- /dev/null
+++ b/Samples/Kraken/SampleKraken/TradesWindow.xaml.cs
@@ -0,0 +1,10 @@
+namespace SampleKraken
+{
+ public partial class TradesWindow
+ {
+ public TradesWindow()
+ {
+ InitializeComponent();
+ }
+ }
+}
\ No newline at end of file
diff --git a/Samples/Kraken/SampleKraken/app.config b/Samples/Kraken/SampleKraken/app.config
new file mode 100644
index 000000000..884f9844f
--- /dev/null
+++ b/Samples/Kraken/SampleKraken/app.config
@@ -0,0 +1,3 @@
+
+
+
diff --git a/Samples/Okcoin/SampleOkcoin/App.xaml b/Samples/Okcoin/SampleOkcoin/App.xaml
new file mode 100644
index 000000000..35ca93668
--- /dev/null
+++ b/Samples/Okcoin/SampleOkcoin/App.xaml
@@ -0,0 +1,8 @@
+
+
+
+
+
diff --git a/Samples/Okcoin/SampleOkcoin/App.xaml.cs b/Samples/Okcoin/SampleOkcoin/App.xaml.cs
new file mode 100644
index 000000000..53ccce016
--- /dev/null
+++ b/Samples/Okcoin/SampleOkcoin/App.xaml.cs
@@ -0,0 +1,14 @@
+namespace SampleOkcoin
+{
+ using System.Windows;
+ using System.Windows.Threading;
+
+ public partial class App
+ {
+ private void ApplicationDispatcherUnhandledException(object sender, DispatcherUnhandledExceptionEventArgs e)
+ {
+ MessageBox.Show(MainWindow, e.Exception.ToString());
+ e.Handled = true;
+ }
+ }
+}
\ No newline at end of file
diff --git a/Samples/Okcoin/SampleOkcoin/MainWindow.xaml b/Samples/Okcoin/SampleOkcoin/MainWindow.xaml
new file mode 100644
index 000000000..98efae454
--- /dev/null
+++ b/Samples/Okcoin/SampleOkcoin/MainWindow.xaml
@@ -0,0 +1,35 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/Samples/Okcoin/SampleOkcoin/MainWindow.xaml.cs b/Samples/Okcoin/SampleOkcoin/MainWindow.xaml.cs
new file mode 100644
index 000000000..b99647c19
--- /dev/null
+++ b/Samples/Okcoin/SampleOkcoin/MainWindow.xaml.cs
@@ -0,0 +1,214 @@
+namespace SampleOkcoin
+{
+ using System;
+ using System.ComponentModel;
+ using System.Windows;
+
+ using Ecng.Common;
+ using Ecng.Xaml;
+
+ using StockSharp.BusinessEntities;
+ using StockSharp.Okcoin;
+ using StockSharp.Logging;
+ using StockSharp.Localization;
+
+ public partial class MainWindow
+ {
+ private bool _isConnected;
+
+ public OkcoinTrader Trader;
+
+ private readonly SecuritiesWindow _securitiesWindow = new SecuritiesWindow();
+ private readonly TradesWindow _tradesWindow = new TradesWindow();
+ private readonly MyTradesWindow _myTradesWindow = new MyTradesWindow();
+ private readonly OrdersWindow _ordersWindow = new OrdersWindow();
+ private readonly PortfoliosWindow _portfoliosWindow = new PortfoliosWindow();
+
+ private readonly LogManager _logManager = new LogManager();
+
+ public MainWindow()
+ {
+ InitializeComponent();
+
+ Title = Title.Put("Okcoin");
+
+ _ordersWindow.MakeHideable();
+ _myTradesWindow.MakeHideable();
+ _tradesWindow.MakeHideable();
+ _securitiesWindow.MakeHideable();
+ _portfoliosWindow.MakeHideable();
+
+ Instance = this;
+
+ _logManager.Sources.Add(MemoryStatistics.Instance);
+ _logManager.Listeners.Add(new FileLogListener { LogDirectory = "StockSharp_Okcoin" });
+ }
+
+ protected override void OnClosing(CancelEventArgs e)
+ {
+ _ordersWindow.DeleteHideable();
+ _myTradesWindow.DeleteHideable();
+ _tradesWindow.DeleteHideable();
+ _securitiesWindow.DeleteHideable();
+ _portfoliosWindow.DeleteHideable();
+
+ _securitiesWindow.Close();
+ _tradesWindow.Close();
+ _myTradesWindow.Close();
+ _ordersWindow.Close();
+ _portfoliosWindow.Close();
+
+ if (Trader != null)
+ Trader.Dispose();
+
+ base.OnClosing(e);
+ }
+
+ public static MainWindow Instance { get; private set; }
+
+ private void ConnectClick(object sender, RoutedEventArgs e)
+ {
+ if (!_isConnected)
+ {
+ if (Key.Text.IsEmpty())
+ {
+ MessageBox.Show(this, LocalizedStrings.Str3689);
+ return;
+ }
+ else if (Secret.Password.IsEmpty())
+ {
+ MessageBox.Show(this, LocalizedStrings.Str3690);
+ return;
+ }
+
+ if (Trader == null)
+ {
+ // create connector
+ Trader = new OkcoinTrader();// { LogLevel = LogLevels.Debug };
+
+ _logManager.Sources.Add(Trader);
+
+ Trader.Restored += () => this.GuiAsync(() =>
+ {
+ // update gui labes
+ ChangeConnectStatus(true);
+ MessageBox.Show(this, LocalizedStrings.Str2958);
+ });
+
+ // subscribe on connection successfully event
+ Trader.Connected += () =>
+ {
+ // set flag (connection is established)
+ _isConnected = true;
+
+ // update gui labes
+ this.GuiAsync(() => ChangeConnectStatus(true));
+ };
+ Trader.Disconnected += () => this.GuiAsync(() => ChangeConnectStatus(false));
+
+ // subscribe on connection error event
+ Trader.ConnectionError += error => this.GuiAsync(() =>
+ {
+ // update gui labes
+ ChangeConnectStatus(false);
+
+ MessageBox.Show(this, error.ToString(), LocalizedStrings.Str2959);
+ });
+
+ // subscribe on error event
+ Trader.Error += error =>
+ this.GuiAsync(() => MessageBox.Show(this, error.ToString(), LocalizedStrings.Str2955));
+
+ // subscribe on error of market data subscription event
+ Trader.MarketDataSubscriptionFailed += (security, msg, error) =>
+ this.GuiAsync(() => MessageBox.Show(this, error.ToString(), LocalizedStrings.Str2956Params.Put(msg.DataType, security)));
+
+ Trader.NewSecurity += _securitiesWindow.SecurityPicker.Securities.Add;
+ Trader.NewMyTrade += _myTradesWindow.TradeGrid.Trades.Add;
+ Trader.NewTrade += _tradesWindow.TradeGrid.Trades.Add;
+ Trader.NewOrder += _ordersWindow.OrderGrid.Orders.Add;
+
+ Trader.NewPortfolio += _portfoliosWindow.PortfolioGrid.Portfolios.Add;
+ Trader.NewPosition += _portfoliosWindow.PortfolioGrid.Positions.Add;
+
+ // subscribe on error of order registration event
+ Trader.OrderRegisterFailed += _ordersWindow.OrderGrid.AddRegistrationFail;
+ // subscribe on error of order cancelling event
+ Trader.OrderCancelFailed += OrderFailed;
+
+ Trader.MassOrderCancelFailed += (transId, error) =>
+ this.GuiAsync(() => MessageBox.Show(this, error.ToString(), LocalizedStrings.Str716));
+
+ // set market data provider
+ _securitiesWindow.SecurityPicker.MarketDataProvider = Trader;
+
+ ShowSecurities.IsEnabled = ShowTrades.IsEnabled =
+ ShowMyTrades.IsEnabled = ShowOrders.IsEnabled =
+ ShowPortfolios.IsEnabled = true;
+ }
+
+ Trader.Key = Key.Text;
+ Trader.Secret = Secret.Password;
+
+ // clear password box for security reason
+ //Secret.Clear();
+
+ Trader.Connect();
+ }
+ else
+ {
+ Trader.Disconnect();
+ }
+ }
+
+ private void OrderFailed(OrderFail fail)
+ {
+ this.GuiAsync(() =>
+ {
+ MessageBox.Show(this, fail.Error.ToString(), LocalizedStrings.Str153);
+ });
+ }
+
+ private void ChangeConnectStatus(bool isConnected)
+ {
+ _isConnected = isConnected;
+ ConnectBtn.Content = isConnected ? LocalizedStrings.Disconnect : LocalizedStrings.Connect;
+ }
+
+ private void ShowSecuritiesClick(object sender, RoutedEventArgs e)
+ {
+ ShowOrHide(_securitiesWindow);
+ }
+
+ private void ShowTradesClick(object sender, RoutedEventArgs e)
+ {
+ ShowOrHide(_tradesWindow);
+ }
+
+ private void ShowMyTradesClick(object sender, RoutedEventArgs e)
+ {
+ ShowOrHide(_myTradesWindow);
+ }
+
+ private void ShowOrdersClick(object sender, RoutedEventArgs e)
+ {
+ ShowOrHide(_ordersWindow);
+ }
+
+ private void ShowPortfoliosClick(object sender, RoutedEventArgs e)
+ {
+ ShowOrHide(_portfoliosWindow);
+ }
+
+ private static void ShowOrHide(Window window)
+ {
+ if (window == null)
+ throw new ArgumentNullException(nameof(window));
+
+ if (window.Visibility == Visibility.Visible)
+ window.Hide();
+ else
+ window.Show();
+ }
+ }
+}
diff --git a/Samples/Okcoin/SampleOkcoin/MyTradesWindow.xaml b/Samples/Okcoin/SampleOkcoin/MyTradesWindow.xaml
new file mode 100644
index 000000000..19fdf8048
--- /dev/null
+++ b/Samples/Okcoin/SampleOkcoin/MyTradesWindow.xaml
@@ -0,0 +1,8 @@
+
+
+
\ No newline at end of file
diff --git a/Samples/Okcoin/SampleOkcoin/MyTradesWindow.xaml.cs b/Samples/Okcoin/SampleOkcoin/MyTradesWindow.xaml.cs
new file mode 100644
index 000000000..a789f94dc
--- /dev/null
+++ b/Samples/Okcoin/SampleOkcoin/MyTradesWindow.xaml.cs
@@ -0,0 +1,10 @@
+namespace SampleOkcoin
+{
+ public partial class MyTradesWindow
+ {
+ public MyTradesWindow()
+ {
+ InitializeComponent();
+ }
+ }
+}
\ No newline at end of file
diff --git a/Samples/Okcoin/SampleOkcoin/OrdersWindow.xaml b/Samples/Okcoin/SampleOkcoin/OrdersWindow.xaml
new file mode 100644
index 000000000..26cf0d184
--- /dev/null
+++ b/Samples/Okcoin/SampleOkcoin/OrdersWindow.xaml
@@ -0,0 +1,16 @@
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/Samples/Okcoin/SampleOkcoin/OrdersWindow.xaml.cs b/Samples/Okcoin/SampleOkcoin/OrdersWindow.xaml.cs
new file mode 100644
index 000000000..3322af4c3
--- /dev/null
+++ b/Samples/Okcoin/SampleOkcoin/OrdersWindow.xaml.cs
@@ -0,0 +1,49 @@
+namespace SampleOkcoin
+{
+ using System.Windows;
+
+ using Ecng.Common;
+ using Ecng.Xaml;
+
+ using StockSharp.Algo;
+ using StockSharp.BusinessEntities;
+ using StockSharp.Localization;
+ using StockSharp.Xaml;
+
+ public partial class OrdersWindow
+ {
+ public OrdersWindow()
+ {
+ InitializeComponent();
+ }
+
+ private static IConnector Connector => MainWindow.Instance.Trader;
+
+ private void OrderGrid_OnOrderCanceling(Order order)
+ {
+ Connector.CancelOrder(order);
+ }
+
+ private void OrderGrid_OnOrderReRegistering(Order order)
+ {
+ var window = new OrderWindow
+ {
+ Title = LocalizedStrings.Str2976Params.Put(order.TransactionId),
+ SecurityProvider = Connector,
+ MarketDataProvider = Connector,
+ Portfolios = new PortfolioDataSource(Connector),
+ Order = order.ReRegisterClone(newVolume: order.Balance),
+ };
+
+ if (window.ShowModal(this))
+ {
+ Connector.ReRegisterOrder(order, window.Order);
+ }
+ }
+
+ private void CancelAll_OnClick(object sender, RoutedEventArgs e)
+ {
+ Connector.CancelOrders();
+ }
+ }
+}
\ No newline at end of file
diff --git a/Samples/Okcoin/SampleOkcoin/PortfoliosWindow.xaml b/Samples/Okcoin/SampleOkcoin/PortfoliosWindow.xaml
new file mode 100644
index 000000000..e193ab319
--- /dev/null
+++ b/Samples/Okcoin/SampleOkcoin/PortfoliosWindow.xaml
@@ -0,0 +1,8 @@
+
+
+
\ No newline at end of file
diff --git a/Samples/Okcoin/SampleOkcoin/PortfoliosWindow.xaml.cs b/Samples/Okcoin/SampleOkcoin/PortfoliosWindow.xaml.cs
new file mode 100644
index 000000000..e38f8c36b
--- /dev/null
+++ b/Samples/Okcoin/SampleOkcoin/PortfoliosWindow.xaml.cs
@@ -0,0 +1,10 @@
+namespace SampleOkcoin
+{
+ public partial class PortfoliosWindow
+ {
+ public PortfoliosWindow()
+ {
+ InitializeComponent();
+ }
+ }
+}
\ No newline at end of file
diff --git a/Samples/Okcoin/SampleOkcoin/Properties/AssemblyInfo.cs b/Samples/Okcoin/SampleOkcoin/Properties/AssemblyInfo.cs
new file mode 100644
index 000000000..18c1efab7
--- /dev/null
+++ b/Samples/Okcoin/SampleOkcoin/Properties/AssemblyInfo.cs
@@ -0,0 +1,20 @@
+using System.Reflection;
+using System.Runtime.InteropServices;
+using System.Windows;
+
+// General Information about an assembly is controlled through the following
+// set of attributes. Change these attribute values to modify the information
+// associated with an assembly.
+[assembly: AssemblyTitle("SampleOkcoin")]
+[assembly: AssemblyDescription("")]
+
+[assembly: Guid("D43C1449-1622-4F4D-A69F-F18B7C0F932C")]
+
+[assembly:ThemeInfo(
+ ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located
+ //(used if a resource is not found in the page,
+ // or application resource dictionaries)
+ ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located
+ //(used if a resource is not found in the page,
+ // app, or any theme specific resource dictionaries)
+)]
diff --git a/Samples/Okcoin/SampleOkcoin/Properties/Resources.Designer.cs b/Samples/Okcoin/SampleOkcoin/Properties/Resources.Designer.cs
new file mode 100644
index 000000000..e1745994f
--- /dev/null
+++ b/Samples/Okcoin/SampleOkcoin/Properties/Resources.Designer.cs
@@ -0,0 +1,63 @@
+//------------------------------------------------------------------------------
+//
+// This code was generated by a tool.
+// Runtime Version:4.0.30319.18449
+//
+// Changes to this file may cause incorrect behavior and will be lost if
+// the code is regenerated.
+//
+//------------------------------------------------------------------------------
+
+namespace SampleOkcoin.Properties {
+ using System;
+
+
+ ///
+ /// A strongly-typed resource class, for looking up localized strings, etc.
+ ///
+ // This class was auto-generated by the StronglyTypedResourceBuilder
+ // class via a tool like ResGen or Visual Studio.
+ // To add or remove a member, edit your .ResX file then rerun ResGen
+ // with the /str option, or rebuild your VS project.
+ [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")]
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
+ [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
+ internal class Resources {
+
+ private static global::System.Resources.ResourceManager resourceMan;
+
+ private static global::System.Globalization.CultureInfo resourceCulture;
+
+ [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
+ internal Resources() {
+ }
+
+ ///
+ /// Returns the cached ResourceManager instance used by this class.
+ ///
+ [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
+ internal static global::System.Resources.ResourceManager ResourceManager {
+ get {
+ if (object.ReferenceEquals(resourceMan, null)) {
+ global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("SampleOkcoin.Properties.Resources", typeof(Resources).Assembly);
+ resourceMan = temp;
+ }
+ return resourceMan;
+ }
+ }
+
+ ///
+ /// Overrides the current thread's CurrentUICulture property for all
+ /// resource lookups using this strongly typed resource class.
+ ///
+ [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
+ internal static global::System.Globalization.CultureInfo Culture {
+ get {
+ return resourceCulture;
+ }
+ set {
+ resourceCulture = value;
+ }
+ }
+ }
+}
diff --git a/Samples/Okcoin/SampleOkcoin/Properties/Resources.resx b/Samples/Okcoin/SampleOkcoin/Properties/Resources.resx
new file mode 100644
index 000000000..13b775f1d
--- /dev/null
+++ b/Samples/Okcoin/SampleOkcoin/Properties/Resources.resx
@@ -0,0 +1,117 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ text/microsoft-resx
+
+
+ 2.0
+
+
+ System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
+ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
\ No newline at end of file
diff --git a/Samples/Okcoin/SampleOkcoin/Properties/Settings.Designer.cs b/Samples/Okcoin/SampleOkcoin/Properties/Settings.Designer.cs
new file mode 100644
index 000000000..c090a248c
--- /dev/null
+++ b/Samples/Okcoin/SampleOkcoin/Properties/Settings.Designer.cs
@@ -0,0 +1,26 @@
+//------------------------------------------------------------------------------
+//
+// This code was generated by a tool.
+// Runtime Version:4.0.30319.18449
+//
+// Changes to this file may cause incorrect behavior and will be lost if
+// the code is regenerated.
+//
+//------------------------------------------------------------------------------
+
+namespace SampleOkcoin.Properties {
+
+
+ [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
+ [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "12.0.0.0")]
+ internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase {
+
+ private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
+
+ public static Settings Default {
+ get {
+ return defaultInstance;
+ }
+ }
+ }
+}
diff --git a/Samples/Okcoin/SampleOkcoin/Properties/Settings.settings b/Samples/Okcoin/SampleOkcoin/Properties/Settings.settings
new file mode 100644
index 000000000..9010101f8
--- /dev/null
+++ b/Samples/Okcoin/SampleOkcoin/Properties/Settings.settings
@@ -0,0 +1,7 @@
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/Samples/Okcoin/SampleOkcoin/QuotesWindow.xaml b/Samples/Okcoin/SampleOkcoin/QuotesWindow.xaml
new file mode 100644
index 000000000..c85348f30
--- /dev/null
+++ b/Samples/Okcoin/SampleOkcoin/QuotesWindow.xaml
@@ -0,0 +1,7 @@
+
+
+
\ No newline at end of file
diff --git a/Samples/Okcoin/SampleOkcoin/QuotesWindow.xaml.cs b/Samples/Okcoin/SampleOkcoin/QuotesWindow.xaml.cs
new file mode 100644
index 000000000..ee56c1284
--- /dev/null
+++ b/Samples/Okcoin/SampleOkcoin/QuotesWindow.xaml.cs
@@ -0,0 +1,10 @@
+namespace SampleOkcoin
+{
+ public partial class QuotesWindow
+ {
+ public QuotesWindow()
+ {
+ InitializeComponent();
+ }
+ }
+}
\ No newline at end of file
diff --git a/Samples/Okcoin/SampleOkcoin/SampleOkcoin.csproj b/Samples/Okcoin/SampleOkcoin/SampleOkcoin.csproj
new file mode 100644
index 000000000..dcfae653f
--- /dev/null
+++ b/Samples/Okcoin/SampleOkcoin/SampleOkcoin.csproj
@@ -0,0 +1,281 @@
+
+
+
+ Debug
+ AnyCPU
+ 9.0.30729
+ 2.0
+ {751BB16D-6C91-4776-A1BA-CCF3156E1D3D}
+ WinExe
+ Properties
+ SampleOkcoin
+ SampleOkcoin
+ v4.5.1
+ 512
+ {60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}
+ 4
+ ..\..\..\References\stocksharp.ico
+
+
+ 3.5
+
+ publish\
+ true
+ Disk
+ false
+ Foreground
+ 7
+ Days
+ false
+ false
+ true
+ 0
+ 1.0.0.%2a
+ false
+ false
+ true
+
+
+
+
+
+
+
+
+
+
+
+ true
+ full
+ false
+ bin\Debug\
+ DEBUG;TRACE
+ prompt
+ 4
+ AnyCPU
+ AllRules.ruleset
+ false
+
+
+ pdbonly
+ true
+ bin\Release\
+ TRACE
+ prompt
+ 4
+ AnyCPU
+ AllRules.ruleset
+ false
+
+
+
+ ..\..\..\References\Ecng.Localization.dll
+
+
+ ..\..\..\References\Ecng.Common.dll
+
+
+ ..\..\..\References\MoreLinq.dll
+
+
+
+
+
+
+
+
+
+
+ ..\..\..\References\Ecng.Collections.dll
+
+
+ ..\..\..\References\Ecng.ComponentModel.dll
+
+
+ ..\..\..\References\Ecng.Serialization.dll
+
+
+ ..\..\..\References\Ecng.Xaml.dll
+
+
+ ..\..\..\References\DevExpress.Data.v17.2.dll
+
+
+ ..\..\..\References\DevExpress.Xpf.Core.v17.2.dll
+
+
+ ..\..\..\References\DevExpress.Xpf.Grid.v17.2.dll
+
+
+ ..\..\..\References\DevExpress.Xpf.Grid.v17.2.Core.dll
+
+
+ ..\..\..\References\DevExpress.Xpf.Themes.Office2016White.v17.2.dll
+
+
+
+
+ MSBuild:Compile
+ Designer
+ MSBuild:Compile
+ Designer
+
+
+ Properties\StockSharpAssemblyInfo.cs
+
+
+ App.xaml
+ Code
+
+
+
+
+ MainWindow.xaml
+
+
+ MyTradesWindow.xaml
+
+
+ OrdersWindow.xaml
+
+
+ PortfoliosWindow.xaml
+
+
+
+ True
+ True
+ Resources.resx
+
+
+ True
+ Settings.settings
+ True
+
+
+ QuotesWindow.xaml
+
+
+ SecuritiesWindow.xaml
+
+
+ TradesWindow.xaml
+
+
+ ResXFileCodeGenerator
+ Resources.Designer.cs
+
+
+
+ SettingsSingleFileGenerator
+ Settings.Designer.cs
+
+
+
+
+
+ MSBuild:Compile
+ Designer
+ MSBuild:Compile
+ Designer
+
+
+ Designer
+ MSBuild:Compile
+ MSBuild:Compile
+ Designer
+
+
+ MSBuild:Compile
+ Designer
+ MSBuild:Compile
+ Designer
+
+
+ MSBuild:Compile
+ Designer
+
+
+ MSBuild:Compile
+ Designer
+ MSBuild:Compile
+ Designer
+
+
+ MSBuild:Compile
+ Designer
+ MSBuild:Compile
+ Designer
+
+
+ MSBuild:Compile
+ Designer
+ MSBuild:Compile
+ Designer
+
+
+
+
+ False
+ .NET Framework 3.5 SP1 Client Profile
+ false
+
+
+ False
+ .NET Framework 3.5 SP1
+ true
+
+
+ False
+ Windows Installer 3.1
+ true
+
+
+
+
+ {52364231-2047-4785-885c-90d2e20c37fa}
+ Okcoin
+
+
+ {2A5C6FAD-106C-4A4A-B602-77A6B1034CA2}
+ Algo
+
+
+ {DCE69DB8-53CA-4B7F-9368-02F175A31074}
+ BusinessEntities
+
+
+ {A98A81CE-75A1-4FAB-9C02-E6EEF4B51F4F}
+ Localization
+
+
+ {C4476ADD-A3D5-41BB-9D43-55D865863B78}
+ Logging
+
+
+ {B47F9C23-A4BD-46A9-BF27-54CB3D653503}
+ Messages
+
+
+ {c449d618-dea4-41c3-ba86-9f827c7421dc}
+ Xaml.Charting
+
+
+ {64E4D6F0-36B6-4904-9BA7-FFFBE5FF71D8}
+ Xaml
+
+
+
+
+ stocksharp.ico
+
+
+
+
+
\ No newline at end of file
diff --git a/Samples/Okcoin/SampleOkcoin/SampleOkcoin.licenseheader b/Samples/Okcoin/SampleOkcoin/SampleOkcoin.licenseheader
new file mode 100644
index 000000000..a1db37839
--- /dev/null
+++ b/Samples/Okcoin/SampleOkcoin/SampleOkcoin.licenseheader
@@ -0,0 +1,45 @@
+extensions: designer.cs generated.cs
+extensions: .cs .cpp .h
+#region S# License
+/******************************************************************************************
+NOTICE!!! This program and source code is owned and licensed by
+StockSharp Algo Trading, LLC, www.stocksharp.com
+Viewing or use of this code requires your acceptance of the license
+agreement found at https://github.com/StockSharp/StockSharp/blob/master/LICENSE
+Removal of this comment is a violation of the license agreement.
+
+Project: %Namespace%.%Project%
+File: %FileName%
+Created: %CreationYear%, %CreationMonth%, %CreationDay%, %CreationTime%
+
+Copyright 2010 by StockSharp Algo Trading, LLC
+*******************************************************************************************/
+#endregion S# License
+extensions: .aspx .ascx
+<%--
+NOTICE!!! This program and source code is owned and licensed by
+StockSharp Algo Trading, LLC, www.stocksharp.com
+Viewing or use of this code requires your acceptance of the license
+agreement found at https://github.com/StockSharp/StockSharp/blob/master/LICENSE
+Removal of this comment is a violation of the license agreement.
+
+Project: %Namespace%.%Project%
+File: %FileName%
+Created: %CreationYear%, %CreationMonth%, %CreationDay%, %CreationTime%
+
+Copyright 2010 by StockSharp Algo Trading, LLC
+--%>
+extensions: .xml .config .xsd
+
\ No newline at end of file
diff --git a/Samples/Okcoin/SampleOkcoin/SampleOkcoinPublic.csproj b/Samples/Okcoin/SampleOkcoin/SampleOkcoinPublic.csproj
new file mode 100644
index 000000000..702130632
--- /dev/null
+++ b/Samples/Okcoin/SampleOkcoin/SampleOkcoinPublic.csproj
@@ -0,0 +1,275 @@
+
+
+
+ Debug
+ AnyCPU
+ 9.0.30729
+ 2.0
+ {67A288CF-8976-49FB-AB76-06E6A9A3182E}
+ WinExe
+ Properties
+ SampleOkcoin
+ SampleOkcoin
+ v4.5.1
+ 512
+ {60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}
+ 4
+ ..\..\..\References\stocksharp.ico
+
+
+ 3.5
+
+ publish\
+ true
+ Disk
+ false
+ Foreground
+ 7
+ Days
+ false
+ false
+ true
+ 0
+ 1.0.0.%2a
+ false
+ false
+ true
+
+
+
+ true
+ full
+ false
+ bin\Debug\
+ DEBUG;TRACE
+ prompt
+ 4
+ AnyCPU
+ AllRules.ruleset
+ false
+
+
+ pdbonly
+ true
+ bin\Release\
+ TRACE
+ prompt
+ 4
+ AnyCPU
+ AllRules.ruleset
+ false
+
+
+
+ ..\..\..\References\StockSharp.Okcoin.dll
+
+
+
+
+
+
+
+
+
+
+ ..\..\..\References\Ecng.Localization.dll
+
+
+ ..\..\..\References\Ecng.Common.dll
+
+
+ ..\..\..\References\MoreLinq.dll
+
+
+ ..\..\..\References\Ecng.Collections.dll
+
+
+ ..\..\..\References\Ecng.ComponentModel.dll
+
+
+ ..\..\..\References\Ecng.Serialization.dll
+
+
+ ..\..\..\References\Ecng.Xaml.dll
+
+
+ ..\..\..\References\Xceed.Wpf.Toolkit.dll
+
+
+ ..\..\..\References\DevExpress.Data.v17.2.dll
+
+
+ ..\..\..\References\DevExpress.Xpf.Core.v17.2.dll
+
+
+ ..\..\..\References\DevExpress.Xpf.Grid.v17.2.dll
+
+
+ ..\..\..\References\DevExpress.Xpf.Grid.v17.2.Core.dll
+
+
+ ..\..\..\References\DevExpress.Xpf.LayoutControl.v17.2.dll
+
+
+
+
+ MSBuild:Compile
+ Designer
+ MSBuild:Compile
+ Designer
+
+
+ Properties\StockSharpAssemblyInfo.cs
+
+
+ App.xaml
+ Code
+
+
+
+
+ MainWindow.xaml
+
+
+ MyTradesWindow.xaml
+
+
+ OrdersWindow.xaml
+
+
+ PortfoliosWindow.xaml
+
+
+
+ True
+ True
+ Resources.resx
+
+
+ True
+ Settings.settings
+ True
+
+
+ QuotesWindow.xaml
+
+
+ SecuritiesWindow.xaml
+
+
+ TradesWindow.xaml
+
+
+ ResXFileCodeGenerator
+ Resources.Designer.cs
+
+
+
+ SettingsSingleFileGenerator
+ Settings.Designer.cs
+
+
+
+
+
+ MSBuild:Compile
+ Designer
+ MSBuild:Compile
+ Designer
+
+
+ Designer
+ MSBuild:Compile
+ MSBuild:Compile
+ Designer
+
+
+ MSBuild:Compile
+ Designer
+ MSBuild:Compile
+ Designer
+
+
+ MSBuild:Compile
+ Designer
+
+
+ MSBuild:Compile
+ Designer
+ MSBuild:Compile
+ Designer
+
+
+ MSBuild:Compile
+ Designer
+ MSBuild:Compile
+ Designer
+
+
+ MSBuild:Compile
+ Designer
+ MSBuild:Compile
+ Designer
+
+
+
+
+ False
+ .NET Framework 3.5 SP1 Client Profile
+ false
+
+
+ False
+ .NET Framework 3.5 SP1
+ true
+
+
+ False
+ Windows Installer 3.1
+ true
+
+
+
+
+ stocksharp.ico
+
+
+
+
+ {AF225452-1CF1-48A2-B381-C02BEBE643D7}
+ Okcoin
+
+
+ {64e4d6f0-36b6-4904-9ba7-fffbe5ff71d8}
+ Xaml
+
+
+ {2A5C6FAD-106C-4A4A-B602-77A6B1034CA2}
+ Algo
+
+
+ {DCE69DB8-53CA-4B7F-9368-02F175A31074}
+ BusinessEntities
+
+
+ {A98A81CE-75A1-4FAB-9C02-E6EEF4B51F4F}
+ Localization
+
+
+ {C4476ADD-A3D5-41BB-9D43-55D865863B78}
+ Logging
+
+
+ {b47f9c23-a4bd-46a9-bf27-54cb3d653503}
+ Messages
+
+
+
+
+
\ No newline at end of file
diff --git a/Samples/Okcoin/SampleOkcoin/SecuritiesWindow.xaml b/Samples/Okcoin/SampleOkcoin/SecuritiesWindow.xaml
new file mode 100644
index 000000000..cc7e260b6
--- /dev/null
+++ b/Samples/Okcoin/SampleOkcoin/SecuritiesWindow.xaml
@@ -0,0 +1,25 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/Samples/Okcoin/SampleOkcoin/SecuritiesWindow.xaml.cs b/Samples/Okcoin/SampleOkcoin/SecuritiesWindow.xaml.cs
new file mode 100644
index 000000000..eb59ba68c
--- /dev/null
+++ b/Samples/Okcoin/SampleOkcoin/SecuritiesWindow.xaml.cs
@@ -0,0 +1,126 @@
+namespace SampleOkcoin
+{
+ using System;
+ using System.Linq;
+ using System.Windows;
+
+ using Ecng.Collections;
+ using Ecng.Xaml;
+
+ using MoreLinq;
+
+ using StockSharp.BusinessEntities;
+ using StockSharp.Xaml;
+ using StockSharp.Localization;
+
+ public partial class SecuritiesWindow
+ {
+ private readonly SynchronizedDictionary _quotesWindows = new SynchronizedDictionary();
+ private bool _initialized;
+
+ public SecuritiesWindow()
+ {
+ InitializeComponent();
+ }
+
+ protected override void OnClosed(EventArgs e)
+ {
+ _quotesWindows.SyncDo(d => d.Values.ForEach(w =>
+ {
+ w.DeleteHideable();
+ w.Close();
+ }));
+
+ var trader = MainWindow.Instance.Trader;
+ if (trader != null)
+ {
+ if (_initialized)
+ trader.MarketDepthChanged -= TraderOnMarketDepthChanged;
+ }
+
+ base.OnClosed(e);
+ }
+
+ private void SecurityPicker_OnSecuritySelected(Security security)
+ {
+ Quotes.IsEnabled = NewOrder.IsEnabled = Depth.IsEnabled = security != null;
+ }
+
+ private void NewOrderClick(object sender, RoutedEventArgs e)
+ {
+ var newOrder = new OrderWindow
+ {
+ Order = new Order { Security = SecurityPicker.SelectedSecurity },
+ SecurityProvider = MainWindow.Instance.Trader,
+ MarketDataProvider = MainWindow.Instance.Trader,
+ Portfolios = new PortfolioDataSource(MainWindow.Instance.Trader),
+ };
+
+ if (newOrder.ShowModal(this))
+ MainWindow.Instance.Trader.RegisterOrder(newOrder.Order);
+ }
+
+ private void DepthClick(object sender, RoutedEventArgs e)
+ {
+ var trader = MainWindow.Instance.Trader;
+
+ foreach (var security in SecurityPicker.SelectedSecurities)
+ {
+ var window = _quotesWindows.SafeAdd(security, s =>
+ {
+ // начинаем получать котировки стакана
+ trader.RegisterMarketDepth(security);
+
+ // создаем окно со стаканом
+ var wnd = new QuotesWindow
+ {
+ Title = security.Id + " " + LocalizedStrings.MarketDepth
+ };
+ wnd.MakeHideable();
+ return wnd;
+ });
+
+ if (window.Visibility == Visibility.Visible)
+ window.Hide();
+ else
+ {
+ window.Show();
+ window.DepthCtrl.UpdateDepth(trader.GetMarketDepth(security));
+ }
+
+ if (!_initialized)
+ {
+ trader.MarketDepthChanged += TraderOnMarketDepthChanged;
+ _initialized = true;
+ }
+ }
+ }
+
+ private void QuotesClick(object sender, RoutedEventArgs e)
+ {
+ var trader = MainWindow.Instance.Trader;
+
+ foreach (var security in SecurityPicker.SelectedSecurities)
+ {
+ if (trader.RegisteredSecurities.Contains(security))
+ {
+ trader.UnRegisterSecurity(security);
+ trader.UnRegisterTrades(security);
+ }
+ else
+ {
+ trader.RegisterSecurity(security);
+ trader.RegisterTrades(security);
+ }
+ }
+ }
+
+ private void TraderOnMarketDepthChanged(MarketDepth depth)
+ {
+ var wnd = _quotesWindows.TryGetValue(depth.Security);
+
+ if (wnd != null)
+ wnd.DepthCtrl.UpdateDepth(depth);
+ }
+ }
+}
\ No newline at end of file
diff --git a/Samples/Okcoin/SampleOkcoin/TradesWindow.xaml b/Samples/Okcoin/SampleOkcoin/TradesWindow.xaml
new file mode 100644
index 000000000..bab06808e
--- /dev/null
+++ b/Samples/Okcoin/SampleOkcoin/TradesWindow.xaml
@@ -0,0 +1,7 @@
+
+
+
\ No newline at end of file
diff --git a/Samples/Okcoin/SampleOkcoin/TradesWindow.xaml.cs b/Samples/Okcoin/SampleOkcoin/TradesWindow.xaml.cs
new file mode 100644
index 000000000..662998f56
--- /dev/null
+++ b/Samples/Okcoin/SampleOkcoin/TradesWindow.xaml.cs
@@ -0,0 +1,10 @@
+namespace SampleOkcoin
+{
+ public partial class TradesWindow
+ {
+ public TradesWindow()
+ {
+ InitializeComponent();
+ }
+ }
+}
\ No newline at end of file
diff --git a/Samples/Okcoin/SampleOkcoin/app.config b/Samples/Okcoin/SampleOkcoin/app.config
new file mode 100644
index 000000000..884f9844f
--- /dev/null
+++ b/Samples/Okcoin/SampleOkcoin/app.config
@@ -0,0 +1,3 @@
+
+
+
diff --git a/Samples/Poloniex/SamplePoloniex/App.xaml b/Samples/Poloniex/SamplePoloniex/App.xaml
new file mode 100644
index 000000000..f2b5b32c9
--- /dev/null
+++ b/Samples/Poloniex/SamplePoloniex/App.xaml
@@ -0,0 +1,8 @@
+
+
+
+
+
diff --git a/Samples/Poloniex/SamplePoloniex/App.xaml.cs b/Samples/Poloniex/SamplePoloniex/App.xaml.cs
new file mode 100644
index 000000000..b4c2a294d
--- /dev/null
+++ b/Samples/Poloniex/SamplePoloniex/App.xaml.cs
@@ -0,0 +1,14 @@
+namespace SamplePoloniex
+{
+ using System.Windows;
+ using System.Windows.Threading;
+
+ public partial class App
+ {
+ private void ApplicationDispatcherUnhandledException(object sender, DispatcherUnhandledExceptionEventArgs e)
+ {
+ MessageBox.Show(MainWindow, e.Exception.ToString());
+ e.Handled = true;
+ }
+ }
+}
\ No newline at end of file
diff --git a/Samples/Poloniex/SamplePoloniex/MainWindow.xaml b/Samples/Poloniex/SamplePoloniex/MainWindow.xaml
new file mode 100644
index 000000000..95f6eb8eb
--- /dev/null
+++ b/Samples/Poloniex/SamplePoloniex/MainWindow.xaml
@@ -0,0 +1,35 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/Samples/Poloniex/SamplePoloniex/MainWindow.xaml.cs b/Samples/Poloniex/SamplePoloniex/MainWindow.xaml.cs
new file mode 100644
index 000000000..393a6c15c
--- /dev/null
+++ b/Samples/Poloniex/SamplePoloniex/MainWindow.xaml.cs
@@ -0,0 +1,214 @@
+namespace SamplePoloniex
+{
+ using System;
+ using System.ComponentModel;
+ using System.Windows;
+
+ using Ecng.Common;
+ using Ecng.Xaml;
+
+ using StockSharp.BusinessEntities;
+ using StockSharp.Poloniex;
+ using StockSharp.Logging;
+ using StockSharp.Localization;
+
+ public partial class MainWindow
+ {
+ private bool _isConnected;
+
+ public PoloniexTrader Trader;
+
+ private readonly SecuritiesWindow _securitiesWindow = new SecuritiesWindow();
+ private readonly TradesWindow _tradesWindow = new TradesWindow();
+ private readonly MyTradesWindow _myTradesWindow = new MyTradesWindow();
+ private readonly OrdersWindow _ordersWindow = new OrdersWindow();
+ private readonly PortfoliosWindow _portfoliosWindow = new PortfoliosWindow();
+
+ private readonly LogManager _logManager = new LogManager();
+
+ public MainWindow()
+ {
+ InitializeComponent();
+
+ Title = Title.Put("Poloniex");
+
+ _ordersWindow.MakeHideable();
+ _myTradesWindow.MakeHideable();
+ _tradesWindow.MakeHideable();
+ _securitiesWindow.MakeHideable();
+ _portfoliosWindow.MakeHideable();
+
+ Instance = this;
+
+ _logManager.Sources.Add(MemoryStatistics.Instance);
+ _logManager.Listeners.Add(new FileLogListener { LogDirectory = "StockSharp_Poloniex" });
+ }
+
+ protected override void OnClosing(CancelEventArgs e)
+ {
+ _ordersWindow.DeleteHideable();
+ _myTradesWindow.DeleteHideable();
+ _tradesWindow.DeleteHideable();
+ _securitiesWindow.DeleteHideable();
+ _portfoliosWindow.DeleteHideable();
+
+ _securitiesWindow.Close();
+ _tradesWindow.Close();
+ _myTradesWindow.Close();
+ _ordersWindow.Close();
+ _portfoliosWindow.Close();
+
+ if (Trader != null)
+ Trader.Dispose();
+
+ base.OnClosing(e);
+ }
+
+ public static MainWindow Instance { get; private set; }
+
+ private void ConnectClick(object sender, RoutedEventArgs e)
+ {
+ if (!_isConnected)
+ {
+ if (Key.Text.IsEmpty())
+ {
+ MessageBox.Show(this, LocalizedStrings.Str3689);
+ return;
+ }
+ else if (Secret.Password.IsEmpty())
+ {
+ MessageBox.Show(this, LocalizedStrings.Str3690);
+ return;
+ }
+
+ if (Trader == null)
+ {
+ // create connector
+ Trader = new PoloniexTrader();// { LogLevel = LogLevels.Debug };
+
+ _logManager.Sources.Add(Trader);
+
+ Trader.Restored += () => this.GuiAsync(() =>
+ {
+ // update gui labes
+ ChangeConnectStatus(true);
+ MessageBox.Show(this, LocalizedStrings.Str2958);
+ });
+
+ // subscribe on connection successfully event
+ Trader.Connected += () =>
+ {
+ // set flag (connection is established)
+ _isConnected = true;
+
+ // update gui labes
+ this.GuiAsync(() => ChangeConnectStatus(true));
+ };
+ Trader.Disconnected += () => this.GuiAsync(() => ChangeConnectStatus(false));
+
+ // subscribe on connection error event
+ Trader.ConnectionError += error => this.GuiAsync(() =>
+ {
+ // update gui labes
+ ChangeConnectStatus(false);
+
+ MessageBox.Show(this, error.ToString(), LocalizedStrings.Str2959);
+ });
+
+ // subscribe on error event
+ Trader.Error += error =>
+ this.GuiAsync(() => MessageBox.Show(this, error.ToString(), LocalizedStrings.Str2955));
+
+ // subscribe on error of market data subscription event
+ Trader.MarketDataSubscriptionFailed += (security, msg, error) =>
+ this.GuiAsync(() => MessageBox.Show(this, error.ToString(), LocalizedStrings.Str2956Params.Put(msg.DataType, security)));
+
+ Trader.NewSecurity += _securitiesWindow.SecurityPicker.Securities.Add;
+ Trader.NewMyTrade += _myTradesWindow.TradeGrid.Trades.Add;
+ Trader.NewTrade += _tradesWindow.TradeGrid.Trades.Add;
+ Trader.NewOrder += _ordersWindow.OrderGrid.Orders.Add;
+
+ Trader.NewPortfolio += _portfoliosWindow.PortfolioGrid.Portfolios.Add;
+ Trader.NewPosition += _portfoliosWindow.PortfolioGrid.Positions.Add;
+
+ // subscribe on error of order registration event
+ Trader.OrderRegisterFailed += _ordersWindow.OrderGrid.AddRegistrationFail;
+ // subscribe on error of order cancelling event
+ Trader.OrderCancelFailed += OrderFailed;
+
+ Trader.MassOrderCancelFailed += (transId, error) =>
+ this.GuiAsync(() => MessageBox.Show(this, error.ToString(), LocalizedStrings.Str716));
+
+ // set market data provider
+ _securitiesWindow.SecurityPicker.MarketDataProvider = Trader;
+
+ ShowSecurities.IsEnabled = ShowTrades.IsEnabled =
+ ShowMyTrades.IsEnabled = ShowOrders.IsEnabled =
+ ShowPortfolios.IsEnabled = true;
+ }
+
+ Trader.Key = Key.Text;
+ Trader.Secret = Secret.Password;
+
+ // clear password box for security reason
+ //Secret.Clear();
+
+ Trader.Connect();
+ }
+ else
+ {
+ Trader.Disconnect();
+ }
+ }
+
+ private void OrderFailed(OrderFail fail)
+ {
+ this.GuiAsync(() =>
+ {
+ MessageBox.Show(this, fail.Error.ToString(), LocalizedStrings.Str153);
+ });
+ }
+
+ private void ChangeConnectStatus(bool isConnected)
+ {
+ _isConnected = isConnected;
+ ConnectBtn.Content = isConnected ? LocalizedStrings.Disconnect : LocalizedStrings.Connect;
+ }
+
+ private void ShowSecuritiesClick(object sender, RoutedEventArgs e)
+ {
+ ShowOrHide(_securitiesWindow);
+ }
+
+ private void ShowTradesClick(object sender, RoutedEventArgs e)
+ {
+ ShowOrHide(_tradesWindow);
+ }
+
+ private void ShowMyTradesClick(object sender, RoutedEventArgs e)
+ {
+ ShowOrHide(_myTradesWindow);
+ }
+
+ private void ShowOrdersClick(object sender, RoutedEventArgs e)
+ {
+ ShowOrHide(_ordersWindow);
+ }
+
+ private void ShowPortfoliosClick(object sender, RoutedEventArgs e)
+ {
+ ShowOrHide(_portfoliosWindow);
+ }
+
+ private static void ShowOrHide(Window window)
+ {
+ if (window == null)
+ throw new ArgumentNullException(nameof(window));
+
+ if (window.Visibility == Visibility.Visible)
+ window.Hide();
+ else
+ window.Show();
+ }
+ }
+}
diff --git a/Samples/Poloniex/SamplePoloniex/MyTradesWindow.xaml b/Samples/Poloniex/SamplePoloniex/MyTradesWindow.xaml
new file mode 100644
index 000000000..c33cb76fe
--- /dev/null
+++ b/Samples/Poloniex/SamplePoloniex/MyTradesWindow.xaml
@@ -0,0 +1,8 @@
+
+
+
\ No newline at end of file
diff --git a/Samples/Poloniex/SamplePoloniex/MyTradesWindow.xaml.cs b/Samples/Poloniex/SamplePoloniex/MyTradesWindow.xaml.cs
new file mode 100644
index 000000000..a3e82b603
--- /dev/null
+++ b/Samples/Poloniex/SamplePoloniex/MyTradesWindow.xaml.cs
@@ -0,0 +1,10 @@
+namespace SamplePoloniex
+{
+ public partial class MyTradesWindow
+ {
+ public MyTradesWindow()
+ {
+ InitializeComponent();
+ }
+ }
+}
\ No newline at end of file
diff --git a/Samples/Poloniex/SamplePoloniex/OrdersWindow.xaml b/Samples/Poloniex/SamplePoloniex/OrdersWindow.xaml
new file mode 100644
index 000000000..ba630654d
--- /dev/null
+++ b/Samples/Poloniex/SamplePoloniex/OrdersWindow.xaml
@@ -0,0 +1,16 @@
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/Samples/Poloniex/SamplePoloniex/OrdersWindow.xaml.cs b/Samples/Poloniex/SamplePoloniex/OrdersWindow.xaml.cs
new file mode 100644
index 000000000..4669cc27e
--- /dev/null
+++ b/Samples/Poloniex/SamplePoloniex/OrdersWindow.xaml.cs
@@ -0,0 +1,49 @@
+namespace SamplePoloniex
+{
+ using System.Windows;
+
+ using Ecng.Common;
+ using Ecng.Xaml;
+
+ using StockSharp.Algo;
+ using StockSharp.BusinessEntities;
+ using StockSharp.Localization;
+ using StockSharp.Xaml;
+
+ public partial class OrdersWindow
+ {
+ public OrdersWindow()
+ {
+ InitializeComponent();
+ }
+
+ private static IConnector Connector => MainWindow.Instance.Trader;
+
+ private void OrderGrid_OnOrderCanceling(Order order)
+ {
+ Connector.CancelOrder(order);
+ }
+
+ private void OrderGrid_OnOrderReRegistering(Order order)
+ {
+ var window = new OrderWindow
+ {
+ Title = LocalizedStrings.Str2976Params.Put(order.TransactionId),
+ SecurityProvider = Connector,
+ MarketDataProvider = Connector,
+ Portfolios = new PortfolioDataSource(Connector),
+ Order = order.ReRegisterClone(newVolume: order.Balance),
+ };
+
+ if (window.ShowModal(this))
+ {
+ Connector.ReRegisterOrder(order, window.Order);
+ }
+ }
+
+ private void CancelAll_OnClick(object sender, RoutedEventArgs e)
+ {
+ Connector.CancelOrders();
+ }
+ }
+}
\ No newline at end of file
diff --git a/Samples/Poloniex/SamplePoloniex/PortfoliosWindow.xaml b/Samples/Poloniex/SamplePoloniex/PortfoliosWindow.xaml
new file mode 100644
index 000000000..51c9dbcca
--- /dev/null
+++ b/Samples/Poloniex/SamplePoloniex/PortfoliosWindow.xaml
@@ -0,0 +1,8 @@
+
+
+
\ No newline at end of file
diff --git a/Samples/Poloniex/SamplePoloniex/PortfoliosWindow.xaml.cs b/Samples/Poloniex/SamplePoloniex/PortfoliosWindow.xaml.cs
new file mode 100644
index 000000000..ca2943700
--- /dev/null
+++ b/Samples/Poloniex/SamplePoloniex/PortfoliosWindow.xaml.cs
@@ -0,0 +1,10 @@
+namespace SamplePoloniex
+{
+ public partial class PortfoliosWindow
+ {
+ public PortfoliosWindow()
+ {
+ InitializeComponent();
+ }
+ }
+}
\ No newline at end of file
diff --git a/Samples/Poloniex/SamplePoloniex/Properties/AssemblyInfo.cs b/Samples/Poloniex/SamplePoloniex/Properties/AssemblyInfo.cs
new file mode 100644
index 000000000..f4b2571b7
--- /dev/null
+++ b/Samples/Poloniex/SamplePoloniex/Properties/AssemblyInfo.cs
@@ -0,0 +1,20 @@
+using System.Reflection;
+using System.Runtime.InteropServices;
+using System.Windows;
+
+// General Information about an assembly is controlled through the following
+// set of attributes. Change these attribute values to modify the information
+// associated with an assembly.
+[assembly: AssemblyTitle("SamplePoloniex")]
+[assembly: AssemblyDescription("")]
+
+[assembly: Guid("711CDA7C-0A20-4BFE-AC3F-E6E53A842A93")]
+
+[assembly:ThemeInfo(
+ ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located
+ //(used if a resource is not found in the page,
+ // or application resource dictionaries)
+ ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located
+ //(used if a resource is not found in the page,
+ // app, or any theme specific resource dictionaries)
+)]
diff --git a/Samples/Poloniex/SamplePoloniex/Properties/Resources.Designer.cs b/Samples/Poloniex/SamplePoloniex/Properties/Resources.Designer.cs
new file mode 100644
index 000000000..7529b1ad0
--- /dev/null
+++ b/Samples/Poloniex/SamplePoloniex/Properties/Resources.Designer.cs
@@ -0,0 +1,63 @@
+//------------------------------------------------------------------------------
+//
+// This code was generated by a tool.
+// Runtime Version:4.0.30319.18449
+//
+// Changes to this file may cause incorrect behavior and will be lost if
+// the code is regenerated.
+//
+//------------------------------------------------------------------------------
+
+namespace SamplePoloniex.Properties {
+ using System;
+
+
+ ///
+ /// A strongly-typed resource class, for looking up localized strings, etc.
+ ///
+ // This class was auto-generated by the StronglyTypedResourceBuilder
+ // class via a tool like ResGen or Visual Studio.
+ // To add or remove a member, edit your .ResX file then rerun ResGen
+ // with the /str option, or rebuild your VS project.
+ [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")]
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
+ [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
+ internal class Resources {
+
+ private static global::System.Resources.ResourceManager resourceMan;
+
+ private static global::System.Globalization.CultureInfo resourceCulture;
+
+ [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
+ internal Resources() {
+ }
+
+ ///
+ /// Returns the cached ResourceManager instance used by this class.
+ ///
+ [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
+ internal static global::System.Resources.ResourceManager ResourceManager {
+ get {
+ if (object.ReferenceEquals(resourceMan, null)) {
+ global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("SamplePoloniex.Properties.Resources", typeof(Resources).Assembly);
+ resourceMan = temp;
+ }
+ return resourceMan;
+ }
+ }
+
+ ///
+ /// Overrides the current thread's CurrentUICulture property for all
+ /// resource lookups using this strongly typed resource class.
+ ///
+ [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
+ internal static global::System.Globalization.CultureInfo Culture {
+ get {
+ return resourceCulture;
+ }
+ set {
+ resourceCulture = value;
+ }
+ }
+ }
+}
diff --git a/Samples/Poloniex/SamplePoloniex/Properties/Resources.resx b/Samples/Poloniex/SamplePoloniex/Properties/Resources.resx
new file mode 100644
index 000000000..13b775f1d
--- /dev/null
+++ b/Samples/Poloniex/SamplePoloniex/Properties/Resources.resx
@@ -0,0 +1,117 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ text/microsoft-resx
+
+
+ 2.0
+
+
+ System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
+ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
\ No newline at end of file
diff --git a/Samples/Poloniex/SamplePoloniex/Properties/Settings.Designer.cs b/Samples/Poloniex/SamplePoloniex/Properties/Settings.Designer.cs
new file mode 100644
index 000000000..496bc47a7
--- /dev/null
+++ b/Samples/Poloniex/SamplePoloniex/Properties/Settings.Designer.cs
@@ -0,0 +1,26 @@
+//------------------------------------------------------------------------------
+//
+// This code was generated by a tool.
+// Runtime Version:4.0.30319.18449
+//
+// Changes to this file may cause incorrect behavior and will be lost if
+// the code is regenerated.
+//
+//------------------------------------------------------------------------------
+
+namespace SamplePoloniex.Properties {
+
+
+ [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
+ [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "12.0.0.0")]
+ internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase {
+
+ private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
+
+ public static Settings Default {
+ get {
+ return defaultInstance;
+ }
+ }
+ }
+}
diff --git a/Samples/Poloniex/SamplePoloniex/Properties/Settings.settings b/Samples/Poloniex/SamplePoloniex/Properties/Settings.settings
new file mode 100644
index 000000000..9010101f8
--- /dev/null
+++ b/Samples/Poloniex/SamplePoloniex/Properties/Settings.settings
@@ -0,0 +1,7 @@
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/Samples/Poloniex/SamplePoloniex/QuotesWindow.xaml b/Samples/Poloniex/SamplePoloniex/QuotesWindow.xaml
new file mode 100644
index 000000000..16d90e2ac
--- /dev/null
+++ b/Samples/Poloniex/SamplePoloniex/QuotesWindow.xaml
@@ -0,0 +1,7 @@
+
+
+
\ No newline at end of file
diff --git a/Samples/Poloniex/SamplePoloniex/QuotesWindow.xaml.cs b/Samples/Poloniex/SamplePoloniex/QuotesWindow.xaml.cs
new file mode 100644
index 000000000..3fbf0f954
--- /dev/null
+++ b/Samples/Poloniex/SamplePoloniex/QuotesWindow.xaml.cs
@@ -0,0 +1,10 @@
+namespace SamplePoloniex
+{
+ public partial class QuotesWindow
+ {
+ public QuotesWindow()
+ {
+ InitializeComponent();
+ }
+ }
+}
\ No newline at end of file
diff --git a/Samples/Poloniex/SamplePoloniex/SamplePoloniex.csproj b/Samples/Poloniex/SamplePoloniex/SamplePoloniex.csproj
new file mode 100644
index 000000000..9f082ec2f
--- /dev/null
+++ b/Samples/Poloniex/SamplePoloniex/SamplePoloniex.csproj
@@ -0,0 +1,281 @@
+
+
+
+ Debug
+ AnyCPU
+ 9.0.30729
+ 2.0
+ {4B9CD58A-ACC6-41DE-89C2-91DEA5922A21}
+ WinExe
+ Properties
+ SamplePoloniex
+ SamplePoloniex
+ v4.5.1
+ 512
+ {60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}
+ 4
+ ..\..\..\References\stocksharp.ico
+
+
+ 3.5
+
+ publish\
+ true
+ Disk
+ false
+ Foreground
+ 7
+ Days
+ false
+ false
+ true
+ 0
+ 1.0.0.%2a
+ false
+ false
+ true
+
+
+
+
+
+
+
+
+
+
+
+ true
+ full
+ false
+ bin\Debug\
+ DEBUG;TRACE
+ prompt
+ 4
+ AnyCPU
+ AllRules.ruleset
+ false
+
+
+ pdbonly
+ true
+ bin\Release\
+ TRACE
+ prompt
+ 4
+ AnyCPU
+ AllRules.ruleset
+ false
+
+
+
+ ..\..\..\References\Ecng.Localization.dll
+
+
+ ..\..\..\References\Ecng.Common.dll
+
+
+ ..\..\..\References\MoreLinq.dll
+
+
+
+
+
+
+
+
+
+
+ ..\..\..\References\Ecng.Collections.dll
+
+
+ ..\..\..\References\Ecng.ComponentModel.dll
+
+
+ ..\..\..\References\Ecng.Serialization.dll
+
+
+ ..\..\..\References\Ecng.Xaml.dll
+
+
+ ..\..\..\References\DevExpress.Data.v17.2.dll
+
+
+ ..\..\..\References\DevExpress.Xpf.Core.v17.2.dll
+
+
+ ..\..\..\References\DevExpress.Xpf.Grid.v17.2.dll
+
+
+ ..\..\..\References\DevExpress.Xpf.Grid.v17.2.Core.dll
+
+
+ ..\..\..\References\DevExpress.Xpf.Themes.Office2016White.v17.2.dll
+
+
+
+
+ MSBuild:Compile
+ Designer
+ MSBuild:Compile
+ Designer
+
+
+ Properties\StockSharpAssemblyInfo.cs
+
+
+ App.xaml
+ Code
+
+
+
+
+ MainWindow.xaml
+
+
+ MyTradesWindow.xaml
+
+
+ OrdersWindow.xaml
+
+
+ PortfoliosWindow.xaml
+
+
+
+ True
+ True
+ Resources.resx
+
+
+ True
+ Settings.settings
+ True
+
+
+ QuotesWindow.xaml
+
+
+ SecuritiesWindow.xaml
+
+
+ TradesWindow.xaml
+
+
+ ResXFileCodeGenerator
+ Resources.Designer.cs
+
+
+
+ SettingsSingleFileGenerator
+ Settings.Designer.cs
+
+
+
+
+
+ MSBuild:Compile
+ Designer
+ MSBuild:Compile
+ Designer
+
+
+ Designer
+ MSBuild:Compile
+ MSBuild:Compile
+ Designer
+
+
+ MSBuild:Compile
+ Designer
+ MSBuild:Compile
+ Designer
+
+
+ MSBuild:Compile
+ Designer
+
+
+ MSBuild:Compile
+ Designer
+ MSBuild:Compile
+ Designer
+
+
+ MSBuild:Compile
+ Designer
+ MSBuild:Compile
+ Designer
+
+
+ MSBuild:Compile
+ Designer
+ MSBuild:Compile
+ Designer
+
+
+
+
+ False
+ .NET Framework 3.5 SP1 Client Profile
+ false
+
+
+ False
+ .NET Framework 3.5 SP1
+ true
+
+
+ False
+ Windows Installer 3.1
+ true
+
+
+
+
+ {b8103f63-11be-455a-89cb-2ad9a0bc07d9}
+ Poloniex
+
+
+ {2A5C6FAD-106C-4A4A-B602-77A6B1034CA2}
+ Algo
+
+
+ {DCE69DB8-53CA-4B7F-9368-02F175A31074}
+ BusinessEntities
+
+
+ {A98A81CE-75A1-4FAB-9C02-E6EEF4B51F4F}
+ Localization
+
+
+ {C4476ADD-A3D5-41BB-9D43-55D865863B78}
+ Logging
+
+
+ {B47F9C23-A4BD-46A9-BF27-54CB3D653503}
+ Messages
+
+
+ {c449d618-dea4-41c3-ba86-9f827c7421dc}
+ Xaml.Charting
+
+
+ {64E4D6F0-36B6-4904-9BA7-FFFBE5FF71D8}
+ Xaml
+
+
+
+
+ stocksharp.ico
+
+
+
+
+
\ No newline at end of file
diff --git a/Samples/Poloniex/SamplePoloniex/SamplePoloniex.licenseheader b/Samples/Poloniex/SamplePoloniex/SamplePoloniex.licenseheader
new file mode 100644
index 000000000..a1db37839
--- /dev/null
+++ b/Samples/Poloniex/SamplePoloniex/SamplePoloniex.licenseheader
@@ -0,0 +1,45 @@
+extensions: designer.cs generated.cs
+extensions: .cs .cpp .h
+#region S# License
+/******************************************************************************************
+NOTICE!!! This program and source code is owned and licensed by
+StockSharp Algo Trading, LLC, www.stocksharp.com
+Viewing or use of this code requires your acceptance of the license
+agreement found at https://github.com/StockSharp/StockSharp/blob/master/LICENSE
+Removal of this comment is a violation of the license agreement.
+
+Project: %Namespace%.%Project%
+File: %FileName%
+Created: %CreationYear%, %CreationMonth%, %CreationDay%, %CreationTime%
+
+Copyright 2010 by StockSharp Algo Trading, LLC
+*******************************************************************************************/
+#endregion S# License
+extensions: .aspx .ascx
+<%--
+NOTICE!!! This program and source code is owned and licensed by
+StockSharp Algo Trading, LLC, www.stocksharp.com
+Viewing or use of this code requires your acceptance of the license
+agreement found at https://github.com/StockSharp/StockSharp/blob/master/LICENSE
+Removal of this comment is a violation of the license agreement.
+
+Project: %Namespace%.%Project%
+File: %FileName%
+Created: %CreationYear%, %CreationMonth%, %CreationDay%, %CreationTime%
+
+Copyright 2010 by StockSharp Algo Trading, LLC
+--%>
+extensions: .xml .config .xsd
+
\ No newline at end of file
diff --git a/Samples/Poloniex/SamplePoloniex/SamplePoloniexPublic.csproj b/Samples/Poloniex/SamplePoloniex/SamplePoloniexPublic.csproj
new file mode 100644
index 000000000..8febba3fe
--- /dev/null
+++ b/Samples/Poloniex/SamplePoloniex/SamplePoloniexPublic.csproj
@@ -0,0 +1,275 @@
+
+
+
+ Debug
+ AnyCPU
+ 9.0.30729
+ 2.0
+ {4D2049D0-8269-4EC8-B046-2FC7AD959173}
+ WinExe
+ Properties
+ SamplePoloniex
+ SamplePoloniex
+ v4.5.1
+ 512
+ {60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}
+ 4
+ ..\..\..\References\stocksharp.ico
+
+
+ 3.5
+
+ publish\
+ true
+ Disk
+ false
+ Foreground
+ 7
+ Days
+ false
+ false
+ true
+ 0
+ 1.0.0.%2a
+ false
+ false
+ true
+
+
+
+ true
+ full
+ false
+ bin\Debug\
+ DEBUG;TRACE
+ prompt
+ 4
+ AnyCPU
+ AllRules.ruleset
+ false
+
+
+ pdbonly
+ true
+ bin\Release\
+ TRACE
+ prompt
+ 4
+ AnyCPU
+ AllRules.ruleset
+ false
+
+
+
+ ..\..\..\References\StockSharp.Poloniex.dll
+
+
+
+
+
+
+
+
+
+
+ ..\..\..\References\Ecng.Localization.dll
+
+
+ ..\..\..\References\Ecng.Common.dll
+
+
+ ..\..\..\References\MoreLinq.dll
+
+
+ ..\..\..\References\Ecng.Collections.dll
+
+
+ ..\..\..\References\Ecng.ComponentModel.dll
+
+
+ ..\..\..\References\Ecng.Serialization.dll
+
+
+ ..\..\..\References\Ecng.Xaml.dll
+
+
+ ..\..\..\References\Xceed.Wpf.Toolkit.dll
+
+
+ ..\..\..\References\DevExpress.Data.v17.2.dll
+
+
+ ..\..\..\References\DevExpress.Xpf.Core.v17.2.dll
+
+
+ ..\..\..\References\DevExpress.Xpf.Grid.v17.2.dll
+
+
+ ..\..\..\References\DevExpress.Xpf.Grid.v17.2.Core.dll
+
+
+ ..\..\..\References\DevExpress.Xpf.LayoutControl.v17.2.dll
+
+
+
+
+ MSBuild:Compile
+ Designer
+ MSBuild:Compile
+ Designer
+
+
+ Properties\StockSharpAssemblyInfo.cs
+
+
+ App.xaml
+ Code
+
+
+
+
+ MainWindow.xaml
+
+
+ MyTradesWindow.xaml
+
+
+ OrdersWindow.xaml
+
+
+ PortfoliosWindow.xaml
+
+
+
+ True
+ True
+ Resources.resx
+
+
+ True
+ Settings.settings
+ True
+
+
+ QuotesWindow.xaml
+
+
+ SecuritiesWindow.xaml
+
+
+ TradesWindow.xaml
+
+
+ ResXFileCodeGenerator
+ Resources.Designer.cs
+
+
+
+ SettingsSingleFileGenerator
+ Settings.Designer.cs
+
+
+
+
+
+ MSBuild:Compile
+ Designer
+ MSBuild:Compile
+ Designer
+
+
+ Designer
+ MSBuild:Compile
+ MSBuild:Compile
+ Designer
+
+
+ MSBuild:Compile
+ Designer
+ MSBuild:Compile
+ Designer
+
+
+ MSBuild:Compile
+ Designer
+
+
+ MSBuild:Compile
+ Designer
+ MSBuild:Compile
+ Designer
+
+
+ MSBuild:Compile
+ Designer
+ MSBuild:Compile
+ Designer
+
+
+ MSBuild:Compile
+ Designer
+ MSBuild:Compile
+ Designer
+
+
+
+
+ False
+ .NET Framework 3.5 SP1 Client Profile
+ false
+
+
+ False
+ .NET Framework 3.5 SP1
+ true
+
+
+ False
+ Windows Installer 3.1
+ true
+
+
+
+
+ stocksharp.ico
+
+
+
+
+ {AF225452-1CF1-48A2-B381-C02BEBE643D7}
+ Poloniex
+
+
+ {64e4d6f0-36b6-4904-9ba7-fffbe5ff71d8}
+ Xaml
+
+
+ {2A5C6FAD-106C-4A4A-B602-77A6B1034CA2}
+ Algo
+
+
+ {DCE69DB8-53CA-4B7F-9368-02F175A31074}
+ BusinessEntities
+
+
+ {A98A81CE-75A1-4FAB-9C02-E6EEF4B51F4F}
+ Localization
+
+
+ {C4476ADD-A3D5-41BB-9D43-55D865863B78}
+ Logging
+
+
+ {b47f9c23-a4bd-46a9-bf27-54cb3d653503}
+ Messages
+
+
+
+
+
\ No newline at end of file
diff --git a/Samples/Poloniex/SamplePoloniex/SecuritiesWindow.xaml b/Samples/Poloniex/SamplePoloniex/SecuritiesWindow.xaml
new file mode 100644
index 000000000..77c4d73c9
--- /dev/null
+++ b/Samples/Poloniex/SamplePoloniex/SecuritiesWindow.xaml
@@ -0,0 +1,25 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/Samples/Poloniex/SamplePoloniex/SecuritiesWindow.xaml.cs b/Samples/Poloniex/SamplePoloniex/SecuritiesWindow.xaml.cs
new file mode 100644
index 000000000..856f4eb92
--- /dev/null
+++ b/Samples/Poloniex/SamplePoloniex/SecuritiesWindow.xaml.cs
@@ -0,0 +1,126 @@
+namespace SamplePoloniex
+{
+ using System;
+ using System.Linq;
+ using System.Windows;
+
+ using Ecng.Collections;
+ using Ecng.Xaml;
+
+ using MoreLinq;
+
+ using StockSharp.BusinessEntities;
+ using StockSharp.Xaml;
+ using StockSharp.Localization;
+
+ public partial class SecuritiesWindow
+ {
+ private readonly SynchronizedDictionary _quotesWindows = new SynchronizedDictionary();
+ private bool _initialized;
+
+ public SecuritiesWindow()
+ {
+ InitializeComponent();
+ }
+
+ protected override void OnClosed(EventArgs e)
+ {
+ _quotesWindows.SyncDo(d => d.Values.ForEach(w =>
+ {
+ w.DeleteHideable();
+ w.Close();
+ }));
+
+ var trader = MainWindow.Instance.Trader;
+ if (trader != null)
+ {
+ if (_initialized)
+ trader.MarketDepthChanged -= TraderOnMarketDepthChanged;
+ }
+
+ base.OnClosed(e);
+ }
+
+ private void SecurityPicker_OnSecuritySelected(Security security)
+ {
+ Quotes.IsEnabled = NewOrder.IsEnabled = Depth.IsEnabled = security != null;
+ }
+
+ private void NewOrderClick(object sender, RoutedEventArgs e)
+ {
+ var newOrder = new OrderWindow
+ {
+ Order = new Order { Security = SecurityPicker.SelectedSecurity },
+ SecurityProvider = MainWindow.Instance.Trader,
+ MarketDataProvider = MainWindow.Instance.Trader,
+ Portfolios = new PortfolioDataSource(MainWindow.Instance.Trader),
+ };
+
+ if (newOrder.ShowModal(this))
+ MainWindow.Instance.Trader.RegisterOrder(newOrder.Order);
+ }
+
+ private void DepthClick(object sender, RoutedEventArgs e)
+ {
+ var trader = MainWindow.Instance.Trader;
+
+ foreach (var security in SecurityPicker.SelectedSecurities)
+ {
+ var window = _quotesWindows.SafeAdd(security, s =>
+ {
+ // начинаем получать котировки стакана
+ trader.RegisterMarketDepth(security);
+
+ // создаем окно со стаканом
+ var wnd = new QuotesWindow
+ {
+ Title = security.Id + " " + LocalizedStrings.MarketDepth
+ };
+ wnd.MakeHideable();
+ return wnd;
+ });
+
+ if (window.Visibility == Visibility.Visible)
+ window.Hide();
+ else
+ {
+ window.Show();
+ window.DepthCtrl.UpdateDepth(trader.GetMarketDepth(security));
+ }
+
+ if (!_initialized)
+ {
+ trader.MarketDepthChanged += TraderOnMarketDepthChanged;
+ _initialized = true;
+ }
+ }
+ }
+
+ private void QuotesClick(object sender, RoutedEventArgs e)
+ {
+ var trader = MainWindow.Instance.Trader;
+
+ foreach (var security in SecurityPicker.SelectedSecurities)
+ {
+ if (trader.RegisteredSecurities.Contains(security))
+ {
+ trader.UnRegisterSecurity(security);
+ trader.UnRegisterTrades(security);
+ }
+ else
+ {
+ trader.RegisterSecurity(security);
+ trader.RegisterTrades(security);
+ }
+ }
+ }
+
+ private void TraderOnMarketDepthChanged(MarketDepth depth)
+ {
+ var wnd = _quotesWindows.TryGetValue(depth.Security);
+
+ if (wnd != null)
+ wnd.DepthCtrl.UpdateDepth(depth);
+ }
+ }
+}
\ No newline at end of file
diff --git a/Samples/Poloniex/SamplePoloniex/TradesWindow.xaml b/Samples/Poloniex/SamplePoloniex/TradesWindow.xaml
new file mode 100644
index 000000000..27dd7fca6
--- /dev/null
+++ b/Samples/Poloniex/SamplePoloniex/TradesWindow.xaml
@@ -0,0 +1,7 @@
+
+
+
\ No newline at end of file
diff --git a/Samples/Poloniex/SamplePoloniex/TradesWindow.xaml.cs b/Samples/Poloniex/SamplePoloniex/TradesWindow.xaml.cs
new file mode 100644
index 000000000..3e1b27d5a
--- /dev/null
+++ b/Samples/Poloniex/SamplePoloniex/TradesWindow.xaml.cs
@@ -0,0 +1,10 @@
+namespace SamplePoloniex
+{
+ public partial class TradesWindow
+ {
+ public TradesWindow()
+ {
+ InitializeComponent();
+ }
+ }
+}
\ No newline at end of file
diff --git a/Samples/Poloniex/SamplePoloniex/app.config b/Samples/Poloniex/SamplePoloniex/app.config
new file mode 100644
index 000000000..884f9844f
--- /dev/null
+++ b/Samples/Poloniex/SamplePoloniex/app.config
@@ -0,0 +1,3 @@
+
+
+