Skip to content

Commit

Permalink
Merge pull request #18 from jhonabreul/refactor-normalize-namespaces
Browse files Browse the repository at this point in the history
Normalize namespace to match all other Lean brokerages
  • Loading branch information
jhonabreul authored Feb 29, 2024
2 parents 1bba7c5 + 546c7b4 commit f2924a1
Show file tree
Hide file tree
Showing 86 changed files with 162 additions and 180 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/gh-actions.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,4 +47,4 @@ jobs:
run: dotnet build /p:Configuration=Release /v:quiet /p:WarningLevel=1 QuantConnect.BybitBrokerage.sln

- name: Run Tests
run: dotnet test ./QuantConnect.BybitBrokerage.Tests/bin/Release/QuantConnect.BybitBrokerage.Tests.dll
run: dotnet test ./QuantConnect.BybitBrokerage.Tests/bin/Release/QuantConnect.Brokerages.Bybit.Tests.dll
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,14 @@
using System;
using Moq;
using NUnit.Framework;
using QuantConnect.Brokerages;
using QuantConnect.Configuration;
using QuantConnect.Util;
using QuantConnect.Interfaces;
using QuantConnect.Lean.Engine.DataFeeds;
using QuantConnect.Securities;
using QuantConnect.Tests.Common.Securities;

namespace QuantConnect.BybitBrokerage.Tests
namespace QuantConnect.Brokerages.Bybit.Tests
{
[TestFixture, Explicit("Requires valid credentials to be setup and run outside USA")]
public class BybitBrokerageAdditionalTests
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
using QuantConnect.Interfaces;
using QuantConnect.Util;

namespace QuantConnect.BybitBrokerage.Tests
namespace QuantConnect.Brokerages.Bybit.Tests
{
[TestFixture]
public class BybitBrokerageFactoryTests
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
using System;
using System.Linq;
using NUnit.Framework;
using QuantConnect.Brokerages;
using QuantConnect.Configuration;
using QuantConnect.Data;
using QuantConnect.Tests;
Expand All @@ -25,7 +24,7 @@
using QuantConnect.Data.Market;
using QuantConnect.Lean.Engine.DataFeeds;

namespace QuantConnect.BybitBrokerage.Tests
namespace QuantConnect.Brokerages.Bybit.Tests
{
[TestFixture, Explicit("Requires valid credentials to be setup and run outside USA")]
public class BybitBrokerageHistoryProviderTests
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
using QuantConnect.Data.Market;
using QuantConnect.Interfaces;

namespace QuantConnect.BybitBrokerage.Tests
namespace QuantConnect.Brokerages.Bybit.Tests
{
[TestFixture]
public partial class BybitBrokerageTests
Expand Down
7 changes: 3 additions & 4 deletions QuantConnect.BybitBrokerage.Tests/BybitBrokerageTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,8 @@
using System.Threading;
using Moq;
using NUnit.Framework;
using QuantConnect.Brokerages;
using QuantConnect.BybitBrokerage.Api;
using QuantConnect.BybitBrokerage.Models.Enums;
using QuantConnect.Brokerages.Bybit.Api;
using QuantConnect.Brokerages.Bybit.Models.Enums;
using QuantConnect.Configuration;
using QuantConnect.Interfaces;
using QuantConnect.Lean.Engine.DataFeeds;
Expand All @@ -31,7 +30,7 @@
using QuantConnect.Tests.Brokerages;
using QuantConnect.Util;

namespace QuantConnect.BybitBrokerage.Tests
namespace QuantConnect.Brokerages.Bybit.Tests
{
[TestFixture, Explicit("Requires valid credentials to be setup and run outside USA")]
public partial class BybitBrokerageTests : BrokerageTests
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
using System;
using System.Linq;

namespace QuantConnect.BybitBrokerage.Tests
namespace QuantConnect.Brokerages.Bybit.Tests
{
[TestFixture, Explicit("Requires valid credentials to be setup and run outside USA")]
public class BybitExchangeInfoDownloaderTests
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
using System;
using NUnit.Framework;

namespace QuantConnect.BybitBrokerage.Tests
namespace QuantConnect.Brokerages.Bybit.Tests
{
[TestFixture, Explicit("Requires valid credentials to be setup and run outside USA")]
public class BybitFuturesBrokerageHistoryProviderTests : BybitBrokerageHistoryProviderTests
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@

using NUnit.Framework;

namespace QuantConnect.BybitBrokerage.Tests
namespace QuantConnect.Brokerages.Bybit.Tests
{
[TestFixture]
public partial class BybitFuturesBrokerageTests
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,10 @@
*/

using NUnit.Framework;
using QuantConnect.BybitBrokerage.Models.Enums;
using QuantConnect.Orders.Fees;
using QuantConnect.Brokerages.Bybit.Models.Enums;
using QuantConnect.Tests.Brokerages;

namespace QuantConnect.BybitBrokerage.Tests;
namespace QuantConnect.Brokerages.Bybit.Tests;

[TestFixture, Explicit("Requires valid credentials to be setup and run outside USA")]
public partial class BybitFuturesBrokerageTests : BybitBrokerageTests
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,10 @@
using System.Collections.Generic;
using Newtonsoft.Json;
using NUnit.Framework;
using QuantConnect.BybitBrokerage.Converters;
using QuantConnect.BybitBrokerage.Models;
using QuantConnect.Brokerages.Bybit.Converters;
using QuantConnect.Brokerages.Bybit.Models;

namespace QuantConnect.BybitBrokerage.Tests.JsonConverters;
namespace QuantConnect.Brokerages.Bybit.Tests.JsonConverters;

public class JsonConverterTests
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,12 @@
<Copyright>Copyright © 2021</Copyright>
<TestProjectType>UnitTest</TestProjectType>
<OutputPath>bin\$(Configuration)\</OutputPath>
<Product>QuantConnect.BybitBrokerage.Tests</Product>
<RootNamespace>QuantConnect.BybitBrokerage.Tests</RootNamespace>
<AssemblyTitle>QuantConnect.BybitBrokerage.Tests</AssemblyTitle>
<Product>QuantConnect.Brokerages.Bybit.Tests</Product>
<RootNamespace>QuantConnect.Brokerages.Bybit.Tests</RootNamespace>
<AssemblyTitle>QuantConnect.Brokerages.Bybit.Tests</AssemblyTitle>
<AssemblyName>QuantConnect.Brokerages.Bybit.Tests</AssemblyName>
<AppendTargetFrameworkToOutputPath>false</AppendTargetFrameworkToOutputPath>
<PackageId>QuantConnect.BybitBrokerage.Tests</PackageId>
<PackageId>QuantConnect.Brokerages.Bybit.Tests</PackageId>
</PropertyGroup>

<ItemGroup>
Expand Down
2 changes: 1 addition & 1 deletion QuantConnect.BybitBrokerage.Tests/TestSetup.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
using QuantConnect.Logging;
using QuantConnect.Configuration;

namespace QuantConnect.BybitBrokerage.Tests
namespace QuantConnect.Brokerages.Bybit.Tests
{
[TestFixture]
public class TestSetup
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,14 @@
using System.Collections.Generic;
using System.Linq;
using NodaTime;
using QuantConnect.Brokerages;
using QuantConnect.Configuration;
using QuantConnect.Data;
using QuantConnect.Data.Market;
using QuantConnect.Logging;
using QuantConnect.Securities;
using QuantConnect.Util;

namespace QuantConnect.BybitBrokerage.ToolBox
namespace QuantConnect.Brokerages.Bybit.ToolBox
{
/// <summary>
/// Template Brokerage Data Downloader implementation
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,13 @@
using System;
using System.Collections.Generic;
using System.Linq;
using QuantConnect.BybitBrokerage.Api;
using QuantConnect.BybitBrokerage.Models;
using QuantConnect.BybitBrokerage.Models.Enums;
using QuantConnect.Brokerages.Bybit.Api;
using QuantConnect.Brokerages.Bybit.Models;
using QuantConnect.Brokerages.Bybit.Models.Enums;
using QuantConnect.Configuration;
using QuantConnect.ToolBox;

namespace QuantConnect.BybitBrokerage.ToolBox
namespace QuantConnect.Brokerages.Bybit.ToolBox
{
/// <summary>
/// Template Brokerage implementation of <see cref="IExchangeInfoDownloader"/>
Expand Down Expand Up @@ -75,7 +75,7 @@ private string GetInstrumentInfoString(BybitInstrumentInfo info, SecurityType se
{
var securityTypeStr = securityType.ToStringInvariant().ToLowerInvariant();

// Remove multiplier prefix from symbols like 10000LADYSUSDT. Not 1 as there is also 1INCHUSDT
// Remove multiplier prefix from symbols like 10000LADYSUSDT. Not 1 as there is also 1INCHUSDT
var symbolName = info.Symbol.StartsWith("10") ? info.Symbol.TrimStart('0', '1') : info.Symbol;

// market,symbol,type,description,quote_currency,contract_multiplier,minimum_price_variation,lot_size,market_ticker,minimum_order_size,price_magnifier
Expand Down
3 changes: 1 addition & 2 deletions QuantConnect.BybitBrokerage.ToolBox/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,11 @@
*/

using System;
using System.Collections.Generic;
using QuantConnect.Configuration;
using QuantConnect.ToolBox;
using static QuantConnect.Configuration.ApplicationParser;

namespace QuantConnect.BybitBrokerage.ToolBox
namespace QuantConnect.Brokerages.Bybit.ToolBox
{
static class Program
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,15 @@
<TargetFramework>net6.0</TargetFramework>
<Copyright>Copyright © 2021</Copyright>
<OutputPath>bin\$(Configuration)\</OutputPath>
<Product>QuantConnect.BybitBrokerage.ToolBox</Product>
<RootNamespace>QuantConnect.BybitBrokerage.ToolBox</RootNamespace>
<AssemblyTitle>QuantConnect.BybitBrokerage.ToolBox</AssemblyTitle>
<AssemblyName>QuantConnect.BybitBrokerage.ToolBox</AssemblyName>
<Product>QuantConnect.Brokerages.Bybit.ToolBox</Product>
<RootNamespace>QuantConnect.Brokerages.Bybit.ToolBox</RootNamespace>
<AssemblyTitle>QuantConnect.Brokerages.Bybit.ToolBox</AssemblyTitle>
<AssemblyName>QuantConnect.Brokerages.Bybit.ToolBox</AssemblyName>
<AppendTargetFrameworkToOutputPath>false</AppendTargetFrameworkToOutputPath>
<CopyLocalLockFileAssemblies>true</CopyLocalLockFileAssemblies>
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
<Description>QuantConnect LEAN Bybit Brokerage: Bybit Brokerage toolbox plugin for Lean</Description>
<PackageId>QuantConnect.BybitBrokerage.ToolBox</PackageId>
<PackageId>QuantConnect.Brokerages.Bybit.ToolBox</PackageId>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugType>full</DebugType>
Expand Down
6 changes: 2 additions & 4 deletions QuantConnect.BybitBrokerage/Api/BybitAccountApiEndpoint.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,10 @@
*/

using System.Collections.Generic;
using QuantConnect.Brokerages;
using QuantConnect.BybitBrokerage.Models;
using QuantConnect.BybitBrokerage.Models.Enums;
using QuantConnect.Brokerages.Bybit.Models;
using QuantConnect.Securities;

namespace QuantConnect.BybitBrokerage.Api;
namespace QuantConnect.Brokerages.Bybit.Api;

/// <summary>
/// Bybit account api endpoint implementation
Expand Down
5 changes: 2 additions & 3 deletions QuantConnect.BybitBrokerage/Api/BybitApi.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,10 @@

using System;
using System.Collections.Generic;
using QuantConnect.Brokerages;
using QuantConnect.BybitBrokerage.Models.Enums;
using QuantConnect.Brokerages.Bybit.Models.Enums;
using QuantConnect.Securities;

namespace QuantConnect.BybitBrokerage.Api;
namespace QuantConnect.Brokerages.Bybit.Api;

/// <summary>
/// Provides methods to work with the Bybit rest API
Expand Down
3 changes: 1 addition & 2 deletions QuantConnect.BybitBrokerage/Api/BybitApiClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,10 @@
using System.Linq;
using System.Security.Cryptography;
using System.Text;
using System.Web;
using QuantConnect.Util;
using RestSharp;

namespace QuantConnect.BybitBrokerage.Api;
namespace QuantConnect.Brokerages.Bybit.Api;

/// <summary>
/// Bybit api client implementation
Expand Down
9 changes: 4 additions & 5 deletions QuantConnect.BybitBrokerage/Api/BybitApiEndpoint.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,15 +21,14 @@
using Newtonsoft.Json;
using Newtonsoft.Json.Converters;
using Newtonsoft.Json.Serialization;
using QuantConnect.Brokerages;
using QuantConnect.BybitBrokerage.Converters;
using QuantConnect.BybitBrokerage.Models;
using QuantConnect.BybitBrokerage.Models.Enums;
using QuantConnect.Brokerages.Bybit.Converters;
using QuantConnect.Brokerages.Bybit.Models;
using QuantConnect.Brokerages.Bybit.Models.Enums;
using QuantConnect.Logging;
using QuantConnect.Securities;
using RestSharp;

namespace QuantConnect.BybitBrokerage.Api;
namespace QuantConnect.Brokerages.Bybit.Api;

/// <summary>
/// Base Bybit api endpoint implementation
Expand Down
8 changes: 4 additions & 4 deletions QuantConnect.BybitBrokerage/Api/BybitHistoryApi.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,13 @@
using System.Globalization;
using System.IO;
using System.IO.Compression;
using QuantConnect.BybitBrokerage.Converters;
using QuantConnect.BybitBrokerage.Models.Enums;
using QuantConnect.BybitBrokerage.Models.Messages;
using QuantConnect.Brokerages.Bybit.Converters;
using QuantConnect.Brokerages.Bybit.Models.Enums;
using QuantConnect.Brokerages.Bybit.Models.Messages;
using QuantConnect.Logging;
using RestSharp;

namespace QuantConnect.BybitBrokerage.Api;
namespace QuantConnect.Brokerages.Bybit.Api;

/// <summary>
/// Implements functionality to download historical tick data from Bybit
Expand Down
7 changes: 3 additions & 4 deletions QuantConnect.BybitBrokerage/Api/BybitMarketApiEndpoint.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,11 @@
using System;
using System.Collections.Generic;
using System.Linq;
using QuantConnect.Brokerages;
using QuantConnect.BybitBrokerage.Models;
using QuantConnect.BybitBrokerage.Models.Enums;
using QuantConnect.Brokerages.Bybit.Models;
using QuantConnect.Brokerages.Bybit.Models.Enums;
using QuantConnect.Securities;

namespace QuantConnect.BybitBrokerage.Api;
namespace QuantConnect.Brokerages.Bybit.Api;

/// <summary>
/// Bybit market api endpoint implementation
Expand Down
7 changes: 3 additions & 4 deletions QuantConnect.BybitBrokerage/Api/BybitPositionApiEndpoint.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,11 @@

using System;
using System.Collections.Generic;
using QuantConnect.Brokerages;
using QuantConnect.BybitBrokerage.Models;
using QuantConnect.BybitBrokerage.Models.Enums;
using QuantConnect.Brokerages.Bybit.Models;
using QuantConnect.Brokerages.Bybit.Models.Enums;
using QuantConnect.Securities;

namespace QuantConnect.BybitBrokerage.Api;
namespace QuantConnect.Brokerages.Bybit.Api;

/// <summary>
/// Bybit position api endpoint implementation
Expand Down
13 changes: 6 additions & 7 deletions QuantConnect.BybitBrokerage/Api/BybitTradeApiEndpoint.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,16 +16,15 @@
using System;
using System.Collections.Generic;
using System.Linq;
using QuantConnect.Brokerages;
using QuantConnect.BybitBrokerage.Models;
using QuantConnect.BybitBrokerage.Models.Enums;
using QuantConnect.BybitBrokerage.Models.Requests;
using QuantConnect.Brokerages.Bybit.Models;
using QuantConnect.Brokerages.Bybit.Models.Enums;
using QuantConnect.Brokerages.Bybit.Models.Requests;
using QuantConnect.Orders;
using QuantConnect.Securities;
using OrderType = QuantConnect.BybitBrokerage.Models.Enums.OrderType;
using TimeInForce = QuantConnect.BybitBrokerage.Models.Enums.TimeInForce;
using OrderType = QuantConnect.Brokerages.Bybit.Models.Enums.OrderType;
using TimeInForce = QuantConnect.Brokerages.Bybit.Models.Enums.TimeInForce;

namespace QuantConnect.BybitBrokerage.Api;
namespace QuantConnect.Brokerages.Bybit.Api;

/// <summary>
/// Bybit trade api endpoint implementation
Expand Down
7 changes: 3 additions & 4 deletions QuantConnect.BybitBrokerage/BybitBrokerage.Brokerage.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,14 @@
using System;
using System.Collections.Generic;
using System.Linq;
using QuantConnect.Brokerages;
using QuantConnect.BybitBrokerage.Models.Enums;
using QuantConnect.Brokerages.Bybit.Models.Enums;
using QuantConnect.Orders;
using QuantConnect.Orders.Fees;
using QuantConnect.Securities;
using OrderStatus = QuantConnect.Orders.OrderStatus;
using OrderType = QuantConnect.BybitBrokerage.Models.Enums.OrderType;
using OrderType = QuantConnect.Brokerages.Bybit.Models.Enums.OrderType;

namespace QuantConnect.BybitBrokerage;
namespace QuantConnect.Brokerages.Bybit;

public partial class BybitBrokerage
{
Expand Down
Loading

0 comments on commit f2924a1

Please sign in to comment.