Esempio n. 1
0
 public Order(long timestamp, string iD, long created, Trade.TradeType type, string orderStatus, double price, double amount, double remainingAmount, string currencyPair, string takeProfit)
 {
     Timestamp       = timestamp;
     ID              = iD;
     Created         = created;
     Type            = type;
     OrderStatus     = orderStatus;
     Price           = price;
     Amount          = amount;
     RemainingAmount = remainingAmount;
     CurrencyPair    = currencyPair;
     TakeProfit      = takeProfit;
 }
Esempio n. 2
0
        /// <summary>
        /// Places new limit order.
        /// </summary>
        /// <param name="tradingPair">E.g. btcusdt</param>
        /// <param name="side">Buy or sell</param>
        /// <param name="amount"></param>
        /// <param name="price"></param>
        /// <returns>Returns order's ID or null if there was an error placing the order.</returns>
        public string AddLimitOrder(string tradingPair, Trade.TradeType side, double amount, double price)
        {
            string endpoint = Statics.Private_AddOpenOrder;

            KeyValuePair <string, string>[] data =
            {
                new KeyValuePair <string, string>("tradingPair", tradingPair),
                new KeyValuePair <string, string>("side",        side.ToString().ToLower()),
                new KeyValuePair <string, string>("amount",      amount.ToString()),
                new KeyValuePair <string, string>("price",       price.ToString())
            };

            string response = Networking.PostResponseSigned(endpoint, this.Credentials, data);

            JObject responseJson = JObject.Parse(response);

            if ((string)responseJson["status"] == "ok")
            {
                return((string)responseJson["orderdId"]);
            }
            return
                (null);
        }
 static Trade SetupANewTradeForStock(string stockSymbol, int qty, Trade.TradeType type, double price)
 {
     return(new Trade(_stockService._stockRepository.FindBySymbol(stockSymbol), DateTime.Now, qty, type, price));
 }
 /// <summary>'#]
 /// Recording a trade.  An event of Sell/Buy has occured for a stock
 /// and it needs to be recorded.
 /// </summary>
 /// <param name="stock"></param>
 private void recordTrade(Stock stock, int quanitityOfShares, Trade.TradeType trade, double price)
 {
     _tradeRepository.Add(new Trade(stock, DateTime.Now, quanitityOfShares, trade, price));
 }