This code has the function of: each time (2 seconds) to consult two APIs obtaining bitcoin prices and finding possible arbitrage opportunities, later buying at the lower price and selling at a higher price.
It is a simple program, but after a while running it simply stops showing messages on the screen, returning to show after clicking Enter or something like that.
Running on Windows 10, one of the pre-requisites is Net Framework 4.6.1 which is up and running.
static Object objLock = new Object();
public static void log(string value)
{
value = "[" + DateTime.Now.ToString() + "] " + value;
lock (objLock)
{
Console.WriteLine(value);
try
{
System.IO.StreamWriter w = new StreamWriter(Program.location + DateTime.Now.ToString("yyyyMMdd") + "_logger.txt", true);
w.WriteLine(value);
w.Close();
w.Dispose();
w = null;
}
catch
{ }
}
}
More: https://github.com/vitorgamer58/ArbitragemNacional
[09/06/2019 21:29:20] -4,71% BRAZILIEX > BITCOINTRADE
[09/06/2019 21:29:22] 0,47% BITCOINTRADE > BRAZILIEX
[09/06/2019 21:29:25] 0,47% BITCOINTRADE > BRAZILIEX
[09/06/2019 21:29:25] -4,71% BRAZILIEX > BITCOINTRADE
After Clicking enter, it started working
[09/06/2019 21:48:30] -4,70% BRAZILIEX > BITCOINTRADE
[09/06/2019 21:48:30] 0,67% BITCOINTRADE > BRAZILIEX
[09/06/2019 21:48:33] -4,70% BRAZILIEX > BITCOINTRADE
[09/06/2019 21:48:34] 0,67% BITCOINTRADE > BRAZILIEX
[09/06/2019 21:48:37] 0,67% BITCOINTRADE > BRAZILIEX