question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

NatsClient AggReceived never fires

See original GitHub issue

I’ve recently set up the Nats client in my application and found that AggReceived never fires while TradeReceived and QuoteReceived fire continuoulsy as expected.

Here is a console application that illustrates the problem. AlpacaNatsTest.zip

And code for good measure:

class Program
{
    public static void Main(string[] args)
        => new Program().MainAsync().GetAwaiter().GetResult();

    public async Task MainAsync()
    {
        var _natsClient = new NatsClient("API_KEY", false);
 
        _natsClient.Open();

        _natsClient.OnError += OnNatsClientError;
        _natsClient.AggReceived += OnBarReceived;
        _natsClient.TradeReceived += OnTradeReceived;
        _natsClient.QuoteReceived += OnQuoteReceived;

        _natsClient.SubscribeTrade("NFLX");
        _natsClient.SubscribeQuote("NFLX");
        _natsClient.SubscribeMinuteAgg("NFLX");
        System.Console.ReadLine();

        _natsClient.Close();

    }

    private void OnQuoteReceived(IStreamQuote obj)
    {
        System.Diagnostics.Debug.WriteLine($"Quote {obj.AskPrice}");
    }

    private void OnTradeReceived(IStreamTrade obj)
    {
        System.Diagnostics.Debug.WriteLine($"Trade {obj.Price}");
    }

    private void OnBarReceived(IStreamAgg obj)
    {
        System.Diagnostics.Debug.WriteLine($"Bar {obj.Close}"); // NEVER fires
    }

    private void OnNatsClientError(string obj)
    {
        System.Diagnostics.Debug.WriteLine(obj);
    }
}

Using Alpaca.Markets 2.1.2 SDK

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:6 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
OlegRacommented, Dec 27, 2018

@codebeaulieu Will run build and publish new version on NuGet later this evening. Thank you for your support!

0reactions
codebeaulieucommented, Jan 2, 2019

looks good @OlegRa

Read more comments on GitHub >

github_iconTop Results From Across the Web

Buffering Messages During Reconnect Attempts - NATS Docs
The Core NATS client libraries try as much as possible to be fire and ... it is possible that it is never sent...
Read more >
National Grid 20-F 2020 Redacted Combined Document
This constitutes the annual report on Form 20-F of National Grid plc (the “Company”) in accordance with the requirements of the US Securities...
Read more >
Annual Report and Accounts 2019/20
The job that can't wait. We believe that people are the key to unlocking a clean energy future, and we ran a recruitment...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found