public void GetBalance_ShouldNotThrowException() { var bittrex = new Bittrex(DefaultApiKey, DefaultApiSecret); Func <Task> action = async() => { var _ = await bittrex.GetBalance(DefaultCurrency); }; action.ShouldNotThrow(); }
public void BuyLimit_ShouldUnauthorizedThrowException_IfNoApiKeyIsGiven() { var bittrex = new Bittrex(); Func <Task> action = async() => { var _ = await bittrex.BuyLimit(DefaultMarketName, 1, 1); }; action.ShouldThrow <UnauthorizedException>(); }
public BittrexStock() { if (bittrex == null) { bittrex = new Bittrex(); } }
public void GetTickerv2_ShouldNotThrowException() { var bittrex = new Bittrex(); Func <Task> action = async() => { var _ = await bittrex.GetTicker(DefaultMarketName, tickInterval, timeStamp); }; action.ShouldNotThrow(); }
public BittrexBridge(string apiKey, string apiSecret) { apiKeyStore = apiKey; ActiveOrders = new List <BittrexSharp.Domain.OpenOrder>(); OnHoldOrders = new List <BittrexSharp.Domain.OpenOrder>(); cancelling = new List <string>(); fFailedConection = fConnected = false; account = new Bittrex(apiKey, apiSecret); //TODO: Modify library so it uses securestring when handling apiSecret //TODO: Maybe change this task so it can use the "testConnection" method Task.Run(async() => { var response = await account.GetBalances(); if (!fFailedConection) { fFailedConection = !response.Success; } if (fFailedConection) { return; } fConnected = true; }); }
public void BuyLimit_ShouldNotThrowException() { var bittrex = new Bittrex(DefaultApiKey, DefaultApiSecret); Func <Task> action = async() => { var _ = await bittrex.BuyLimit(DefaultMarketName, 1, 1); }; action.ShouldNotThrow(); }
public void GetOrderBook_ShouldNotThrowException() { var bittrex = new Bittrex(); Func <Task> action = async() => { var _ = await bittrex.GetOrderBook(DefaultMarketName, OrderType.Both, 1); }; action.ShouldNotThrow(); }
public void GetDepositAddress_ShouldUnauthorizedThrowException_IfNoApiKeyIsGiven() { var bittrex = new Bittrex(); Func <Task> action = async() => { var _ = await bittrex.GetDepositAddress(DefaultCurrency); }; action.ShouldThrow <UnauthorizedException>(); }
public void Withdraw_ShouldUnauthorizedThrowException_IfNoApiKeyIsGiven() { var bittrex = new Bittrex(); Func <Task> action = async() => { var _ = await bittrex.Withdraw(DefaultCurrency, 0, DefaultTargetAddress); }; action.ShouldThrow <UnauthorizedException>(); }
public void GetDepositHistory_ShouldNotThrowException() { var bittrex = new Bittrex(DefaultApiKey, DefaultApiSecret); Func <Task> action = async() => { var _ = await bittrex.GetDepositHistory(); }; action.ShouldNotThrow(); }
public void Withdraw_ShouldNotThrowException() { var bittrex = new Bittrex(DefaultApiKey, DefaultApiSecret); Func <Task> action = async() => { var _ = await bittrex.Withdraw(DefaultCurrency, 0, DefaultTargetAddress); }; action.ShouldNotThrow(); }
public void GetOpenOrders_ShouldNotThrowException() { var bittrex = new Bittrex(DefaultApiKey, DefaultApiSecret); Func <Task> action = async() => { var _ = await bittrex.GetOpenOrders(); }; action.ShouldNotThrow(); }
public void GetDepositHistory_ShouldUnauthorizedThrowException_IfNoApiKeyIsGiven() { var bittrex = new Bittrex(); Func <Task> action = async() => { var _ = await bittrex.GetDepositHistory(); }; action.ShouldThrow <UnauthorizedException>(); }
public void GetSupportedCurrencies_ShouldNotThrowException() { var bittrex = new Bittrex(); Func <Task> action = async() => { var _ = await bittrex.GetSupportedCurrencies(); }; action.ShouldNotThrow(); }
public void GetMarketSummaries_ShouldNotThrowException() { var bittrex = new Bittrex(); Func <Task> action = async() => { var _ = await bittrex.GetMarketSummaries(); }; action.ShouldNotThrow(); }
public void GetMarketHistory_ShouldNotThrowException() { var bittrex = new Bittrex(); Func <Task> action = async() => { var _ = await bittrex.GetMarketHistory(DefaultMarketName); }; action.ShouldNotThrow(); }
public void GetOrder_ShouldNotThrowException() { var orderId = Guid.NewGuid().ToString(); var bittrex = new Bittrex(DefaultApiKey, DefaultApiSecret); Func <Task> action = async() => { var _ = await bittrex.GetOrder(orderId); }; action.ShouldNotThrow(); }
public void GetOrder_ShouldUnauthorizedThrowException_IfNoApiKeyIsGiven() { var orderId = Guid.NewGuid().ToString(); var bittrex = new Bittrex(); Func <Task> action = async() => { var _ = await bittrex.GetOrder(orderId); }; action.ShouldThrow <UnauthorizedException>(); }
public static async Task <bool> testConnection(string apiKey, string apiSecret) { Bittrex TempAccount = new Bittrex(apiKey, apiSecret); var response = await TempAccount.GetBalances(); TempAccount = null; return(response.Success); }
private async Task <ResponseWrapper <IEnumerable <MarketSummary> > > GetMarketSummaries() { Bittrex bittrex = new Bittrex(); var uri = BaseUrl + "public/getmarketsummaries"; var marketSummariesResponse = await bittrex.Request <IEnumerable <MarketSummary> >(HttpMethod.Get, uri); return(marketSummariesResponse); }
public async void MarketHistoryInvalidOnline() { var r = new Maybe <IDownloadData>(); var b = new Bittrex(r); var res = await b.GetMarketHistory("NotValid"); Assert.Equal("INVALID_MARKET", res.Message); }
/// <summary> /// Constructor /// </summary> public My_Bittrex() { // Connection to bittrex this.api_key = "<your_api_key>"; this.api_secret = "<your_api_secret>"; this.my_bittrex = new Bittrex(this.api_key, this.api_secret); this.my_balances = new Dictionary <string, double>(); this.portfolio_size = this.my_balances.Count; }
public async void OrderbookBothOnline() { var r = new Maybe <IDownloadData>(); var b = new Bittrex(r); var res = await b.GetOrderbook("BTC-LTC", "both"); Assert.NotEmpty(res.Result.buy); Assert.NotEmpty(res.Result.sell); }
private static async Task <ResponseWrapper <IEnumerable <Market> > > GetBittrixMarketAsync() { Console.WriteLine("before"); // Step Out from here var apiKey = "b6261f5e794f4c5fb0fcd8ede10eaea8"; var apiSecret = "7c8e55b4d0b245779e4d645f7a5bc92f"; var bittrex = new Bittrex(apiKey, apiSecret); var result = await bittrex.GetMarkets(); Console.WriteLine("after"); // Step Out from here return(result); }
public BittrexService( BittrexConfig config, DatabaseService databaseService, PriceService priceService, ILogger <BittrexService> log) { var config1 = config; _databaseService = databaseService; _priceService = priceService; _log = log; _exchange = new Bittrex(config1.Key, config1.Secret); }
public void Restart() { string apiKey = AppSetings.Default.BittrexApiKey; if (apiKey.Length > 0) { bittrex = new Bittrex(apiKey, Security.ToInsecureString(Security.DecryptString(AppSetings.Default.BittrexApiSecret))); } else { bittrex = new Bittrex("", ""); } }
public BittrexService( BittrexConfig config, DatabaseService databaseService, GeneralConfig generalConfig, ILogger <BittrexService> log) { var config1 = config; _databaseService = databaseService; _generalConfig = generalConfig; _log = log; _exchange = new Bittrex(config1.Key, config1.Secret); }
private static async Task <ResponseWrapper <IEnumerable <TickerV2> > > GetBittrixTickerDataAsync() { Console.WriteLine("before"); // Step Out from here var apiKey = "b6261f5e794f4c5fb0fcd8ede10eaea8"; var apiSecret = "7c8e55b4d0b245779e4d645f7a5bc92f"; var bittrex = new Bittrex(apiKey, apiSecret); string DefaultMarketName = "BTC-ETH"; string tickInterval = "thirtyMin"; UInt64 timeStamp = 1500915289433; var result = await bittrex.GetTicker(DefaultMarketName, tickInterval, timeStamp); Console.WriteLine("after"); // Step Out from here return(result); }
public static async Task Main() { // Our apiKey and apiSecret variables const string apiKey = ""; const string apiSecret = ""; // Set up the three clients: one for the operations (such as buy/sell), one to calculate the margins and one for the CoinMarketCap data var bittrexClient = new Bittrex(apiKey, apiSecret); var calculationClient = new CalculationClient(bittrexClient); // Load the user config file var userConfig = bittrexClient.LoadConfig(); foreach (var item in userConfig.Result) { await calculationClient.CalculateToDollar(item.CoinName, item.Amount).ConfigureAwait(false); } }
public async Task <decimal> GetPrice(string baseCcy, string termsCurrency) { var apiKey = "..."; var apiSecret = "..."; var bittrex = new Bittrex(apiKey, apiSecret); Ticker tcik = null; try { tcik = await bittrex.GetTicker(baseCcy, termsCurrency); } catch (Exception ex) { // should log } if (tcik != null && tcik.Last.HasValue) { return(tcik.Last.Value); } var btcPrice = await bittrex.GetTicker("BTC", termsCurrency); if (btcPrice?.Last != null) { var btcBasePrice = await bittrex.GetTicker("BTC", baseCcy); if (btcBasePrice?.Last != null) { return(btcPrice.Last.Value * btcBasePrice.Last.Value); } else { var baseBtcPrice = await bittrex.GetTicker(baseCcy, "BTC"); if (baseBtcPrice?.Last != null) { return(baseBtcPrice.Last.Value * btcPrice.Last.Value); } } } return(0); }