Here you can download an CSharp Example Projekt that includes most of the interface commands described below TAI-PAN_net_Example.zip
Here you can download an CSharp Example Projekt that includes most of the interface commands described below TAI-PAN_net_Example.zip
First, you need to download and unzip the TPRAccess.zip
In the Solution Explorer, right-click on 'References' and select the entry 'Add Reference ...'
Click on 'Browse ...' in the Reference Manager
Navigate to the location of TPRAccess.dll and add it to the project with 'Add ...'.
Make sure that the check mark in front of the TPRAccess.dll is set and confirm with 'OK'
<ItemGroup>
<PackageReference Include="System.Text.Encoding.CodePages" Version="4.3.0" />
</ItemGroup>
sourcecode:
Encoding.RegisterProvider(CodePagesEncodingProvider.Instance);
You can now access the interface
Insert using statement
using TPRAccess;
private TPRServerConnection m_TPRCon;
private void Form1_Load(object sender, EventArgs e) {
m_TPRCon = new TPRServerConnection("Insert Your DeveloperID here");
m_TPRCon.ClientLanguage = TPRClientLanguages.English;
//m_TPRCon.ClientLanguage = TPRClientLanguages.German;
}
TPRConnectionClientInfo rClientInfo = new TPRConnectionClientInfo();
if (m_TPRCon.GetConnectionClientInfo(ref rClientInfo)) {
// some Info: rClientInfo.InfoText;
}
if(m_TPRCon.Login("CustomerID", "Password")) {
int YouAreIn = 0;
}
private TPRUserInfo userInfo;
private void Form1_Load(object sender, EventArgs e) {
...
userInfo = myTPRConnection.GetUserInfo();
}
userInfo.EMail
userInfo.Mobile
foreach (var NewsAboID in userInfo.NewsAbos){
//NewsAboID
}
userInfo.Password
userInfo.UseEMail
userInfo.UserId
userInfo.Username
userInfo.UseSMS
foreach (var WatchList in userInfo.WatchLists) {
//WatchList.Value.Name;
//WatchList.Value.Id;
}
foreach (var Branch in userInfo.Branches) {
//Branch.Value.Name;
//Branch.Value.Id;
}
foreach (var Country in userInfo.Countries) {
//Country.Value.Name;
//Country.Value.Id;
}
foreach (var Exchange in userInfo.Exchanges) {
//Exchange.Value.Name;
//Exchange.Value.Id;
}
foreach (var SecurityType in userInfo.SecurityTypes) {
//SecurityType.Value.Name;
//SecurityType.Value.Id;
}
foreach (var QuoteSubscription in userInfo.QuoteSubscriptions) {
//QuoteSubscription.Name;
//QuoteSubscription.Id;
}
foreach (var NewsCatetory in userInfo.NewsCatetories) {
//NewsCatetory.Value.Name;
//NewsCatetory.Value.ID;
}
foreach (var NewsAboID in userInfo.NewsAbos){
TPRNewsSubscription Subscription;
if(userInfo.NewsSubscriptions.TryGetValue(NewsAboID, out Subscription)){
//Subscription.Name;
//Subscription.Id;
}
}
foreach (var AssetManagementCompany in userInfo.AssetManagementCompanies) {
//AssetManagementCompany.Value.Name;
//AssetManagementCompany.Value.ID;
}
foreach (var AssetManagementField in userInfo.AssetManagementFields) {
//AssetManagementField.Value.Name;
//AssetManagementField.Value.ID;
}
foreach (var FondSegment in userInfo.FondSegments) {
//FondSegment.Value.Name;
//FondSegment.Value.ID;
}
foreach (var Issuer in userInfo.Issuers) {
//Issuer.Value.Name;
//Issuer.Value.ID;
}
using System.Collections.Generic;
...
private List<TPRCatalogEntry> CatEntries = new List<TPRCatalogEntry>();
private Dictionary<long, TPRCatalogFolder> dictCatFolder = new Dictionary<long, TPRCatalogFolder>();
private Dictionary<long, TPRCatalogItem> dictCatItems = new Dictionary<long, TPRCatalogItem>();
private void Form1_Load(object sender, EventArgs e) {
...
m_TPRCon.GetCatalogStructure(ref CatEnt, ref d_CatFold, ref d_CatItm);
BuildTreeChilds(-1, null);// <-example
}
//example of filling a TreeView (tvKataloge)
void BuildTreeChilds(long GruppenId, TreeNode ParentItem)
{
TPRCatalogueEntry GrpStrkSatz;
TreeNode TempItem;
for (int nKatStructIndex = 0; nKatStructIndex < CatEntries.Count; nKatStructIndex++)
{
string Name = "";
GrpStrkSatz = CatEntries[nKatStructIndex];
if (GrpStrkSatz.ParentId == GruppenId)
{
if (GrpStrkSatz.EntryType == TPRCatalogueTreeEntryTypes.Folder)
{
TPRCatalogueFolder KatFolder;
dictCatFolder.TryGetValue(GrpStrkSatz.Id, out KatFolder);
if (KatFolder != null)
Name = KatFolder.Name;
}
else
{
TPRCatalogueItem KatItem;
dictCatItems.TryGetValue(GrpStrkSatz.Id, out KatItem);
if (KatItem != null)
Name = KatItem.Name;
}
if (ParentItem == null)
TempItem = tvKataloge.Nodes.Add(Name);
else
TempItem = ParentItem.Nodes.Add(Name);
if (GrpStrkSatz.EntryType == TPRCatalogueTreeEntryTypes.Folder)
{
TempItem.ImageIndex = 0;
TempItem.SelectedImageIndex = 0;
}
else
{
TempItem.ImageIndex = 2;
TempItem.SelectedImageIndex = 2;
}
TempItem.Tag = nKatStructIndex;
if (GrpStrkSatz.EntryType == TPRCatalogueTreeEntryTypes.Folder)
{
TempItem.ImageIndex = 0;
BuildTreeChilds(GrpStrkSatz.Id, TempItem);
}
}
}
}
using System.Threading.Tasks;
...
private TPRPushFeed m_PushFeed;
...
public void InitFeed(){
m_PushFeed = m_TPRCon.GetPushFeed();
m_PushFeed.ConnectFeed();
//subscribe one Symbol
//m_PushFeed.SubscribeSymbol(169286); //710000.ETR Daimler Xetra
//unsubscribe one Symbol
//m_PushFeed.UnsubscribeSymbol(169286); //710000.ETR Daimler Xetra
//or subscribe several symbols at the same time
var symbols = new List<int>();
symbols.Add(169286); //710000.ETR Daimler Xetra
symbols.Add(79514); //846900.ETR Dax
m_PushFeed.SubscribeSymbol(symbols);
//unsubscribe several symbols at the same time
//m_PushFeed.UnsubscribeSymbol(symbols);
//unsubscribe all symbols at once
//m_PushFeed.UnsubscribeAllSymbols();
Task.Factory.StartNew(() => { FeedProcessing(); } );
}
public void FeedProcessing(){
TPRPushFeedMessage pfm = m_PushFeed.GetNextPushFeedMessage();
if (pfm != null){
do{
switch (pfm.MessageType)
{
case TPRPushFeedMessageTypes.Quote:
var TickMessage = pfm as TPRQuoteTickMessage;
//TickMessage.SymbolNo
//TickMessage.QuoteTick.Quote
//TickMessage.QuoteTick.Time
//TickMessage.QuoteTick.Volume
switch (TickMessage.QuoteType) {
case TPRQuoteTypes.Ask: break;
case TPRQuoteTypes.Auktion: break;
case TPRQuoteTypes.Bid: break;
case TPRQuoteTypes.Last: break;
case TPRQuoteTypes.OpenInterest: break;
default: /*huh?*/ break;
}
break;
case TPRPushFeedMessageTypes.MarketDepth:
var MarketDepthMessage = pfm as TPRMarketDepthMessage;
//MarketDepthMessage.SymbolNo
//MarketDepthMessage.QuoteTick.Quote
//MarketDepthMessage.QuoteTick.Time
//MarketDepthMessage.QuoteTick.Volume
//MarketDepthMessage.QuoteType
//MarketDepthMessage.Position
break;
case TPRPushFeedMessageTypes.News:
var NewsMessage = pfm as TPRNewsMessage;
//NewsMessage.NewsMsg.Categories
//NewsMessage.NewsMsg.Headline
//NewsMessage.NewsMsg.Id
//NewsMessage.NewsMsg.Subscriptions
//NewsMessage.NewsMsg.Symbols
//NewsMessage.NewsMsg.Time
break;
case TPRPushFeedMessageTypes.SymbolUpdate:
var SymbolUpdateMessage = pfm as TPRSymbolUpdateMessage;
//SymbolUpdateMessage.Symbol
break;
case TPRPushFeedMessageTypes.Message:
var PushFeedMessage = pfm as TPRPushFeedMessage;
break;
case TPRPushFeedMessageTypes.LimitUpdate:
var LimitUpdateMessage = pfm as TPRAccess.TPRAlertUpdateMessage;
//LimitUpdateMessage.Alert.AktionBeiAusloesung
//TPRAlertActions.Deaktivieren
//TPRAlertActions.Loeschen
//TPRAlertActions.Reset
//LimitUpdateMessage.Alert.Art
//TPRAlertTypes.DynamischStop
//TPRAlertTypes.DynamischStopProzent
//TPRAlertTypes.DynamischZiel
//TPRAlertTypes.DynamischZielProzent
//TPRAlertTypes.GuardingLine
//TPRAlertTypes.StatischStop
//TPRAlertTypes.StatischZiel
//LimitUpdateMessage.Alert.AufKursArt
//LimitUpdateMessage.Alert.LimitNr
//LimitUpdateMessage.Alert.MaxAbstand
//LimitUpdateMessage.Alert.NextArt
//TPRAlertTypes.DynamischStop
//TPRAlertTypes.DynamischStopProzent
//TPRAlertTypes.DynamischZiel
//TPRAlertTypes.DynamischZielProzent
//TPRAlertTypes.GuardingLine
//TPRAlertTypes.StatischStop
//TPRAlertTypes.StatischZiel
//LimitUpdateMessage.Alert.NextWert
//LimitUpdateMessage.Alert.StartZeit
//LimitUpdateMessage.Alert.Status
//TPRAlertStatusTypes.Aktiv
//TPRAlertStatusTypes.Deleted
//TPRAlertStatusTypes.InAktiv
//TPRAlertStatusTypes.Reached
//LimitUpdateMessage.Alert.Steigung
//LimitUpdateMessage.Alert.SymbolNo
//LimitUpdateMessage.Alert.TypNrBenachrichtigung ???
//LimitUpdateMessage.Alert.UserText
//LimitUpdateMessage.Alert.Wert
break;
case TPRPushFeedMessageTypes.LimitTrigger:
var LimitTriggerMessage = pfm as TPRAccess.TPRAlertTriggerMessage;
//LimitTriggerMessage.AktKurs
//LimitTriggerMessage.BenachrichtigungsId
//LimitTriggerMessage.BoerseNr
//LimitTriggerMessage.Currency
//LimitTriggerMessage.Datum
//LimitTriggerMessage.EDV
//LimitTriggerMessage.FullSymbol
//LimitTriggerMessage.ISIN
//LimitTriggerMessage.LimitArt
//LimitTriggerMessage.LimitKurs
//LimitTriggerMessage.Limittext
//LimitTriggerMessage.Name
//LimitTriggerMessage.SecurityType
//LimitTriggerMessage.Symbol
//LimitTriggerMessage.SymbolId
//LimitTriggerMessage.Zeit
break;
case TPRPushFeedMessageTypes.Reconnect:
var ReconnectMessage = pfm as TPRReconnectMessage;
//ReconnectMessage.FirstIntervall
//ReconnectMessage.OptionalText
//ReconnectMessage.SecondIntervall
break;
case TPRPushFeedMessageTypes.Korrection:
var KorrectionMessage = pfm as TPRCorrectionMessage;
//KorrectionMessage.CorrectedQuoteTick.Quote
//KorrectionMessage.CorrectedQuoteTick.Time
//KorrectionMessage.CorrectedQuoteTick.Volume
switch (KorrectionMessage.QuoteCorrection)
{
case TPRQuoteCorrectionTypes.Close: break;
case TPRQuoteCorrectionTypes.High: break;
case TPRQuoteCorrectionTypes.Low: break;
case TPRQuoteCorrectionTypes.Open: break;
case TPRQuoteCorrectionTypes.Volume: break;
}
break;
case TPRPushFeedMessageTypes.Ping:
var PingMessage = pfm as TPRPingMessage;
//PingMessage.ServerDate
break;
case TPRPushFeedMessageTypes.Info:
var InfoMessage = pfm as TPRInfoMessage;
//InfoMessage.Message;
break;
case TPRPushFeedMessageTypes.ConnectionStatus:
var ConnectionMessage = pfm as TPRPushFeedConnectionMessage;
switch (ConnectionMessage.Status){
case TPRPushFeedOnlineStatusTypes.Online: break;
case TPRPushFeedOnlineStatusTypes.Offline: break;
case TPRPushFeedOnlineStatusTypes.Offline_AutoReconnect_Pending: break;
case TPRPushFeedOnlineStatusTypes.OnBackup: break;
case TPRPushFeedOnlineStatusTypes.Connecting: break;
default:break;
}
//ConnectionMessage.Name
//ConnectionMessage.NextReconnectTry
break;
default: /*huh?*/ break;
}
m_PushFeed.ReturnFeedMessage(pfm);
pfm = m_PushFeed.GetNextPushFeedMessage();
}while (pfm != null);
}
}
public void EndFeed(){
if (m_PushFeed != null)
m_PushFeed.DisconnectFeed();
}
TPRWatchList watchlist = userInfo.WatchLists.AddWatchList("MyWatchlistName");
watchlist.Add(169286); //710000.ETR Daimler Xetra
//Add Multiple SymbolID's
var symbols = new List<int>();
symbols.Add(169286); //710000.ETR Daimler Xetra
symbols.Add(79514); //846900.ETR Dax
watchlist.Add(symbols);
//Add TPRSymbolList
TPRSymbolList foundSymbols = m_TPRCon.Search(TPRSearchTypes.Name,
"Daimler",
TPRSecurityType.All.Id,
0/*see userInfo.Exchanges*/);
watchlist.Add(foundSymbols);
userInfo.WatchLists.DeleteWatchList(watchlist.Id);
userInfo.WatchLists.RenameWatchList(watchlist.Id,"NewWatchlistName");
foreach (var List in userInfo.WatchLists){
TPRSymbolList Entrys = m_TPRCon.GetWatchListContent(List.Value.Id);
foreach(TPRSymbol Entry in Entrys){
//Entry.SymbolNo
//Entry.Name
//...see TPRSymbol
}
break;
}
//TPRSymbol.AGMDate
//TPRSymbol.BondBranch
//TPRSymbol.BondInterestRate
//TPRSymbol.BondMatury
//TPRSymbol.BonusLevel
//TPRSymbol.Branch
//TPRSymbol.Cap
//TPRSymbol.CashFlow
//TPRSymbol.ConversionRatio1
//TPRSymbol.ConversionRatio2
//TPRSymbol.Country
//TPRSymbol.Currency
//TPRSymbol.DayHigh
//TPRSymbol.DayLow
//TPRSymbol.DayOpen
//TPRSymbol.DayVolume
//TPRSymbol.Decimals
//TPRSymbol.Divident
//TPRSymbol.Earning
//TPRSymbol.EDV
//TPRSymbol.Exchange
//TPRSymbol.FundSegment
//TPRSymbol.InsertDatum
//TPRSymbol.InterestSector
//TPRSymbol.InvestmentCompany
//TPRSymbol.ISIN
//TPRSymbol.IssuerShortCode
//TPRSymbol.KnockOutValue
//TPRSymbol.LastActiveTickDate
//TPRSymbol.LastAsk.Quote
//TPRSymbol.LastAsk.Time
//TPRSymbol.LastAsk.Volume
//TPRSymbol.LastBid.Quote
//TPRSymbol.LastBid.Time
//TPRSymbol.LastBid.Volume
//TPRSymbol.LastTrade.Quote
//TPRSymbol.LastTrade.Time
//TPRSymbol.LastTrade.Volume
//TPRSymbol.LastTradingDay
//TPRSymbol.MarketCap
//TPRSymbol.Name
//TPRSymbol.OpenInterest
//TPRSymbol.PrevClose
//TPRSymbol.QuoteFactor
//TPRSymbol.SecurityLevel
//TPRSymbol.SecurityLevelHitDate
//TPRSymbol.SecurityType
//TPRSymbol.StopPrice
//TPRSymbol.StopPriceAlertStatus
//TPRSymbol.SubscriptionPrice
//TPRSymbol.SymbolColumnInTPRClient
//TPRSymbol.SymbolNo
//TPRSymbol.SymbolString
//TPRSymbol.TargetPrice
//TPRSymbol.TargetPriceAlertStatus
//TPRSymbol.TerminationDate
//TPRSymbol.Trades
//TPRSymbol.TradingVolume
//TPRSymbol.UnderlyingSecurityType
//TPRSymbol.UnderlyingWPK
//TPRSymbol.UnderlyingLastPrice
//TPRSymbol.UnderlyingSymbolNo
//TPRSymbol.UPC
//TPRSymbol.WarrentType
//TPRSymbol.WatchListEntryID
//TPRSymbol.WKN
//TPRSearchTypes.Default
//TPRSearchTypes.EDV
//TPRSearchTypes.ISIN
//TPRSearchTypes.LimitSymbolen
//TPRSearchTypes.MMQuoteId <- Market-Maker QuoteID
//TPRSearchTypes.Name
//TPRSearchTypes.QuickSuggestion <- best 10 Seachentries
//TPRSearchTypes.SucheSymbolKuerzel
//TPRSearchTypes.Symbol
//TPRSearchTypes.SymbolNo
//TPRSearchTypes.Symbol_Equal
//TPRSearchTypes.Symbol_ISIN_Name
//TPRSearchTypes.TaiPanEODDBID <- TAI-PAN End-of-Day SymbolID
var foundSymbols = m_TPRCon.Search(TPRSearchTypes.Name,
"Daimler",
TPRSecurityType.All.Id,
0/*see userInfo.Exchanges*/);
foreach (var Symbol in foundSymbols){
//Symbol.Name;
//Symbol.SymbolNo;
//...see TPRSymbol
}
//169286 = 710000.ETR Daimler Xetra
// (compression = 1 Day) last 10 Days
var candles = m_TPRCon.GetCandleChart(169286, DateTime.Now.Date.AddDays(-10));
foreach(var candle in candles){
//candle.Close
//candle.High
//candle.Low
//candle.Open
//candle.Time
//candle.Volume
}
//(12 minute compression) last 42 Candles
//var candles = m_TPRCon.GetCandleChart(169286, 12, 42);
//(15 minute compression) last 10 Days
var candles = m_TPRCon.GetCandleChart(169286,15,DateTime.Now.Date.AddDays(-10));
foreach(var candle in candles){
//candle.Close
//candle.High
//candle.Low
//candle.Open
//candle.Time
//candle.Volume
}
//TPRCandle.Close
//TPRCandle.High
//TPRCandle.Low
//TPRCandle.Open
//TPRCandle.Time
//TPRCandle.Volume
//169286 = 710000.ETR Daimler Xetra
//let GetIntradayChart fill your Lists from 3 days ago incl Bid/Ask
var LastList = new TPRQuoteTickList();
var AskList = new TPRQuoteTickList();
var BidList = new TPRQuoteTickList();
m_TPRCon.GetIntradayChart(169286, DateTime.Now.Date.AddDays(-3),
out LastList,
out AskList,
out BidList,
1 /*one Day*/)
foreach (var Tick in LastList){
//Tick.Quote
//Tick.Time
//Tick.Volume
//see TPRQuoteTick
}
//TickData only from yesterday
var LastList1 = m_TPRCon.GetIntradayChart(169286,
DateTime.Now.Date.AddDays(-1),
1 /*one Day*/);
foreach (var Tick in LastList1){
//Tick.Quote
//Tick.Time
//Tick.Volume
//see TPRQuoteTick
}
//last 2 Days + Today Tickdata
var LastList2 = m_TPRCon.GetIntradayChart(169286, DateTime.Now.Date.AddDays(-2));
foreach(var Tick in LastList2){
//Tick.Quote
//Tick.Time
//Tick.Volume
// see TPRQuoteTick
}
//Tick.Quote
//Tick.Time
//Tick.Volume
var OptionsMatrix = m_TPRCon.GetOptionsMatrix(169286); //710000.ETR Daimler
if (OptionsMatrix != null && (OptionsMatrix.Matrix != null)){
var baseEntries = OptionsMatrix.BasisEntries;
foreach (var baseEntry in baseEntries){
//baseEntry.Name;
//baseEntry.SymbolNo;
//...see TPRSymbol
}
foreach(var Entry in OptionsMatrix.Matrix){
foreach(var Element in Entry.OptionsMatrixElements){
//Element.CallOption
//Element.OptionsSequenceNo
//Element.PutOption
//Element.StrikePrice
//Element.TerminationDate
}
//Entry.Exchange;
//Entry.SYM;
//Entry.SYM_EX;
//Entry.TabLBL;
//Entry.Used;
//Entry.WPKBAS;
//Entry.WPKVWD;
}
}
//Tick.Quote
//Tick.Time
//Tick.Volume
var MT = m_TPRCon.GetMarketDepth(169286); //710000.ETR Daimler Xetra
//MT.SymbolNo
//MT.LastTrade.Quote
//MT.LastTrade.Time
//MT.LastTrade.Volume
var askList = MT.Ask;
foreach(var AskTick in askList)
{
//AskTick.Quote
//AskTick.Time
//AskTick.Volume
//...see TPRQuoteTick
}
var bidList = MT.Bid;
foreach (var BidTick in bidList)
{
//BidTick.Quote
//BidTick.Time
//BidTick.Volume
//...see TPRQuoteTick
}