using System; using System.Net; using System.Text; namespace AuthMoexSmpl { class Program { static void Main(string[] args) { string authLink = "https://passport.moex.com/authenticate"; HttpWebRequest request = (HttpWebRequest)WebRequest.Create(authLink); request.ContentType = "text/plain; charset=utf-8"; request.Headers["Authorization"] = "Basic " + Convert.ToBase64String(Encoding.GetEncoding("ISO-8859-1").GetBytes("login:password")); //свои данные request.PreAuthenticate = true; request.CookieContainer = new CookieContainer(); HttpWebResponse response = request.GetResponse() as HttpWebResponse; for(int i=0; i < response.Headers.Count; ++i) Console.WriteLine("\nHeader Name:{0}, Value :{1}",response.Headers.Keys[i],response.Headers[i]); } } }
D:\devel\net\AuthMoexSmpl>dotnet run Header Name:Cache-Control, Value :no-store, must-revalidate, no-cache, ma Header Name:Connection, Value :close Header Name:Date, Value :Fri, 10 Nov 2017 19:53:12 GMT Header Name:Pragma, Value :no-cache Header Name:ETag, Value :"xxxxxx" Header Name:Server, Value :nginx Header Name:Set-Cookie, Value :MicexPassportCert=xxxxxxx; domain=.moex.com; path=/, _passport_se m xxxxx; path=/; HttpOnly Header Name:Status, Value :200 OK Header Name:X-Runtime, Value :713 Header Name:X-Moex-Passport-Certificate, Value :xxxxxx Header Name:X-Powered-By, Value :Phusion Passenger 4.0.57 Header Name:Access-Control-Allow-Credentials, Value :true Header Name:Access-Control-Expose-Headers, Value :X-MicexPassport-Marker
using System; using System.Net; using System.Text; namespace AuthMoexSmpl { class Program { static void Main(string[] args) { string authLink = "https://passport.moex.com/authenticate"; HttpWebRequest request = (HttpWebRequest)WebRequest.Create(authLink); request.ContentType = "text/plain; charset=utf-8"; request.Headers["Authorization"] = "Basic " + Convert.ToBase64String(Encoding.GetEncoding("ISO-8859-1").GetBytes("login:password")); // вносим свои данные request.PreAuthenticate = true; request.CookieContainer = new CookieContainer(); HttpWebResponse response = request.GetResponse() as HttpWebResponse; foreach (Cookie cook in response.Cookies) { Console.WriteLine("Cookie:"); Console.WriteLine("{0} = {1}", cook.Name, cook.Value); Console.WriteLine("Domain: {0}", cook.Domain); Console.WriteLine("Path: {0}", cook.Path); Console.WriteLine("Port: {0}", cook.Port); Console.WriteLine("Secure: {0}", cook.Secure); Console.WriteLine("When issued: {0}", cook.TimeStamp); Console.WriteLine("Expires: {0} (expired? {1})", cook.Expires, cook.Expired); Console.WriteLine("Don't save: {0}", cook.Discard); Console.WriteLine("Comment: {0}", cook.Comment); Console.WriteLine("Uri for comments: {0}", cook.CommentUri); Console.WriteLine("Version: RFC {0}" , cook.Version == 1 ? "2109" : "2965"); Console.WriteLine ("String: {0}", cook.ToString()); } } } }
D:\devel\net\AuthMoexSmpl>dotnet run Cookie: _passport_session = xxxxxxxxxxxxxxxxxxxxxxxxxxxxx Domain: passport.moex.com Path: / Port: Secure: False When issued: 11.11.2017 01:55:42 Expires: 01.01.0001 00:00:00 (expired? False) Don't save: False Comment: Uri for comments: Version: RFC 2965 ...
reversed=1и оставить только строчку номер 15 в запросе
limit=1получим запрос вида
https://iss.moex.com/iss/engines/futures/markets/forts/securities/SiZ7/trades.json?reversed=1&limit=1Вариант автоматизации упрощенно:
using System; using System.Net; using System.IO; using System.Text; namespace GetLastPrice { class Program { static void Main(string[] args) { string newLine; string[] lastLine; string link = "https://iss.moex.com/iss/engines/futures/markets/forts/securities/SiZ7/trades.json?reversed=1&limit=1"; int count = 0; for (;;) { HttpWebRequest request = (HttpWebRequest)WebRequest.Create(link); request.ContentType = "text/plain; charset=utf-8"; HttpWebResponse response = request.GetResponse() as HttpWebResponse; using (Stream responseStream = response.GetResponseStream()) { StreamReader sr = new StreamReader(responseStream, Encoding.UTF8); while ((newLine = sr.ReadLine()) != null) { if (count == 14) { if (newLine =="") break; else { lastLine = newLine.Split(","); Console.WriteLine("Volume is " + lastLine[6] +" at Price " + lastLine[5]); } } count++; } } count = 0; response.Close(); } } } }
dotnet run
dotnet publish -c Release -r win7-x64для Ubuntu 14.04:
dotnet publish -c Release -r ubuntu.14.04-x64
Debian is a free operating system that comes with over 43,000 packages and runs in many architectures and even different kernels. The 64-bit version of Debian GNU/Linux for Intel architecture is one of the most popular Linux distributions in the market, used by developers, governments, enterprises, application architects and derivative developers alike.
Today, I’m happy to share that Microsoft is taking its relationship with the Eclipse community to the next level by joining the Eclipse Foundation as a Solutions Member. Joining the Eclipse Foundation enables us to collaborate more closely with the Eclipse community, deliver a great set of tools and services for all development teams, and continuously improve our cloud services, SDKs and tools.
Microsoft R Open is the enhanced distribution of open source R from Microsoft Corporation. Enhancements include multi-core processing, a fixed CRAN repository date, and reproducible R with the checkpoint package.
Today I’m excited to announce our plans to bring SQL Server to Linux as well. This will enable SQL Server to deliver a consistent data platform across Windows Server and Linux, as well as on-premises and cloud. We are bringing the core relational database capabilities to preview today, and are targeting availability in mid-2017.
Координацией проекта займётся независимая некоммерческая организация .NET Foundation, созданная Microsoft в сотрудничестве с созданной Мигелем де Икаса компанией Xamarin. Начиная со следующего выпуска планируется полностью открыть весь серверный стек .NET, включая ASP.NET 5, JIT-компилятор, Common Language Runtime и основные библиотеки классов. Кроме того, все компоненты серверной платформы .Net будут портированы для операционных систем Linux и OS X, которые будут готовы для промышленного применения и будут поддерживаться наряду с Windows.