75eac27795
* bitfinex unsubscribe impl * IB implementation * Alpaca Brokerage * Fxcm Brokerage * Bitfinex remake * GDAX Brokerage * move & rename DataQueueHandler subscription manager to better place for using in ToolBox * performance tuning use unified Channel class everywhere BaseWebsocketBrokerage.GetSubscribed method relies on DQHSubscriptionManager * TradierBrokerage implementation * OandaBrokerage implementation * FakeDataQueue subcription manager * Fake SubscriptionManager for testing * CoinApi implementation * IEXDataQueueHandler implementation * IQFeed Implementation * unit tests * fix SubscribeSymbols params * thread safe subscribed symbols * don't need to lock Keys prop, because it's thread safe * accurate PolygonDataQueueHandler subscribe/unsubscribe methods * Alpaca isnt DataQueueHAndler anymore * remove unused variable * remove redundant hashset * fix coin api subscribe method * disclaimer * prettify code * race condition? * fix symbol conversion * log if unsubscribed; change Channel Id type * requested changes * pass GetChannelName func as required parameter * centralized logs * use single name for all idqh with no difference in tick type * change Oanda resubscribe method * CanSubscribe doesn't change instance state - can be marked as static. * change Oanda Subscription tracking * style changes * bitfinex fix * fix spelling
60 lines
2.4 KiB
C#
60 lines
2.4 KiB
C#
/*
|
|
* QUANTCONNECT.COM - Democratizing Finance, Empowering Individuals.
|
|
* Lean Algorithmic Trading Engine v2.0. Copyright 2014 QuantConnect Corporation.
|
|
*
|
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
* you may not use this file except in compliance with the License.
|
|
* You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
*
|
|
* Unless required by applicable law or agreed to in writing, software
|
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
* See the License for the specific language governing permissions and
|
|
* limitations under the License.
|
|
*/
|
|
|
|
using System;
|
|
using System.Linq;
|
|
using NUnit.Framework;
|
|
using QuantConnect.Data;
|
|
|
|
namespace QuantConnect.Tests.Common.Data
|
|
{
|
|
[TestFixture]
|
|
public class ChannelTests
|
|
{
|
|
private static TestCaseData[] Equality => new[]
|
|
{
|
|
new TestCaseData(new Channel("trade", Symbols.SPY), Symbols.SPY, "trade"),
|
|
new TestCaseData(new Channel("quote", Symbols.AAPL), Symbols.AAPL, "quote"),
|
|
new TestCaseData(new Channel("quote-trade", Symbols.IBM), Symbols.IBM, "quote-trade")
|
|
};
|
|
|
|
[TestCaseSource(nameof(Equality))]
|
|
public void Equal(Channel expected, Symbol symbol, string channelName)
|
|
{
|
|
var actual = new Channel(channelName, symbol);
|
|
Assert.AreNotSame(expected, actual);
|
|
Assert.AreEqual(expected, actual);
|
|
Assert.AreEqual(expected.GetHashCode(), actual.GetHashCode());
|
|
}
|
|
|
|
private static TestCaseData[] Inequality => new[]
|
|
{
|
|
new TestCaseData(new Channel("trade", Symbols.SPY), Symbols.SPY, "quote"),
|
|
new TestCaseData(new Channel("trade", Symbols.AAPL), Symbols.SPY, "trade"),
|
|
new TestCaseData(new Channel("quote-trade", Symbols.IBM), Symbols.IBM, "quote"),
|
|
new TestCaseData(new Channel("quote-trade", Symbols.MSFT), Symbols.MSFT, "trade")
|
|
};
|
|
|
|
[TestCaseSource(nameof(Inequality))]
|
|
public void NotEqual(Channel expected, Symbol symbol, string channelName)
|
|
{
|
|
var actual = new Channel(channelName, symbol);
|
|
Assert.AreNotSame(expected, actual);
|
|
Assert.AreNotEqual(expected, actual);
|
|
Assert.AreNotEqual(expected.GetHashCode(), actual.GetHashCode());
|
|
}
|
|
}
|
|
}
|