internal static void Sell(string pair) { if (pair.StartsWith("t")) { pair = pair.Substring(1).ToLower(); } float qty = Exchange.Portfolio[pair.Substring(0, 3).ToUpper()]; Random r = new Random(); BitfinexNewOrderResponse resp = SendSimpleLimitSell(pair, qty.ToString().Replace(",", "."), r.NextDouble().ToString().Replace(",", ".")); Console.WriteLine("Sold " + resp.OriginalAmount + " " + resp.Symbol + " for " + resp.Price); RetrieveBalances(); }
private static readonly string DefaultOrderType = "exchange market"; //Either “market” / “limit” / “stop” / “trailing-stop” / “fill-or-kill” / “exchange market” / “exchange limit” / “exchange stop” / “exchange trailing-stop” / “exchange fill-or-kill”. (type starting by “exchange ” are exchange orders, others are margin trading orders) internal static void Buy(string pair, float closePrice, float qty) { if (pair.StartsWith("t")) { pair = pair.Substring(1).ToLower(); } float amount = BBBullMarket.BuyQty / closePrice; Random r = new Random(); BitfinexNewOrderResponse resp = SendSimpleLimitBuy(pair, amount.ToString().Replace(",", "."), r.NextDouble().ToString().Replace(",", ".")); Console.WriteLine("Bought " + resp.OriginalAmount + " " + resp.Symbol + " for " + resp.Price); RetrieveBalances(); }
private void OnOrderFeedMsg(BitfinexNewOrderResponse orderResponse) { }
private void ApiOnOrderFeedMsg(BitfinexNewOrderResponse orderResponse) { lbLogger.Items.Add(orderResponse.ToString()); }
protected virtual void OnOrderFeedMsg(BitfinexNewOrderResponse orderResponse) { }
public OrderFeedMsgEventArgs(BitfinexNewOrderResponse orderResponse) { OrderResponse = orderResponse; }
protected virtual void OnOrderFeedMsg(BitfinexNewOrderResponse orderResponse) { OrderFeedMsg?.Invoke(this, new OrderFeedMsgEventArgs(orderResponse)); }