Thank you very very much. I also got in touch with their support and received prompt responses. I will try it out and keep you posted.
Question 1 - Do they have Price Data (which is a derivative of Trades that contains Total Volume, trade count etc that happened on an Exchange)?
I am okay with 1 second latency in market data. Is it worse than that?
Are able to receive Level 1, Level 2 and trades or just Level 1 and trades?
I am using C# to connect. They asked me to look at Subscribe in https://github.com/nats-io/csharp-nats
I m learning NATS and pub sub as we go. Are you developing in C# or Java?
This is what i developed so far after merging API docs with SUBscriber example from NATS:
Question 2: Are you doing something similar to subscribe and listen to events. I am more used to IQfeed or other MD providers that provide an event to listen. Their codebase for me requires some understanding of how Pub-Sub messaging works (similar to ZMQ or NetMQ) that I am familiar with, please feel free to correct me if i am wrong
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using NATS;
using NATS.Client;
using System.Diagnostics;
using System.Threading;
namespace PolyIO
{
public class PolyIO
{
string[] servers = new string[3];
int count = 1000000;
string url = Defaults.Url;
string subject = "foo";
bool sync = false;
int received = 0;
bool verbose = false;
public PolyIO()
{
servers[0] = "nats://nats1.polygon.io:30401";
servers[1] = "nats://nats2.polygon.io:30402";
servers[2] = "nats://nats3.polygon.io:30403";
Options opts = ConnectionFactory.GetDefaultOptions();
opts.Token = "DO NOT SHARE by Polygon";
opts.Servers = servers;
using (IConnection c = new ConnectionFactory().CreateConnection(opts))
{
TimeSpan elapsed = receiveAsyncSubscriber(c);
}
}
private TimeSpan receiveAsyncSubscriber(IConnection c)
{
Stopwatch sw = new Stopwatch();
Object testLock = new Object();
EventHandler<MsgHandlerEventArgs> msgHandler = (sender, args) =>
{
if (received == 0)
sw.Start();
received++;
if (verbose)
Console.WriteLine("Received: " + args.Message);
if (received >= count)
{
sw.Stop();
lock (testLock)
{
Monitor.Pulse(testLock);
}
}
};
using (IAsyncSubscription s = c.SubscribeAsync(subject, msgHandler))
{
// just wait until we are done.
lock (testLock)
{
Monitor.Wait(testLock);
}
}
return sw.Elapsed;
}
}
}
Question 1 - Do they have Price Data (which is a derivative of Trades that contains Total Volume, trade count etc that happened on an Exchange)?
I am okay with 1 second latency in market data. Is it worse than that?
Are able to receive Level 1, Level 2 and trades or just Level 1 and trades?
I am using C# to connect. They asked me to look at Subscribe in https://github.com/nats-io/csharp-nats
I m learning NATS and pub sub as we go. Are you developing in C# or Java?
This is what i developed so far after merging API docs with SUBscriber example from NATS:
Question 2: Are you doing something similar to subscribe and listen to events. I am more used to IQfeed or other MD providers that provide an event to listen. Their codebase for me requires some understanding of how Pub-Sub messaging works (similar to ZMQ or NetMQ) that I am familiar with, please feel free to correct me if i am wrong
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using NATS;
using NATS.Client;
using System.Diagnostics;
using System.Threading;
namespace PolyIO
{
public class PolyIO
{
string[] servers = new string[3];
int count = 1000000;
string url = Defaults.Url;
string subject = "foo";
bool sync = false;
int received = 0;
bool verbose = false;
public PolyIO()
{
servers[0] = "nats://nats1.polygon.io:30401";
servers[1] = "nats://nats2.polygon.io:30402";
servers[2] = "nats://nats3.polygon.io:30403";
Options opts = ConnectionFactory.GetDefaultOptions();
opts.Token = "DO NOT SHARE by Polygon";
opts.Servers = servers;
using (IConnection c = new ConnectionFactory().CreateConnection(opts))
{
TimeSpan elapsed = receiveAsyncSubscriber(c);
}
}
private TimeSpan receiveAsyncSubscriber(IConnection c)
{
Stopwatch sw = new Stopwatch();
Object testLock = new Object();
EventHandler<MsgHandlerEventArgs> msgHandler = (sender, args) =>
{
if (received == 0)
sw.Start();
received++;
if (verbose)
Console.WriteLine("Received: " + args.Message);
if (received >= count)
{
sw.Stop();
lock (testLock)
{
Monitor.Pulse(testLock);
}
}
};
using (IAsyncSubscription s = c.SubscribeAsync(subject, msgHandler))
{
// just wait until we are done.
lock (testLock)
{
Monitor.Wait(testLock);
}
}
return sw.Elapsed;
}
}
}
