30 lines
641 B
C#
30 lines
641 B
C#
using System;
|
|
using sharp.json;
|
|
using sharp.json.attributes;
|
|
namespace sharp.trading
|
|
{
|
|
[JSONClassPolicy(Policy = JSONPolicy.ATTRIBUTED)]
|
|
public struct VolumeRate : IComparable
|
|
{
|
|
[JSONField(Alias = "Quantity")]
|
|
public Double Volume { get; set; }
|
|
[JSONField(Alias = "Rate")]
|
|
public Double Price { get; set; }
|
|
|
|
public VolumeRate(Double Volume,Double Price)
|
|
{
|
|
this.Volume = Volume;
|
|
this.Price = Price;
|
|
}
|
|
|
|
public int CompareTo(object obj)
|
|
{
|
|
return Price.CompareTo(((VolumeRate)obj).Price);
|
|
}
|
|
|
|
public double UnityPrice {
|
|
get { if (this.Volume != 0) { return this.Price / this.Volume; } return 0; }
|
|
}
|
|
}
|
|
}
|