internal static TransactionsPage GetTransactionsPage(string accountId, DateTime from, DateTime to) { string fromStr = OandaV20Utils.ConvertDateTimeToOandaFormat(from, true); string toStr = OandaV20Utils.ConvertDateTimeToOandaFormat(to, true); string requestString = Server(EServer.Account) + "accounts/" + accountId + "/transactions?to=" + toStr + "&from=" + fromStr; var responce = MakeRequest <TransactionsPage>(requestString); return(responce); }
public string GetRequestString() { var result = new StringBuilder(); result.Append("instruments/"); result.Append(InstrumentId); result.Append("/candles"); bool firstJoin = true; foreach (var declaredField in this.GetType().GetFields()) { if (Attribute.IsDefined(declaredField, typeof(NonSerializedAttribute))) { continue; } var prop = declaredField.GetValue(this); if (prop == null) { continue; } if (firstJoin) { result.Append("?"); firstJoin = false; } else { result.Append("&"); } var dt = prop as DateTime?; if (dt != null && dt.HasValue) { result.Append(declaredField.Name + "=" + Uri.EscapeDataString(OandaV20Utils.ConvertDateTimeToOandaFormat(dt.Value))); } else { result.Append(declaredField.Name + "=" + Uri.EscapeDataString(prop.ToString())); } } return(result.ToString()); }