Tai-Pan Realtime COM Developer Documentation
Quick Start
using TaiPanRTLib;
TaiPanRealtimeClass m_TPR = new TaiPanRealtimeClass();
DataBase db = (DataBase)m_TPR.DataBase;
Central COM object for accessing Tai-Pan Realtime. From here you can access the database, data stream, charts, news, and other objects.
Integrating the COM interface
Right-click References in the Solution Explorer.
Select Add Reference... from the context menu.
Search for and select the following reference under COM: Tai-Pan Realtime Library 1.0 Then confirm with OK.
Please make sure that in the properties of TaiPanRTLib, the option Embed Interop Types is set to False.
Using the COM Interface
using Statement
using TaiPanRTLib;
Create Object
TaiPanRealtimeClass m_TPR = new TaiPanRealtimeClass();
...
m_TPR.Quit();
The object establishes the connection to the Tai-Pan Realtime COM interface. After use, close it properly with Quit().
TaiPanRealtime
The TaiPanRealtime object provides the foundation for communication between your application and Tai-Pan Realtime.
TaiPanRealtime TPRTObject;
public void StartComServer()
{
TPRTObject = new TaiPanRealtime();
}
Database
Use the DataBase object to read existing data from Tai-Pan Realtime or to make changes to it.
DataBase db = (DataBase)TPRTObjekt.DataBase;
BarChart
A BarChart object provides access to already compressed data (e.g. 5-minute candles) for a symbol.
BarChart bc = new BarChart();
IBarChartEntry
This interface provides access to the key data of a period contained in the BarChart.
foreach(IBarChartEntry candle in BarChart)
{
// candle.Zeit
// candle.Open
// candle.High
// candle.Low
// candle.Close
// candle.Volume
}
Barchart via Data and Data2
For high-performance processing, period data can be read directly as arrays or via pointer.
// Data2
var openKurse = chart.Data2(
TPRQuickAccessKursArten.TPRQuickAccessKursArtenOpen);
var highKurse = chart.Data2(
TPRQuickAccessKursArten.TPRQuickAccessKursArtenHigh);
var lowKurse = chart.Data2(
TPRQuickAccessKursArten.TPRQuickAccessKursArtenLow);
var closeKurse = chart.Data2(
TPRQuickAccessKursArten.TPRQuickAccessKursArtenClose);
var volumeKurse = chart.Data2(
TPRQuickAccessKursArten.TPRQuickAccessKursArtenVolume);
var zeiten = chart.Data2(
TPRQuickAccessKursArten.TPRQuickAccessKursArtenZeit);
// Data
int[] arrInt = chart.Data;
fixed(void* pointer = &arrInt[0])
{
TPRPERIODE* tprPerioden = (TPRPERIODE*)pointer;
if(tprPerioden != null)
{
for(int i = 0; i < chart.Count; i++)
{
DateTime dt =
DateTime.FromOADate(tprPerioden[i].Zeit);
Debug.WriteLine(
"O:{0} H:{1} L:{2} C:{3} V:{4} Z:{5}",
tprPerioden[i].Open,
tprPerioden[i].High,
tprPerioden[i].Low,
tprPerioden[i].Close,
tprPerioden[i].Volume,
dt.ToLongTimeString());
}
}
}
Datastream (new variant)
The Datastream object encapsulates the functionality for receiving realtime price data. This variant is the recommended modern usage.
m_TPRTDataStream =
m_TPRTObject.DataStream as DataStream;
var datastreamEx =
m_TPRTDataStream as IDataStreamEx;
datastreamEx.EnableExEvent();
m_TPRTDataStream.ExEvent +=
M_datastream_ExEvent;
// Symbol 123456 paid trades only
m_TPRTDataStream.Add(123456, 0);
// Symbol 555555 all three quote types
m_TPRTDataStream.Add(555555, 1);
// Remove symbol
m_TPRTDataStream.Remove(78303);
// Remove all
m_TPRTDataStream.RemoveAll();
Receive push data
private void M_datastream_ExEvent(
TPRStreamEventID nEventID,
int SymbolNr,
float Kurs,
float Volume,
DateTime Zeit,
int LongValue)
{
switch(nEventID)
{
case TPRStreamEventID.TPRStreamEvent_Price:
M_datastream_Bezahlt(
SymbolNr, Kurs, Volume, Zeit);
break;
case TPRStreamEventID.TPRStreamEvent_Bid:
M_datastream_Geld(
SymbolNr, Kurs, Volume, Zeit);
break;
case TPRStreamEventID.TPRStreamEvent_Ask:
M_datastream_Brief(
SymbolNr, Kurs, Volume, Zeit);
break;
}
}
Further processing
private void M_datastream_Brief(
int SymbolNr, float Kurs,
float Volume, DateTime Zeit)
{
Debug.WriteLine($"{Kurs}");
}
private void M_datastream_Geld(
int SymbolNr, float Kurs,
float Volume, DateTime Zeit)
{
Debug.WriteLine($"{Kurs}");
}
private void M_datastream_Bezahlt(
int SymbolNr, float Kurs,
float Volume, DateTime Zeit)
{
Debug.WriteLine($"{Kurs}");
}
Datastream (OLD method)
Not recommended. Only for legacy projects.
m_TPRTDataStream.Bezahlt +=
M_TPRTDataStream_Bezahlt;
// Add symbol number 123456
m_TPRTDataStream.Add(123456, 0);
// Add symbol number 555555
m_TPRTDataStream.Add(555555, 1);
// Remove symbol number 78303
m_TPRTDataStream.Remove(78303);
// Remove all symbols
m_TPRTDataStream.RemoveAll();
private void M_TPRTDataStream_Bezahlt(
int SymbolNr,
float Kurs,
float Volume,
DateTime Zeit)
{
// SymbolNr
// Kurs
// Volume
// Zeit
}
IBoerse
This object provides access to the name and number of an exchange.
foreach(IBoerse boerse in
(IBoersen)db.Boersen)
{
// boerse.Name
// boerse.Nr
}
IChartTimeRange
This interface must be retrieved by casting. After that, a time range can be set.
IChartTimeRange range =
(IChartTimeRange)new Jahreschart();
DateTime Time1 =
new DateTime(2005, 01, 01);
DateTime Time2 =
new DateTime(2005, 01, 20);
range.TimeRange(Time1, Time2);
IDepotListe
An object of type IDepotListe encapsulates all symbol entries of a watchlist.
foreach(IDepotListe DepotListe in
(IListen)db.DepotListen)
{
// DepotListe.Nr
// DepotListe.Name
}
IDepotListe2
Allows adding and removing symbols within a watchlist.
IDepotListe2 DepotListe2;
foreach(IDepotListe DepotListe in
(IListen)db.DepotListen)
{
DepotListe2 =
(IDepotListe2)DepotListe;
DepotListe2.Add(79514);
DepotListe2.Remove(42);
DepotListe2.RemoveAll();
}
IIntradayChart
This object contains all intraday prices for a symbol from a specific day. Depending on the requirement, paid trades as well as ask/bid prices are available.
var heute = DateTime.Now.Date;
var DAX = 79514;
// 0 = no BidAsk prices
IIntradayChart Chart =
(IIntradayChart)db.IntradayChart(
DAX,
0,
heute);
Chart.KursArt =
TPRKursart.TPRKursartBezahlt;
IIntradayChartEintrag
An IIntradayChartEintrag object provides timestamp, price value, and trade volume of a price tick.
foreach(IIntradayChartEintrag Eintrag
in TPRTIntradayChart)
{
// Eintrag.Kurs
// Eintrag.Volume
// Eintrag.Zeit
}
IIntradayChartPeriodeEintrag
Provides the key data of a compressed period.
IIntradayChartQuickAccessPeriode IChart;
var heute = DateTime.Now.Date;
var DAX = 79514;
// 0 = no BidAsk prices
IChart =
(IIntradayChartQuickAccessPeriode)
db.IntradayChart(DAX,0,heute);
IChart.Komprimierung = 60;
foreach(IIntradayChartPeriodeEintrag Eintrag
in IChart)
{
// Eintrag.Open
// Eintrag.High
// Eintrag.Low
// Eintrag.Close
// Eintrag.Volume
// Eintrag.Zeit
}
IIntradayChartQuickAccess
Provides fast access to complete price series of a security as arrays.
IIntradayChartQuickAccess IDAccess =
(IIntradayChartQuickAccess)
db.IntradayChart(
79514,
9,
DateTime.Now.Date);
float[] Kurse =
(float[])IDAccess.IntradayData2(
TPRQuickAccessKursArten
.TPRQuickAccessKursArtenClose);
DateTime[] Zeit =
(DateTime[])IDAccess.IntradayData2(
TPRQuickAccessKursArten
.TPRQuickAccessKursArtenZeit);
Int32[] Volume =
(Int32[])IDAccess.IntradayData2(
TPRQuickAccessKursArten
.TPRQuickAccessKursArtenVolume);
IIntradayChartQuickAccessPeriode
Provides price information where the data is aggregated based on a compression interval.
IIntradayChartQuickAccessPeriode IChart =
(IIntradayChartQuickAccessPeriode)
db.IntradayChart(
79514,
0,
DateTime.Now.Date);
IChart.Komprimierung = 60;
foreach(IIntradayChartPeriodeEintrag Eintrag
in IChart)
{
// Eintrag.Open
// Eintrag.High
// Eintrag.Low
// Eintrag.Close
// Eintrag.Volume
}
IIntradayChartCollection (ArrayLoader)
Loads intraday data for multiple days efficiently using the ArrayLoader.
ArrayLoader loader = new ArrayLoader();
// Security via SymbolNr
int symbolNr = 78303;
// Start date = yesterday
DateTime startDatum =
DateTime.Now.AddDays(-1);
// 0 = without BidAsk
int bidAsk = 0;
IIntradayChartCollection ichartCol =
loader.Intradaycharts(
symbolNr,
startDatum,
bidAsk)
as IIntradayChartCollection;
if(ichartCol != null)
{
int count = ichartCol.Count;
for(int i = 1; i <= count; i++)
{
IIntradayChart ichart =
ichartCol[i] as IIntradayChart;
if(ichart != null)
{
foreach(
IIntradayChartEintrag entry
in ichart)
{
Debug.WriteLine(
"{0}{1}",
entry.Zeit.ToShortTimeString(),
entry.Kurs);
}
}
}
}
JahreschartCollection (ArrayLoader)
Loads end-of-day charts for multiple symbols at the same time.
ArrayLoader loader = new ArrayLoader();
int[] symbolNr = new int[5]
{
78303,
169286,
78275,
78340,
78267
};
DateTime datumVon =
new DateTime(2013,8,1);
DateTime datumBis =
DateTime.Now;
JahreschartCollection jahresCol =
loader.Jahrescharts(
symbolNr,
datumVon,
datumBis)
as JahreschartCollection;
if(jahresCol != null)
{
foreach(Jahreschart chart in jahresCol)
{
foreach(IJahreschartEintrag entry
in chart)
{
Debug.WriteLine(
"{0} {1} {2} {3} {4}",
entry.Zeit.ToShortDateString(),
entry.Open,
entry.High,
entry.Low,
entry.Close);
}
}
}
BarChartCollection (ArrayLoader)
Loads period charts for multiple symbols at the same time.
ArrayLoader loader = new ArrayLoader();
int[] symbolNr = new int[5]
{
78303,
169286,
78275,
78340,
78267
};
int minuten = 60;
int anzahl = 5;
BarChartCollection barCol =
loader.Periodencharts(
symbolNr,
minuten,
anzahl)
as BarChartCollection;
if(barCol != null)
{
foreach(BarChart chart in barCol)
{
foreach(IBarChartEntry bar in chart)
{
Debug.WriteLine(
"{0} {1} {2} {3} {4}",
bar.Zeit,
bar.Open,
bar.High,
bar.Low,
bar.Close);
}
}
}
IKatalogListe
The IKatalogListe object is a collection of all catalogs available in Tai-Pan Realtime. The Item property (objects of type IKatalog) provides access to further catalog details.
foreach(IKatalog Liste in
(IKatalogListe)db.KatalogListe)
{
// Liste.Nr
// Liste.Art
// Liste.Count
// Liste.Name
}
IKatalog
An IKatalog object provides information about a catalog and offers access to the contained entries through the Item property.
// see IKatalogListe example
An IKursSuchListe object contains detailed information about securities. This object is returned by the KursSuche() method of the Database object.
IKursSuchListe SuchListe =
(IKursSuchListe)db.KursSuche(
TPRSuchKriterien.TPRSucheWertpapiername,
"volkswagen",
9,
1);
foreach(IKursSymbol Symbol in SuchListe)
{
// Symbol.Aktuell
// Symbol.AktuellZeit
// Symbol.BezahltVolume
// Symbol.Boerse
// Symbol.Brief
// Symbol.BriefVolume
// Symbol.BriefZeit
// Symbol.EDV
// Symbol.FirstTickDate
// Symbol.Geld
// Symbol.GeldVolume
// Symbol.GeldZeit
// Symbol.Handel
// Symbol.High
// Symbol.Low
// Symbol.Marktkapitalisierung
// Symbol.Name
// Symbol.Open
// Symbol.PrevClose
// Symbol.Symbol
// Symbol.SymbolNr
// Symbol.Volume
// Symbol.Waehrung
// Symbol.WPArt
}
An object of this type allows querying almost all column information of a search result.
// see IKursSuchListe example
IListen
This object can be used to read existing watchlists and portfolio lists.
foreach(IWatchListe Liste in
(IListen)db.WatchListen)
{
// Liste.Name
// Liste.Nr
// Liste.Count
}
foreach(IDepotListe Liste in
(IListen)db.DepotListen)
{
// Liste.Name
// Liste.Nr
// Liste.Count
}
IMarkttiefeListe
This object provides a collection of the current values within the market depth. All entries are of type IMarkttiefe.
IMarkttiefeListe TPRTMarkttiefeListe =
(IMarkttiefeListe)
db.get_Markttiefe(78303);
foreach(IMarkttiefe MT
in TPRTMarkttiefeListe)
{
// MT.Bezahlt
// MT.BezahltVolume
// MT.BezahltZeit
// MT.Brief
// MT.BriefVolume
// MT.BriefZeit
// MT.Geld
// MT.GeldVolume
// MT.GeldZeit
// MT.Position
}
IMarkttiefe
An object of type IMarkttiefe provides all information at a specific position within the market depth of a symbol.
// see IMarkttiefeListe example
Watchlists & Portfolio Lists Notes
Watchlists are used to monitor symbols. Portfolio lists can additionally contain position data and can be modified actively.
| Type |
Description |
| Watchlist |
Monitoring list without holdings |
| Portfolio list |
Portfolio / position management |
Notes on Security Search
With KursSuche(), symbols can be found by name, ISIN, symbol, WKN, or other criteria.
db.KursSuche(
TPRSuchKriterien.TPRSucheISIN,
"DE0005557508",
9,
1);
News
A News object provides access to the news from Tai-Pan Realtime. The retrievable news list contains all available news and can additionally be filtered.
TaiPanRTLib.News m_News;
TaiPanRTLib.INewsListe ListeNews;
TaiPanRTLib.INewsItem EineNews;
m_News = new TaiPanRTLib.News();
// Retrieve news list
ListeNews = m_News.NewsListe;
// Set filter:
// all news from today
// Deutsche Telekom
ListeNews.Filter(
TaiPanRTLib.NewsTagFilter.TPRNewsTagAlle,
0,
"555750");
// Retrieve news
foreach(EineNews in ListeNews)
{
// EineNews.NewsNr
// EineNews.Datum
// EineNews.Zeit
// EineNews.Headline
// EineNews.Body
// EineNews.Wertpapiere
}
NewsAbo
Ein News Objekt bietet ebenfalls Zugriff auf abonnierbare Newsquellen.
News m_News = new News();
INewsAboListe AboListe =
(INewsAboListe)m_News.NewsAboListe;
foreach(INewsAbo Abo in AboListe)
{
// Abo.ID
// Abo.Name
}
// Beispiel Filter:
// 128 + 16400 = 16528
m_News.Add(16528, "");
IOSListe
Ein Objekt vom Typ IOSListe kapselt alle Symboleinträge einer Optionsscheinliste.
foreach(IOSListe Listen in
(IListen)db.Optionsscheinlisten)
{
// Listen.Count
// Listen.Name
// Listen.Nr
// Listen.VolaBasis
}
IOS
Ein Objekt dieses Typs ermöglicht die Abfrage fast aller Spalteninformationen einer IOSListe.
foreach(IOS Liste in Listen)
{
// Liste.Name
// Liste.SymbolNr
// Liste.Bezahlt
// Liste.Brief
// Liste.Geld
// Liste.Hebel
// Liste.Delta
// Liste.Gamma
// Liste.Theta
// Liste.Vega
// Liste.Vola
// Liste.Restlaufzeit
// Liste.Faelligkeit
}
IStammInfo
Die Informationen dieses Objektes bilden die sinnvolle gemeinsame Schnittmenge aller Wertpapierarten.
foreach(IStammInfo sInfo in
(IKatalog)db.get_Katalog(42))
{
// sInfo.Aktuell
// sInfo.AktuellZeit
// sInfo.Boerse
// sInfo.EDV
// sInfo.FullSymbol
// sInfo.ISIN
// sInfo.Name
// sInfo.Symbol
// sInfo.SymbolNr
// sInfo.Waehrung
// sInfo.WPArt
}
Durch Setzen der Symbolnummer werden automatisch die zugehörigen Stammdaten geladen.
IStamminformationen StammInfo =
new StamminformationenClass();
StammInfo.SymbolNr = 78303;
// StammInfo.Name
// StammInfo.Symbol
// StammInfo.ISIN
// StammInfo.Branche
// StammInfo.Land
// StammInfo.TickSize
// StammInfo.TickValue
// StammInfo.Waehrung
// StammInfo.WertpapierArt
IStamminformationen (ArrayLoader)
Mehrere Stammdatensätze gleichzeitig laden.
ArrayLoader loader = new ArrayLoader();
int[] symbolNr = new int[5]
{
78303,
169286,
78275,
78340,
78267
};
StammdatenCollection stammCol =
loader.Stammdaten(symbolNr)
as StammdatenCollection;
ISuchListe
An ISuchListe object contains search results for securities within Tai-Pan Realtime.
ISuchListe liste =
(ISuchListe)db.KursSuche(
TPRSuchKriterien.TPRSucheWertpapiername,
"Telekom",
9,
1);
foreach(ISuchSymbol item in liste)
{
// item.Name
// item.Symbol
}
ISuchSymbol
A single result within a search list.
foreach(ISuchSymbol item in liste)
{
// item.Name
// item.Symbol
// item.SymbolNr
// item.ISIN
// item.WKN
}
IWatchListe
A watchlist contains monitored securities.
foreach(IWatchListe wl in
(IListen)db.WatchListen)
{
// wl.Name
// wl.Nr
// wl.Count
}
IWatchListe2
Extended interface for editing a watchlist.
IWatchListe2 wl2 =
(IWatchListe2)watchliste;
wl2.Add(78303);
wl2.Remove(1);
wl2.RemoveAll();
IWertpapier
A single security object with price, master, and symbol information.
IWertpapier wp =
liste.Item(1);
wp.Name;
wp.Symbol;
wp.ISIN;
wp.WKN;
wp.Aktuell;
IWertpapierListe
Collection of multiple security objects.
IWertpapierListe wl =
katalog.WertpapierListe;
foreach(IWertpapier wp in wl)
{
// wp.Name
// wp.Symbol
}
IZertifikat
Special object for certificates and structured products. Additional fields are available depending on the product type.
IZertifikat z =
(IZertifikat)wp;
// e.g.
// z.Basiswert
// z.Hebel
// z.Barriere
// z.Laufzeit
// z.Emittent
Preferred for large data volumes: • ArrayLoader • Data2() methods • QuickAccess interfaces These variants are significantly faster than individual COM calls.
General Notes
• Tai-Pan Realtime must be installed
• COM interface must be registered
• x86 build often recommended
• Release COM objects properly
• Remove streams after use
• Unsubscribe events correctly