-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Nuspec update * publishing update * docker update * progress * name space * progress * Equities almost done * Halfway through client.cs * break * private methods * interface methods * naming conventions csharp * pause * checkpoint * don't forget to use double instead of f# float (equivalent) * bring in from testing * diff lock * cleanup * trap invoke * Change network buffer to not pile up * Move to native websocket for more efficient memory interface * ready the client for sharing with options * update for config * cleanup unused usings * move runtime config * move thread creation * partial progress replay * almost done replay * replay * clean up usings * delete old project, update packages * few more cleanup items ready for options import * Partially done options * bring over from current * candle class conversion * progress * simple sample * constructors * constructor doc for params * message length in different places * one more method * compile * subscribe bits * Initial interfaces for realtime greeks * optionscontractdata good * update interfaces * Update docs * bump version of header
- Loading branch information
1 parent
b395210
commit 9a365a9
Showing
76 changed files
with
7,945 additions
and
2,332 deletions.
There are no files selected for viewing
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,106 @@ | ||
using System.Globalization; | ||
|
||
namespace Intrinio.Realtime; | ||
|
||
using System; | ||
|
||
public abstract class CandleStick | ||
{ | ||
private readonly string _contract; | ||
private readonly double _openTimestamp; | ||
private readonly double _closeTimestamp; | ||
private readonly IntervalType _interval; | ||
|
||
public UInt32 Volume { get; set; } | ||
public double High { get; set; } | ||
public double Low { get; set; } | ||
public double Close { get; set; } | ||
public double Open { get; set; } | ||
public double OpenTimestamp | ||
{ | ||
get { return _openTimestamp; } | ||
} | ||
public double CloseTimestamp | ||
{ | ||
get { return _closeTimestamp; } | ||
} | ||
public double FirstTimestamp { get; set; } | ||
public double LastTimestamp { get; set; } | ||
public bool Complete { get; set; } | ||
public double Average { get; set; } | ||
public double Change { get; set; } | ||
public IntervalType Interval | ||
{ | ||
get { return _interval; } | ||
} | ||
|
||
public CandleStick(UInt32 volume, double price, double openTimestamp, double closeTimestamp, IntervalType interval, double eventTime) | ||
{ | ||
Volume = volume; | ||
High = price; | ||
Low = price; | ||
Close = price; | ||
Open = price; | ||
_openTimestamp = openTimestamp; | ||
_closeTimestamp = closeTimestamp; | ||
FirstTimestamp = eventTime; | ||
LastTimestamp = eventTime; | ||
Complete = false; | ||
Average = price; | ||
Change = 0.0; | ||
_interval = interval; | ||
} | ||
|
||
public CandleStick(UInt32 volume, double high, double low, double closePrice, double openPrice, double openTimestamp, double closeTimestamp, double firstTimestamp, double lastTimestamp, bool complete, double average, double change, IntervalType interval) | ||
{ | ||
Volume = volume; | ||
High = high; | ||
Low = low; | ||
Close = closePrice; | ||
Open = openPrice; | ||
_openTimestamp = openTimestamp; | ||
_closeTimestamp = closeTimestamp; | ||
FirstTimestamp = firstTimestamp; | ||
LastTimestamp = lastTimestamp; | ||
Complete = complete; | ||
Average = average; | ||
Change = change; | ||
_interval = interval; | ||
} | ||
|
||
public void Merge(CandleStick candle) | ||
{ | ||
Average = ((Convert.ToDouble(Volume) * Average) + (Convert.ToDouble(candle.Volume) * candle.Average)) / (Convert.ToDouble(Volume + candle.Volume)); | ||
Volume += candle.Volume; | ||
High = High > candle.High ? High : candle.High; | ||
Low = Low < candle.Low ? Low : candle.Low; | ||
Close = LastTimestamp > candle.LastTimestamp ? Close : candle.Close; | ||
Open = FirstTimestamp < candle.FirstTimestamp ? Open : candle.Open; | ||
FirstTimestamp = candle.FirstTimestamp < FirstTimestamp ? candle.FirstTimestamp : FirstTimestamp; | ||
LastTimestamp = candle.LastTimestamp > LastTimestamp ? candle.LastTimestamp : LastTimestamp; | ||
Change = (Close - Open) / Open; | ||
} | ||
|
||
internal void Update(UInt32 volume, double price, double time) | ||
{ | ||
Average = ((Convert.ToDouble(Volume) * Average) + (Convert.ToDouble(volume) * price)) / (Convert.ToDouble(Volume + volume)); | ||
Volume += volume; | ||
High = price > High ? price : High; | ||
Low = price < Low ? price : Low; | ||
Close = time > LastTimestamp ? price : Close; | ||
Open = time < FirstTimestamp ? price : Open; | ||
FirstTimestamp = time < FirstTimestamp ? time : FirstTimestamp; | ||
LastTimestamp = time > LastTimestamp ? time : LastTimestamp; | ||
Change = (Close - Open) / Open; | ||
} | ||
|
||
internal void MarkComplete() | ||
{ | ||
Complete = true; | ||
} | ||
|
||
internal void MarkIncomplete() | ||
{ | ||
Complete = false; | ||
} | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
namespace Intrinio.Realtime; | ||
|
||
using System; | ||
|
||
public class ClientStats | ||
{ | ||
private readonly UInt64 _socketDataMessages; | ||
private readonly UInt64 _socketTextMessages; | ||
private readonly int _queueDepth; | ||
private readonly UInt64 _eventCount; | ||
private readonly int _queueCapacity; | ||
private readonly int _overflowQueueDepth; | ||
private readonly int _overflowQueueCapacity; | ||
private readonly int _droppedCount; | ||
private readonly int _overflowCount; | ||
|
||
public ClientStats(UInt64 socketDataMessages, UInt64 socketTextMessages, int queueDepth, UInt64 eventCount, int queueCapacity, int overflowQueueDepth, int overflowQueueCapacity, int droppedCount, int overflowCount) | ||
{ | ||
_socketDataMessages = socketDataMessages; | ||
_socketTextMessages = socketTextMessages; | ||
_queueDepth = queueDepth; | ||
_eventCount = eventCount; | ||
_queueCapacity = queueCapacity; | ||
_overflowQueueDepth = overflowQueueDepth; | ||
_overflowQueueCapacity = overflowQueueCapacity; | ||
_droppedCount = droppedCount; | ||
_overflowCount = overflowCount; | ||
} | ||
|
||
public UInt64 SocketDataMessages { get { return _socketDataMessages; } } | ||
|
||
public UInt64 SocketTextMessages { get { return _socketTextMessages; } } | ||
|
||
public int QueueDepth { get { return _queueDepth; } } | ||
|
||
public int QueueCapacity { get { return _queueCapacity; } } | ||
|
||
public int OverflowQueueDepth { get { return _overflowQueueDepth; } } | ||
|
||
public int OverflowQueueCapacity { get { return _overflowQueueCapacity; } } | ||
|
||
public UInt64 EventCount { get { return _eventCount; } } | ||
|
||
public int DroppedCount { get { return _droppedCount; } } | ||
|
||
public int OverflowCount { get { return _overflowCount; } } | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
namespace Intrinio.Realtime.Composite; | ||
|
||
using System; | ||
using System.Threading.Tasks; | ||
|
||
public delegate Task OnSupplementalDatumUpdated(String key, double datum, IDataCache dataCache); | ||
public delegate Task OnSecuritySupplementalDatumUpdated(String key, double datum, ISecurityData securityData, IDataCache dataCache); | ||
public delegate Task OnOptionsContractSupplementalDatumUpdated(String key, double datum, IOptionsContractData optionsContractData, ISecurityData securityData, IDataCache dataCache); | ||
|
||
public delegate Task OnEquitiesTradeUpdated(ISecurityData securityData, IDataCache dataCache); | ||
public delegate Task OnEquitiesQuoteUpdated(ISecurityData SecurityData, IDataCache DataCache); | ||
public delegate Task OnEquitiesTradeCandleStickUpdated(ISecurityData securityData, IDataCache dataCache); | ||
public delegate Task OnEquitiesQuoteCandleStickUpdated(ISecurityData SecurityData, IDataCache DataCache); | ||
|
||
public delegate Task OnOptionsTradeUpdated(IOptionsContractData optionsContractData, IDataCache dataCache, ISecurityData securityData); | ||
public delegate Task OnOptionsQuoteUpdated(IOptionsContractData optionsContractData, IDataCache dataCache, ISecurityData securityData); | ||
public delegate Task OnOptionsRefreshUpdated(IOptionsContractData optionsContractData, IDataCache dataCache, ISecurityData securityData); | ||
public delegate Task OnOptionsUnusualActivityUpdated(IOptionsContractData optionsContractData, IDataCache dataCache, ISecurityData securityData); | ||
public delegate Task OnOptionsTradeCandleStickUpdated(IOptionsContractData optionsContractData, IDataCache dataCache, ISecurityData securityData); | ||
public delegate Task OnOptionsQuoteCandleStickUpdated(IOptionsContractData optionsContractData, IDataCache dataCache, ISecurityData securityData); |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
using System.Collections.Concurrent; | ||
using System.Collections.Generic; | ||
using System.Threading.Tasks; | ||
|
||
namespace Intrinio.Realtime.Composite; | ||
|
||
using System; | ||
|
||
/// <summary> | ||
/// Not for Use yet. Subject to change. | ||
/// </summary> | ||
public interface IDataCache | ||
{ | ||
double? GetsupplementaryDatum(string key); | ||
Task<bool> SetsupplementaryDatum(string key, double? datum); | ||
IReadOnlyDictionary<string, double?> AllSupplementaryData { get; } | ||
|
||
ISecurityData GetSecurityData(string tickerSymbol); | ||
IReadOnlyDictionary<string, ISecurityData> AllSecurityData { get; } | ||
|
||
Intrinio.Realtime.Equities.Trade? GetLatestEquityTrade(string tickerSymbol); | ||
Task<bool> SetEquityTrade(Intrinio.Realtime.Equities.Trade trade); | ||
|
||
Intrinio.Realtime.Equities.Quote? GetLatestEquityQuote(string tickerSymbol); | ||
Task<bool> SetEquityQuote(Intrinio.Realtime.Equities.Quote quote); | ||
|
||
Intrinio.Realtime.Equities.TradeCandleStick? GetLatestEquityTradeCandleStick(string tickerSymbol); | ||
Task<bool> SetEquityTradeCandleStick(Intrinio.Realtime.Equities.TradeCandleStick tradeCandleStick); | ||
|
||
Intrinio.Realtime.Equities.QuoteCandleStick? GetLatestEquityAskQuoteCandleStick(string tickerSymbol); | ||
Intrinio.Realtime.Equities.QuoteCandleStick? GetLatestEquityBidQuoteCandleStick(string tickerSymbol); | ||
Task<bool> SetEquityQuoteCandleStick(Intrinio.Realtime.Equities.QuoteCandleStick quoteCandleStick); | ||
|
||
IOptionsContractData GetOptionsContractData(string tickerSymbol, string contract); | ||
|
||
Intrinio.Realtime.Options.Trade? GetLatestOptionsTrade(string tickerSymbol, string contract); | ||
Task<bool> SetOptionsTrade(Intrinio.Realtime.Options.Trade trade); | ||
|
||
Intrinio.Realtime.Options.Quote? GetLatestOptionsQuote(string tickerSymbol, string contract); | ||
Task<bool> SetOptionsQuote(Intrinio.Realtime.Options.Quote quote); | ||
|
||
Intrinio.Realtime.Options.Refresh? GetLatestOptionsRefresh(string tickerSymbol, string contract); | ||
Task<bool> SetOptionsRefresh(Intrinio.Realtime.Options.Refresh refresh); | ||
|
||
Intrinio.Realtime.Options.UnusualActivity? GetLatestOptionsUnusualActivity(string tickerSymbol, string contract); | ||
Task<bool> SetOptionsUnusualActivity(Intrinio.Realtime.Options.UnusualActivity unusualActivity); | ||
|
||
Intrinio.Realtime.Options.TradeCandleStick? GetLatestOptionsTradeCandleStick(string tickerSymbol, string contract); | ||
Task<bool> SetOptionsTradeCandleStick(Intrinio.Realtime.Options.TradeCandleStick tradeCandleStick); | ||
|
||
Intrinio.Realtime.Options.QuoteCandleStick? GetOptionsAskQuoteCandleStick(string tickerSymbol); | ||
Intrinio.Realtime.Options.QuoteCandleStick? GetOptionsBidQuoteCandleStick(string tickerSymbol); | ||
Task<bool> SetOptionsQuoteCandleStick(Intrinio.Realtime.Options.QuoteCandleStick quoteCandleStick); | ||
|
||
double? GetSecuritySupplementalDatum(string tickerSymbol, string key); | ||
Task<bool> SetSecuritySupplementalDatum(string tickerSymbol, string key, double? datum); | ||
|
||
double? GetOptionsContractSupplementalDatum(string tickerSymbol, string contract, string key); | ||
Task<bool> SetOptionSupplementalDatum(string tickerSymbol, string contract, string key, double? datum); | ||
|
||
void SetOnSupplementalDatumUpdated(OnSupplementalDatumUpdated onSupplementalDatumUpdated); | ||
void SetOnSecuritySupplementalDatumUpdated(OnSecuritySupplementalDatumUpdated onSecuritySupplementalDatumUpdated); | ||
void SetOnOptionSupplementalDatumUpdated(OnOptionsContractSupplementalDatumUpdated onOptionsContractSupplementalDatumUpdated); | ||
|
||
void SetOnEquitiesTradeUpdated(OnEquitiesTradeUpdated onEquitiesTradeUpdated); | ||
void SetOnEquitiesQuoteUpdated(OnEquitiesQuoteUpdated onEquitiesQuoteUpdated); | ||
void SetOnEquitiesTradeCandleStickUpdated(OnEquitiesTradeCandleStickUpdated onEquitiesTradeCandleStickUpdated); | ||
void SetOnEquitiesQuoteCandleStickUpdated(OnEquitiesQuoteCandleStickUpdated onEquitiesQuoteCandleStickUpdated); | ||
|
||
void SetOnOptionsTradeUpdated(OnOptionsTradeUpdated onOptionsTradeUpdated); | ||
void SetOnOptionsQuoteUpdated(OnOptionsQuoteUpdated onOptionsQuoteUpdated); | ||
void SetOnOptionsRefreshUpdated(OnOptionsRefreshUpdated onOptionsRefreshUpdated); | ||
void SetOnOptionsUnusualActivityUpdated(OnOptionsUnusualActivityUpdated onOptionsUnusualActivityUpdated); | ||
void SetOnOptionsTradeCandleStickUpdated(OnOptionsTradeCandleStickUpdated onOptionsTradeCandleStickUpdated); | ||
void SetOnOptionsQuoteCandleStickUpdated(OnOptionsQuoteCandleStickUpdated onOptionsQuoteCandleStickUpdated); | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
using System; | ||
using System.Collections.Concurrent; | ||
using System.Collections.Generic; | ||
using System.Threading.Tasks; | ||
|
||
namespace Intrinio.Realtime.Composite; | ||
|
||
/// <summary> | ||
/// Not for Use yet. Subject to change. | ||
/// </summary> | ||
public interface IOptionsContractData { | ||
string Contract { get; } | ||
|
||
Intrinio.Realtime.Options.Trade? LatestTrade { get; } | ||
Intrinio.Realtime.Options.Quote? LatestQuote { get; } | ||
Intrinio.Realtime.Options.Refresh? LatestRefresh { get; } | ||
Intrinio.Realtime.Options.UnusualActivity? LatestUnusualActivity { get; } | ||
Intrinio.Realtime.Options.TradeCandleStick? LatestTradeCandleStick { get; } | ||
Intrinio.Realtime.Options.QuoteCandleStick? LatestAskQuoteCandleStick { get; } | ||
Intrinio.Realtime.Options.QuoteCandleStick? LatestBidQuoteCandleStick { get; } | ||
|
||
Task<bool> SetTrade(Intrinio.Realtime.Options.Trade trade); | ||
Task<bool> SetQuote(Intrinio.Realtime.Options.Quote quote); | ||
Task<bool> SetRefresh(Intrinio.Realtime.Options.Refresh refresh); | ||
Task<bool> SetUnusualActivity(Intrinio.Realtime.Options.UnusualActivity unusualActivity); | ||
Task<bool> SetTradeCandleStick(Intrinio.Realtime.Options.TradeCandleStick tradeCandleStick); | ||
Task<bool> SetQuoteCandleStick(Intrinio.Realtime.Options.QuoteCandleStick quoteCandleStick); | ||
|
||
double? GetSupplementaryDatum(string key); | ||
Task<bool> SetSupplementaryDatum(string key, double? datum); | ||
IReadOnlyDictionary<string, double?> AllSupplementaryData { get; } | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
using System; | ||
using System.Collections.Concurrent; | ||
using System.Collections.Generic; | ||
using System.Threading.Tasks; | ||
|
||
namespace Intrinio.Realtime.Composite; | ||
|
||
/// <summary> | ||
/// Not for Use yet. Subject to change. | ||
/// </summary> | ||
public interface ISecurityData { | ||
string TickerSymbol { get; } | ||
|
||
double? GetSupplementaryDatum(string key); | ||
Task<bool> SetSupplementaryDatum(string key, double? datum); | ||
IReadOnlyDictionary<string, double?> AllSupplementaryData { get; } | ||
|
||
Intrinio.Realtime.Equities.Trade? LatestEquitiesTrade { get; } | ||
Intrinio.Realtime.Equities.Quote? LatestEquitiesQuote { get; } | ||
|
||
Intrinio.Realtime.Equities.TradeCandleStick? LatestEquitiesTradeCandleStick { get; } | ||
Intrinio.Realtime.Equities.QuoteCandleStick? LatestEquitiesAskQuoteCandleStick { get; } | ||
Intrinio.Realtime.Equities.QuoteCandleStick? LatestEquitiesBidQuoteCandleStick { get; } | ||
|
||
IOptionsContractData GetOptionsContractData(string contract); | ||
IReadOnlyDictionary<string, IOptionsContractData> AllOptionsContractData { get; } | ||
List<string> GetContractNames(string ticker); | ||
|
||
Task<bool> SetEquitiesTrade(Intrinio.Realtime.Equities.Trade trade); | ||
Task<bool> SetEquitiesQuote(Intrinio.Realtime.Equities.Quote quote); | ||
|
||
Task<bool> SetEquitiesTradeCandleStick(Intrinio.Realtime.Equities.TradeCandleStick tradeCandleStick); | ||
Task<bool> SetEquitiesQuoteCandleStick(Intrinio.Realtime.Equities.QuoteCandleStick quoteCandleStick); | ||
|
||
Intrinio.Realtime.Options.Trade? GetLatestOptionsContractTrade(string contract); | ||
Task<bool> SetOptionsContractTrade(Intrinio.Realtime.Options.Trade trade); | ||
|
||
Intrinio.Realtime.Options.Quote? GetLatestOptionsContractQuote(string contract); | ||
Task<bool> SetOptionsContractQuote(Intrinio.Realtime.Options.Quote quote); | ||
|
||
Intrinio.Realtime.Options.Refresh? GetLatestOptionsContractRefresh(string contract); | ||
Task<bool> SetOptionsContractRefresh(Intrinio.Realtime.Options.Refresh refresh); | ||
|
||
Intrinio.Realtime.Options.UnusualActivity? GetLatestOptionsContractUnusualActivity(string contract); | ||
Task<bool> SetOptionsContractUnusualActivity(Intrinio.Realtime.Options.UnusualActivity unusualActivity); | ||
|
||
double? GetOptionsContractSupplementalDatum(string contract, string key); | ||
Task<bool> SetOptionsContractSupplementalDatum(string contract, string key, double? datum); | ||
} |
Oops, something went wrong.