static void Main(string[] args) { var wallstreetClient = new WallstreetDataServiceClient(new InstanceContext(new WallstreetHandlerDummy())); string name, exchange; int shares; double pricePerShare; if (args.Count() == 4) { exchange = args[0]; name = args[1]; shares = Int32.Parse(args[2]); pricePerShare = Double.Parse(args[3]); } else { Console.WriteLine("Enter a quadruple of <ExchangeName> <FirmName> <NoOfShares> <PricePerShare> to create a firm."); var input = Console.ReadLine().Split(' '); exchange = input[0]; name = input[1]; shares = Int32.Parse(input[2]); pricePerShare = Double.Parse(input[3]); } var depot = wallstreetClient.RegisterFirm(new FirmRegistration { Id = name, Shares = shares, PricePerShare = pricePerShare }, exchange); Console.WriteLine("Depot created."); Thread.Sleep(2000); }
public WcfDataService() { client = new WallstreetDataServiceClient(new InstanceContext(this)); marketCallbacks = new List <Action <ShareInformation> >(); orderAddedCallbacks = new List <Action <Order> >(); investorAddedCallbacks = new List <Action <InvestorDepot> >(); transactionAddedCallbacks = new List <Action <Transaction> >(); }
static void Main(string[] args) { wallstreetClient = new WallstreetDataServiceClient(new InstanceContext(new WallstreetHandlerDummy())); timer = Observable.Interval(TimeSpan.FromSeconds(2)); timer.Subscribe(_ => UpdateStockPrices()); while (true) { Thread.Sleep(1000); } }
public WcfDataService() { client = new WallstreetDataServiceClient(new InstanceContext(this)); exchanges = client.GetExchanges(); foreach (string e in exchanges) { client.SubscribeOnNewShareInformationAvailable(e); client.SubscribeOnNewOrderAvailable(e); client.SubscribeOnNewTransactionAvailable(e); } marketCallbacks = new List <Action <ShareInformation> >(); orderAddedCallbacks = new List <Action <Order> >(); orderRemovedCallbacks = new List <Action <Order> >(); transactionAddedCallbacks = new List <Action <Transaction> >(); }
static void Main(string[] args) { var wallstreetClient = new WallstreetDataServiceClient(new InstanceContext(new WallstreetHandlerDummy())); Console.WriteLine("Type in the name of the exchange you want to connect to. Available:"); var exchanges = wallstreetClient.GetExchanges(); foreach (string e in exchanges) { Console.WriteLine(e); } var exchangeId = Console.ReadLine(); var handler = new BrokerHandler(wallstreetClient, exchangeId); BrokerServiceClient client = new BrokerServiceClient(new InstanceContext(handler)); client.RegisterBroker(exchangeId); Console.WriteLine("Broker online. Press enter to exit ..."); Console.ReadLine(); client.UnregisterBroker(exchangeId); client.Close(); }
public BrokerHandler(WallstreetDataServiceClient wallstreetClient, string exchangeId) { this.wallstreetClient = wallstreetClient; this.exchangeId = exchangeId; }
public BrokerService() { client = new WallstreetDataServiceClient(new InstanceContext(this)); }