本文整理汇总了C#中KaiTrade类的典型用法代码示例。如果您正苦于以下问题:C# KaiTrade类的具体用法?C# KaiTrade怎么用?C# KaiTrade使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
KaiTrade类属于命名空间,在下文中一共展示了KaiTrade类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: ApplyDOMUpdate
public void ApplyDOMUpdate(IProduct product, KaiTrade.Interfaces.IPXUpdate update)
{
try
{
KaiTrade.Interfaces.IDOM dom = _mnemonicDOM[product.Mnemonic];
if (dom == null)
{
// must have a least a price
decimal? initPx = null;
if (update.BidPrice.HasValue)
{
initPx = update.BidPrice;
}
else if (update.OfferPrice.HasValue)
{
initPx = update.OfferPrice;
}
else if (update.TradePrice.HasValue)
{
initPx = update.TradePrice;
}
if (initPx.HasValue)
{
dom = GetProductDOM(product, initPx.Value);
}
}
dom.Update(update);
}
catch
{
}
}
开发者ID:junwin,项目名称:TradingTools,代码行数:35,代码来源:MemoryPriceHandler.cs
示例2: SetRangeType
public void SetRangeType(KaiTrade.Interfaces.TSRangeType rangeType)
{
foreach (TSQueryGroupTSDataSet dataSet in TsQueryGroup.TSDataSet)
{
dataSet.RangeType = (byte) rangeType;
}
}
开发者ID:junwin,项目名称:TradingTools,代码行数:7,代码来源:TSGroupTool.cs
示例3: CancelRequestData
public CancelRequestData(crrType type, KaiTrade.Interfaces.ICancelOrderRequest cancelRequest)
{
_cancelRequest = cancelRequest;
if(_cancelRequest == null)
{
Exception myE = new Exception("a non null cancel request must be supplied");
throw myE;
}
Mnemonic = cancelRequest.Mnemonic;
_lastChangeTicks = DateTime.Now.Ticks;
if(_cancelRequest.ClOrdID.Length == 0 )
{
Exception myE = new Exception("a clordid must be specified on a cancelOrder");
throw myE;
}
if (_cancelRequest.OrigClOrdID.Length == 0)
{
Exception myE = new Exception("a original clordid must be specified on a cancelOrder");
throw myE;
}
ClOrdID = cancelRequest.ClOrdID;
OrigClOrdID = cancelRequest.OrigClOrdID;
CRRType = crrType.cancel;
}
开发者ID:junwin,项目名称:TradingTools,代码行数:27,代码来源:ReplaceData.cs
示例4: UpdateVenue
public void UpdateVenue(KaiTrade.Interfaces.IVenue myVenue)
{
try
{
using (K2DataObjects.DataContext db = Factory.Instance().GetDSContext())
{
var venue = db.Venues.Where(s => s.Name == myVenue.Name).FirstOrDefault();
venue.AccountNumber = myVenue.AccountNumber;
venue.Code = myVenue.Code;
venue.DataFeedVenue = myVenue.DataFeedVenue;
venue.DefaultCFICode = myVenue.DefaultCFICode;
venue.DefaultCurrencyCode = myVenue.DefaultCurrencyCode;
venue.DefaultSecurityExchange = myVenue.DefaultSecurityExchange;
venue.DriverCode = myVenue.DriverCode;
venue.TargetVenue = myVenue.TargetVenue;
venue.UseSymbol = myVenue.UseSymbol;
db.SubmitChanges();
}
}
catch (Exception myE)
{
m_Log.Error("Update Venue", myE);
}
}
开发者ID:junwin,项目名称:TradingTools,代码行数:27,代码来源:K2VenueDS.cs
示例5: GetCurveValue
/// <summary>
/// Gets the curve values contained in a TSItem
/// </summary>
/// <returns>
/// The curve value.
/// </returns>
/// <param name='tsItem'>
/// Ts item.
/// </param>
public static K2DataObjects.CurveValue[] GetCurveValue(KaiTrade.Interfaces.ITSItem tsItem)
{
if (tsItem.CurveValues.Length > 0)
{
K2DataObjects.CurveValue[] curveVals = new K2DataObjects.CurveValue[tsItem.CurveValues.Length];
int i = 0;
foreach (var parm in tsItem.CurveValues)
{
try
{
K2DataObjects.CurveValue cv = new K2DataObjects.CurveValue();
cv.Mnemonic = tsItem.Mnemonic;
cv.HeaderID = parm.ParameterName;
cv.TimeStamp = tsItem.TimeStamp.Ticks;
cv.ItemType = (int)tsItem.ItemType;
cv.ItemSize = 1;
cv.RequestID = "1";
cv.Value = decimal.Parse(parm.ParameterValue);
curveVals[i++] = cv;
}
catch (Exception ex)
{
}
}
return curveVals;
}
return null;
}
开发者ID:junwin,项目名称:TradingTools,代码行数:37,代码来源:BarDataUtils.cs
示例6: PriceUpdate
public void PriceUpdate(KaiTrade.Interfaces.IPXUpdate pxUpdate)
{
if (_priceHandler != null)
{
_priceHandler.ApplyPriceUpdate(pxUpdate);
}
}
开发者ID:junwin,项目名称:TradingTools,代码行数:7,代码来源:OrderTest.cs
示例7: ProductUpdate
public void ProductUpdate(string updateType, KaiTrade.Interfaces.IProduct product)
{
if (product != null)
{
string jsonData = JsonConvert.SerializeObject(product);
rmqHelper.Publish("", product);
}
}
开发者ID:junwin,项目名称:TradingTools,代码行数:8,代码来源:Form1.cs
示例8: OnBarUpdate
public void OnBarUpdate(string requestID, KaiTrade.Interfaces.ITSItem[] bars)
{
if (bars.Length > 0)
{
//rmqHelper.Publish("IBM", tsi);
rmqPub.Publish("", bars);
}
}
开发者ID:junwin,项目名称:TradingTools,代码行数:8,代码来源:Form1.cs
示例9: addProductPriceFile
private void addProductPriceFile(string filepath, KaiTrade.Interfaces.IProduct prod, int interval, bool runRealTime, bool repeatOnEnd, bool playOnSubscribe)
{
try
{
m_Simulator.AddPriceFile(prod.Mnemonic, filepath, interval, runRealTime, repeatOnEnd, playOnSubscribe);
}
catch (Exception myE)
{
}
}
开发者ID:junwin,项目名称:TradingTools,代码行数:10,代码来源:SimulatorMainUI.cs
示例10: Add
/// <summary>
/// Add/replace a publisher to the manager
/// </summary>
/// <param name="myPub"></param>
public void Add(KaiTrade.Interfaces.Publisher myPub)
{
if(m_PublisherMap.ContainsKey(myPub.TopicID()))
{
m_PublisherMap[myPub.TopicID()] = myPub;
}
else
{
m_PublisherMap.Add(myPub.TopicID(), myPub);
}
}
开发者ID:junwin,项目名称:TradingTools,代码行数:15,代码来源:PublisherMgr.cs
示例11: GetTrade
/// <summary>
/// Get a trade given the order
/// </summary>
/// <param name="o"></param>
/// <returns></returns>
public KaiTrade.Interfaces.ITrade GetTrade(KaiTrade.Interfaces.IOrder o)
{
K2DS.K2TradeDS tradeDS = new K2DS.K2TradeDS();
IEnumerable<K2DataObjects.Trade> trades = tradeDS.GetTrade((o as K2DataObjects.Order));
foreach(K2DataObjects.Trade t in trades)
{
return t;
}
return null;
}
开发者ID:junwin,项目名称:TradingTools,代码行数:16,代码来源:Order.cs
示例12: InsertFill
public void InsertFill(KaiTrade.Interfaces.IFill f)
{
try
{
K2DS.K2TradeDS tradeDS = new K2DS.K2TradeDS();
tradeDS.InsertFill(f as K2DataObjects.Fill,true);
}
catch (Exception myE)
{
}
}
开发者ID:junwin,项目名称:TradingTools,代码行数:11,代码来源:Trade.cs
示例13: InsertOrder
public void InsertOrder(KaiTrade.Interfaces.IOrder o)
{
try
{
K2DS.K2OrderDS orderDS = new K2DS.K2OrderDS();
orderDS.InsertOrder(o as K2DataObjects.Order, true);
}
catch (Exception myE)
{
m_Log.Error("InsertOrder", myE);
}
}
开发者ID:junwin,项目名称:TradingTools,代码行数:12,代码来源:Order.cs
示例14: recordMessage
private void recordMessage(KaiTrade.Interfaces.IMessage message)
{
if (_messages == null)
{
_messages = new Dictionary<string, List<KaiTrade.Interfaces.IMessage>>();
}
if (!_messages.ContainsKey(message.Label))
{
_messages.Add(message.Label, new List<KaiTrade.Interfaces.IMessage>());
}
_messages[message.Label].Add(message);
}
开发者ID:junwin,项目名称:TradingTools,代码行数:12,代码来源:StartStopTest.cs
示例15: PXUpdateBase
public PXUpdateBase(KaiTrade.Interfaces.IProduct myProduct)
{
try
{
m_DataArray = new decimal?[KaiTrade.Interfaces.PXFields.MAXPXFIELDS];
throw new Exception("Not Implimemnted");
//this.From(myProduct.Mnemonic, myProduct.L1PX);
}
catch
{
}
}
开发者ID:junwin,项目名称:TradingTools,代码行数:12,代码来源:PXUpdateBase.cs
示例16: Publish
public void Publish(string routingKey, KaiTrade.Interfaces.ITSItem[] tsBars)
{
try
{
routingKey = KaiTrade.Interfaces.MQRoutingKeyPrefix.TSBAR + routingKey;
string jsonData = Newtonsoft.Json.JsonConvert.SerializeObject(tsBars);
byte[] messageBody = Encoding.UTF8.GetBytes(jsonData);
Publish(KaiTrade.Interfaces.MQExchanges.DEFAULT, KaiTrade.Interfaces.MQType.TSBAR, routingKey, messageBody);
}
catch (Exception myE)
{
}
}
开发者ID:junwin,项目名称:TradingTools,代码行数:14,代码来源:RMQ.cs
示例17: DoRejectModReq
/// <summary>
/// Reject a cancel request
/// </summary>
/// <param name="myReq"></param>
public static string DoRejectModReq(KaiTrade.Interfaces.IModifyOrderRequst mod, string orderID, KaiTrade.Interfaces.CxlRejReason myReason, string myReasonText)
{
KaiTrade.Interfaces.IRequestCancelRejectResponse cxl = new K2DataObjects.RequestCancelRejectResponse();
cxl.OrderID = orderID;
cxl.ClOrdID = mod.ClOrdID;
cxl.OrdStatus = KaiTrade.Interfaces.OrderStatus.REJECTED;
cxl.OrigClOrdID = mod.OrigClOrdID;
cxl.CxlRejResponseTo = KaiTrade.Interfaces.CxlRejResponseTo.Modify;
cxl.ReasonText = myReasonText;
cxl.TransactTime = DateTime.Now;
cxl.CxlRejReason = myReason;
// send our response message back to the clients of the adapter
return JsonConvert.SerializeObject(cxl);
}
开发者ID:junwin,项目名称:TradingTools,代码行数:19,代码来源:RequestBuilder.cs
示例18: AddVenue
public void AddVenue(KaiTrade.Interfaces.IVenue myVenue)
{
try
{
using (K2DataObjects.DataContext db = Factory.Instance().GetDSContext())
{
var venue = (K2DataObjects.TradeVenue)myVenue;
db.Venues.InsertOnSubmit(venue);
db.SubmitChanges();
}
}
catch (Exception myE)
{
m_Log.Error("Add Venue", myE);
}
}
开发者ID:junwin,项目名称:TradingTools,代码行数:18,代码来源:K2VenueDS.cs
示例19: GetPriceBar
/// <summary>
/// Gets the price bar from a ITSItem, TSItem is data returned from a driver
/// that connects to the prices source CQG, IB, etc
/// </summary>
/// <returns>
/// The price bar.
/// </returns>
/// <param name='tsItem'>
/// Ts item.
/// </param>
public static K2DataObjects.PriceBar GetPriceBar(KaiTrade.Interfaces.ITSItem tsItem)
{
K2DataObjects.PriceBar bar = new K2DataObjects.PriceBar();
bar.High = (decimal) tsItem.High;
bar.AskVolume = (decimal)tsItem.AskVolume;
bar.Avg = (decimal)tsItem.Avg;
bar.BidVolume = (decimal)tsItem.BidVolume;
bar.Close = (decimal)tsItem.Close;
bar.Low = (decimal)tsItem.Low;
bar.Mnemonic = tsItem.Mnemonic;
bar.Open = (decimal)tsItem.Open;
bar.Volume = (decimal)tsItem.Volume;
bar.TimeStamp = tsItem.TimeStamp.Ticks;
bar.ItemType = (int)tsItem.ItemType;
bar.ItemSize = 1;
bar.RequestID = "1";
return bar;
}
开发者ID:junwin,项目名称:TradingTools,代码行数:28,代码来源:BarDataUtils.cs
示例20: DeleteVenue
public void DeleteVenue(KaiTrade.Interfaces.IVenue myVenue)
{
try
{
using (K2DataObjects.DataContext db = Factory.Instance().GetDSContext())
{
var venue = db.Venues.Where(s => s.Name == myVenue.Name).FirstOrDefault();
db.Venues.DeleteOnSubmit(venue);
db.SubmitChanges();
}
}
catch (Exception myE)
{
m_Log.Error("Delete Venue", myE);
}
}
开发者ID:junwin,项目名称:TradingTools,代码行数:18,代码来源:K2VenueDS.cs
注:本文中的KaiTrade类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论