Bitcoin Forum
July 30, 2024, 09:25:45 PM *
News: Latest Bitcoin Core release: 27.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: C# code working with Bitstamp, BTC-e, Bitfinex, Cryptsy  (Read 1782 times)
bitdude (OP)
Sr. Member
****
Offline Offline

Activity: 277
Merit: 254


View Profile
June 24, 2014, 09:53:35 AM
 #1

Hi,

this is my private C# code that I use for my automatic trading operations. I wonder if someone would find it useful too. If you would, feel free to bid.


Auction rules

Starting price: 0.035 BTC
Smallest price increment: 0.005 BTC
Auction ends: 29th June, 2PM forum time
Winning bids are binding.
Escrow? Possible, if you need it, you arrange the deal and pay fees. Must be super trusted like JohnK. Mutual agreement on the guy is needed.
The winner gets nonexclusive copy of the source code under the license terms mentioned below.
No PM bids accepted for this auction.

If you are interested in modifications of this code or creating custom tools, please do not post in this auction. This auction is only for the code as described below. If you are interested in something else, just let me know in PM what would you need and include your offer in BTC too.

License
By bidding you agree that if you win, you will not be allowed to sell the code to other persons, you just get a license to use the code for yourself. You will be allowed to modify the source code and add new features, create your own tools, but not to sell my code or its parts. Thanks for understanding.

Guarantee
The tool is being sold as is. I use it for myself, that is primary purpose of its existence. I just thought that someone else might be interested in this too, so that could make me some extra satoshis. I really can not guarantee you any additional coding work in the future for 0.035 BTC or similar amounts. It just works now. Updates needed due to API changes of supported services can be done upon mutual agreement, but not free of charge.

However, I offer you updates in case something does not work or stops working within 20 days after purchase. For example, if Bitstamp changes their API in 20 days from purchase, you will get update for free so that you can use the code again. If I fail to give you that update within 14 days of your request, you get your money back.

So, what is being sold?
For my own trading I have coded tools in C# that I use daily, works well for me. Here, I do not offer any particular tool or bot, but a code that works with supported services' API. I will give you that source code and tell you how to use it.

This code works on Windows - Vista and higher for sure, any .NET 4 machine should be fine (*nix systems might have Mono or Wine, but I am not familiar with these and I do not know if my program runs under Mono or Wine; if you are *nix user, it is completely your risk to bid in this auction, you might end with a thing you might not be able to use on your non-Windows system; however, if you use VirtualBox or VMware with Windows, it would work for sure).

Little about the code
Best to see some samples, on how I use it. Let's say we want BTC-e and trade LTC and BTC.

We start with initialization of BTC-e API and then we create BTC-e trade server and execute a buy order:

Code:
        BtceAPI BtceApi = new BtceAPI(BtceApiKey, BtceApiSecret);
        Btce_LtcBtc = new TradeServerBtce(BtceApi, xCurrency.Pairs.LtcBtc);

        string orderId = null;
        if (Btce_LtcBtc.Buy(0.1m, 0.02m, out orderId))
        {
          if (BtceApi.waitOrderFinished(orderId, 10000))
          {
            Console.WriteLine("You just bought 0.1 LTC.");
          }
          else Console.WriteLine("Order did not get executed within 10 seconds, order ID {0}.", orderId);
        }
        else Console.WriteLine("Unable to execute buy order.");

What is trade server? That is an abstraction of a trading platform such as BTC-e or Bitstamp, but with a particular trading pair selected. A bitcoin platform (in my code called BitcoinServer) has its order books, best bid/ask, currencies it supports, currency pairs that can be traded there, trading fees, balances for each supported currency, and obviously some methods such as UpdateOrderBook, UpdateBalance, UpdateBestBidAsk, TradeFeeUpdate, Buy, Sell. Trade server is an instance with a trading pair selected, so if you want to trade a particular pair, you create a trade server for it. So, a trade server has a single order book, single best bid and best ask amount and value, and is easy to operate.

So, in short, I have a simple abstraction that allows me to do basic tasks that are common to all supported platforms - Buy, Sell, wait until order is finished, get balance, get fees. By no means my code supports all functions of all platforms. Only these important things that I needed to create working trading bots. If you need to support more functions, it is easy to extend since the hard work is done.

bitdude (OP)
Sr. Member
****
Offline Offline

Activity: 277
Merit: 254


View Profile
June 26, 2014, 02:28:37 PM
 #2

little bump
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!