Real time price GET FUNCTION UNITY C#

Hi. i create Unity game(C#)
i want to get real time price of some stock

i did it:

  1. private void Start()
    {

     Application.OpenURL("//stream.data.alpaca.markets/v1beta1/crypto");
    

}
2.client = Alpaca.Markets.Environments.Paper
.GetAlpacaTradingClient(new SecretKey(MYAPI_KEY, MYAPI_SECRET));

for example, I’m interested in the AAPL promotion
how do i get its current price values???
what function to write?

I would also like this, but their API doesn’t really have a good way to do it. You would need to open a stream for getting data. They go over opening a stream here

I tried it, and could not get any data, so I am not 100% sure what is needed to get the data.

Check the .NET SDK Wiki page about streaming clients - it contains basic information about initializing and using streaming clients. You can also check the UsageExamples project in this repository - it also contains samples for stock streaming consuming patterns (the crypto streaming usage pattern is almost the same).

Maybe I have an old SDK? because when I write:
using Alpaca.Markets.Extensions;

I have a mistake:
The type or namespace name ‘Extensions’ does not exist in the namespace ‘Alpaca.Markets’ (possibly missing an assembly reference).

Can u give me new SDK for UNITY, because i cant install c# NuGet(i have some mistakes)

The usage is not the problem. I am told you will not get any data updates when the stock market is closed. You won’t even get the last update.

@johnglen244 What type of real-time data do you expect on the closed stock market? If you work with crypto you can trade 24/7 (mostly) but even in this case frequency of updates will depend on market activity on the selected pair. On the stock market, you have trading hours and outside of these hours, nobody can trade so no quotes/trades will be sent on the Alpaca stream.

@ILya111 If you want to use helper methods from the Alpaca.Markets.Extensions package you have to add it using NuGet instead your C# compiler will not find them.
The latest Unity version works fine with NuGet and current SDK packages should not generate any errors after installation. If you have trouble with it - just provide all the required information on GitHub and I’ll take a look. Another option - is just to get code from GitHub and include it in your project - the Apache OSS license allows you to do so.