109 lines
2.1 KiB
C#
109 lines
2.1 KiB
C#
using System;
|
|
using sharp.json;
|
|
using sharp.json.attributes;
|
|
namespace sharp.trading.bittrex
|
|
{
|
|
[JSONClassPolicy( Policy = JSONPolicy.ALL)]
|
|
public class BittrexOrder : Order
|
|
{
|
|
BittrexConnector Connector { get; set; }
|
|
|
|
public BittrexOrder(BittrexConnector connector)
|
|
{
|
|
this.Connector = connector;
|
|
}
|
|
|
|
public BittrexOrder()
|
|
{
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
return string.Format("[BittrexOrder: MarketName={0}, Limit={1}, OrderVolume={2}, FilledVolume={3}]", MarketName, LimitPrice, OrderVolume, FilledVolume);
|
|
}
|
|
|
|
|
|
|
|
[JSONField(Alias = "Exchange")]
|
|
string MarketName { get; set; }
|
|
|
|
[JSONField(Alias = "Type")]
|
|
private string __type
|
|
{
|
|
get {
|
|
return null;
|
|
}
|
|
set
|
|
{
|
|
BittrexOrderType = value;
|
|
}
|
|
}
|
|
|
|
[JSONField( Alias = "OrderType")]
|
|
private string BittrexOrderType {
|
|
set {
|
|
if (value.Equals("LIMIT_SELL")){
|
|
OrderType = OrderType.SELL;
|
|
OrderTarget = OrderTarget.LIMIT;
|
|
} else if (value.Equals("LIMIT_BUY")){
|
|
OrderType = OrderType.BUY;
|
|
OrderTarget = OrderTarget.LIMIT;
|
|
}
|
|
}
|
|
}
|
|
|
|
[JSONField( Alias = "Quantity")]
|
|
private double _volume {
|
|
get { return OrderVolume; }
|
|
set {
|
|
OrderVolume = value;
|
|
}
|
|
}
|
|
|
|
[JSONField(Alias = "QuantityRemaining")]
|
|
double OrderVolumeRemaining
|
|
{
|
|
get; set;
|
|
}
|
|
|
|
public override double FilledVolume {
|
|
get { return this.OrderVolume - this.OrderVolumeRemaining; }
|
|
set { this.OrderVolumeRemaining = this.OrderVolume - value; }
|
|
}
|
|
|
|
[JSONField(Alias = "Limit")]
|
|
private double _limit
|
|
{
|
|
get { return this.LimitPrice; }
|
|
set { this.LimitPrice = value; }
|
|
}
|
|
|
|
[JSONField(Alias = "Price")]
|
|
private double _price
|
|
{
|
|
get { return this.PayedPrice; }
|
|
set { this.PayedPrice = value; }
|
|
}
|
|
|
|
[JSONField(Alias = "Commission")]
|
|
private double _fee
|
|
{
|
|
get { return this.PayedFees; }
|
|
set { this.PayedFees = value; }
|
|
}
|
|
[JSONField(Alias = "CommissionPaid")]
|
|
private double _fee2
|
|
{
|
|
get { return this.PayedFees; }
|
|
set { this.PayedFees = value; }
|
|
}
|
|
|
|
[JSONField]
|
|
private string OrderUuid {
|
|
get { return this.OrderID; }
|
|
set { this.OrderID = value; }
|
|
}
|
|
|
|
}
|
|
}
|