refactor: Move Book into own file
This commit is contained in:
1 parent
f26cb80e5f
commit
99a661089f
2 files changed
+44
-32
No files matched your search
@@ -0,0 +1,44 @@
|
||||
namespace bts.md {
|
||||
using bts.api.core;
|
||||
|
||||
using mbts;
|
||||
using mbts.co2;
|
||||
using mbts.spark;
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Reactive.Linq;
|
||||
|
||||
public readonly struct Book : IEquatable<Book> {
|
||||
public Book(uint security_id, List<PriceSize> bids, List<PriceSize> asks) {
|
||||
this.security_id = security_id;
|
||||
this.bids = bids;
|
||||
this.asks = asks;
|
||||
}
|
||||
|
||||
public uint security_id { get; }
|
||||
public List<PriceSize> bids { get; }
|
||||
public List<PriceSize> asks { get; }
|
||||
|
||||
public static Book empty(uint security_id) =>
|
||||
new(security_id, new(0), new(0));
|
||||
|
||||
public bool Equals(Book other) =>
|
||||
security_id == other.security_id &&
|
||||
bids.SequenceEqual(other.bids) &&
|
||||
asks.SequenceEqual(other.asks);
|
||||
|
||||
public override bool Equals(object obj) =>
|
||||
obj is Book other && Equals(other);
|
||||
|
||||
public override int GetHashCode() =>
|
||||
security_id.GetHashCode();
|
||||
|
||||
public static bool operator ==(Book left, Book right) =>
|
||||
left.Equals(right);
|
||||
|
||||
public static bool operator !=(Book left, Book right) =>
|
||||
!(left == right);
|
||||
}
|
||||
}
|
||||
@@ -10,38 +10,6 @@ namespace bts.md {
|
||||
using System.Linq;
|
||||
using System.Reactive.Linq;
|
||||
|
||||
public readonly struct Book : IEquatable<Book> {
|
||||
public Book(uint security_id, List<PriceSize> bids, List<PriceSize> asks) {
|
||||
this.security_id = security_id;
|
||||
this.bids = bids;
|
||||
this.asks = asks;
|
||||
}
|
||||
|
||||
public uint security_id { get; }
|
||||
public List<PriceSize> bids { get; }
|
||||
public List<PriceSize> asks { get; }
|
||||
|
||||
public static Book empty(uint security_id) =>
|
||||
new(security_id, new(0), new(0));
|
||||
|
||||
public bool Equals(Book other) =>
|
||||
security_id == other.security_id &&
|
||||
bids.SequenceEqual(other.bids) &&
|
||||
asks.SequenceEqual(other.asks);
|
||||
|
||||
public override bool Equals(object obj) =>
|
||||
obj is Book other && Equals(other);
|
||||
|
||||
public override int GetHashCode() =>
|
||||
security_id.GetHashCode();
|
||||
|
||||
public static bool operator ==(Book left, Book right) =>
|
||||
left.Equals(right);
|
||||
|
||||
public static bool operator !=(Book left, Book right) =>
|
||||
!(left == right);
|
||||
}
|
||||
|
||||
public class IncrementalMarketDataClient {
|
||||
readonly MDSource _source;
|
||||
readonly TimeSpan _poll_interval;
|
||||
|
||||
Reference in new issue
Block a user