MCPcopy Create free account
hub / github.com/chronoxor/FastBinaryEncoding / Order

Class Order

projects/CSharp/Proto/com.chronoxor.proto.cs:780–901  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

778namespace com.chronoxor.proto {
779
780 public struct Order : IComparable, IComparable<Order>, IEquatable<Order>
781 {
782 public int id;
783 public string symbol;
784 public OrderSide side;
785 public OrderType type;
786 public double price;
787 public double volume;
788
789 public const long FBETypeConst = 1;
790 #if UTF8JSON
791 [IgnoreDataMember]
792 #else
793 [JsonIgnore]
794 #endif
795 public long FBEType => FBETypeConst;
796
797 public static Order Default => new Order
798 {
799 id = (int)0
800 , symbol = ""
801 , side = global::com.chronoxor.proto.OrderSide.Default
802 , type = global::com.chronoxor.proto.OrderType.Default
803 , price = (double)0.0D
804 , volume = (double)0.0D
805 };
806
807 public Order(int id, string symbol, OrderSide side, OrderType type, double price, double volume)
808 {
809 this.id = id;
810 this.symbol = symbol;
811 this.side = side;
812 this.type = type;
813 this.price = price;
814 this.volume = volume;
815 }
816
817 public Order Clone()
818 {
819 // Serialize the struct to the FBE stream
820 var writer = new com.chronoxor.proto.FBE.OrderModel();
821 writer.Serialize(this);
822
823 // Deserialize the struct from the FBE stream
824 var reader = new com.chronoxor.proto.FBE.OrderModel();
825 reader.Attach(writer.Buffer);
826 reader.Deserialize(out var result);
827 return result;
828 }
829
830 public int CompareTo(object other)
831 {
832 int result = 0;
833 result = id.CompareTo(((Order)other).id);
834 if (result != 0)
835 return result;
836 return result;
837 }

Callers

nothing calls this directly

Calls 1

EqualsMethod · 0.45

Tested by

no test coverage detected