Skip to content

Commit 18fc676

Browse files
committed
Refactor market depth project structure
1 parent c7aa101 commit 18fc676

13 files changed

Lines changed: 68 additions & 12 deletions

File tree

src/BinanceBot.Market/Abstracts/IMarketDepthPublisher.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
using System;
22
using System.Collections.Generic;
3-
using BinanceBot.Market.Core;
3+
using BinanceBot.Market.Domain;
44

55
namespace BinanceBot.Market;
66

src/BinanceBot.Market/Utility/DescDecimalComparer.cs renamed to src/BinanceBot.Market/Core/DescDecimalComparer.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
using System.Collections.Generic;
22

3-
namespace BinanceBot.Market.Utility;
3+
namespace BinanceBot.Market.Core;
44

55
/// <summary>
66
/// Descending decimal comparer

src/BinanceBot.Market/Core/MarketDepth.cs renamed to src/BinanceBot.Market/Domain/MarketDepth.cs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,10 @@
33
using System.Linq;
44
using Binance.Net.Enums;
55
using Binance.Net.Objects.Models;
6-
using BinanceBot.Market.Utility;
6+
using BinanceBot.Market.Core;
7+
using BinanceBot.Market.Extensions;
78

8-
namespace BinanceBot.Market.Core;
9+
namespace BinanceBot.Market.Domain;
910

1011
/// <summary>
1112
/// Order book

src/BinanceBot.Market/Core/MarketDepthPair.cs renamed to src/BinanceBot.Market/Domain/MarketDepthPair.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
using System;
22

3-
namespace BinanceBot.Market.Core;
3+
namespace BinanceBot.Market.Domain;
44

55
/// <summary>
66
/// Order book's ask-bid pair
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
using System;
22
using Binance.Net.Enums;
33

4-
namespace BinanceBot.Market.Core;
4+
namespace BinanceBot.Market.Domain;
55

66
/// <summary>
77
/// <see cref="MarketDepth"/> quote representing bid or ask
Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
2+
using System;
3+
4+
namespace BinanceBot.Market.Domain;
5+
6+
/// <summary>
7+
/// A symbol representation based on a Base and Quote asset
8+
/// </summary>
9+
public record MarketSymbol
10+
{
11+
public MarketSymbol(string baseAsset, string quoteAsset, ContractType contractType)
12+
{
13+
BaseAsset = baseAsset ?? throw new ArgumentNullException(nameof(baseAsset));
14+
QuoteAsset = quoteAsset ?? throw new ArgumentNullException(nameof(quoteAsset));
15+
ContractType = contractType;
16+
}
17+
18+
/// <summary>
19+
/// The base asset of the symbol
20+
/// </summary>
21+
public string BaseAsset { get; init; }
22+
23+
/// <summary>
24+
/// The quote asset of the symbol
25+
/// </summary>
26+
public string QuoteAsset { get; init; }
27+
28+
/// <summary>
29+
/// The symbol name, can be used to overwrite the default formatted name
30+
/// </summary>
31+
public string FullName => $"{BaseAsset}{QuoteAsset}";
32+
33+
/// <summary>
34+
/// The Contract type of the symbol
35+
/// </summary>
36+
public ContractType ContractType { get; init; }
37+
}
38+
39+
40+
/// <summary>
41+
/// Contract type
42+
/// </summary>
43+
public enum ContractType
44+
{
45+
/// <summary>
46+
/// Spot market
47+
/// </summary>
48+
Spot,
49+
/// <summary>
50+
/// Perpetual Futures contract
51+
/// </summary>
52+
Perpetual
53+
}

src/BinanceBot.Market/Utility/QuoteExtensions.cs renamed to src/BinanceBot.Market/Extensions/QuoteExtensions.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
using System.Collections.Generic;
22
using System.Linq;
33
using Binance.Net.Enums;
4-
using BinanceBot.Market.Core;
4+
using BinanceBot.Market.Domain;
55

6-
namespace BinanceBot.Market.Utility;
6+
namespace BinanceBot.Market.Extensions;
77

88
internal static class QuoteExtensions
99
{

src/BinanceBot.Market/MarketDepthManager.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
using Binance.Net.Interfaces;
77
using Binance.Net.Interfaces.Clients;
88
using Binance.Net.Objects.Models.Spot;
9-
using BinanceBot.Market.Core;
9+
using BinanceBot.Market.Domain;
1010
using CryptoExchange.Net.Objects;
1111
using CryptoExchange.Net.Sockets;
1212
using NLog;

src/BinanceBot.Market/MarketMakerBot.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
using Binance.Net.Enums;
77
using Binance.Net.Interfaces.Clients;
88
using Binance.Net.Objects.Models.Spot;
9-
using BinanceBot.Market.Core;
9+
using BinanceBot.Market.Domain;
1010
using BinanceBot.Market.Strategies;
1111
using CryptoExchange.Net.Objects;
1212
using NLog;

src/BinanceBot.Market/Strategies/NaiveMarketMakerStrategy.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
using System;
22
using Binance.Net.Enums;
33
using BinanceBot.Market.Configurations;
4-
using BinanceBot.Market.Core;
4+
using BinanceBot.Market.Domain;
55
using NLog;
66

77
namespace BinanceBot.Market.Strategies;

0 commit comments

Comments
 (0)