diff --git a/yobit software.sln b/yobit software.sln new file mode 100644 index 0000000..67bb152 --- /dev/null +++ b/yobit software.sln @@ -0,0 +1,25 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 16 +VisualStudioVersion = 16.0.32126.315 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "yobit software", "yobit software\yobit software.csproj", "{170D3E73-0BD2-4A25-A04E-F52AFD0D1B05}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {170D3E73-0BD2-4A25-A04E-F52AFD0D1B05}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {170D3E73-0BD2-4A25-A04E-F52AFD0D1B05}.Debug|Any CPU.Build.0 = Debug|Any CPU + {170D3E73-0BD2-4A25-A04E-F52AFD0D1B05}.Release|Any CPU.ActiveCfg = Release|Any CPU + {170D3E73-0BD2-4A25-A04E-F52AFD0D1B05}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {5A03309A-0B94-4B42-9502-4C3F2DC1038C} + EndGlobalSection +EndGlobal diff --git a/yobit software/App.config b/yobit software/App.config new file mode 100644 index 0000000..56efbc7 --- /dev/null +++ b/yobit software/App.config @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/yobit software/Form1.Designer.cs b/yobit software/Form1.Designer.cs new file mode 100644 index 0000000..0c584c9 --- /dev/null +++ b/yobit software/Form1.Designer.cs @@ -0,0 +1,137 @@ + +namespace yobit_software +{ + partial class Form1 + { + /// + /// Обязательная переменная конструктора. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Освободить все используемые ресурсы. + /// + /// истинно, если управляемый ресурс должен быть удален; иначе ложно. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Код, автоматически созданный конструктором форм Windows + + /// + /// Требуемый метод для поддержки конструктора — не изменяйте + /// содержимое этого метода с помощью редактора кода. + /// + private void InitializeComponent() + { + this.components = new System.ComponentModel.Container(); + this.dataGridView_yobit = new System.Windows.Forms.DataGridView(); + this.pictureBox_yobit = new System.Windows.Forms.PictureBox(); + this.proc_yobit = new System.Windows.Forms.TextBox(); + this.time_step_yobit = new System.Windows.Forms.TextBox(); + this.time_step_timer_yobit = new System.Windows.Forms.Timer(this.components); + this.label1 = new System.Windows.Forms.Label(); + this.label2 = new System.Windows.Forms.Label(); + ((System.ComponentModel.ISupportInitialize)(this.dataGridView_yobit)).BeginInit(); + ((System.ComponentModel.ISupportInitialize)(this.pictureBox_yobit)).BeginInit(); + this.SuspendLayout(); + // + // dataGridView_yobit + // + this.dataGridView_yobit.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize; + this.dataGridView_yobit.Location = new System.Drawing.Point(1, 2); + this.dataGridView_yobit.Name = "dataGridView_yobit"; + this.dataGridView_yobit.Size = new System.Drawing.Size(1000, 336); + this.dataGridView_yobit.TabIndex = 0; + this.dataGridView_yobit.CellMouseDoubleClick += new System.Windows.Forms.DataGridViewCellMouseEventHandler(this.dataGridView_yobit_CellMouseDoubleClick); + // + // pictureBox_yobit + // + this.pictureBox_yobit.Location = new System.Drawing.Point(1, 342); + this.pictureBox_yobit.Name = "pictureBox_yobit"; + this.pictureBox_yobit.Size = new System.Drawing.Size(1000, 362); + this.pictureBox_yobit.TabIndex = 78; + this.pictureBox_yobit.TabStop = false; + // + // proc_yobit + // + this.proc_yobit.Location = new System.Drawing.Point(8, 357); + this.proc_yobit.Name = "proc_yobit"; + this.proc_yobit.Size = new System.Drawing.Size(37, 20); + this.proc_yobit.TabIndex = 81; + this.proc_yobit.Text = "1000"; + this.proc_yobit.TextAlign = System.Windows.Forms.HorizontalAlignment.Center; + this.proc_yobit.TextChanged += new System.EventHandler(this.proc_yobit_TextChanged); + // + // time_step_yobit + // + this.time_step_yobit.Location = new System.Drawing.Point(937, 678); + this.time_step_yobit.Name = "time_step_yobit"; + this.time_step_yobit.Size = new System.Drawing.Size(56, 20); + this.time_step_yobit.TabIndex = 80; + this.time_step_yobit.Text = "1000"; + this.time_step_yobit.TextAlign = System.Windows.Forms.HorizontalAlignment.Center; + // + // time_step_timer_yobit + // + this.time_step_timer_yobit.Enabled = true; + this.time_step_timer_yobit.Interval = 1000; + this.time_step_timer_yobit.Tick += new System.EventHandler(this.time_step_timer_yobit_Tick); + // + // label1 + // + this.label1.AutoSize = true; + this.label1.Location = new System.Drawing.Point(936, 665); + this.label1.Name = "label1"; + this.label1.Size = new System.Drawing.Size(61, 13); + this.label1.TabIndex = 82; + this.label1.Text = "Interval, ms"; + // + // label2 + // + this.label2.AutoSize = true; + this.label2.Location = new System.Drawing.Point(5, 344); + this.label2.Name = "label2"; + this.label2.Size = new System.Drawing.Size(44, 13); + this.label2.TabIndex = 83; + this.label2.Text = "Percent"; + // + // Form1 + // + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.ClientSize = new System.Drawing.Size(1003, 707); + this.Controls.Add(this.label2); + this.Controls.Add(this.label1); + this.Controls.Add(this.proc_yobit); + this.Controls.Add(this.time_step_yobit); + this.Controls.Add(this.pictureBox_yobit); + this.Controls.Add(this.dataGridView_yobit); + this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.Fixed3D; + this.Name = "Form1"; + this.Text = "Yobit"; + this.Load += new System.EventHandler(this.Form1_Load); + ((System.ComponentModel.ISupportInitialize)(this.dataGridView_yobit)).EndInit(); + ((System.ComponentModel.ISupportInitialize)(this.pictureBox_yobit)).EndInit(); + this.ResumeLayout(false); + this.PerformLayout(); + + } + + #endregion + + private System.Windows.Forms.DataGridView dataGridView_yobit; + private System.Windows.Forms.PictureBox pictureBox_yobit; + private System.Windows.Forms.TextBox proc_yobit; + private System.Windows.Forms.TextBox time_step_yobit; + private System.Windows.Forms.Timer time_step_timer_yobit; + private System.Windows.Forms.Label label1; + private System.Windows.Forms.Label label2; + } +} + diff --git a/yobit software/Form1.cs b/yobit software/Form1.cs new file mode 100644 index 0000000..c3c29cb --- /dev/null +++ b/yobit software/Form1.cs @@ -0,0 +1,124 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Data; +using System.Drawing; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows.Forms; + +namespace yobit_software +{ + public partial class Form1 : Form + { + ToolStripLabel info_label_text; + int instrumenty_kol_yobit = 0; + string[,] instrumenty_yobit_array = new string[200, 500000]; + Random rgb_yobit = new Random(); + string[,] graph_yobit = new string[4000, 2000]; + int[,] message_array_color = new int[400, 400]; + + float graph_massht_yobit = 0; + Bitmap bmp_yobit = new Bitmap(1000, 1000); + Graphics g; + byte graph = 0; + + public Form1() + { + InitializeComponent(); + } + + private void Form1_Load(object sender, EventArgs e) + { + dataGridView_edit(); + WebSocket_start(); + } + + private void time_step_timer_yobit_Tick(object sender, EventArgs e) + { + { + time_step_timer_yobit.Interval = Convert.ToInt32(time_step_yobit.Text); + for (int n = 1; n <= instrumenty_kol_yobit; n++) + { + for (int k = 0; k < 1000; k++) + { + graph_yobit[n, k] = graph_yobit[n, k + 1]; graph_yobit[n, k + 1] = null; + } + } + try + { + if (graph == 0) + { + g = Graphics.FromImage(bmp_yobit); + g.Clear(Color.White); + g.DrawLine(new Pen(Color.FromArgb(230, 230, 230)), 0, pictureBox_yobit.Height / 2, pictureBox_yobit.Width, pictureBox_yobit.Height / 2); + for (int n = 1; n <= instrumenty_kol_yobit; n++) + { + if (instrumenty_yobit_array[n, 1] == "1") + { + int pred = 0; float znach = 0; + for (int k = 0; k <= 1000; k++) + { + if (graph_yobit[n, k] != null) + { + if (pred == 0) + { + pred = k; znach = Convert.ToSingle(graph_yobit[n, k].ToString().Replace(".", ",")); + } + else + { + g.DrawLine(new Pen(Color.FromArgb(Convert.ToInt32(instrumenty_yobit_array[n, 6]), Convert.ToInt32(instrumenty_yobit_array[n, 7]), Convert.ToInt32(instrumenty_yobit_array[n, 8]))), + (pred + 2), + pictureBox_yobit.Height / 2 - znach * graph_massht_yobit, + (k + 2), + pictureBox_yobit.Height / 2 - Convert.ToSingle(graph_yobit[n, k].ToString().Replace(".", ",")) * graph_massht_yobit); + pred = k; znach = Convert.ToSingle(graph_yobit[n, k].ToString().Replace(".", ",")); + } + g.DrawLine(new Pen(Color.FromArgb(Convert.ToInt32(instrumenty_yobit_array[n, 6]), Convert.ToInt32(instrumenty_yobit_array[n, 7]), Convert.ToInt32(instrumenty_yobit_array[n, 8]))), + (k + 2) - 1, + pictureBox_yobit.Height / 2 - Convert.ToSingle(graph_yobit[n, k].ToString().Replace(".", ",")) * graph_massht_yobit - 1, + (k + 2) + 1, + pictureBox_yobit.Height / 2 - Convert.ToSingle(graph_yobit[n, k].ToString().Replace(".", ",")) * graph_massht_yobit + 1); + g.DrawLine(new Pen(Color.FromArgb(Convert.ToInt32(instrumenty_yobit_array[n, 6]), Convert.ToInt32(instrumenty_yobit_array[n, 7]), Convert.ToInt32(instrumenty_yobit_array[n, 8]))), + (k + 2) + 1, + pictureBox_yobit.Height / 2 - Convert.ToSingle(graph_yobit[n, k].ToString().Replace(".", ",")) * graph_massht_yobit - 1, + (k + 2) - 1, + pictureBox_yobit.Height / 2 - Convert.ToSingle(graph_yobit[n, k].ToString().Replace(".", ",")) * graph_massht_yobit + 1); + } + } + } + } + pictureBox_yobit.Image = bmp_yobit; + } + } + catch (Exception ex) + { + Console.WriteLine(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss.fff") + " error graph:" + ex); + } + } + } + + private void proc_yobit_TextChanged(object sender, EventArgs e) + { + graph_massht_yobit = pictureBox_yobit.Height / Convert.ToSingle(proc_yobit.Text) / 2; + } + + private void dataGridView_yobit_CellMouseDoubleClick(object sender, DataGridViewCellMouseEventArgs e) + { + System.Diagnostics.Process.Start("chrome.exe", "https://yobit.io/ru/trade/" + dataGridView_yobit.Rows[e.RowIndex].Cells["name"].EditedFormattedValue.ToString()); + } + } + + + public class dataGridView_yobit : DataGridView + { + public dataGridView_yobit() + { + this.DoubleBuffered = true; + this.SetStyle(ControlStyles.DoubleBuffer | + ControlStyles.UserPaint | ControlStyles.AllPaintingInWmPaint, true); + this.UpdateStyles(); + } + } +} diff --git a/yobit software/Form1.resx b/yobit software/Form1.resx new file mode 100644 index 0000000..f0a774c --- /dev/null +++ b/yobit software/Form1.resx @@ -0,0 +1,123 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + 133, 17 + + \ No newline at end of file diff --git a/yobit software/Initialization.cs b/yobit software/Initialization.cs new file mode 100644 index 0000000..db13090 --- /dev/null +++ b/yobit software/Initialization.cs @@ -0,0 +1,35 @@ +using System; +using System.Drawing; +using System.Windows.Forms; + +namespace yobit_software +{ + public partial class Form1 + { + private void dataGridView_edit() + { + dataGridView_yobit.ReadOnly = true; + dataGridView_yobit.Columns.Add("time", "Time adding"); + dataGridView_yobit.Columns["time"].Width = 160; + dataGridView_yobit.Columns.Add("name", "Pair"); + dataGridView_yobit.Columns["name"].Width = 140; + dataGridView_yobit.Columns.Add("change", "Price"); + dataGridView_yobit.Columns["change"].Width = 130; + dataGridView_yobit.Columns.Add("volume", "Volume"); + dataGridView_yobit.Columns["volume"].Width = 130; + dataGridView_yobit.Columns.Add("proc", "Сhange in 24 hours"); + dataGridView_yobit.Columns["proc"].Width = 130; + dataGridView_yobit.Columns.Add("volBTC", "Volume in 24 hours"); + dataGridView_yobit.Columns["volBTC"].Width = 130; + dataGridView_yobit.Columns.Add("kolvo", "Amount of deals"); + dataGridView_yobit.Columns["kolvo"].Width = 130; + dataGridView_yobit.ColumnHeadersDefaultCellStyle.Font = new Font(dataGridView_yobit.ColumnHeadersDefaultCellStyle.Font.FontFamily, 9f, FontStyle.Regular); + dataGridView_yobit.ColumnHeadersDefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter; + dataGridView_yobit.AutoSizeRowsMode = DataGridViewAutoSizeRowsMode.AllCells; + info_label_text = new ToolStripLabel(); + info_label_text.Text = "Start"; + + graph_massht_yobit = pictureBox_yobit.Height / Convert.ToSingle(proc_yobit.Text) / 2; + } + } +} \ No newline at end of file diff --git a/yobit software/Program.cs b/yobit software/Program.cs new file mode 100644 index 0000000..1f766ca --- /dev/null +++ b/yobit software/Program.cs @@ -0,0 +1,22 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; +using System.Windows.Forms; + +namespace yobit_software +{ + static class Program + { + /// + /// Главная точка входа для приложения. + /// + [STAThread] + static void Main() + { + Application.EnableVisualStyles(); + Application.SetCompatibleTextRenderingDefault(false); + Application.Run(new Form1()); + } + } +} diff --git a/yobit software/Properties/AssemblyInfo.cs b/yobit software/Properties/AssemblyInfo.cs new file mode 100644 index 0000000..3d81337 --- /dev/null +++ b/yobit software/Properties/AssemblyInfo.cs @@ -0,0 +1,36 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// Общие сведения об этой сборке предоставляются следующим набором +// набора атрибутов. Измените значения этих атрибутов для изменения сведений, +// связанных со сборкой. +[assembly: AssemblyTitle("yobit software")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("yobit software")] +[assembly: AssemblyCopyright("Copyright © 2022")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// Установка значения False для параметра ComVisible делает типы в этой сборке невидимыми +// для компонентов COM. Если необходимо обратиться к типу в этой сборке через +// COM, следует установить атрибут ComVisible в TRUE для этого типа. +[assembly: ComVisible(false)] + +// Следующий GUID служит для идентификации библиотеки типов, если этот проект будет видимым для COM +[assembly: Guid("170d3e73-0bd2-4a25-a04e-f52afd0d1b05")] + +// Сведения о версии сборки состоят из указанных ниже четырех значений: +// +// Основной номер версии +// Дополнительный номер версии +// Номер сборки +// Редакция +// +// Можно задать все значения или принять номера сборки и редакции по умолчанию +// используя "*", как показано ниже: +// [assembly: AssemblyVersion("1.0.*")] +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/yobit software/Properties/Resources.Designer.cs b/yobit software/Properties/Resources.Designer.cs new file mode 100644 index 0000000..a8dd148 --- /dev/null +++ b/yobit software/Properties/Resources.Designer.cs @@ -0,0 +1,70 @@ +//------------------------------------------------------------------------------ +// +// Этот код создан программным средством. +// Версия среды выполнения: 4.0.30319.42000 +// +// Изменения в этом файле могут привести к неправильному поведению и будут утрачены, если +// код создан повторно. +// +//------------------------------------------------------------------------------ + + +namespace yobit_software.Properties +{ + /// + /// Класс ресурсов со строгим типом для поиска локализованных строк и пр. + /// + // Этот класс был автоматически создан при помощи StronglyTypedResourceBuilder + // класс с помощью таких средств, как ResGen или Visual Studio. + // Для добавления или удаления члена измените файл .ResX, а затем перезапустите ResGen + // с параметром /str или заново постройте свой VS-проект. + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] + internal class Resources + { + + private static global::System.Resources.ResourceManager resourceMan; + + private static global::System.Globalization.CultureInfo resourceCulture; + + [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] + internal Resources() + { + } + + /// + /// Возврат кэшированного экземпляра ResourceManager, используемого этим классом. + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Resources.ResourceManager ResourceManager + { + get + { + if ((resourceMan == null)) + { + global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("yobit_software.Properties.Resources", typeof(Resources).Assembly); + resourceMan = temp; + } + return resourceMan; + } + } + + /// + /// Переопределяет свойство CurrentUICulture текущего потока для всех + /// подстановки ресурсов с помощью этого класса ресурсов со строгим типом. + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Globalization.CultureInfo Culture + { + get + { + return resourceCulture; + } + set + { + resourceCulture = value; + } + } + } +} diff --git a/yobit software/Properties/Resources.resx b/yobit software/Properties/Resources.resx new file mode 100644 index 0000000..af7dbeb --- /dev/null +++ b/yobit software/Properties/Resources.resx @@ -0,0 +1,117 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/yobit software/Properties/Settings.Designer.cs b/yobit software/Properties/Settings.Designer.cs new file mode 100644 index 0000000..3edb73b --- /dev/null +++ b/yobit software/Properties/Settings.Designer.cs @@ -0,0 +1,29 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// Runtime Version:4.0.30319.42000 +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + + +namespace yobit_software.Properties +{ + [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "11.0.0.0")] + internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase + { + + private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings()))); + + public static Settings Default + { + get + { + return defaultInstance; + } + } + } +} diff --git a/yobit software/Properties/Settings.settings b/yobit software/Properties/Settings.settings new file mode 100644 index 0000000..3964565 --- /dev/null +++ b/yobit software/Properties/Settings.settings @@ -0,0 +1,7 @@ + + + + + + + diff --git a/yobit software/WebSocket.cs b/yobit software/WebSocket.cs new file mode 100644 index 0000000..5545006 --- /dev/null +++ b/yobit software/WebSocket.cs @@ -0,0 +1,186 @@ +using System; +using System.Drawing; +using System.Linq; +using WebSocketSharp; + +namespace yobit_software +{ + public partial class Form1 + { + private void WebSocket_start() + { + string[] message_array; + var ws = new WebSocket("wss://pro-pusher.com/"); + ws.Origin = "https://yobit.net"; + ws.OnMessage += (sender, Message) => + { + // message : [36,8459502800938507,2670751664575343,{},["[300,1,\"PAK\",\"BTC\",\"0.00000015\",\"200\",\"0.00000029\",\"0.00000005\",\"65917167.78826904\",\"11.96083069\",\"11.96083069\"]"]] + // 36,8464396815689224,8370293604295211,,8059,2,BCHABC,BTC,0.02872705,0.1,0.02960000,0.02870300,9736.32298686,284.18896423,284.18896423 + //[0]36 + //[1]8464396815689224 + //[2]8370293604295211 + //[3] + //[4]8059 + //[5]2 1-buy 2-sell + //[6]BCHABC + //[7]BTC + //[8]0.02872705 price + //[9]0.1 + //[10]0.02960000 + //[11]0.02870300 + //[12]9736.32298686 + //[13]284.18896423 + //[14]284.18896423 + string message = Message.Data.Replace(" ", "").Replace("message:[", "").Replace("{", "").Replace("}", "").Replace("[", "").Replace("]", "").Replace("\"", "").Replace("\\", ""); + Console.WriteLine(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss.fff") + " message2 : " + Message.Data); + if ((Message.Data.ToString().IndexOf("36,") != -1) && (Message.Data.ToString().IndexOf("ETH") == -1) && (Message.Data.ToString().IndexOf("DOGE") == -1) && (Message.Data.ToString().IndexOf("YO") == -1) && (Message.Data.ToString().IndexOf("WAVES") == -1) && (Message.Data.ToString().IndexOf("USD") == -1) && (Message.Data.ToString().IndexOf("RUR") == -1)) + { + message_array = message.Split(',').ToArray(); + if (message_array.Length == 15) + { + int est = 0; + for (int n = 0; n <= instrumenty_kol_yobit; n++) + { + if (instrumenty_yobit_array[n, 0] == message_array[6] + "/" + message_array[7]) est = n; + } + if (est != 0) + { + dataGridView_yobit.Invoke(new Action(() => dataGridView_yobit.Rows[est - 1].Cells["proc"].Value = message_array[9])); + dataGridView_yobit.Invoke(new Action(() => dataGridView_yobit.Rows[est - 1].Cells["volBTC"].Value = message_array[14])); + } + else + { + { + ws.Send("[32,7403684586532254,{},\"trhist" + message_array[4] + "\"]"); + instrumenty_kol_yobit++; + instrumenty_yobit_array[instrumenty_kol_yobit, 0] = message_array[6] + "/" + message_array[7]; + instrumenty_yobit_array[instrumenty_kol_yobit, 1] = "1"; + instrumenty_yobit_array[instrumenty_kol_yobit, 6] = rgb_yobit.Next(0, 255).ToString(); + instrumenty_yobit_array[instrumenty_kol_yobit, 7] = rgb_yobit.Next(0, 255).ToString(); + instrumenty_yobit_array[instrumenty_kol_yobit, 8] = rgb_yobit.Next(0, 255).ToString(); + instrumenty_yobit_array[instrumenty_kol_yobit, 9] = "1"; + dataGridView_yobit.Invoke(new Action(() => dataGridView_yobit.Rows.Add(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss.fff"), message_array[6] + "/" + message_array[7], "", "", message_array[9], message_array[14], "1"))); + dataGridView_yobit.Invoke(new Action(() => dataGridView_yobit.Rows[instrumenty_kol_yobit - 1].DefaultCellStyle.BackColor = Color.Honeydew)); + dataGridView_yobit.Rows[instrumenty_kol_yobit - 1].Cells["name"].Style.BackColor = System.Drawing.Color.FromArgb(Convert.ToInt32(instrumenty_yobit_array[instrumenty_kol_yobit, 6]), + Convert.ToInt32(instrumenty_yobit_array[instrumenty_kol_yobit, 7]), Convert.ToInt32(instrumenty_yobit_array[instrumenty_kol_yobit, 8])); + if (dataGridView_yobit.Rows[instrumenty_kol_yobit - 1].Cells["proc"].Value != null) + if (dataGridView_yobit.Rows[instrumenty_kol_yobit - 1].Cells["proc"].Value.ToString() != "") + { + graph_yobit[instrumenty_kol_yobit, 1000] = dataGridView_yobit.Rows[instrumenty_kol_yobit - 1].Cells["proc"].Value.ToString(); + } + } + } + } + if (message_array.Length == 12) + { + int est = 0; + for (int n = 0; n <= instrumenty_kol_yobit; n++) + { + if (instrumenty_yobit_array[n, 0] == message_array[6] + "/" + message_array[7]) est = n; + } + if (est != 0) + { + instrumenty_yobit_array[est, 9] = (Convert.ToInt32(instrumenty_yobit_array[est, 9]) + 1).ToString(); + + instrumenty_yobit_array[est, Convert.ToInt32(instrumenty_yobit_array[est, 9]) * 5 + 10] = message_array[11]; + instrumenty_yobit_array[est, Convert.ToInt32(instrumenty_yobit_array[est, 9]) * 5 + 11] = message_array[8]; + instrumenty_yobit_array[est, Convert.ToInt32(instrumenty_yobit_array[est, 9]) * 5 + 12] = message_array[9]; + instrumenty_yobit_array[est, Convert.ToInt32(instrumenty_yobit_array[est, 9]) * 5 + 14] = DateTime.Now.ToString(); + + if (dataGridView_yobit.Rows[est - 1].Cells["proc"].Value != null) + if (dataGridView_yobit.Rows[est - 1].Cells["proc"].Value.ToString() != "") + { + graph_yobit[est, 1000] = dataGridView_yobit.Rows[est - 1].Cells["proc"].Value.ToString(); + + } + dataGridView_yobit.Invoke(new Action(() => dataGridView_yobit.Rows[est - 1].Cells["change"].Value = message_array[8])); + dataGridView_yobit.Invoke(new Action(() => dataGridView_yobit.Rows[est - 1].Cells["volume"].Value = message_array[9])); + dataGridView_yobit.Invoke(new Action(() => dataGridView_yobit.Rows[est - 1].Cells["kolvo"].Value = Convert.ToInt32(instrumenty_yobit_array[est, 9]))); + + message_array_color[est, 0] = message_array_color[est, 0] + 1; + message_array_color[est, 1] = Convert.ToInt32(message_array[5]); + } + else + { + instrumenty_kol_yobit++; + instrumenty_yobit_array[instrumenty_kol_yobit, 0] = message_array[6] + "/" + message_array[7]; + instrumenty_yobit_array[instrumenty_kol_yobit, 1] = "1"; + instrumenty_yobit_array[instrumenty_kol_yobit, 6] = rgb_yobit.Next(0, 255).ToString(); + instrumenty_yobit_array[instrumenty_kol_yobit, 7] = rgb_yobit.Next(0, 255).ToString(); + instrumenty_yobit_array[instrumenty_kol_yobit, 8] = rgb_yobit.Next(0, 255).ToString(); + instrumenty_yobit_array[instrumenty_kol_yobit, 9] = "1"; + instrumenty_yobit_array[instrumenty_kol_yobit, 15] = message_array[11]; + instrumenty_yobit_array[instrumenty_kol_yobit, 16] = message_array[8]; + instrumenty_yobit_array[instrumenty_kol_yobit, 17] = message_array[9]; + instrumenty_yobit_array[instrumenty_kol_yobit, 19] = DateTime.Now.ToString(); + // dataGridView_yobit.Invoke(new Action(() => dataGridView_yobit.Rows.Add(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss.fff"),message_array[6] + "/" + message_array[7], message_array[8], message_array[9]))); + dataGridView_yobit.Invoke(new Action(() => dataGridView_yobit.Rows[instrumenty_kol_yobit - 1].DefaultCellStyle.BackColor = Color.Honeydew)); + dataGridView_yobit.Rows[instrumenty_kol_yobit - 1].Cells["name"].Style.BackColor = System.Drawing.Color.FromArgb(Convert.ToInt32(instrumenty_yobit_array[instrumenty_kol_yobit, 6]), + Convert.ToInt32(instrumenty_yobit_array[instrumenty_kol_yobit, 7]), Convert.ToInt32(instrumenty_yobit_array[instrumenty_kol_yobit, 8])); + message_array_color[instrumenty_kol_yobit, 0] = 1; + } + try + { + graph = 1; + g = Graphics.FromImage(bmp_yobit); + g.Clear(Color.White); + g.DrawLine(new Pen(Color.FromArgb(230, 230, 230)), 0, pictureBox_yobit.Height / 2, pictureBox_yobit.Width, pictureBox_yobit.Height / 2); + for (int n = 1; n <= instrumenty_kol_yobit; n++) + { + if (instrumenty_yobit_array[n, 1] == "1") + { + int pred = 0; float znach = 0; + for (int k = 0; k <= 1000; k++) + { + if (graph_yobit[n, k] != null) + { + if (pred == 0) + { + pred = k; znach = Convert.ToSingle(graph_yobit[n, k].ToString().Replace(".", ",")); + } + else + { + g.DrawLine(new Pen(Color.FromArgb(Convert.ToInt32(instrumenty_yobit_array[n, 6]), Convert.ToInt32(instrumenty_yobit_array[n, 7]), Convert.ToInt32(instrumenty_yobit_array[n, 8]))), + (pred + 2), + pictureBox_yobit.Height / 2 - znach * graph_massht_yobit, + (k + 2), + pictureBox_yobit.Height / 2 - Convert.ToSingle(graph_yobit[n, k].ToString().Replace(".", ",")) * graph_massht_yobit); + pred = k; znach = Convert.ToSingle(graph_yobit[n, k].ToString().Replace(".", ",")); + } + if (graph_yobit[n, k] != null) + if (graph_yobit[n, k] != "") + { + g.DrawLine(new Pen(Color.FromArgb(Convert.ToInt32(instrumenty_yobit_array[n, 6]), Convert.ToInt32(instrumenty_yobit_array[n, 7]), Convert.ToInt32(instrumenty_yobit_array[n, 8]))), + (k + 2) - 1, + pictureBox_yobit.Height / 2 - Convert.ToSingle(graph_yobit[n, k].ToString().Replace(".", ",")) * graph_massht_yobit - 1, + (k + 2) + 1, + pictureBox_yobit.Height / 2 - Convert.ToSingle(graph_yobit[n, k].ToString().Replace(".", ",")) * graph_massht_yobit + 1); + g.DrawLine(new Pen(Color.FromArgb(Convert.ToInt32(instrumenty_yobit_array[n, 6]), Convert.ToInt32(instrumenty_yobit_array[n, 7]), Convert.ToInt32(instrumenty_yobit_array[n, 8]))), + (k + 2) + 1, + pictureBox_yobit.Height / 2 - Convert.ToSingle(graph_yobit[n, k].ToString().Replace(".", ",")) * graph_massht_yobit - 1, + (k + 2) - 1, + pictureBox_yobit.Height / 2 - Convert.ToSingle(graph_yobit[n, k].ToString().Replace(".", ",")) * graph_massht_yobit + 1); + } + } + } + } + } + pictureBox_yobit.Image = bmp_yobit; + graph = 0; + } + catch (Exception ex) + { + Console.WriteLine(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss.fff") + " error gr1 " + ex); + } + } + } + }; + ws.OnError += (sender, error) => Console.WriteLine((DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss.fff") + " OnError: " + error.Message)); + ws.OnClose += (sender, OnClose) => Console.WriteLine((DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss.fff") + " OnClose: " + OnClose.Code.ToString())); + ws.Connect(); + ws.Send("[1,\"restricted_realm\",{\"roles\":{\"caller\":{\"features\":{\"caller_identification\":true,\"progressive_call_results\":true}},\"callee\":{\"features\":{\"caller_identification\":true,\"pattern_based_registration\":true,\"shared_registration\":true,\"progressive_call_results\":true,\"registration_revocation\":true}},\"publisher\":{\"features\":{\"publisher_identification\":true,\"subscriber_blackwhite_listing\":true,\"publisher_exclusion\":true}},\"subscriber\":{\"features\":{\"publisher_identification\":true,\"pattern_based_subscription\":true,\"subscription_revocation\":true}}}}]"); + ws.Send("[32,5859204059174672,{},\"ticker\"]"); + } + } +} + \ No newline at end of file diff --git a/yobit software/packages.config b/yobit software/packages.config new file mode 100644 index 0000000..c31467f --- /dev/null +++ b/yobit software/packages.config @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/yobit software/yobit software.csproj b/yobit software/yobit software.csproj new file mode 100644 index 0000000..134079c --- /dev/null +++ b/yobit software/yobit software.csproj @@ -0,0 +1,93 @@ + + + + + Debug + AnyCPU + {170D3E73-0BD2-4A25-A04E-F52AFD0D1B05} + WinExe + yobit_software + yobit software + v4.7.2 + 512 + true + true + + + AnyCPU + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + + + AnyCPU + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + + + + + + + + + + + + + + + ..\packages\websocketsharp.core.1.0.0\lib\netstandard2.0\websocket-sharp-core.dll + + + + + Form + + + Form + + + Form + + + Form1.cs + + + + + Form1.cs + + + ResXFileCodeGenerator + Resources.Designer.cs + Designer + + + True + Resources.resx + + + + SettingsSingleFileGenerator + Settings.Designer.cs + + + True + Settings.settings + True + + + + + + + \ No newline at end of file