77 lines
2.9 KiB
C#
77 lines
2.9 KiB
C#
using bts.api;
|
|
using bts.shell.fills;
|
|
using bts.shell.manual_fills;
|
|
using bts.spark;
|
|
using mbts.persist;
|
|
using mbts.spark;
|
|
using mbts.ui;
|
|
using System.Collections.Generic;
|
|
using System.ComponentModel.Composition;
|
|
using System.IO;
|
|
using System.Linq;
|
|
using System.Threading.Tasks;
|
|
using System.Windows.Media;
|
|
using static mbts.ui.shell.ProtoBufSerializationHelper;
|
|
|
|
namespace bts.shell {
|
|
[Export(typeof(IShellModule))]
|
|
class TradingShellModule : IShellModule {
|
|
LadderWindowFactory _lwf;
|
|
OrderBookWindowFactory _obwf;
|
|
FillsWindowFactory _fwf;
|
|
PAndLWindowFactory _plwf;
|
|
AlgoStudioWindowFactory _aswf;
|
|
ManualFillsWindowFactory _mfwf;
|
|
|
|
[ImportingConstructor]
|
|
public TradingShellModule(
|
|
IBus bus,
|
|
IWindowManager wm,
|
|
INotificationService notification_service,
|
|
INotificationServiceDataCache notification_service_data_cache,
|
|
UserSettingsHub settings_hub,
|
|
OrdersModel orders_model,
|
|
md.MBOService mbo,
|
|
ErrorReporter error_reporter) {
|
|
_lwf = new LadderWindowFactory(this, bus, wm, settings_hub, orders_model, mbo);
|
|
_obwf = new OrderBookWindowFactory(this, bus, notification_service, notification_service_data_cache, orders_model, settings_hub);
|
|
_fwf = new FillsWindowFactory(this, bus, settings_hub, orders_model);
|
|
_plwf = new PAndLWindowFactory(this, bus, settings_hub, orders_model);
|
|
_aswf = new AlgoStudioWindowFactory(this, bus, orders_model, error_reporter);
|
|
_mfwf = new ManualFillsWindowFactory(this, bus, orders_model);
|
|
}
|
|
|
|
public ImageSource icon => Icons.Trades;
|
|
|
|
public string name => "Trading";
|
|
|
|
public int priority => 20;
|
|
|
|
public IEnumerable<SparkCommand> actions => new [] {
|
|
SparkCommands.ShowOrders.complete(() => bts.shell.orderbook.OrderBookStartupData.Default),
|
|
SparkCommands.ShowFills(null).complete(() => new FillsSettings()),
|
|
SparkCommands.ShowPAndL.complete(() => new PAndLWindowFactory.PAndLStartupData()),
|
|
SparkCommands.PickLadder,
|
|
SparkCommands.PickOrderTicket,
|
|
SparkCommands.ShowAlgoStudio.complete(() => new AlgoStudioWindowFactory.StartupData()),
|
|
SparkCommands.ShowManualFills().complete(() => ManualFillsSettings.Default)
|
|
};
|
|
|
|
IEnumerable<IShellWindowFactory> window_factories() {
|
|
yield return _lwf;
|
|
yield return _obwf;
|
|
yield return _fwf;
|
|
yield return _plwf;
|
|
yield return _aswf;
|
|
yield return _mfwf;
|
|
}
|
|
|
|
public Task<IShellWindow> create(Stream load_stream) =>
|
|
dispatch_to_factory(load_stream, window_factories().ToArray());
|
|
|
|
public void Dispose() {
|
|
foreach (var i in window_factories())
|
|
if (i != null) i.Dispose();
|
|
}
|
|
}
|
|
} |