Bitcoin Forum
December 08, 2016, 04:21:46 PM *
News: To be able to use the next phase of the beta forum software, please ensure that your email address is correct/functional.
 
   Home   Help Search Donate Login Register  
Pages: [1]
  Print  
Author Topic: EasyMTGox - simple .NET API-wrapper for MTGox  (Read 1244 times)
ThePok
Full Member
***
Offline Offline

Activity: 137


View Profile
July 03, 2011, 03:58:48 PM
 #1

With EasyMTGox you can access MTGox from inside you own .NET Application!

In the Download is a Sampleapplication that shows nearly everything that can be done! (trader.exe)

http://www-user.tu-chemnitz.de/~rimarc/wordpress/easymtgox-simple-net-api-wrapper-to-mtgox/

Its as easy as a Hello World:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using EasyMTGoxNS;
namespace ConsoleApplication2
{
class Program
{
static void Main(string[] args)
{
Console.WriteLine(”Lastprice:” + EasyMTGox.GetTickerData().LastPrice.ToString()+”USD/BTC”);
Console.WriteLine(”Input your username”);
string Username = Console.ReadLine();
Console.WriteLine(”Input your Password:”);
string Password = Console.ReadLine();

EasyMTGox EMTGOX = new EasyMTGox(Username, Password);
if (EMTGOX.IsConnectionFine())
{

Balance Balance = EMTGOX.GetBalance();
Console.WriteLine(”You have ” + Balance.BTC + “BTC” + ” and ” + Balance.USD + “USD”);

Console.WriteLine(”How many BTC do you want to buy?”);
string amount = Console.ReadLine();
Console.WriteLine(”Maximum price you want to pay per BTC in USD?”);
string price = Console.ReadLine();
EMTGOX.BuyBTCOrder(amount, price);
}

else
{
Console.WriteLine(”Something went wrong! Check Username Password and Internetconnection!”);
}
Console.ReadLine();
}
}
}

This little Programm shows the Last Price on MTGox and you can send an order to buy BTC!
All the API Functions are included! Get the DepthOfMarket, your open Orders, the Ticker, delet Orders!
Its not Freeware!!! You have to Pay 0.01BTC fee per Trade with a probability. Thats 0.01BTC in any case for 100 and more BTC trades.
If you send an Order over 50BTC you have to pay the fee with probability of 50%. If you trade 1 BTC, you have to pay the Fee with 1% and so on. You never have to pay more than 0.01BTC per order.

There are many Events that get trickert too, so you can write an Eventdriven Programm too. Everything that can be done Wthout an MTGox Account uses static functions.


I know, i have no reputation. But i can tell you, iam Hosting this Programm on the Webspace from my University. So i am not Anonym.

What do you think?
1481214106
Hero Member
*
Offline Offline

Posts: 1481214106

View Profile Personal Message (Offline)

Ignore
1481214106
Reply with quote  #2

1481214106
Report to moderator
Advertised sites are not endorsed by the Bitcoin Forum. They may be unsafe, untrustworthy, or illegal in your jurisdiction. Advertise here.
saykor
Sr. Member
****
Offline Offline

Activity: 350


View Profile WWW
July 03, 2011, 04:47:25 PM
 #2

Everyone can host a program on Webspace from his University. This is not a guarantee for trust.

Anyway good job and good luck but personally i not will use your program to pay to you a fee when i can make a transactions directly from their website. Other question is that I will ever use a MTGox. They have a too many hacks in last month.

Let's color the MOON: YP4ZV8yabKGBKG2uNWHQBwrdURkyxqst4D
Before to do business with me you can check my  BitcoinFeedback; ebay and .net developer profile
ThePok
Full Member
***
Offline Offline

Activity: 137


View Profile
July 03, 2011, 04:55:35 PM
 #3

Yes, i know.

In first line, i did make it for personal use.

And now i try to get some extra juce out of that work Wink

The Programm can be helpfull even without MTGox account. It Shows a list of the MarketDepth, Tickerdata, and Livestream of Trades with help of  Bitcoincharts.com




Maxim Gladkov
Newbie
*
Offline Offline

Activity: 28



View Profile WWW
July 08, 2011, 03:39:53 PM
 #4

Nice to see .NET developers in here... Don't you want to make a WPF/Silverlight app as example? Tongue

NYConsultant
Newbie
*
Offline Offline

Activity: 21


View Profile
July 09, 2011, 05:44:23 AM
 #5

Nice to see .NET developers in here... Don't you want to make a WPF/Silverlight app as example? Tongue

+1 on seeing other .NET devs here.

As to the OP, not too sure why people would pay for a wrapper that anyone proficient in C# can write within 30 minutes.

I think the value add would be a Silverlight/WPF frontend as Maxim said
Maxim Gladkov
Newbie
*
Offline Offline

Activity: 28



View Profile WWW
July 09, 2011, 10:13:44 AM
 #6

Nice to see .NET developers in here... Don't you want to make a WPF/Silverlight app as example? Tongue

+1 on seeing other .NET devs here.

As to the OP, not too sure why people would pay for a wrapper that anyone proficient in C# can write within 30 minutes.

I think the value add would be a Silverlight/WPF frontend as Maxim said

Fully, agree. But I think community don't need new MtGox watcher in .NET... We need normal Client with all necessary watchers and trackers and, of course, sexy UI...

txcoin
Jr. Member
*
Offline Offline

Activity: 32


View Profile
July 09, 2011, 04:36:09 PM
 #7

For all the C# devs around here: This is the basic code to use the API as of today.

        public static string GetBalance(string userName, string password)
        {
            // parameters: name1=value1&name2=value2
            var parameters = "name=" + HttpUtility.UrlEncode(userName)
                 + "&pass=" + HttpUtility.UrlEncode(password);

            var req = (HttpWebRequest) WebRequest.Create("https://mtgox.com/code/getFunds.php");

            req.ContentType = "application/x-www-form-urlencoded";
            req.Method = "POST";
            req.UserAgent = "Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; WOW64; Trident/5.0)";
            req.Accept = "application/json";

            byte[] bytes = Encoding.ASCII.GetBytes(parameters);
            req.ContentLength = bytes.Length;

            Stream os = req.GetRequestStream();
            os.Write(bytes, 0, bytes.Length);
            os.Close();

            WebResponse resp = req.GetResponse();

            try
            {
                var sr = new StreamReader(resp.GetResponseStream());
                return sr.ReadToEnd().Trim();
            }
            catch (Exception ex)
            {
                Logger.Fatal(ex.Message);
                Logger.FatalException(ex.InnerException.ToString(), ex);   
                return null;
            }
        } // end HttpPost


As this may become out of date pretty much any moment, also look out for comments by "SlipperySlope" on how to do it in Java. The only change you have to make is that whenever we writes that he is using HtmlEncoding, in C# the UrlEncoding is needed.


Cheers
txcoin

PS: Thus, no need to run a dubious exe and pay fees to anyone obsfuscating his code without reason. We are a community.

1AcwaWn5Xu1LjWBts6YjQyumWaEg6Mh9jb
Pages: [1]
  Print  
 
Jump to:  

Sponsored by , a Bitcoin-accepting VPN.
Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!