IntrinioRealTimeClient 9.1.0
See the version list below for details.
dotnet add package IntrinioRealTimeClient --version 9.1.0
NuGet\Install-Package IntrinioRealTimeClient -Version 9.1.0
<PackageReference Include="IntrinioRealTimeClient" Version="9.1.0" />
paket add IntrinioRealTimeClient --version 9.1.0
#r "nuget: IntrinioRealTimeClient, 9.1.0"
// Install IntrinioRealTimeClient as a Cake Addin #addin nuget:?package=IntrinioRealTimeClient&version=9.1.0 // Install IntrinioRealTimeClient as a Cake Tool #tool nuget:?package=IntrinioRealTimeClient&version=9.1.0
intrinio-realtime-dotnet-sdk
SDK for working with Intrinio's realtime Multi-Exchange, delayed SIP, or NASDAQ Basic prices feeds. Get a comprehensive view with increased market volume and enjoy minimized exchange and per user fees.
Intrinio provides real-time stock prices via a two-way WebSocket connection. To get started, subscribe to a real-time data feed and follow the instructions below.
Documentation for our legacy realtime client
Requirements
- .NET 6+
Docker
Add your API key to the config.json file in IntrinioRealTimeSDK, then
docker compose build
docker compose run example
Installation
Go to Release, download the DLLs, reference it in your project. The DLLs contains dependencies necessary to the SDK.
Sample Project
For a sample .NET project see: intrinio-realtime-dotnet-sdk Be sure to update config.json
Features
- Receive streaming, real-time price quotes (last trade, bid, ask)
- Subscribe to updates from individual securities
- Subscribe to updates for all securities
Example Usage
static void Main(string[] _)
{
Client.Log("Starting sample app");
client = new Client(OnTrade, OnQuote);
timer = new Timer(TimerCallback, client, 10000, 10000);
client.Join(); //Load symbols from config.json
//client.Join(new string[] { "AAPL", "GOOG", "MSFT" }, false); //Specify symbols at runtime
Console.CancelKeyPress += new ConsoleCancelEventHandler(Cancel);
}
Handling Quotes
There are thousands of securities, each with their own feed of activity. We highly encourage you to make your trade and quote handlers has short as possible and follow a queue pattern so your app can handle the volume of activity.
Data Format
Trade Message
type [<Struct>] Trade =
{
Symbol : string
Price : float
Size : uint32
TotalVolume : uint32
Timestamp : DateTime
SubProvider: SubProvider
MarketCenter: char
Condition: string
}
- Symbol - Ticker symbol.
- Price - the price in USD
- Size - the size of the last trade.
- TotalVolume - The number of stocks traded so far today for this symbol.
- Timestamp - a Unix timestamp
- SubProvider - Denotes the detailed source within grouped sources.
NONE
- No subtype specified.CTA_A
- CTA_A in the DELAYED_SIP provider.CTA_B
- CTA_B in the DELAYED_SIP provider.UTP
- UTP in the DELAYED_SIP provider.OTC
- OTC in the DELAYED_SIP provider.NASDAQ_BASIC
- NASDAQ Basic in the NASDAQ_BASIC provider.IEX
- From the IEX exchange in the REALTIME provider.
- MarketCenter - Provides the market center
- Condition - Provides the condition
Quote Message
type [<Struct>] Quote =
{
Type : QuoteType
Symbol : string
Price : float
Size : uint32
Timestamp : DateTime
SubProvider: SubProvider
MarketCenter: char
Condition: string
}
- Type - the quote type
Ask
- represents an ask typeBid
- represents a bid type
- Symbol - Ticker symbol.
- Price - the price in USD
- Size - the size of the last ask or bid.
- Timestamp - a Unix timestamp
- SubProvider - Denotes the detailed source within grouped sources.
NONE
- No subtype specified.CTA_A
- CTA_A in the DELAYED_SIP provider.CTA_B
- CTA_B in the DELAYED_SIP provider.UTP
- UTP in the DELAYED_SIP provider.OTC
- OTC in the DELAYED_SIP provider.NASDAQ_BASIC
- NASDAQ Basic in the NASDAQ_BASIC provider.IEX
- From the IEX exchange in the REALTIME provider.
- MarketCenter - Provides the market center
- Condition - Provides the condition
API Keys
You will receive your Intrinio API Key after creating an account. You will need a subscription to a realtime data feed as well.
Methods
Client client = new Client(OnTrade, OnQuote);
- Creates a new instance of the Intrinio Real-Time client. The provided actions implement OnTrade and OnQuote, which handle what happens when the associated event happens.
- Parameter
onTrade
: The Action accepting trades. This function will be invoked when a 'trade' has been received. The trade will be passed as an argument to the callback. - Parameter
onQuote
: Optional. The Action accepting quotes. This function will be invoked when a 'quote' has been received. The quote will be passed as an argument to the callback. If 'onQuote' is not provided, the client will NOT request to receive quote updates from the server.
client.Join(symbols, tradesOnly);
- Joins the given channels. This can be called at any time. The client will automatically register joined channels and establish the proper subscriptions with the WebSocket connection. If no arguments are provided, this function joins channel(s) configured in config.json.
- Parameter
symbols
- Optional. A string representing a single ticker symbol (e.g. "AAPL") or an array of ticker symbols (e.g. ["AAPL", "MSFT", "GOOG"]) to join. You can also use the special symbol, "lobby" to join the firehose channel and recieved updates for all ticker symbols. You must have a valid "firehose" subscription. - Parameter
tradesOnly
- Optional (default: false). A boolean value indicating whether the server should return trade data only (as opposed to trade and quote data).
client.Join(["AAPL", "MSFT", "GOOG"])
client.Join("GE", true)
client.Join("lobby") //must have a valid 'firehose' subscription
client.Leave(symbols)
- Leaves the given channels.
- Parameter
symbols
- Optional (default = all channels). A string representing a single ticker symbol (e.g. "AAPL") or an array of ticker symbols (e.g. ["AAPL", "MSFT", "GOOG"]) to leave. If not provided, all subscribed channels will be unsubscribed.
client.Leave(["AAPL", "MSFT", "GOOG"])
client.Leave("GE")
client.Leave("lobby")
client.Leave()
client.Stop()
- Closes the WebSocket, stops the self-healing and heartbeat intervals. Call this to properly dispose of the client.
Configuration
config.json
config.json The application will look for the config file if you don't pass in a config object.
{
"Config": {
"ApiKey": "", //Your Intrinio API key.
"NumThreads": 2, //The number of threads to use for processing events.
"Provider": "REALTIME", //or DELAYED_SIP or NASDAQ_BASIC or MANUAL
"Symbols": [ "AAPL", "MSFT", "GOOG" ], //This is a list of individual tickers to subscribe to, or "lobby" to subscribe to all at once (firehose).
"TradesOnly": true //This indicates whether you only want trade events (true) or you want trade, ask, and bid events (false).
},
"Serilog": {
"Using": [ "Serilog.Sinks.Console", "Serilog.Sinks.File" ],
"MinimumLevel": {
"Default": "Information",
"Override": {
"Microsoft": "Warning",
"System": "Warning"
}
},
"WriteTo": [
{ "Name": "Console" }
]
}
}
To create a config object to pass in instead of the file, do the following. Don't forget to also set up sirilog configuration as well:
Log.Logger = new LoggerConfiguration().WriteTo.Console(restrictedToMinimumLevel: Serilog.Events.LogEventLevel.Information).CreateLogger();
Config.Config config = new Config.Config();
config.Provider = Provider.REALTIME;
config.ApiKey = "";
config.Symbols = new[] { "AAPL", "MSFT" };
config.NumThreads = 2;
client = new Client(onTrade, onQuote, config);
Example Replay Client Usage
static void Main(string[] _)
{
Client.Log("Starting sample app");
//You can also simulate a trading day by replaying a particular day's data. You can do this with the actual time between events, or without.
DateTime yesterday = DateTime.Today - TimeSpan.FromDays(1);
replayClient = new ReplayClient(onTrade, onQuote, yesterday, true, true); //A client to replay a previous day's data
timer = new Timer(ReplayTimerCallback, replayClient, 10000, 10000);
replayClient.Join(); //Load symbols from your config or config.json
//client.Join(new string[] { "AAPL", "GOOG", "MSFT" }, false); //Specify symbols at runtime
Console.CancelKeyPress += new ConsoleCancelEventHandler(Cancel);
}
Example Candlestick Client Usage
static void Main(string[] _)
{
Client.Log("Starting sample app");
Action<Trade> onTrade = OnTrade;
Action<Quote> onQuote = OnQuote;
//Subscribe the candlestick client to trade and/or quote events as well. It's important any method subscribed this way handles exceptions so as to not cause issues for other subscribers!
_useTradeCandleSticks = true;
_useQuoteCandleSticks = true;
_candleStickClient = new CandleStickClient(OnTradeCandleStick, OnQuoteCandleStick, IntervalType.OneMinute, true, null, null, 0, false);
onTrade += _candleStickClient.OnTrade;
onQuote += _candleStickClient.OnQuote;
_candleStickClient.Start();
client = new Client(onTrade, onQuote);
timer = new Timer(TimerCallback, client, 10000, 10000);
client.Join(); //Load symbols from your config or config.json
//client.Join(new string[] { "AAPL", "GOOG", "MSFT" }, false); //Specify symbols at runtime
Console.CancelKeyPress += new ConsoleCancelEventHandler(Cancel);
}
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net6.0 is compatible. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 was computed. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. |
-
net6.0
- FSharp.Core (>= 7.0.400)
- Intrinio.SDK (>= 7.3.0)
- Microsoft.Extensions.Configuration (>= 7.0.0)
- Microsoft.Extensions.Configuration.Binder (>= 7.0.4)
- Microsoft.Extensions.Configuration.Json (>= 7.0.0)
- Serilog (>= 3.0.1)
- Serilog.Settings.Configuration (>= 7.0.0)
- Serilog.Sinks.Console (>= 4.1.0)
- Serilog.Sinks.File (>= 5.0.0)
- System.Text.Json (>= 7.0.3)
- WebSocket4Net (>= 0.15.2)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
Version | Downloads | Last updated |
---|---|---|
12.2.0 | 43 | 11/22/2024 |
12.1.2 | 77 | 10/28/2024 |
12.1.1 | 51 | 10/28/2024 |
12.0.4 | 59 | 10/24/2024 |
11.0.4 | 60 | 10/14/2024 |
11.0.3 | 50 | 10/7/2024 |
11.0.2 | 54 | 10/7/2024 |
11.0.1 | 58 | 10/3/2024 |
11.0.0 | 59 | 10/3/2024 |
10.0.0 | 109 | 7/11/2024 |
9.2.0 | 135 | 3/14/2024 |
9.1.1 | 191 | 3/9/2024 |
9.1.0 | 122 | 3/9/2024 |
9.0.0 | 138 | 2/20/2024 |
8.3.2 | 241 | 10/30/2023 |
8.3.1 | 149 | 10/30/2023 |
8.3.0 | 147 | 10/30/2023 |
8.2.0 | 120 | 10/27/2023 |
8.1.2 | 130 | 10/16/2023 |
8.1.1 | 208 | 8/16/2023 |
8.0.1 | 176 | 7/23/2023 |
8.0.0 | 180 | 7/14/2023 |
7.0.0 | 155 | 5/25/2023 |
7.0.0-beta | 200 | 5/9/2023 |
7.0.0-alpha | 123 | 5/9/2023 |
6.2.1 | 184 | 4/20/2023 |
6.1.1 | 222 | 4/17/2023 |
6.0.1 | 242 | 3/10/2023 |
5.0.0 | 231 | 3/5/2023 |
4.3.1 | 261 | 3/4/2023 |
4.2.0 | 246 | 3/2/2023 |
4.1.1 | 297 | 1/25/2023 |
4.1.0 | 291 | 1/24/2023 |
4.0.0 | 463 | 4/25/2022 |
3.0.0 | 491 | 10/22/2021 |
2.2.0-rc | 712 | 2/13/2019 |
2.1.0-rc | 656 | 11/30/2018 |
2.0.0-rc | 867 | 10/18/2017 |
1.0.0-rc | 900 | 9/21/2017 |
Version 9.1.0 release.