Skip to content

Commit d845e6b

Browse files
vsleejjxtra
authored andcommitted
NDAX: move supporting classes to ExchangeNDAXAPI class (#468)
- additional capitalization fixes
1 parent 80b0610 commit d845e6b

18 files changed

+572
-532
lines changed
Lines changed: 21 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,30 @@
11
using System;
22
using Newtonsoft.Json;
33

4-
namespace ExchangeSharp.NDAX
4+
namespace ExchangeSharp
55
{
6-
public class BoolConverter : JsonConverter
7-
{
8-
public override void WriteJson(JsonWriter writer, object value, JsonSerializer serializer)
6+
public sealed partial class ExchangeNDAXAPI
7+
{
8+
class BoolConverter : JsonConverter
9+
{
10+
public override void WriteJson(JsonWriter writer, object value, JsonSerializer serializer)
911

10-
{
11-
writer.WriteValue(((bool) value) ? 1 : 0);
12-
}
12+
{
13+
writer.WriteValue(((bool)value) ? 1 : 0);
14+
}
1315

14-
public override object ReadJson(JsonReader reader, Type objectType, object existingValue,
15-
JsonSerializer serializer)
16+
public override object ReadJson(JsonReader reader, Type objectType, object existingValue,
17+
JsonSerializer serializer)
1618

17-
{
18-
return reader.Value.ToString() == "1";
19-
}
19+
{
20+
return reader.Value.ToString() == "1";
21+
}
2022

21-
public override bool CanConvert(Type objectType)
23+
public override bool CanConvert(Type objectType)
2224

23-
{
24-
return objectType == typeof(bool);
25-
}
26-
}
27-
}
25+
{
26+
return objectType == typeof(bool);
27+
}
28+
}
29+
}
30+
}

ExchangeSharp/API/Exchanges/NDAX/ExchangeNdaxAPI.cs renamed to ExchangeSharp/API/Exchanges/NDAX/ExchangeNDAXAPI.cs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
using System.Linq;
44
using System.Threading;
55
using System.Threading.Tasks;
6-
using ExchangeSharp.NDAX;
76
using Newtonsoft.Json;
87
using Newtonsoft.Json.Linq;
98

@@ -427,4 +426,4 @@ public partial class ExchangeName
427426
{
428427
public const string NDAX = "NDAX";
429428
}
430-
}
429+
}
Lines changed: 30 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,40 +1,43 @@
11
using Newtonsoft.Json;
22

3-
namespace ExchangeSharp.NDAX
3+
namespace ExchangeSharp
44
{
5-
public partial class AccountBalance
6-
{
7-
[JsonProperty("OMSId")]
8-
public long OmsId { get; set; }
5+
public sealed partial class ExchangeNDAXAPI
6+
{
7+
class AccountBalance
8+
{
9+
[JsonProperty("OMSId")]
10+
public long OmsId { get; set; }
911

10-
[JsonProperty("AccountId")]
11-
public long AccountId { get; set; }
12+
[JsonProperty("AccountId")]
13+
public long AccountId { get; set; }
1214

13-
[JsonProperty("ProductSymbol")]
14-
public string ProductSymbol { get; set; }
15+
[JsonProperty("ProductSymbol")]
16+
public string ProductSymbol { get; set; }
1517

16-
[JsonProperty("ProductId")]
17-
public long ProductId { get; set; }
18+
[JsonProperty("ProductId")]
19+
public long ProductId { get; set; }
1820

19-
[JsonProperty("Amount")]
20-
public decimal Amount { get; set; }
21+
[JsonProperty("Amount")]
22+
public decimal Amount { get; set; }
2123

22-
[JsonProperty("Hold")]
23-
public long Hold { get; set; }
24+
[JsonProperty("Hold")]
25+
public long Hold { get; set; }
2426

25-
[JsonProperty("PendingDeposits")]
26-
public long PendingDeposits { get; set; }
27+
[JsonProperty("PendingDeposits")]
28+
public long PendingDeposits { get; set; }
2729

28-
[JsonProperty("PendingWithdraws")]
29-
public long PendingWithdraws { get; set; }
30+
[JsonProperty("PendingWithdraws")]
31+
public long PendingWithdraws { get; set; }
3032

31-
[JsonProperty("TotalDayDeposits")]
32-
public long TotalDayDeposits { get; set; }
33+
[JsonProperty("TotalDayDeposits")]
34+
public long TotalDayDeposits { get; set; }
3335

34-
[JsonProperty("TotalDayWithdraws")]
35-
public long TotalDayWithdraws { get; set; }
36+
[JsonProperty("TotalDayWithdraws")]
37+
public long TotalDayWithdraws { get; set; }
3638

37-
[JsonProperty("TotalMonthWithdraws")]
38-
public long TotalMonthWithdraws { get; set; }
39-
}
40-
}
39+
[JsonProperty("TotalMonthWithdraws")]
40+
public long TotalMonthWithdraws { get; set; }
41+
}
42+
}
43+
}
Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,14 @@
1-
namespace ExchangeSharp.NDAX
1+
namespace ExchangeSharp
22
{
3-
public class AuthenticateResult
4-
{
5-
public bool Authenticated { get; set; }
6-
public int UserId { get; set; }
7-
public string Token { get; set; }
8-
public string AccountId { get; set; }
9-
public string OMSId { get; set; }
10-
}
11-
}
3+
public sealed partial class ExchangeNDAXAPI
4+
{
5+
class AuthenticateResult
6+
{
7+
public bool Authenticated { get; set; }
8+
public int UserId { get; set; }
9+
public string Token { get; set; }
10+
public string AccountId { get; set; }
11+
public string OMSId { get; set; }
12+
}
13+
}
14+
}
Lines changed: 16 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,19 @@
11
using Newtonsoft.Json;
22

3-
namespace ExchangeSharp.NDAX
3+
namespace ExchangeSharp
44
{
5-
public class GenericResponse
6-
{
7-
[JsonProperty("result")]
8-
public bool Result { get; set; }
9-
[JsonProperty("errormsg")]
10-
public string ErrorMsg { get; set; }
11-
[JsonProperty("errorcode")]
12-
public int ErrorCode { get; set; }
13-
[JsonProperty("detail")]
14-
public int Detail { get; set; }
15-
}
16-
}
5+
public sealed partial class ExchangeNDAXAPI
6+
{
7+
class GenericResponse
8+
{
9+
[JsonProperty("result")]
10+
public bool Result { get; set; }
11+
[JsonProperty("errormsg")]
12+
public string ErrorMsg { get; set; }
13+
[JsonProperty("errorcode")]
14+
public int ErrorCode { get; set; }
15+
[JsonProperty("detail")]
16+
public int Detail { get; set; }
17+
}
18+
}
19+
}
Lines changed: 52 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -1,71 +1,74 @@
11
using System;
22
using Newtonsoft.Json;
33

4-
namespace ExchangeSharp.NDAX
4+
namespace ExchangeSharp
55
{
6-
public partial class Instrument
7-
{
8-
[JsonProperty("OMSId")]
9-
public long OmsId { get; set; }
6+
public sealed partial class ExchangeNDAXAPI
7+
{
8+
class Instrument
9+
{
10+
[JsonProperty("OMSId")]
11+
public long OmsId { get; set; }
1012

11-
[JsonProperty("InstrumentId")]
12-
public long InstrumentId { get; set; }
13+
[JsonProperty("InstrumentId")]
14+
public long InstrumentId { get; set; }
1315

14-
[JsonProperty("Symbol")]
15-
public string Symbol { get; set; }
16+
[JsonProperty("Symbol")]
17+
public string Symbol { get; set; }
1618

17-
[JsonProperty("Product1")]
18-
public long Product1 { get; set; }
19+
[JsonProperty("Product1")]
20+
public long Product1 { get; set; }
1921

20-
[JsonProperty("Product1Symbol")]
21-
public string Product1Symbol { get; set; }
22+
[JsonProperty("Product1Symbol")]
23+
public string Product1Symbol { get; set; }
2224

23-
[JsonProperty("Product2")]
24-
public long Product2 { get; set; }
25+
[JsonProperty("Product2")]
26+
public long Product2 { get; set; }
2527

26-
[JsonProperty("Product2Symbol")]
27-
public string Product2Symbol { get; set; }
28+
[JsonProperty("Product2Symbol")]
29+
public string Product2Symbol { get; set; }
2830

29-
[JsonProperty("InstrumentType")]
30-
public string InstrumentType { get; set; }
31+
[JsonProperty("InstrumentType")]
32+
public string InstrumentType { get; set; }
3133

32-
[JsonProperty("VenueInstrumentId")]
33-
public long VenueInstrumentId { get; set; }
34+
[JsonProperty("VenueInstrumentId")]
35+
public long VenueInstrumentId { get; set; }
3436

35-
[JsonProperty("VenueId")]
36-
public long VenueId { get; set; }
37+
[JsonProperty("VenueId")]
38+
public long VenueId { get; set; }
3739

38-
[JsonProperty("SortIndex")]
39-
public long SortIndex { get; set; }
40+
[JsonProperty("SortIndex")]
41+
public long SortIndex { get; set; }
4042

41-
[JsonProperty("SessionStatus")]
42-
public string SessionStatus { get; set; }
43+
[JsonProperty("SessionStatus")]
44+
public string SessionStatus { get; set; }
4345

44-
[JsonProperty("PreviousSessionStatus")]
45-
public string PreviousSessionStatus { get; set; }
46+
[JsonProperty("PreviousSessionStatus")]
47+
public string PreviousSessionStatus { get; set; }
4648

47-
[JsonProperty("SessionStatusDateTime")]
48-
public DateTimeOffset SessionStatusDateTime { get; set; }
49+
[JsonProperty("SessionStatusDateTime")]
50+
public DateTimeOffset SessionStatusDateTime { get; set; }
4951

50-
[JsonProperty("SelfTradePrevention")]
51-
public bool SelfTradePrevention { get; set; }
52+
[JsonProperty("SelfTradePrevention")]
53+
public bool SelfTradePrevention { get; set; }
5254

53-
[JsonProperty("QuantityIncrement")]
54-
public double QuantityIncrement { get; set; }
55+
[JsonProperty("QuantityIncrement")]
56+
public double QuantityIncrement { get; set; }
5557

56-
[JsonProperty("PriceIncrement")]
57-
public double PriceIncrement { get; set; }
58+
[JsonProperty("PriceIncrement")]
59+
public double PriceIncrement { get; set; }
5860

59-
public ExchangeMarket ToExchangeMarket()
60-
{
61-
return new ExchangeMarket()
62-
{
63-
BaseCurrency = Product1Symbol,
64-
IsActive = SessionStatus.Equals("running", StringComparison.InvariantCultureIgnoreCase),
65-
MarginEnabled = false,
66-
MarketId = InstrumentId.ToStringInvariant(),
67-
MarketSymbol = Symbol
68-
};
69-
}
61+
public ExchangeMarket ToExchangeMarket()
62+
{
63+
return new ExchangeMarket()
64+
{
65+
BaseCurrency = Product1Symbol,
66+
IsActive = SessionStatus.Equals("running", StringComparison.InvariantCultureIgnoreCase),
67+
MarginEnabled = false,
68+
MarketId = InstrumentId.ToStringInvariant(),
69+
MarketSymbol = Symbol
70+
};
71+
}
72+
}
7073
}
71-
}
74+
}

0 commit comments

Comments
 (0)