public void UpdatePairData(PoloniexAPI.CurrencyPair pair, Dictionary <string, double> ruleVariables) { if (pairData == null) { pairData = new List <PairData>(); } double[] vars = new double[PairData.varNames.Length]; for (int i = 0; i < PairData.varNames.Length; i++) { double tempVar = 0; ruleVariables.TryGetValue(PairData.varNames[i], out tempVar); vars[i] = tempVar; } for (int i = 0; i < pairData.Count; i++) { if (pairData[i].quoteName == pair.QuoteCurrency) { pairData[i] = new PairData(pair.QuoteCurrency, pair.BaseCurrency, vars); return; } } }
public static List <PoloniexAPI.MarketTools.ITrade> GetTrades(PoloniexAPI.CurrencyPair pair, DateTime startTime, DateTime endTime) { int startTimeUNIX = (int)DateTimeHelper.DateTimeToUnixTimestamp(startTime); int endTimeUNIX = (int)DateTimeHelper.DateTimeToUnixTimestamp(endTime); return(GetTrades(pair, startTimeUNIX, endTimeUNIX)); }
public static List <PoloniexAPI.MarketTools.ITrade> GetTrades(PoloniexAPI.CurrencyPair pair, int startTime, int endTime) { startTime = (int)DateTimeHelper.GetServerTime(startTime); endTime = (int)DateTimeHelper.GetServerTime(endTime); string response = QueryGet("https://poloniex.com/public?command=returnTradeHistory¤cyPair=" + pair + "&start=" + startTime + "&end=" + endTime); return(ParseTrades(response)); }
public static void BlockPair(PoloniexAPI.CurrencyPair pair, bool state) { mainForm.strategyControl1.SetBlockedPairData(pair, state); mainForm.strategyControl1.Invalidate(); PairSummariesManager.SetPairBlock(pair, state); UpdatePairSummaries(); }
public void SetToNoData() { lock (this) { pair = null; MarkedUser = false; priceData = null; } }
public void AddPairData(PoloniexAPI.CurrencyPair pair) { if (pairData == null) { pairData = new List <PairData>(); } pairData.Add(new PairData(pair.QuoteCurrency, pair.BaseCurrency)); UpdateModulesScreen(); }
public static bool UnmarkPairUser(PoloniexAPI.CurrencyPair pair) { if (PairSummariesManager.MarkPairSummary(pair, false)) { UpdatePairSummaries(); return(true); } else { return(false); } }
public static void ForceBuy(string[] parameters) { if (parameters == null || parameters.Length != 2) { throw new Exception("Wrong Parameters"); } PoloniexAPI.CurrencyPair pair = new PoloniexAPI.CurrencyPair("BTC", parameters[1].ToUpper()); if (!Trading.Manager.ForceBuy(pair)) { throw new Exception("Specified currency does not exist"); } }
public void SetBlockedPairData(PoloniexAPI.CurrencyPair pair, bool state) { if (pairData == null) { pairData = new List <PairData>(); } for (int i = 0; i < pairData.Count; i++) { if (pairData[i].quoteName == pair.QuoteCurrency) { pairData[i].blocked = state; return; } } }
// -------------------------- public void UpdatePair(PoloniexAPI.CurrencyPair pair, PoloniexAPI.TickerChangedEventArgs[] tickers, bool marked) { if (pair == null) { return; } if (tickers == null || tickers.Length == 0) { return; } this.pair = pair; this.MarkedUser = marked; lock (this) { List <PoloniexAPI.TickerChangedEventArgs> tempList = new List <PoloniexAPI.TickerChangedEventArgs>(); long startTime = tickers.Last().Timestamp - (GraphTimeframe * 3600 + 900); long lastTime = 0; bool doneSkip = false; for (int i = 0; i < tickers.Length; i++) { if (!doneSkip && tickers[i].Timestamp < startTime) { continue; } doneSkip = true; if (tickers[i].Timestamp - 60 < lastTime) { continue; } tempList.Add(tickers[i]); lastTime = tickers[i].Timestamp; } priceData = tempList.ToArray(); } this.lastPrice = tickers.Last().MarketData.PriceLast; this.change24 = tickers.Last().MarketData.PriceChangePercentage * 100; this.volume = tickers.Last().MarketData.Volume24HourBase; }
public static IList <PoloniexAPI.MarketTools.IMarketChartData> GetChartData( PoloniexAPI.CurrencyPair currencyPair, PoloniexAPI.MarketTools.MarketPeriod period, DateTime startTime, DateTime endTime) { int startTimestamp = (int)Utility.DateTimeHelper.DateTimeToUnixTimestamp(startTime); int endTimestamp = (int)Utility.DateTimeHelper.DateTimeToUnixTimestamp(endTime); startTimestamp = (int)Utility.DateTimeHelper.GetServerTime(startTimestamp); endTimestamp = (int)Utility.DateTimeHelper.GetServerTime(endTimestamp); string response = QueryGet("https://poloniex.com/public?command=returnChartData¤cyPair=" + currencyPair + "&start=" + startTimestamp + "&end=" + endTimestamp + "&period=" + (int)period); return(ParseChartData(response)); }
public static void UnmarkPair(string[] parameters) { if (parameters == null || parameters.Length != 2) { throw new Exception("Wrong Parameters"); } Utility.ThreadManager.Register(() => { PoloniexAPI.CurrencyPair pair = new PoloniexAPI.CurrencyPair("BTC", parameters[1].ToUpper()); if (GUI.GUIManager.UnmarkPairUser(pair)) { CLI.Manager.PrintNote("Removing " + pair.QuoteCurrency + " from display priority."); } else { CLI.Manager.PrintError("Specified currency not found in tracked pairs!"); } }, "Unmark Pair", false); }
public static void Resume(string[] parameters) { if (parameters == null || parameters.Length != 2) { throw new Exception("Wrong Parameters"); } string param = parameters[1].Trim().ToLower(); if (param == "all") { Trading.Manager.ResumeAll(); } else { PoloniexAPI.CurrencyPair pair = new PoloniexAPI.CurrencyPair("BTC", parameters[1].Trim().ToUpper()); Trading.Manager.ResumePair(pair); } }
public static void SetPairSummary(PoloniexAPI.CurrencyPair pair, PoloniexAPI.TickerChangedEventArgs[] tickers, double volume) { PairSummariesManager.SetPairSummary(pair, tickers, volume); UpdatePairSummaries(); }
// -------------------- public static List <PoloniexAPI.MarketTools.ITrade> GetTrades(PoloniexAPI.CurrencyPair pair) { string response = QueryGet("https://poloniex.com/public?command=returnTradeHistory¤cyPair=" + pair.ToString()); return(ParseTrades(response)); }
public static void RemovePairSummary(PoloniexAPI.CurrencyPair pair) { PairSummariesManager.RemovePairSummary(pair); UpdatePairSummaries(); }
public static void UpdateStrategyScreenPair(PoloniexAPI.CurrencyPair pair, Dictionary <string, double> ruleVariables) { mainForm.strategyControl1.UpdatePairData(pair, ruleVariables); mainForm.strategyControl1.Invalidate(); }
// -------------------------- public static void AddStrategyScreenPair(PoloniexAPI.CurrencyPair pair) { mainForm.strategyControl1.AddPairData(pair); mainForm.strategyControl1.Invalidate(); }