-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'feature_LWDEV-7845-Bulk-orders' into dev
- Loading branch information
Showing
23 changed files
with
437 additions
and
45 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
7 changes: 5 additions & 2 deletions
7
client/Lykke.Service.HFT.Wamp.Client/Lykke.Service.HFT.Wamp.Client.csproj
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,19 @@ | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
|
||
<PropertyGroup> | ||
<TargetFramework>netcoreapp2.1</TargetFramework> | ||
<ApplicationIcon /> | ||
<OutputType>Exe</OutputType> | ||
<StartupObject /> | ||
<Version>1.0.0</Version> | ||
<LangVersion>latest</LangVersion> | ||
</PropertyGroup> | ||
|
||
<ItemGroup> | ||
<PackageReference Include="Lykke.Common" Version="7.0.1" /> | ||
<PackageReference Include="Lykke.WampSharp.Default.Client" Version="1.0.2" /> | ||
</ItemGroup> | ||
|
||
<ItemGroup> | ||
<ProjectReference Include="..\..\src\Lykke.Service.HFT.Contracts\Lykke.Service.HFT.Contracts.csproj" /> | ||
</ItemGroup> | ||
|
||
</Project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
35 changes: 35 additions & 0 deletions
35
src/Lykke.Service.HFT.Contracts/Orders/BulkOrderItemModel.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
using System.ComponentModel.DataAnnotations; | ||
using JetBrains.Annotations; | ||
|
||
namespace Lykke.Service.HFT.Contracts.Orders | ||
{ | ||
/// <summary> | ||
/// Order model for bulk limit orders. | ||
/// </summary> | ||
[PublicAPI] | ||
public class BulkOrderItemModel | ||
{ | ||
/// <summary> | ||
/// The order action, buy or sell. | ||
/// </summary> | ||
[Required] | ||
public OrderAction OrderAction { get; set; } | ||
|
||
/// <summary> | ||
/// The volume of the order. | ||
/// </summary> | ||
[Required] | ||
public double Volume { get; set; } | ||
|
||
/// <summary> | ||
/// The price of the order. | ||
/// </summary> | ||
[Required] | ||
public double Price { get; set; } | ||
|
||
/// <summary> | ||
/// [Optional] The old order identifier that needs to be replaced with this order. | ||
/// </summary> | ||
public string OldId { get; set; } | ||
} | ||
} |
32 changes: 32 additions & 0 deletions
32
src/Lykke.Service.HFT.Contracts/Orders/BulkOrderItemStatusModel.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
using System; | ||
using JetBrains.Annotations; | ||
|
||
namespace Lykke.Service.HFT.Contracts.Orders | ||
{ | ||
/// <summary> | ||
/// Response status model for a specific order in a bulk order. | ||
/// </summary> | ||
[PublicAPI] | ||
public class BulkOrderItemStatusModel | ||
{ | ||
/// <summary> | ||
/// The id under which this order was registered. Needed for cancel or status updates. | ||
/// </summary> | ||
public Guid Id { get; set; } | ||
|
||
/// <summary> | ||
/// The possible error that occured when placing this order. | ||
/// </summary> | ||
public ErrorCodeType? Error { get; set; } | ||
|
||
/// <summary> | ||
/// The volume of this order. | ||
/// </summary> | ||
public double Volume { get; set; } | ||
|
||
/// <summary> | ||
/// The price of this order. | ||
/// </summary> | ||
public double Price { get; set; } | ||
} | ||
} |
27 changes: 27 additions & 0 deletions
27
src/Lykke.Service.HFT.Contracts/Orders/BulkOrderResponseModel.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
using System.Collections.Generic; | ||
using JetBrains.Annotations; | ||
|
||
namespace Lykke.Service.HFT.Contracts.Orders | ||
{ | ||
/// <summary> | ||
/// Response model for placing new bulk orders. | ||
/// </summary> | ||
[PublicAPI] | ||
public class BulkOrderResponseModel | ||
{ | ||
/// <summary> | ||
/// The asset pair of this bulk order. | ||
/// </summary> | ||
public string AssetPairId { get; set; } | ||
|
||
/// <summary> | ||
/// The possible error that occured when processing this bulk order. Check individual statusses for the status per order. | ||
/// </summary> | ||
public ErrorCodeType? Error { get; set; } | ||
|
||
/// <summary> | ||
/// The bulk order item statuses. | ||
/// </summary> | ||
public IReadOnlyList<BulkOrderItemStatusModel> Statuses { get; set; } | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
using JetBrains.Annotations; | ||
|
||
namespace Lykke.Service.HFT.Contracts.Orders | ||
{ | ||
/// <summary> | ||
/// CancelMode behavior for bulk orders. | ||
/// </summary> | ||
[PublicAPI] | ||
public enum CancelMode | ||
{ | ||
/// <summary> | ||
/// Cancel previous orders as defined in the given parameter. | ||
/// </summary> | ||
NotEmptySide = 0, | ||
|
||
/// <summary> | ||
/// Cancel all previous buy- and sell-orders (even if there are no incoming orders) | ||
/// </summary> | ||
BothSides = 1, | ||
|
||
/// <summary> | ||
/// Cancel only previous sell-orders(even if there are no incoming sell-orders) | ||
/// </summary> | ||
SellSide = 2, | ||
|
||
/// <summary> | ||
/// Cancel only previous buy-orders(even if there are no incoming buy-orders) | ||
/// </summary> | ||
BuySide = 3, | ||
} | ||
} |
34 changes: 34 additions & 0 deletions
34
src/Lykke.Service.HFT.Contracts/Orders/PlaceBulkOrderModel.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
using System.Collections.Generic; | ||
using System.ComponentModel.DataAnnotations; | ||
using JetBrains.Annotations; | ||
|
||
namespace Lykke.Service.HFT.Contracts.Orders | ||
{ | ||
/// <summary> | ||
/// Request model for placing bulk limit orders. | ||
/// </summary> | ||
[PublicAPI] | ||
public class PlaceBulkOrderModel | ||
{ | ||
/// <summary> | ||
/// The asset pair you want to buy or sell. | ||
/// </summary> | ||
[Required] | ||
public string AssetPairId { get; set; } | ||
|
||
/// <summary> | ||
/// Cancel the previous orders of this asset pair. | ||
/// </summary> | ||
public bool CancelPreviousOrders { get; set; } | ||
|
||
/// <summary> | ||
/// [Optional] The cancel mode behavior for cancelling previous orders. | ||
/// </summary> | ||
public CancelMode? CancelMode { get; set; } | ||
|
||
/// <summary> | ||
/// The orders you want to place. | ||
/// </summary> | ||
public IEnumerable<BulkOrderItemModel> Orders { get; set; } | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
8 changes: 5 additions & 3 deletions
8
src/Lykke.Service.HFT.Core/Services/IMatchingEngineAdapter.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,19 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Threading.Tasks; | ||
using Lykke.Service.Assets.Client.Models; | ||
using OrderAction = Lykke.Service.HFT.Contracts.Orders.OrderAction; | ||
using Lykke.Service.HFT.Contracts; | ||
using Lykke.Service.HFT.Contracts.Orders; | ||
using OrderAction = Lykke.Service.HFT.Contracts.Orders.OrderAction; | ||
|
||
namespace Lykke.Service.HFT.Core.Services | ||
{ | ||
public interface IMatchingEngineAdapter | ||
{ | ||
Task<ResponseModel> CancelLimitOrderAsync(Guid limitOrderId); | ||
Task<ResponseModel> CancelAllAsync(string clientId, AssetPair pair, bool? isBuy); | ||
Task<ResponseModel<double>> HandleMarketOrderAsync(string clientId, AssetPair assetPair, OrderAction orderAction, double volume, bool straight, double? reservedLimitVolume = default(double?)); | ||
Task<ResponseModel<double>> HandleMarketOrderAsync(string clientId, AssetPair assetPair, OrderAction orderAction, double volume, bool straight, double? reservedLimitVolume = default); | ||
Task<ResponseModel<Guid>> PlaceLimitOrderAsync(string clientId, AssetPair assetPair, OrderAction orderAction, double volume, double price, bool cancelPreviousOrders = false); | ||
|
||
Task<ResponseModel<BulkOrderResponseModel>> PlaceBulkLimitOrderAsync(string clientId, AssetPair assetPair, IEnumerable<BulkOrderItemModel> items, bool cancelPrevious = false, CancelMode? cancelMode = default); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.