unilimited buy order implemented

This commit is contained in:
7u83
2017-02-25 06:24:26 +01:00
parent 88331b262c
commit 65ca4d9e21
5 changed files with 122 additions and 17 deletions

View File

@ -91,10 +91,11 @@
<Component class="javax.swing.JComboBox" name="typeComboBox">
<Properties>
<Property name="model" type="javax.swing.ComboBoxModel" editor="org.netbeans.modules.form.editors2.ComboBoxModelEditor">
<StringArray count="3">
<StringArray count="4">
<StringItem index="0" value="Buy Limit"/>
<StringItem index="1" value="Sell Limit"/>
<StringItem index="2" value="Sell"/>
<StringItem index="3" value="Buy"/>
</StringArray>
</Property>
</Properties>

View File

@ -53,8 +53,8 @@ public class CreateOrderDialog extends javax.swing.JDialog {
public CreateOrderDialog(java.awt.Frame parent, boolean modal, Account account, OrderType type) {
this(parent, modal);
this.account = account;
typeComboBox.setModel(new javax.swing.DefaultComboBoxModel<>(new String[]{"Buy Lim", "Sell Lim", "Sell"}));
typeList = new OrderType[]{OrderType.BUYLIMIT, OrderType.SELLLIMIT, OrderType.SELL};
typeComboBox.setModel(new javax.swing.DefaultComboBoxModel<>(new String[]{"Buy Lim", "Sell Lim", "Buy", "Sell"}));
typeList = new OrderType[]{OrderType.BUYLIMIT, OrderType.SELLLIMIT, OrderType.BUY,OrderType.SELL};
for (int i = 0; i < typeList.length; i++) {
if (typeList[i] == type) {
this.typeComboBox.setSelectedIndex(i);
@ -72,7 +72,7 @@ public class CreateOrderDialog extends javax.swing.JDialog {
public void initDialog() {
OrderType t = getOrderType();
Quote q = Globals.se.getCurrentPrice();
Quote q = Globals.se.getBestPrice_0();
Double price = q == null ? 0.0 : q.price;
if (t == OrderType.BUYLIMIT) {
@ -123,7 +123,7 @@ public class CreateOrderDialog extends javax.swing.JDialog {
}
});
typeComboBox.setModel(new javax.swing.DefaultComboBoxModel<>(new String[] { "Buy Limit", "Sell Limit", "Sell" }));
typeComboBox.setModel(new javax.swing.DefaultComboBoxModel<>(new String[] { "Buy Limit", "Sell Limit", "Sell", "Buy" }));
limitSpinner.setModel(new javax.swing.SpinnerNumberModel(0.0d, 0.0d, null, 0.1d));

View File

@ -283,7 +283,7 @@ public class RandomTraderA extends AutoTraderBase {
// how much money we ant to invest?
double money = getRandomAmmount(ad.getMoney(), buy_volume);
Quote q = se.getCurrentPrice();
Quote q = se.getBestPrice_0();
//q=se.getLastQuoete();
double lp = q == null ? getStart() : q.price;
@ -323,7 +323,7 @@ public class RandomTraderA extends AutoTraderBase {
// double lp = 100.0; //se.getBestLimit(type);
Quote q = se.getCurrentPrice();
Quote q = se.getBestPrice_0();
// q=se.getLastQuoete();
double lp = q == null ? getStart() : q.price;

View File

@ -283,7 +283,7 @@ public class RandomTraderB extends AutoTraderBase {
// how much money we ant to invest?
double money = getRandomAmmount(ad.getMoney(), buy_volume);
Quote q = se.getCurrentPrice();
Quote q = se.getBestPrice_0();
//q=se.getLastQuoete();
double lp = q == null ? getStart() : q.price;
@ -323,7 +323,7 @@ public class RandomTraderB extends AutoTraderBase {
// double lp = 100.0; //se.getBestLimit(type);
Quote q = se.getCurrentPrice();
Quote q = se.getBestPrice_0();
// q=se.getLastQuoete();
double lp = q == null ? getStart() : q.price;