45 lines
1.2 KiB
C#
45 lines
1.2 KiB
C#
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);
|
|
}
|
|
}
|