-
-
Save anonymous/3abe1cd1b74ae60655e9 to your computer and use it in GitHub Desktop.
Crypto Coin Price version 1.0.0
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
'Developer: Skilo with the help of Ditto and the community at stackoverflow.com | |
'Crypto price | |
'An application for getting the prices of various crypto currencies from various different exchanges | |
'Liscence: GPLv3 Free Software | |
Imports System.Net | |
Imports System.IO | |
Imports System.Web.Script.Serialization | |
Public Class Form1 | |
Private Function getData(ByVal Address As String) As String | |
Dim rt As String = "" | |
Dim wRequest As WebRequest | |
Dim wResponse As WebResponse | |
Dim SR As StreamReader | |
wRequest = WebRequest.Create(Address) | |
wResponse = wRequest.GetResponse | |
SR = New StreamReader(wResponse.GetResponseStream) | |
rt = SR.ReadToEnd | |
SR.Close() | |
Dim js As New System.Web.Script.Serialization.JavaScriptSerializer | |
Dim counter As Integer | |
Dim out As New System.Text.StringBuilder(1000) | |
Dim cObjects = js.Deserialize(rt, New Object().GetType()) | |
For Each testObj In cObjects | |
Dim high = testObj.Value("high") | |
Dim low = testObj.Value("low") | |
Dim avg = testObj.Value("avg") | |
Dim vol = testObj.Value("vol") | |
Dim last = testObj.Value("last") | |
Dim buy = testObj.Value("buy") | |
Dim sell = testObj.Value("sell") | |
' do something with the values | |
out.Append("Data from btc-e.com").AppendLine() | |
counter += 1 | |
If ComboBox1.Text = "BTC/USD" Then | |
out.Append("BTC/USD ").Append(counter).AppendLine() | |
ElseIf ComboBox1.Text = "BTC/RUR" Then | |
out.Append("BTC/RUR ").Append(counter).AppendLine() | |
ElseIf ComboBox1.Text = "LTC/BTC" Then | |
out.Append("LTC/BTC ").Append(counter).AppendLine() | |
ElseIf ComboBox1.Text = "LTC/USD" Then | |
out.Append("LTC/USD ").Append(counter).AppendLine() | |
ElseIf ComboBox1.Text = "LTC/RUR" Then | |
out.Append("LTC/RUR ").Append(counter).AppendLine() | |
ElseIf ComboBox1.Text = "NMC/BTC" Then | |
out.Append("NMC/BTC ").Append(counter).AppendLine() | |
ElseIf ComboBox1.Text = "NVC/BTC" Then | |
out.Append("NVC/BTC ").Append(counter).AppendLine() | |
ElseIf ComboBox1.Text = "USD/RUR" Then | |
out.Append("USD/RUR ").Append(counter).AppendLine() | |
ElseIf ComboBox1.Text = "EUR/USD" Then | |
out.Append("EUR/USD ").Append(counter).AppendLine() | |
ElseIf ComboBox1.Text = "FTC/BTC" Then | |
out.Append("FTC/BTC ").Append(counter).AppendLine() | |
End If | |
out.Append(DateTime.Now).AppendLine() | |
out.Append("High: ").Append(high).AppendLine() | |
out.Append("Low: ").Append(low).AppendLine() | |
out.Append("Average: ").Append(avg).AppendLine() | |
out.Append("Volume: ").Append(vol).AppendLine() | |
out.Append("Last: ").Append(last).AppendLine() | |
out.Append("Buy: ").Append(buy).AppendLine() | |
out.Append("Sell: ").Append(sell).AppendLine() | |
Next | |
Return out.ToString() | |
End Function | |
Private Function campBX(ByVal Address As String) As String | |
Dim rt As String = "" | |
Dim out As String | |
Dim wRequest As WebRequest | |
Dim wResponse As WebResponse | |
Dim SR As StreamReader | |
Dim time As Date | |
time = Now() | |
wRequest = WebRequest.Create(Address) | |
wResponse = wRequest.GetResponse | |
SR = New StreamReader(wResponse.GetResponseStream) | |
rt = SR.ReadToEnd | |
SR.Close() | |
Dim js As New System.Web.Script.Serialization.JavaScriptSerializer | |
Dim testObj = js.Deserialize(rt, New Object().GetType()) | |
out = "Data from campbx.com" + Environment.NewLine | |
out += "--------------------------------" + Environment.NewLine | |
out += (time) + Environment.NewLine | |
out += "Last Trade: " + testObj("Last Trade") + Environment.NewLine | |
out += "Best Bid: " + testObj("Best Bid") + Environment.NewLine | |
out += "Best Ask: " + testObj("Best Ask") | |
Return out | |
End Function | |
Private Function Bitstamp(ByVal Address As String) As String | |
Dim rt As String = "" | |
Dim out As String | |
Dim wRequest As WebRequest | |
Dim wResponse As WebResponse | |
Dim SR As StreamReader | |
Dim Time As Date | |
Time = Now() | |
wRequest = WebRequest.Create(Address) | |
wResponse = wRequest.GetResponse | |
SR = New StreamReader(wResponse.GetResponseStream) | |
rt = SR.ReadToEnd | |
SR.Close() | |
Dim js As New System.Web.Script.Serialization.JavaScriptSerializer | |
Dim testObj = js.Deserialize(rt, New Object().GetType()) | |
out = "Data from bitstamp.net " + Environment.NewLine | |
out += (Time) + Environment.NewLine | |
out += "---------------------------------" + Environment.NewLine | |
out += "Last: $" + testObj("last") + Environment.NewLine | |
out += "Bid: $" + testObj("bid") + Environment.NewLine | |
out += "Ask: $" + testObj("ask") + Environment.NewLine | |
out += "High: $" + testObj("high") + Environment.NewLine | |
out += "Low: $" + testObj("low") + Environment.NewLine | |
out += "Volume: " + testObj("volume") | |
Return out | |
End Function | |
Private Sub ComboBox1_SelectedIndexChanged(sender As Object, e As EventArgs) Handles ComboBox1.SelectedIndexChanged | |
End Sub | |
Private Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click | |
Me.Close() | |
End Sub | |
Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load | |
Me.ComboBox1.Items.AddRange(New String() {"BTC/USD", "BTC/RUR", "BTC/EUR", "LTC/BTC", "LTC/USD", "LTC/RUR", "NMC/BTC", "NVC/BTC", "USD/RUR", "EUR/USD", "FTC/BTC", "PPC/BTC", "CampBX BTC/USD", "Bitstamp BTC/USD"}) | |
End Sub | |
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click | |
If ComboBox1.Text = "BTC/USD" Then | |
TextBox1.Text = getData("https://btc-e.com/api/2/btc_usd/ticker") | |
ElseIf ComboBox1.Text = "BTC/RUR" Then | |
TextBox1.Text = getData("https://btc-e.com/api/2/btc_rur/ticker") | |
ElseIf ComboBox1.Text = "BTC/EUR" Then | |
TextBox1.Text = getData("https://btc-e.com/api/2/btc_eur/ticker") | |
ElseIf ComboBox1.Text = "LTC/BTC" Then | |
TextBox1.Text = getData("https://btc-e.com/api/2/ltc_btc/ticker") | |
ElseIf ComboBox1.Text = "LTC/USD" Then | |
TextBox1.Text = getData("https://btc-e.com/api/2/ltc_usd/ticker") | |
ElseIf ComboBox1.Text = "LTC/RUR" Then | |
TextBox1.Text = getData("https://btc-e.com/api/2/ltc_rur/ticker") | |
ElseIf ComboBox1.Text = "NMC/BTC" Then | |
TextBox1.Text = getData("https://btc-e.com/api/2/nmc_btc/ticker") | |
ElseIf ComboBox1.Text = "NVC/BTC" Then | |
TextBox1.Text = getData("https://btc-e.com/api/2/nvc_btc/ticker") | |
ElseIf ComboBox1.Text = "USD/RUR" Then | |
TextBox1.Text = getData("https://btc-e.com/api/2/usd_rur/ticker") | |
ElseIf ComboBox1.Text = "EUR/USD" Then | |
TextBox1.Text = getData("https://btc-e.com/api/2/eur_usd/ticker") | |
ElseIf ComboBox1.Text = "FTC/BTC" Then | |
TextBox1.Text = getData("https://btc-e.com/api/2/ftc_btc/ticker") | |
ElseIf ComboBox1.Text = "CampBX BTC/USD" Then | |
TextBox1.Text = campBX("http://www.campbx.com/api/xticker.php") | |
ElseIf ComboBox1.Text = "Bitstamp BTC/USD" Then | |
TextBox1.Text = Bitstamp("https://www.bitstamp.net/api/ticker/") | |
ElseIf ComboBox1.Text = "PPC/BTC" Then | |
TextBox1.Text = getData("https://btc-e.com/api/2/ppc_btc/ticker") | |
End If | |
End Sub | |
Private Sub LinkLabel1_LinkClicked(sender As Object, e As LinkLabelLinkClickedEventArgs) Handles LinkLabel1.LinkClicked | |
TextBox1.Text = "BTC: 1M2ar9nvbeeGtCeZ3PAxrgsNTqedmptVTB" + Environment.NewLine + "LTC: LbLLKjBsvGfBCxsFGnr5uSvuyy3hPusTLs" + Environment.NewLine + "FTC: 71bJYtc8dQbCxqbQ2f7rTTRaXUBmvvJPhU" + Environment.NewLine + "Thank you for your support" | |
End Sub | |
End Class |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment