Created
June 9, 2019 19:35
-
-
Save damoahdominic/08f58805c74e47f33e52e26a1bfc6dbf to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Collections.Generic; | |
using System.Linq; | |
using System.Text; | |
using System.Threading.Tasks; | |
using TradingAPI.MT4Server; | |
namespace RealTimeQuotes | |
{ | |
class Program | |
{ | |
static void Main(string[] args) | |
{ | |
new Program().Run(); | |
} | |
void Run() | |
{ | |
MainServer srv = QuoteClient.LoadSrv(@"GerchikCo-Demo.srv"); | |
QuoteClient qc = new QuoteClient(67611, "wx1yhpn", srv.Host, srv.Port); | |
try | |
{ | |
Console.WriteLine("Connecting..."); | |
qc.Connect(); | |
Console.WriteLine("Connected to server"); | |
qc.OnQuote += new QuoteEventHandler(qc_OnQuote); | |
qc.Subscribe("EURUSD"); | |
Console.WriteLine("Press any key..."); | |
Console.ReadKey(); | |
qc.Disconnect(); | |
} | |
catch (Exception ex) | |
{ | |
Console.WriteLine(ex.Message); | |
Console.WriteLine("Press any key..."); | |
Console.ReadKey(); | |
} | |
} | |
void qc_OnQuote(object sender, QuoteEventArgs args) | |
{ | |
Console.WriteLine(args.Symbol + " " + args.Bid + " " + args.Ask); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment