Moved OrderStatus from Exchange to Order

This commit is contained in:
7u83 2017-10-08 21:14:28 +02:00
parent f4d4ba2c46
commit 08c4c5e91d
5 changed files with 87 additions and 84 deletions

View File

@ -1,4 +1,4 @@
#Sun, 08 Oct 2017 19:42:34 +0200
#Sun, 08 Oct 2017 21:13:57 +0200
annotation.processing.enabled=true
annotation.processing.enabled.in.editor=false
annotation.processing.processors.list=

View File

@ -36,6 +36,7 @@ import java.util.logging.Level;
import java.util.logging.Logger;
import org.json.JSONArray;
import org.json.JSONObject;
import sesim.Order.OrderStatus;
/**
* @desc Echchange class
@ -294,12 +295,6 @@ public class Exchange {
return a.id;
}
public enum OrderStatus {
OPEN,
PARTIALLY_EXECUTED,
CLOSED,
CANCELED
}
class OrderComparator implements Comparator<Order> {

View File

@ -29,10 +29,17 @@ package sesim;
*
* @author 7u83 <7u83@mail.ru>
*/
public class Order {
public class Order {
public enum OrderStatus {
OPEN,
PARTIALLY_EXECUTED,
CLOSED,
CANCELED
}
Stock stock;
Exchange.OrderStatus status;
OrderStatus status;
Exchange.OrderType type;
protected double limit;
protected double volume;
@ -47,14 +54,14 @@ package sesim;
Order(long id, long created, Exchange.Account account, Exchange.OrderType type, double volume, double limit) {
//id = order_id_generator.getNext();
this.id=id;
this.id = id;
this.account = account;
this.type = type;
this.limit = limit;
this.volume = volume;
this.initial_volume = this.volume;
this.created = created;
this.status = Exchange.OrderStatus.OPEN;
this.status = OrderStatus.OPEN;
this.cost = 0;
}
@ -98,11 +105,11 @@ package sesim;
return account;
}
public Exchange.OrderStatus getOrderStatus() {
public OrderStatus getOrderStatus() {
return status;
}
public long getCreated() {
return created;
}
}
}

View File

@ -37,7 +37,7 @@ import sesim.AutoTraderGui;
import sesim.AutoTraderInterface;
import sesim.Exchange;
import sesim.Exchange.AccountListener;
import sesim.Exchange.OrderStatus;
import sesim.Order.OrderStatus;
import sesim.Order;
/**

View File

@ -36,9 +36,10 @@ import sesim.AutoTraderGui;
import sesim.Exchange;
import sesim.Exchange.Account;
import sesim.Exchange.AccountListener;
import sesim.Exchange.OrderStatus;
import sesim.Exchange.OrderType;
import sesim.Order;
import sesim.Order.OrderStatus;
import sesim.Quote;
/**