static void Main(string[] args) { Console.WriteLine("Hello World!"); BCRestClient bcClient = new BCRestClient("a1bf9170e49bf603d4faf500c768908927ad2e3254e6e6a3cd7dfeeace2b01a5", "554934414"); NewTransactionResponseModel newTrans = bcClient.PlaceOrder(new LimitTransactionModel { action = TransactionType.BUY, amount = "10", rate = "1", market1 = CryptoCurrency.BTC, market2 = FiatCurrency.PLN, }); if (newTrans.success) { Console.WriteLine($"Offer {newTrans.code} placed with message {newTrans.message}"); TransactionModel transactions = bcClient.GetActiveTransactions(); foreach (Offer trans in transactions.offers) { Console.WriteLine($"Canceling {trans.nr} {trans.price} {trans.offertype}"); Thread.Sleep(1000); bcClient.CancelOffer(trans); } } }
/// <summary> /// Place new transaction on specify market. Use new LimitTransactionModel to create new transaction object. /// </summary> /// <param name="transaction"></param> /// <returns></returns> public NewTransactionResponseModel PlaceOrder(LimitTransactionModel transaction) { if (key == null || secret == null) { throw new ArgumentException("This method need key and secret (key and id)"); } IRestRequest req = new RestRequest(); req = addMandatoryParameters(req, "transactions", transaction.action); req.AddParameter("market1", transaction.market1); req.AddParameter("market2", transaction.market2); req.AddParameter("amount", transaction.amount); req.AddParameter("rate", transaction.rate); string responsestring = client.Execute(req).Content; NewTransactionResponseModel response = JsonConvert.DeserializeObject <NewTransactionResponseModel>(responsestring); return(response); }