Example #1
0
        static void Main(string[] args)
        {
            Console.WriteLine("Server address: " + serverData.Address + " port: " + serverData.MainPort + " streaming port: " + serverData.StreamingPort);

            // Connect to server
            SyncAPIConnector connector = new SyncAPIConnector(serverData);

            Console.WriteLine("Connected to the server");

            // Login to server
            Credentials credentials = new Credentials(userId, password, "", "YOUR APP NAME");

            LoginResponse loginResponse = APICommandFactory.ExecuteLoginCommand(connector, credentials, true);

            Console.WriteLine("Logged in as: " + userId);

            // Execute GetServerTime command
            ServerTimeResponse serverTimeResponse = APICommandFactory.ExecuteServerTimeCommand(connector, true);

            Console.WriteLine("Server time: " + serverTimeResponse.TimeString);

            // Execute GetAllSymbols command
            AllSymbolsResponse allSymbolsResponse = APICommandFactory.ExecuteAllSymbolsCommand(connector, true);

            Console.WriteLine("All symbols count: " + allSymbolsResponse.SymbolRecords.Count);

            // Print first 5 symbols
            Console.WriteLine("First five symbols:");
            foreach (SymbolRecord symbolRecord in allSymbolsResponse.SymbolRecords.Take(5))
            {
                Console.WriteLine(" > " + symbolRecord.Symbol + " ask: " + symbolRecord.Ask + " bid: " + symbolRecord.Bid);
            }

            Console.Read();
        }
Example #2
0
        static void Main(string[] args)
        {
            //serverData.
            var ser = new Server("xapia.x-station.eu", 5124, 5125, true, Environment.MachineName);
            SyncAPIConnector connector = new SyncAPIConnector(ser);

            Console.WriteLine("Connected to the server");

            // Login to server
            Credentials credentials = new Credentials(userId, password, "", "YOUR APP NAME");

            LoginResponse loginResponse = APICommandFactory.ExecuteLoginCommand(connector, credentials, true);

            Console.WriteLine("Logged in as: " + userId);

            // Execute GetServerTime command
            ServerTimeResponse serverTimeResponse = APICommandFactory.ExecuteServerTimeCommand(connector, true);

            Console.WriteLine("Server time: " + serverTimeResponse.TimeString);

            // Execute GetAllSymbols command
            AllSymbolsResponse allSymbolsResponse = APICommandFactory.ExecuteAllSymbolsCommand(connector, true);

            Console.WriteLine("All symbols count: " + allSymbolsResponse.SymbolRecords.Count);

            // Print first 5 symbols
            Console.WriteLine("First five symbols:");
            foreach (SymbolRecord symbolRecord in allSymbolsResponse.SymbolRecords.Take(5))
            {
                Console.WriteLine(" > " + symbolRecord.Symbol + " ask: " + symbolRecord.Ask + " bid: " + symbolRecord.Bid);
            }

            Console.Read();
        }
Example #3
0
        public AllSymbolsResponse GetAllSymbols()
        {
            SyncAPIConnector connector     = new SyncAPIConnector(serverData);
            LoginResponse    loginResponse = APICommandFactory.ExecuteLoginCommand(connector, GetCredentials(), true);
            var allSymbolsResponse         = APICommandFactory.ExecuteAllSymbolsCommand(connector, true);

            return(allSymbolsResponse);
        }
        private void ListaInstrumentow()
        {
            try
            {
                SyncAPIConnector   connector          = new SyncAPIConnector(serverData);
                Credentials        credentials        = new Credentials(userId, password, "", "pixelNet");
                LoginResponse      loginResponse      = APICommandFactory.ExecuteLoginCommand(connector, credentials, true);
                AllSymbolsResponse allSymbolsResponse = APICommandFactory.ExecuteAllSymbolsCommand(connector, true);

                ListaInstrumentow fx = new ListaInstrumentow()
                {
                    Symbol = "FX"
                };
                ListaInstrumentow cmd = new ListaInstrumentow()
                {
                    Symbol = "CMD"
                };
                ListaInstrumentow crt = new ListaInstrumentow()
                {
                    Symbol = "CRT"
                };


                foreach (SymbolRecord symbolRecord in allSymbolsResponse.SymbolRecords)
                {
                    if (symbolRecord.CategoryName == "FX")
                    {
                        fx.Pozycje.Add(symbolRecord);
                    }
                    if (symbolRecord.CategoryName == "CMD")
                    {
                        cmd.Pozycje.Add(symbolRecord);
                    }
                    if (symbolRecord.CategoryName == "CRT")
                    {
                        crt.Pozycje.Add(symbolRecord);
                    }
                }

                treev.Items.Add(fx);
                treev.Items.Add(cmd);
                treev.Items.Add(crt);

                LogoutResponse logoutResponse = APICommandFactory.ExecuteLogoutCommand(connector);
            }
            catch (Exception e) { MessageBox.Show(e.Message); }
        }