public void ShouldGetHistoricalPrices() { ExchangeSharpPoloniex poloniexApi = new ExchangeSharpPoloniex(); CandleEvent[] candleEvents = poloniexApi.GetHistoricalPrices("USDC_BTC", 300, DateTimeExtensions.CreateNodaTime(2019, 2, 10, 0, 0, 0), DateTimeExtensions.CreateNodaTime(2019, 2, 10, 12, 04, 0)); // Uncomment in order to print all the symbols. You have to run the test with "Debug Test" // and go to the View: "Debug Console". // foreach (Event<Candle> candleEvent in candleEvents) // { // Debug.WriteLine(String.Format("{0} - {1}", candleEvent.Date, candleEvent.Value)); // } // [GlobalDate: 15497565000000000] - 3628.599, 3628.599, 3628.599, 3628.599 var firstEvent = candleEvents[0]; Assert.Equal(15497565000000000, firstEvent.Date); //Assert.Equal(DateTimeExtensions.CreateNodaTime(2019,2,10,0,0,0).ToUnixTimeTicks(), firstEvent.Date); var tuple = CheckCandlesEqual(new Candle(3628.599f, 3628.599f, 3628.599f, 3628.599f), firstEvent.Value); Assert.True(tuple.Item1, tuple.Item2); // [GlobalDate: 15497568000000000] - 3628.599, 3628.6, 3624.248, 3625.45 var secondEvent = candleEvents[1]; Assert.Equal(15497568000000000, secondEvent.Date); //Assert.Equal(DateTimeExtensions.CreateNodaTime(2019,2,10,0,05,0).ToUnixTimeTicks(), secondEvent.Date); var tuple2 = CheckCandlesEqual(new Candle(3628.599f, 3628.599f, 3628.599f, 3628.599f), secondEvent.Value); Assert.True(tuple2.Item1, tuple2.Item2); }
public void ShouldConvertCandle_WhenTimestampIsUnixEpoch() { ExchangeSharp.MarketCandle candle = new ExchangeSharp.MarketCandle(); candle.OpenPrice = 32m; candle.HighPrice = 50m; candle.LowPrice = 1m; candle.ClosePrice = 1m; candle.Timestamp = new DateTime(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc); ExchangeSharpPoloniex poloniexApi = new ExchangeSharpPoloniex(); CandleEvent myEvent = poloniexApi.Convert(candle); Candle ourCandle = new Candle(32f, 50f, 1f, 1f); Assert.Equal(ourCandle, myEvent.Value); Assert.Equal(0, myEvent.Date); }
public void ShouldConvertCandle_WhenTimestampIsLaterThanUnixEpoch() { ExchangeSharp.MarketCandle candle = new ExchangeSharp.MarketCandle(); candle.OpenPrice = 32m; candle.HighPrice = 50m; candle.LowPrice = 1m; candle.ClosePrice = 1m; candle.Timestamp = new DateTime(2019, 2, 19, 15, 22, 32, DateTimeKind.Utc); ExchangeSharpPoloniex poloniexApi = new ExchangeSharpPoloniex(); CandleEvent myEvent = poloniexApi.Convert(candle); Candle ourCandle = new Candle(32f, 50f, 1f, 1f); Assert.Equal(ourCandle, myEvent.Value); Assert.Equal(candle.Timestamp.ToNodaTime().ToUnixTimeTicks(), myEvent.Date); }
public void ShouldListSymbols() { ExchangeSharpPoloniex poloniexApi = new ExchangeSharpPoloniex(); var symbols = poloniexApi.ListSymbols(); Assert.Contains("BTC_ARDR", symbols); Assert.Contains("BTC_BCN", symbols); Assert.Contains("BTC_ETC", symbols); Assert.Contains("BTC_ETH", symbols); Assert.Contains("BTC_XMR", symbols); Assert.Contains("USDC_BTC", symbols); Assert.Contains("USDC_XMR", symbols); Assert.Contains("USDT_BCH", symbols); Assert.Contains("USDT_XMR", symbols); // Uncomment in order to print all the symbols. You have to run the test with "Debug Test" // and go to the View: "Debug Console". // foreach (string symbol in symbols) // { // Debug.WriteLine(symbol); // } }