private void btnSendNewOffer_Click(object sender, EventArgs e) { try { var currency = cbCurrency.SelectedItem.ToString().ToUpper(); var amount = Convert.ToDecimal(txtOfferAmount.Text); var rate = Convert.ToDecimal(txtRate.Text) * 365; var period = Convert.ToInt32(txtDays.Text); var direction = cbDirection.SelectedItem.ToString(); var newOffer = new BitfinexNewOfferPost { Currency = currency, Amount = amount.ToString(), Rate = rate.ToString(), Period = period, Direction = direction }; var newOfferResult = BfExchange.Api.SendNewOffer(newOffer); lbGenericData.Items.Add(newOfferResult.ToString()); } catch (Exception ex) { Logger.LogException(ex); } }
/// <summary> /// rate is the yearly rate. So if you want to borrow/lend at 10 basis points per day you would /// pass in 36.5 as the rate (10 * 365). Also, lend = lend (aka offer swap), loan = borrow (aka receive swap) /// </summary> /// <param name="currency"></param> /// <param name="amount"></param> /// <param name="rate"></param> /// <param name="period"></param> /// <param name="direction"></param> /// <returns></returns> public BitfinexOfferStatusResponse SendNewOffer(string currency, string amount, string rate, int period, string direction) { var newOffer = new BitfinexNewOfferPost() { Amount = amount, Currency = currency, Rate = rate, Period = period, Direction = direction }; return(SendNewOffer(newOffer)); }
/// <summary> /// rate is the yearly rate. So if you want to borrow/lend at 10 basis points per day you would /// pass in 36.5 as the rate (10 * 365). Also, lend = lend (aka offer swap), loan = borrow (aka receive swap) /// The newOffer's currency propery = ExchangeSymbolEnum uppercase. /// </summary> /// <param name="newOffer"></param> /// <returns></returns> public BitfinexOfferStatusResponse SendNewOffer(BitfinexNewOfferPost newOffer) { newOffer.Request = NewOfferRequestUrl; newOffer.Nonce = Common.UnixTimeStampUtc().ToString(CultureInfo.InvariantCulture); var response = GetRestResponse(newOffer); var newOfferResponseObj = JsonConvert.DeserializeObject <BitfinexOfferStatusResponse>(response); Log.Info("Sending New Offer: {0}", newOffer.ToString()); Log.Info("Response From Exchange: {0}", newOfferResponseObj); return(newOfferResponseObj); }
/// <summary> /// rate is the yearly rate. So if you want to borrow/lend at 10 basis points per day you would /// pass in 36.5 as the rate (10 * 365). Also, lend = lend (aka offer swap), loan = borrow (aka receive swap) /// The newOffer's currency propery = ExchangeSymbolEnum uppercase. /// </summary> /// <param name="newOffer"></param> /// <returns></returns> public BitfinexOfferStatusResponse SendNewOffer(BitfinexNewOfferPost newOffer) { newOffer.Request = NewOfferRequestUrl; newOffer.Nonce = Common.UnixTimeStampUtc().ToString(); var client = GetRestClient(NewOfferRequestUrl); var response = GetRestResponse(client, newOffer); var newOfferResponseObj = JsonConvert.DeserializeObject <BitfinexOfferStatusResponse>(response.Content); Log.Trace(string.Format("BitfinexApi.CancelMultipleOrders(): Response From Exchange: {0}", newOfferResponseObj)); return(newOfferResponseObj); }
/// <summary> /// rate is the yearly rate. So if you want to borrow/lend at 10 basis points per day you would /// pass in 36.5 as the rate (10 * 365). Also, lend = lend (aka offer swap), loan = borrow (aka receive swap) /// The newOffer's currency propery = ExchangeSymbolEnum uppercase. /// </summary> /// <param name="newOffer"></param> /// <returns></returns> public BitfinexOfferStatusResponse SendNewOffer(BitfinexNewOfferPost newOffer) { newOffer.Request = NewOfferRequestUrl; newOffer.Nonce = Common.UnixTimeStampUtc().ToString(); var client = GetRestClient(NewOfferRequestUrl); var response = GetRestResponse(client, newOffer); var newOfferResponseObj = JsonConvert.DeserializeObject <BitfinexOfferStatusResponse>(response.Content); NewOfferStatusMsg(newOfferResponseObj); Logger.Log.InfoFormat("Sending New Offer: {0}", newOffer.ToString()); Logger.Log.InfoFormat("Response From Exchange: {0}", newOfferResponseObj); return(newOfferResponseObj); }
/// <summary> /// rate is the yearly rate. So if you want to borrow/lend at 10 basis points per day you would /// pass in 36.5 as the rate (10 * 365). Also, lend = lend (aka offer swap), loan = borrow (aka receive swap) /// The newOffer's currency propery = ExchangeSymbolEnum uppercase. /// </summary> /// <param name="newOffer"></param> /// <returns></returns> public Task <BitfinexOfferStatusResponse> SendNewOfferAsync(BitfinexNewOfferPost newOffer) { return(Task.Run(() => SendNewOffer(newOffer))); }