public void TestGenerateSHA512Signature() { string publicKey = "mypublickey"; string privateKey = "topsecret"; FormUrlEncodedContent request = new FormUrlEncodedContent(new[] { new KeyValuePair<string, string>("order_currency", "BTC"), new KeyValuePair<string, string>("payment_currency", "USD"), new KeyValuePair<string, string>(VoSExchange.PARAMETER_NONCE, "1391467880847682") }); using (VoSExchange exchange = new VoSExchange() { PublicKey = publicKey, PrivateKey = privateKey } ) { Assert.AreEqual(privateKey, System.Text.Encoding.ASCII.GetString(exchange.PrivateKeyBytes)); string signature = exchange.GenerateSHA512Signature(VoSExchange.Method.ticker, request); Console.WriteLine(signature); Assert.AreEqual("OWVmM2NkMDA2ZjI2NzBhYzgyNDU0OWRjZWMxOGUwNmRhODE2OGMzZjM1MDMzNzc2MjI5NmE0ZjVmYzM3NDIzMTlmODZjODZkMDVjZDY0Y2UzMzQzM2Y5ZGYxNTM0YjNjMDkzODA5ZGFiNzAyZmVmYjgwMTQ2NTdkYjE1Yzk2ZDk=", signature); } }
private static void CalculateArbitrageResult(VoSExchange vaultOfSatoshi, MarketDepth bestDogeBtcAsk, string currencyCode) { Task<MarketDepth> bestDogeFiatBidTask = GetBestBid(vaultOfSatoshi, new VoSMarketId("DOGE", currencyCode)); Task<MarketDepth> bestBtcFiatAskTask = GetBestAsk(vaultOfSatoshi, new VoSMarketId("BTC", currencyCode)); MarketDepth bestDogeFiatBid = bestDogeFiatBidTask.Result; MarketDepth bestBtcFiatAsk = bestBtcFiatAskTask.Result; if (bestDogeFiatBid == null || bestDogeFiatBid.Price == 0.0m) { Console.WriteLine("No valid DOGE/" + currencyCode + " price available."); return; } if (bestBtcFiatAsk == null || bestBtcFiatAsk.Price == 0.0m) { Console.WriteLine("No valid BTC/" + currencyCode + " price available."); return; } CalculateArbitrageResult(bestDogeFiatBid, bestDogeBtcAsk, bestBtcFiatAsk, currencyCode); }
public void TestGenerateSHA512Signature() { string publicKey = "mypublickey"; string privateKey = "topsecret"; FormUrlEncodedContent request = new FormUrlEncodedContent(new[] { new KeyValuePair <string, string>("order_currency", "BTC"), new KeyValuePair <string, string>("payment_currency", "USD"), new KeyValuePair <string, string>(VoSExchange.PARAMETER_NONCE, "1391467880847682") }); using (VoSExchange exchange = new VoSExchange() { PublicKey = publicKey, PrivateKey = privateKey } ) { Assert.AreEqual(privateKey, System.Text.Encoding.ASCII.GetString(exchange.PrivateKeyBytes)); string signature = exchange.GenerateSHA512Signature(VoSExchange.Method.ticker, request); Console.WriteLine(signature); Assert.AreEqual("OWVmM2NkMDA2ZjI2NzBhYzgyNDU0OWRjZWMxOGUwNmRhODE2OGMzZjM1MDMzNzc2MjI5NmE0ZjVmYzM3NDIzMTlmODZjODZkMDVjZDY0Y2UzMzQzM2Y5ZGYxNTM0YjNjMDkzODA5ZGFiNzAyZmVmYjgwMTQ2NTdkYjE1Yzk2ZDk=", signature); } }
public void TestGetNextNonce() { using (VoSExchange exchange = new VoSExchange()) { string nonce = exchange.GetNextNonce(); // Should test we're within 10 seconds of local clock } }
public void TestGetNextNonce() { using (VoSExchange exchange = new VoSExchange()) { string nonce = exchange.GetNextNonce(); // Should test we're within 10 seconds of local clock } }
public void TestFormatAsCurrencyObject() { using (VoSExchange exchange = new VoSExchange()) { string actual = exchange.FormatAsCurrencyObject(0.00000132m, 8); string expected = "{\"precision\":8,\"value_int\":132,\"value\":\"0.00000132\"}"; Assert.AreEqual(expected, actual); } }
public void TestFormatAsCurrencyObject() { using (VoSExchange exchange = new VoSExchange()) { string actual = exchange.FormatAsCurrencyObject(0.00000132m, 8); string expected = "{\"precision\":8,\"value_int\":132,\"value\":\"0.00000132\"}"; Assert.AreEqual(expected, actual); } }
public static void Main() { try { using (BterExchange bter = new BterExchange()) { using (CoinExExchange coinEx = new CoinExExchange()) { PublicPrivateKeyPair cryptsyConfiguration = LoadPublicPrivateKeyPair(CRYPTSY_CONFIGURATION_FILENAME); using (CryptsyExchange cryptsy = new CryptsyExchange() { PublicKey = cryptsyConfiguration.PublicKey, PrivateKey = cryptsyConfiguration.PrivateKey } ) { PublicPrivateKeyPair vaultOfSatoshiConfiguration = LoadPublicPrivateKeyPair(VAULT_OF_SATOSHI_CONFIGURATION_FILENAME); using (VoSExchange vaultOfSatoshi = new VoSExchange() { PublicKey = vaultOfSatoshiConfiguration.PublicKey, PrivateKey = vaultOfSatoshiConfiguration.PrivateKey } ) { using (VircurexExchange vircurex = new VircurexExchange()) { DoAnalysis(new List <IExchange>() { vaultOfSatoshi, bter, coinEx, cryptsy, vircurex }); } } } } } } catch (ExchangeConfigurationException e) { Console.WriteLine(e.Message); Console.WriteLine("Press any key to exit"); Console.ReadKey(); } }
public static void Main() { try { using (BterExchange bter = new BterExchange()) { using (CoinExExchange coinEx = new CoinExExchange()) { PublicPrivateKeyPair cryptsyConfiguration = LoadPublicPrivateKeyPair(CRYPTSY_CONFIGURATION_FILENAME); using (CryptsyExchange cryptsy = new CryptsyExchange() { PublicKey = cryptsyConfiguration.PublicKey, PrivateKey = cryptsyConfiguration.PrivateKey } ) { PublicPrivateKeyPair vaultOfSatoshiConfiguration = LoadPublicPrivateKeyPair(VAULT_OF_SATOSHI_CONFIGURATION_FILENAME); using (VoSExchange vaultOfSatoshi = new VoSExchange() { PublicKey = vaultOfSatoshiConfiguration.PublicKey, PrivateKey = vaultOfSatoshiConfiguration.PrivateKey } ) { using (VircurexExchange vircurex = new VircurexExchange()) { DoAnalysis(new List<IExchange>() { vaultOfSatoshi, bter, coinEx, cryptsy, vircurex }); } } } } } } catch (ExchangeConfigurationException e) { Console.WriteLine(e.Message); Console.WriteLine("Press any key to exit"); Console.ReadKey(); } }
public void TestGenerateMessageToSign() { FormUrlEncodedContent request = new FormUrlEncodedContent(new[] { new KeyValuePair <string, string>("order_currency", "BTC"), new KeyValuePair <string, string>("payment_currency", "USD"), new KeyValuePair <string, string>(VoSExchange.PARAMETER_NONCE, "1391466805814182") }); using (VoSExchange exchange = new VoSExchange()) { byte[] message = exchange.GenerateMessageToSign(VoSExchange.Method.ticker, request); Assert.AreEqual("/info/ticker\0order_currency=BTC&payment_currency=USD&nonce=1391466805814182", System.Text.Encoding.ASCII.GetString(message)); } }
public void TestGenerateMessageToSign() { FormUrlEncodedContent request = new FormUrlEncodedContent(new[] { new KeyValuePair<string, string>("order_currency", "BTC"), new KeyValuePair<string, string>("payment_currency", "USD"), new KeyValuePair<string, string>(VoSExchange.PARAMETER_NONCE, "1391466805814182") }); using (VoSExchange exchange = new VoSExchange()) { byte[] message = exchange.GenerateMessageToSign(VoSExchange.Method.ticker, request); Assert.AreEqual("/info/ticker\0order_currency=BTC&payment_currency=USD&nonce=1391466805814182", System.Text.Encoding.ASCII.GetString(message)); } }
public static void Main(string[] argv) { ApiKeySection configSection = GetRoamingConfiguration(); using (VoSExchange vaultOfSatoshi = new VoSExchange() { PublicKey = configSection.VaultOfSatoshi.PublicKey, PrivateKey = configSection.VaultOfSatoshi.PrivateKey }) { using (VircurexExchange vircurex = new VircurexExchange() { PublicKey = configSection.Vircurex.PublicKey, DefaultPrivateKey = configSection.VaultOfSatoshi.PrivateKey }) { while (true) { MarketDepth bestDogeBtcAsk = GetBestAsk(vircurex, new VircurexMarketId("DOGE", "BTC")).Result; if (bestDogeBtcAsk == null || bestDogeBtcAsk.Price == 0.0m) { Console.WriteLine("No valid DOGE/BTC price available."); Console.ReadKey(); return; } CalculateArbitrageResult(vaultOfSatoshi, bestDogeBtcAsk, "USD"); CalculateArbitrageResult(vaultOfSatoshi, bestDogeBtcAsk, "CAD"); Thread.Sleep(60000); } } } }