public TradeStationConnector(Client client, ClientHandlerImpl handler, SynchronizationContext uiContext, GetServerLoginInfoDel getServerLoginParam) { _client = client; _handler = handler; _handler.OnLogin += new Action <bool, string>(_handler_OnLogin); _handler.OnServerLogin += new Action <PTEntity.ServerType, bool, string>(_handler_OnServerLogin); _uiContext = uiContext; _getServerLoginParamFunc = getServerLoginParam; }
public AccountVM() { AddPortfolioCommand = new DelegateCommand <AccountVM>(OnAddPortfolio); ConnectCommand = new DelegateCommand <AccountVM>(OnConnectHost); DisconnectCommand = new DelegateCommand <AccountVM>(OnDisconnectHost); RemovePortfolioCommand = new DelegateCommand <XamDataGrid>(OnRemovePortfolio); DetachCommand = new DelegateCommand <AccountVM>(OnDetachHost); StartAllPortfolioCmd = new DelegateCommand <AccountVM>(OnStartAllPortfolio); StopAllPortfolioCmd = new DelegateCommand <AccountVM>(OnStopAllPortfolio); _host = new NativeHost(); AccountInfo = new AccountInfoVM(this); EventAggregator = ServiceLocator.Current.GetInstance <IEventAggregator>(); AddressRepo = ServiceLocator.Current.GetInstance <ServerAddressRepoVM>(); _clientHandler = new ClientHandlerImpl(); _client = new Client(_clientHandler); _clientHandler.OnPortfolioUpdated += new Action <PTEntity.PortfolioUpdateItem>(_clientHandler_OnPortfolioUpdated); _clientHandler.OnMultiLegOrderUpdated += new Action <PTEntity.MultiLegOrder>(_client_OnMultiLegOrderUpdated); _clientHandler.OnLegOrderUpdated += new Action <string, string, string, PTEntity.Order>(_client_OnLegOrderUpdated); _clientHandler.OnTradeUpdated += new Action <PTEntity.TradeUpdate>(_client_OnTradeUpdated); _clientHandler.OnConnectionClosed += new Action(_clientHandler_OnConnectionClosed); /* * _client.OnError += new Action<string>(_client_OnError); * _client.OnQuoteReceived += new Action<entity.Quote>(_client_OnQuoteReceived); * _client.OnPositionDetialReturn += new Action<trade.PositionDetailInfo>(_client_OnPositionDetialReturn); */ _hedgeFlagItemsSource.Add(new RefDataItem <PTEntity.HedgeFlagType, string> { Value = PTEntity.HedgeFlagType.SPECULATION, DisplayText = "投机" }); _hedgeFlagItemsSource.Add(new RefDataItem <PTEntity.HedgeFlagType, string> { Value = PTEntity.HedgeFlagType.ARBITRAGE, DisplayText = "套利" }); _hedgeFlagItemsSource.Add(new RefDataItem <PTEntity.HedgeFlagType, string> { Value = PTEntity.HedgeFlagType.HEDGE, DisplayText = "套保" }); }