Renamed size to volume
This commit is contained in:
parent
cff5f34cd0
commit
818282d4cb
@ -119,19 +119,19 @@ public class MainWin extends javax.swing.JFrame {
|
||||
|
||||
SeSim.BuyOrder bo = new SeSim.BuyOrder();
|
||||
bo.limit = 20.0;
|
||||
bo.size = 12;
|
||||
bo.volume = 12;
|
||||
bo.timestamp = 12;
|
||||
se.SendOrder(bo);
|
||||
|
||||
SeSim.BuyOrder bo1 = new SeSim.BuyOrder();
|
||||
bo1.limit = 27.0;
|
||||
bo1.size = 123;
|
||||
bo1.volume = 123;
|
||||
bo1.timestamp = 922;
|
||||
se.SendOrder(bo1);
|
||||
|
||||
for (int i = 0; i < 130; i++) {
|
||||
BuyOrder o = new BuyOrder();
|
||||
o.size = 90 + i;
|
||||
o.volume = 90 + i;
|
||||
o.limit = 80 + i;
|
||||
se.SendOrder(o);
|
||||
|
||||
|
@ -28,7 +28,7 @@ public class Account {
|
||||
SellOrder o = new SellOrder();
|
||||
o.account = this;
|
||||
o.limit = limit;
|
||||
o.size = size;
|
||||
o.volume = size;
|
||||
|
||||
orderpending = true;
|
||||
ex.SendOrder(o);
|
||||
@ -43,7 +43,7 @@ public class Account {
|
||||
|
||||
BuyOrder o = new BuyOrder();
|
||||
o.limit = limit;
|
||||
o.size = size;
|
||||
o.volume = size;
|
||||
o.account = this;
|
||||
orderpending = true;
|
||||
ex.SendOrder(o);
|
||||
|
@ -79,7 +79,7 @@ public class Exchange extends Thread {
|
||||
if (bid.isEmpty()) {
|
||||
b = new BuyOrder();
|
||||
b.limit = -1;
|
||||
b.size = 0;
|
||||
b.volume = 0;
|
||||
} else {
|
||||
b = bid.first();
|
||||
}
|
||||
@ -87,7 +87,7 @@ public class Exchange extends Thread {
|
||||
if (ask.isEmpty()) {
|
||||
a = new SellOrder();
|
||||
a.limit = -1;
|
||||
a.size = 0;
|
||||
a.volume = 0;
|
||||
|
||||
} else {
|
||||
a = ask.first();
|
||||
@ -128,7 +128,7 @@ public class Exchange extends Thread {
|
||||
BuyOrder b = bid.first();
|
||||
SellOrder a = ask.first();
|
||||
|
||||
if (a.size == 0) {
|
||||
if (a.volume == 0) {
|
||||
// This order is fully executed, remove
|
||||
a.account.orderpending = false;
|
||||
a.status = OrderStatus.executed;
|
||||
@ -136,7 +136,7 @@ public class Exchange extends Thread {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (b.size == 0) {
|
||||
if (b.volume == 0) {
|
||||
//
|
||||
b.account.orderpending = false;
|
||||
b.status = OrderStatus.executed;
|
||||
@ -160,15 +160,15 @@ public class Exchange extends Thread {
|
||||
|
||||
long size = 0;
|
||||
|
||||
if (b.size >= a.size) {
|
||||
size = a.size;
|
||||
if (b.volume >= a.volume) {
|
||||
size = a.volume;
|
||||
} else {
|
||||
size = b.size;
|
||||
size = b.volume;
|
||||
}
|
||||
|
||||
b.account.Buy(a.account, size, price);
|
||||
b.size -= size;
|
||||
a.size -= size;
|
||||
b.volume -= size;
|
||||
a.volume -= size;
|
||||
|
||||
lastprice = price;
|
||||
lastsize = size;
|
||||
@ -233,10 +233,10 @@ public class Exchange extends Thread {
|
||||
*/
|
||||
public double getlastprice() {
|
||||
/*
|
||||
* SellOrder so = new SellOrder(); so.limit=1000.0; so.size=500;
|
||||
* SellOrder so = new SellOrder(); so.limit=1000.0; so.volume=500;
|
||||
* SendOrder(so);
|
||||
*
|
||||
* BuyOrder bo = new BuyOrder(); bo.limit=1001.0; bo.size=300;
|
||||
* BuyOrder bo = new BuyOrder(); bo.limit=1001.0; bo.volume=300;
|
||||
* SendOrder(bo);
|
||||
*/
|
||||
|
||||
|
@ -10,7 +10,7 @@ public abstract class Order implements Comparable<Order> {
|
||||
/**
|
||||
* Number of shares
|
||||
*/
|
||||
public long size;
|
||||
public long volume;
|
||||
|
||||
/**
|
||||
* Limit price
|
||||
@ -43,7 +43,7 @@ public abstract class Order implements Comparable<Order> {
|
||||
}
|
||||
|
||||
String format_size() {
|
||||
return String.format("%d", size);
|
||||
return String.format("%d", volume);
|
||||
}
|
||||
|
||||
Order() {
|
||||
|
Loading…
Reference in New Issue
Block a user