本文整理匯總了C#中QuantConnect.Data.Market.TradeBar.UpdateTrade方法的典型用法代碼示例。如果您正苦於以下問題:C# TradeBar.UpdateTrade方法的具體用法?C# TradeBar.UpdateTrade怎麽用?C# TradeBar.UpdateTrade使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類QuantConnect.Data.Market.TradeBar
的用法示例。
在下文中一共展示了TradeBar.UpdateTrade方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。
示例1: UpdatesProperly
public void UpdatesProperly()
{
var bar = new TradeBar();
bar.UpdateTrade(10, 10);
Assert.AreEqual(10, bar.Open);
Assert.AreEqual(10, bar.High);
Assert.AreEqual(10, bar.Low);
Assert.AreEqual(10, bar.Close);
Assert.AreEqual(10, bar.Volume);
bar.UpdateTrade(20, 5);
Assert.AreEqual(10, bar.Open);
Assert.AreEqual(20, bar.High);
Assert.AreEqual(10, bar.Low);
Assert.AreEqual(20, bar.Close);
Assert.AreEqual(15, bar.Volume);
bar.UpdateTrade(5, 50);
Assert.AreEqual(10, bar.Open);
Assert.AreEqual(20, bar.High);
Assert.AreEqual(5, bar.Low);
Assert.AreEqual(5, bar.Close);
Assert.AreEqual(65, bar.Volume);
bar.UpdateTrade(11, 100);
Assert.AreEqual(10, bar.Open);
Assert.AreEqual(20, bar.High);
Assert.AreEqual(5, bar.Low);
Assert.AreEqual(11, bar.Close);
Assert.AreEqual(165, bar.Volume);
}
示例2: HandlesAssetWithValidZeroPrice
public void HandlesAssetWithValidZeroPrice()
{
var bar = new TradeBar();
bar.UpdateTrade(10, 10);
Assert.AreEqual(10, bar.Open);
Assert.AreEqual(10, bar.High);
Assert.AreEqual(10, bar.Low);
Assert.AreEqual(10, bar.Close);
Assert.AreEqual(10, bar.Volume);
bar.UpdateTrade(0, 100);
Assert.AreEqual(10, bar.Open);
Assert.AreEqual(10, bar.High);
Assert.AreEqual(0, bar.Low);
Assert.AreEqual(0, bar.Close);
Assert.AreEqual(110, bar.Volume);
bar.UpdateTrade(-5, 100);
Assert.AreEqual(10, bar.Open);
Assert.AreEqual(10, bar.High);
Assert.AreEqual(-5, bar.Low);
Assert.AreEqual(-5, bar.Close);
Assert.AreEqual(210, bar.Volume);
bar.UpdateTrade(5, 100);
Assert.AreEqual(10, bar.Open);
Assert.AreEqual(10, bar.High);
Assert.AreEqual(-5, bar.Low);
Assert.AreEqual(5, bar.Close);
Assert.AreEqual(310, bar.Volume);
bar.UpdateTrade(50, 100);
Assert.AreEqual(10, bar.Open);
Assert.AreEqual(50, bar.High);
Assert.AreEqual(-5, bar.Low);
Assert.AreEqual(50, bar.Close);
Assert.AreEqual(410, bar.Volume);
}