From 40909470019db900bdb52b3137b9a7f151ef738d Mon Sep 17 00:00:00 2001
From: 7u83 <7u83@maiol.ru>
Date: Sat, 11 Feb 2017 13:12:02 +0100
Subject: [PATCH] Code cleaning
---
src/main/java/gui/EditExchangeDialog.form | 3 +
src/main/java/gui/EditExchangeDialog.java | 9 +
src/main/java/gui/NewMDIApplication.java | 13 +-
src/main/java/sesim/AccountData.java | 44 --
src/main/java/sesim/Exchange.java | 7 +-
src/main/java/traders/RandomTrader.java | 304 ------------
src/main/java/traders/RandomTraderA.java | 149 +++---
src/main/java/traders/RandomTraderConfig.java | 6 +-
src/main/java/traders/RandomTraderGui.form | 465 ------------------
src/main/java/traders/RandomTraderGui.java | 446 -----------------
src/main/java/traders/RandomTraderGuiA.form | 137 ++++--
src/main/java/traders/RandomTraderGuiA.java | 115 +++--
src/main/java/traders/SwitchingTrader.java | 98 ----
.../java/traders/SwitchingTraderConfig.java | 69 ---
src/test/java/sesim/Test.java | 11 -
15 files changed, 292 insertions(+), 1584 deletions(-)
delete mode 100644 src/main/java/sesim/AccountData.java
delete mode 100644 src/main/java/traders/RandomTrader.java
delete mode 100644 src/main/java/traders/RandomTraderGui.form
delete mode 100644 src/main/java/traders/RandomTraderGui.java
delete mode 100644 src/main/java/traders/SwitchingTrader.java
delete mode 100644 src/main/java/traders/SwitchingTraderConfig.java
diff --git a/src/main/java/gui/EditExchangeDialog.form b/src/main/java/gui/EditExchangeDialog.form
index 2abfd62..b2b5e1c 100644
--- a/src/main/java/gui/EditExchangeDialog.form
+++ b/src/main/java/gui/EditExchangeDialog.form
@@ -112,6 +112,9 @@
+
+
+
diff --git a/src/main/java/gui/EditExchangeDialog.java b/src/main/java/gui/EditExchangeDialog.java
index ac3745d..2977fdb 100644
--- a/src/main/java/gui/EditExchangeDialog.java
+++ b/src/main/java/gui/EditExchangeDialog.java
@@ -79,6 +79,11 @@ public class EditExchangeDialog extends javax.swing.JDialog {
jButton2.setMnemonic('o');
jButton2.setText("Ok");
+ jButton2.addActionListener(new java.awt.event.ActionListener() {
+ public void actionPerformed(java.awt.event.ActionEvent evt) {
+ jButton2ActionPerformed(evt);
+ }
+ });
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
getContentPane().setLayout(layout);
@@ -123,6 +128,10 @@ public class EditExchangeDialog extends javax.swing.JDialog {
pack();
}// //GEN-END:initComponents
+ private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton2ActionPerformed
+// Globals.prefs.put("money_decimals", value);
+ }//GEN-LAST:event_jButton2ActionPerformed
+
/**
* @param args the command line arguments
*/
diff --git a/src/main/java/gui/NewMDIApplication.java b/src/main/java/gui/NewMDIApplication.java
index f167ac4..2afd82f 100644
--- a/src/main/java/gui/NewMDIApplication.java
+++ b/src/main/java/gui/NewMDIApplication.java
@@ -67,11 +67,15 @@ public class NewMDIApplication extends javax.swing.JFrame {
AutoTraderInterface ac = Globals.tloader.getStrategyBase(base);
ac.putConfig(cfg);
ac.init(se, id, name, money, shares, cfg);
+
return ac;
}
public void startTraders() {
+ Globals.se.setMoneyDecimals(8);
+ Globals.se.setSharesDecimals(0);
+
JSONArray tlist = Globals.getTraders();
Double moneyTotal = 0.0;
@@ -495,14 +499,19 @@ public class NewMDIApplication extends javax.swing.JFrame {
resetSim();
this.stopButton.setEnabled(true);
+
+ this.orderBookPanel.invalidate();
+ this.orderBookPanel.repaint();
+ this.clock.invalidate();
+ this.clock.repaint();
+
this.startTraders();
Globals.se.timer.setPause(false);
Globals.se.timer.start();
Globals.se.timer.setAcceleration((Double) this.accelSpinner.getValue());
- this.clock.invalidate();
- this.clock.repaint();
+
}
diff --git a/src/main/java/sesim/AccountData.java b/src/main/java/sesim/AccountData.java
deleted file mode 100644
index 7b069a9..0000000
--- a/src/main/java/sesim/AccountData.java
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
- * Copyright (c) 2017, 7u83 <7u83@mail.ru>
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- *
- * * Redistributions of source code must retain the above copyright notice, this
- * list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright notice,
- * this list of conditions and the following disclaimer in the documentation
- * and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
- * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- */
-package sesim;
-
-import sesim.Exchange.OrderComparator;
-
-import java.util.*;
-import sesim.Exchange.*;
-
-/**
- *
- * @author 7u83 <7u83@mail.ru>
- */
-public class AccountData {
- public double id;
- public double money;
- public double shares;
-
- public ArrayList orders;
-
-}
diff --git a/src/main/java/sesim/Exchange.java b/src/main/java/sesim/Exchange.java
index fac1fc7..e1caec4 100644
--- a/src/main/java/sesim/Exchange.java
+++ b/src/main/java/sesim/Exchange.java
@@ -101,7 +101,7 @@ public class Exchange {
return owner;
}
- public Map getOrders() {
+ public HashMap getOrders() {
return orders;
}
@@ -676,7 +676,7 @@ public class Exchange {
return accounts.get(account_id);
}
- public AccountData getAccountData(double account_id) {
+ /*public AccountData getAccountData(double account_id) {
tradelock.lock();
Account a = accounts.get(account_id);
tradelock.unlock();
@@ -713,7 +713,8 @@ public class Exchange {
//KeySet ks = a.orders.keySet();
return ad;
}
-
+*/
+
public ArrayList getOpenOrders(double account_id) {
Account a = accounts.get(account_id);
diff --git a/src/main/java/traders/RandomTrader.java b/src/main/java/traders/RandomTrader.java
deleted file mode 100644
index 764d0f9..0000000
--- a/src/main/java/traders/RandomTrader.java
+++ /dev/null
@@ -1,304 +0,0 @@
-/*
- * Copyright (c) 2017, 7u83
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- *
- * * Redistributions of source code must retain the above copyright notice, this
- * list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright notice,
- * this list of conditions and the following disclaimer in the documentation
- * and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
- * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- */
-package traders;
-
-import gui.Globals;
-import java.util.*;
-import java.util.Random;
-import org.json.JSONObject;
-//import java.util.TimerTask;
-/*import sesim.AccountData;*/
-
-import sesim.AutoTrader;
-import sesim.Exchange;
-import sesim.Exchange.OrderType;
-
-import sesim.*;
-
-/**
- *
- * @author 7u83
- */
-public class RandomTrader extends AutoTrader {
-
-
-
-
- /* long event() {
-
- sesim.Exchange.Account a = se.getAccount(account_id);
- long rc = this.doTrade();
- return rc;
-
- }
-*/
-
- public RandomTrader(Exchange se, long id, String name, double money, double shares, RandomTraderConfig config) {
- super(se, id, name,money, shares, config);
- if (this.config == null) {
- this.config = new RandomTraderConfig();
- }
-
- }
-
- /**
- *
- * @return
- */
- @Override
- public long timerTask() {
- sesim.Exchange.Account a = se.getAccount(account_id);
- long rc = this.doTrade();
-
- return rc;
-
-// return this.event();
- }
-
-
-
- protected enum Action {
- BUY, SELL, RANDOM
- }
-
- protected Action getAction() {
- if (se.randNextInt(2) == 0) {
- return Action.BUY;
- } else {
- return Action.SELL;
- }
-
- }
-
- double getStart() {
- return Globals.se.fairValue;
-
- }
- //Timer timer = new Timer();
-
- @Override
- public void start() {
-
- // timer.schedule(new TimerTaskImpl(this, timer), 0);
- se.timer.startTimerEvent(this, 0);
-
- // timer.schedule(new TimerTaskImpl, date);
- }
-
- // config for this trader
- //final private RandomTraderConfig_old myconfig;
- // object to generate random numbers
- //final private Random rand = new Random();
- /**
- * Get a (long) random number between min an max
- *
- * @param min minimum value
- * @param max maximeum value
- * @return the number
- */
- protected double getRandom(double min, double max) {
- double r = se.randNextDouble();
-
- // System.out.printf("RD: %f", r);
- // System.exit(0);
-
- return (max - min) * r + min;
- }
-
- protected int getRandom(Long[] minmax) {
- return (int) Math.round(getRandom(minmax[0], minmax[1]));
- }
-
- /**
- *
- * @param val
- * @param minmax
- * @return
- */
- protected double getRandomAmmount(double val, Float[] minmax) {
-
- //System.out.printf("RandomAmmount: %f (%f,%f)\n",val, minmax[0], minmax[1]);
- double min = val * minmax[0] / 100.0;
- double max = val * minmax[1] / 100.0;
- return getRandom(min, max);
- }
-
- public long cancelOrders() {
- int n = se.getNumberOfOpenOrders(account_id);
-// System.out.print("Open Orders: "+n+"\n");
- if (n > 0) {
-// System.out.print("Want to killń\n");
- AccountData ad = se.getAccountData(account_id);
- Iterator it = ad.orders.iterator();
- while (it.hasNext()) {
- OrderData od = it.next();
- boolean rc = se.cancelOrder(account_id, od.id);
-// System.out.print("killer rc "+rc+"\n");
- // System.out.print("Killing: "+od.id+"\n");
- }
- }
-
- return n;
-
- }
-
-
-
-
- public long doBuy() {
-
- RandomTraderConfig myconfig = (RandomTraderConfig) this.config;
- AccountData ad = this.se.getAccountData(account_id);
-
- OrderType type = OrderType.BUYLIMIT;
-
- if (ad == null || myconfig == null) {
- //System.out.printf("%s: myconf = 0 \n", this.getName());
- return 0;
-
- }
-
-
-
- // how much money we ant to invest?
- double money = getRandomAmmount(ad.money, myconfig.buy_volume);
-
-
- Quote q = se.getCurrentPrice();
- double lp = q == null ? getStart() : q.price;
-
-
-
- double limit;
- limit = lp + getRandomAmmount(lp, myconfig.buy_limit);
-
-
-
-
-
- // 10
- // 24 13
-
-
-
-// System.out.printf("MyLimit: %f\n",limit);
- long volume = (long) (money / limit);
-
-
- if (volume <= 0) {
-
- volume=1;
- limit = money;
-
-
- }
-
-// double volume = (money / (limit * 1));
-// if (volume <= 0) {
- // return 0;
- // }
-
-
- //System.out.printf("%s: create order %s %f\n", this.getName(),type.toString(),limit);
- se.createOrder(account_id, type, volume, limit);
-
- return getRandom(myconfig.buy_wait);
-
- }
-
- public long doSell() {
- RandomTraderConfig myconfig = (RandomTraderConfig) this.config;
- AccountData ad = this.se.getAccountData(account_id);
-
- OrderType type = OrderType.SELLLIMIT;
-
- //System.out.printf("%s: calling rand for volume\n", this.getName());
- // how much money we ant to envest?
- double volume = (long) getRandomAmmount(ad.shares, myconfig.sell_volume);
-
- // double lp = 100.0; //se.getBestLimit(type);
- Quote q = se.getCurrentPrice();
- double lp = q == null ? getStart() : q.price;
-
- double limit;
- limit = lp + getRandomAmmount(lp, myconfig.sell_limit);
-
-// long volume = (long) (money / (limit * 1));
- if (volume <= 0) {
-// System.out.print("SellVolume 0\n");
- return 5000;
- }
-
-// System.out.print("Volume is:"+volume+"\n");
- // System.out.print("My Ammount is: "+volume+" My limit si:"+limit+ "\n");
-
- //System.out.printf("%s: create order %s %f\n", this.getName(),type.toString(),limit);
- se.createOrder(account_id, type, volume, limit);
-
- return getRandom(myconfig.sell_wait);
-
- }
-
- long doTrade() {
- cancelOrders();
- Action a = getAction();
- switch (a) {
- case BUY:
- return doBuy()+1;
- case SELL:
- return doSell()+1;
-
- }
-// System.out.printf("%s: do nothing\n",this.getName());
- return 0;
-
- }
-
- /*
- private static class TimerTaskImpl extends TimerTask {
-
- RandomTrader trader;
- Timer timer;
-
- public TimerTaskImpl(RandomTrader trader, Timer timer) {
- this.trader = trader;
- this.timer = timer;
-
- }
-
- @Override
- public void run() {
-
- long time = trader.event();
- time /= 100;
-
- this.cancel();
- timer.schedule(new TimerTaskImpl(trader, timer), time);
-
- }
- }
- */
-}
diff --git a/src/main/java/traders/RandomTraderA.java b/src/main/java/traders/RandomTraderA.java
index 3bd1923..6417b9f 100644
--- a/src/main/java/traders/RandomTraderA.java
+++ b/src/main/java/traders/RandomTraderA.java
@@ -26,15 +26,21 @@
package traders;
import gui.Globals;
+import java.util.HashMap;
import java.util.Iterator;
+import java.util.Map;
+import java.util.Set;
+import java.util.SortedMap;
import org.json.JSONArray;
import org.json.JSONObject;
-import sesim.AccountData;
+//import sesim.AccountData;
import sesim.AutoTrader;
import sesim.AutoTraderBase;
import sesim.AutoTraderConfig;
import sesim.AutoTraderGui;
import sesim.Exchange;
+import sesim.Exchange.Account;
+import sesim.Exchange.Order;
import sesim.OrderData;
import sesim.Quote;
@@ -42,7 +48,9 @@ import sesim.Quote;
*
* @author 7u83 <7u83@mail.ru>
*/
-public class RandomTraderA extends AutoTraderBase {
+public class RandomTraderA extends AutoTraderBase {
+
+ public Float[] initial_delay = {0f, 5.0f};
public Float[] sell_volume = {100f, 100f};
public Float[] sell_limit = {-2f, 2f};
@@ -54,6 +62,7 @@ public class RandomTraderA extends AutoTraderBase {
public Long[] buy_wait = {10000L, 50000L};
public Long[] wait_after_buy = {10L, 30L};
+ final String INITIAL_DELAY = "initla_delay";
final String SELL_VOLUME = "sell_volume";
final String BUY_VOLUME = "buy_volume";
final String SELL_LIMIT = "sell_limit";
@@ -65,7 +74,8 @@ public class RandomTraderA extends AutoTraderBase {
@Override
public void start() {
- se.timer.startTimerEvent(this, 0);
+ long delay = (long) (getRandom(initial_delay[0], initial_delay[1]) * 1000);
+ se.timer.startTimerEvent(this, delay);
}
@Override
@@ -76,11 +86,6 @@ public class RandomTraderA extends AutoTraderBase {
}
- /* @Override
- public AutoTrader createTrader(Exchange se, JSONObject cfg, long id, String name, double money, double shares) {
- return null;
- }
-*/
@Override
public String getDisplayName() {
return null;
@@ -94,6 +99,7 @@ public class RandomTraderA extends AutoTraderBase {
@Override
public JSONObject getConfig() {
JSONObject jo = new JSONObject();
+ jo.put(INITIAL_DELAY, initial_delay);
jo.put(SELL_VOLUME, sell_volume);
jo.put(BUY_VOLUME, buy_volume);
jo.put(SELL_LIMIT, sell_limit);
@@ -132,17 +138,20 @@ public class RandomTraderA extends AutoTraderBase {
return;
}
- String cname = cfg.get(SELL_VOLUME).getClass().getName();
+ try {
+ initial_delay = to_float(cfg.getJSONArray(INITIAL_DELAY));
+ sell_volume = to_float(cfg.getJSONArray(SELL_VOLUME));
+ buy_volume = to_float(cfg.getJSONArray(BUY_VOLUME));
+ sell_limit = to_float(cfg.getJSONArray(SELL_LIMIT));
+ buy_limit = to_float(cfg.getJSONArray(BUY_LIMIT));
+ sell_wait = to_long(cfg.getJSONArray(SELL_WAIT));
+ buy_wait = to_long(cfg.getJSONArray(BUY_WAIT));
- sell_volume = to_float(cfg.getJSONArray(SELL_VOLUME));
- buy_volume = to_float(cfg.getJSONArray(BUY_VOLUME));
- sell_limit = to_float(cfg.getJSONArray(SELL_LIMIT));
- buy_limit = to_float(cfg.getJSONArray(BUY_LIMIT));
- sell_wait = to_long(cfg.getJSONArray(SELL_WAIT));
- buy_wait = to_long(cfg.getJSONArray(BUY_WAIT));
+ wait_after_sell = to_long(cfg.getJSONArray(WAIT_AFTER_SELL));
+ wait_after_buy = to_long(cfg.getJSONArray(WAIT_AFTER_BUY));
+ } catch (Exception e) {
- wait_after_sell = to_long(cfg.getJSONArray(WAIT_AFTER_SELL));
- wait_after_buy = to_long(cfg.getJSONArray(WAIT_AFTER_BUY));
+ }
}
@@ -154,14 +163,19 @@ public class RandomTraderA extends AutoTraderBase {
public long cancelOrders() {
int n = se.getNumberOfOpenOrders(account_id);
if (n > 0) {
- AccountData ad = se.getAccountData(account_id);
- Iterator it = ad.orders.iterator();
- while (it.hasNext()) {
- OrderData od = it.next();
- boolean rc = se.cancelOrder(account_id, od.id);
- }
+ Account ad = se.getAccount(account_id);
+
+
+ Set keys = ad.getOrders().keySet();
+
+ Iterator it = keys.iterator();
+ while (it.hasNext()) {
+ // Order od = it.next();
+ boolean rc = se.cancelOrder(account_id, it.next());
+ }
}
return n;
+
}
protected enum Action {
@@ -177,14 +191,32 @@ public class RandomTraderA extends AutoTraderBase {
}
+ Action mode=Action.RANDOM;
+
long doTrade() {
cancelOrders();
Action a = getAction();
switch (a) {
- case BUY:
- return doBuy() + 1;
+ case BUY: {
+ boolean rc = doBuy();
+ if (rc) {
+ mode = Action.BUY;
+ return getRandom(buy_wait);
+ }
+ return 5000;
+ }
+
case SELL:
- return doSell() + 1;
+ {
+ boolean rc = doSell();
+ if (rc){
+ mode = Action.SELL;
+ return getRandom(sell_wait);
+
+ }
+ return 5000;
+
+ }
}
return 0;
@@ -211,6 +243,7 @@ public class RandomTraderA extends AutoTraderBase {
}
double getStart() {
+
return Globals.se.fairValue;
}
@@ -229,60 +262,55 @@ public class RandomTraderA extends AutoTraderBase {
return getRandom(min, max);
}
- public long doBuy() {
+ public boolean doBuy() {
- // RandomTraderConfig myoldconfig = (RandomTraderConfig) this.oldconfig;
- AccountData ad = this.se.getAccountData(account_id);
+// AccountData ad = this.se.getAccountData(account_id);
+
+ Account ad = se.getAccount(account_id);
Exchange.OrderType type = Exchange.OrderType.BUYLIMIT;
if (ad == null) {
- //System.out.printf("%s: myconf = 0 \n", this.getName());
- return 0;
-
+ return false;
}
// how much money we ant to invest?
- double money = getRandomAmmount(ad.money, buy_volume);
+ double money = getRandomAmmount(ad.getMoney(), buy_volume);
+ money = se.roundMoney(money);
Quote q = se.getCurrentPrice();
double lp = q == null ? getStart() : q.price;
double limit;
limit = lp + getRandomAmmount(lp, buy_limit);
+ limit = se.roundMoney(limit);
- // 10
- // 24 13
-// System.out.printf("MyLimit: %f\n",limit);
- long volume = (long) (money / limit);
-
- if (volume <= 0) {
-
- volume = 1;
- limit = money;
+ double volume = money / limit;
+ volume = se.roundShares(volume);
+ if (volume <= 0 || money <= 0) {
+ return false;
}
-// double volume = (money / (limit * 1));
-// if (volume <= 0) {
- // return 0;
- // }
- //System.out.printf("%s: create order %s %f\n", this.getName(),type.toString(),limit);
se.createOrder(account_id, type, volume, limit);
- return getRandom(buy_wait);
+ return true;
}
- public long doSell() {
+ public boolean doSell() {
// RandomTraderConfig myoldconfig = (RandomTraderConfig) this.oldconfig;
- AccountData ad = this.se.getAccountData(account_id);
+ //AccountData ad = this.se.getAccountData(account_id);
+
+ Account ad = se.getAccount(account_id);
Exchange.OrderType type = Exchange.OrderType.SELLLIMIT;
- //System.out.printf("%s: calling rand for volume\n", this.getName());
- // how much money we ant to envest?
- double volume = (long) getRandomAmmount(ad.shares, sell_volume);
+
+ // how much shares we ant to sell?
+ double volume = getRandomAmmount(ad.getShares(), sell_volume);
+ volume = se.roundShares(volume);
+
// double lp = 100.0; //se.getBestLimit(type);
Quote q = se.getCurrentPrice();
@@ -290,19 +318,18 @@ public class RandomTraderA extends AutoTraderBase {
double limit;
limit = lp + getRandomAmmount(lp, sell_limit);
+ se.roundMoney(limit);
-// long volume = (long) (money / (limit * 1));
- if (volume <= 0) {
-// System.out.print("SellVolume 0\n");
- return 5000;
+
+ if (volume <= 0 || limit <=0) {
+ return false;
}
-// System.out.print("Volume is:"+volume+"\n");
- // System.out.print("My Ammount is: "+volume+" My limit si:"+limit+ "\n");
- //System.out.printf("%s: create order %s %f\n", this.getName(),type.toString(),limit);
se.createOrder(account_id, type, volume, limit);
+
+ return true;
+
- return getRandom(sell_wait);
}
diff --git a/src/main/java/traders/RandomTraderConfig.java b/src/main/java/traders/RandomTraderConfig.java
index 0aed1a1..507a9af 100644
--- a/src/main/java/traders/RandomTraderConfig.java
+++ b/src/main/java/traders/RandomTraderConfig.java
@@ -57,7 +57,8 @@ public class RandomTraderConfig extends AutoTraderConfigBase implements AutoTrad
if (cfg != null) {
this.putConfig(cfg);
}
- return new traders.RandomTrader(se, id, name, money, shares, this);
+ return null;
+ //return new traders.RandomTrader(se, id, name, money, shares, this);
}
@Override
@@ -67,7 +68,8 @@ public class RandomTraderConfig extends AutoTraderConfigBase implements AutoTrad
@Override
public AutoTraderGui getGui() {
- return new RandomTraderGui(this);
+ return null;
+ //return new RandomTraderGui(this);
}
final String SELL_VOLUME = "sell_volume";
diff --git a/src/main/java/traders/RandomTraderGui.form b/src/main/java/traders/RandomTraderGui.form
deleted file mode 100644
index 4b30196..0000000
--- a/src/main/java/traders/RandomTraderGui.form
+++ /dev/null
@@ -1,465 +0,0 @@
-
-
-
diff --git a/src/main/java/traders/RandomTraderGui.java b/src/main/java/traders/RandomTraderGui.java
deleted file mode 100644
index e46035e..0000000
--- a/src/main/java/traders/RandomTraderGui.java
+++ /dev/null
@@ -1,446 +0,0 @@
-/*
- * Copyright (c) 2017, 7u83 <7u83@mail.ru>
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- *
- * * Redistributions of source code must retain the above copyright notice, this
- * list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright notice,
- * this list of conditions and the following disclaimer in the documentation
- * and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
- * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- */
-package traders;
-
-import javax.swing.JDialog;
-import org.json.JSONObject;
-import sesim.AutoTraderGui;
-
-/**
- *
- * @author 7u83 <7u83@mail.ru>
- */
-public class RandomTraderGui extends AutoTraderGui {
-
- private RandomTraderConfig cfg;
-
- /**
- * Creates new form RandomTraderConfigForm
- */
- public RandomTraderGui(RandomTraderConfig cfg) {
- initComponents();
- this.cfg = cfg;
-
- JDialog d;
-
- this.buyVolMin.setValue(cfg.buy_volume[0]);
- this.buyVolMax.setValue(cfg.buy_volume[1]);
- this.sellVolMin.setValue(cfg.sell_volume[0]);
- this.sellVolMax.setValue(cfg.sell_volume[1]);
- this.buyLimitMin.setValue(cfg.buy_limit[0]);
- this.buyLimitMax.setValue(cfg.buy_limit[1]);
- this.sellLimitMin.setValue(cfg.sell_limit[0]);
- this.sellLimitMax.setValue(cfg.sell_limit[1]);
-
- this.buyWaitMin.setValue(cfg.buy_wait[0]);
- this.buyWaitMax.setValue(cfg.buy_wait[1]);
- this.sellWaitMin.setValue(cfg.sell_wait[0]);
- this.sellWaitMax.setValue(cfg.sell_wait[1]);
-
- this.waitAfterBuyMin.setValue(cfg.wait_after_buy[0]);
- this.waitAfterBuyMax.setValue(cfg.wait_after_buy[1]);
-
- this.waitAfterSellMin.setValue(cfg.wait_after_sell[0]);
- this.waitAfterSellMax.setValue(cfg.wait_after_sell[1]);
-
- }
-
- @Override
- public void save() {
-
- cfg.buy_volume[0] = (Float) this.buyVolMin.getValue();
- cfg.buy_volume[1] = (Float) this.buyVolMax.getValue();
- cfg.sell_volume[0] = (Float) this.sellVolMin.getValue();
- cfg.sell_volume[1] = (Float) this.sellVolMax.getValue();
- cfg.buy_limit[0] = (Float) this.buyLimitMin.getValue();
- cfg.buy_limit[1] = (Float) this.buyLimitMax.getValue();
- cfg.sell_limit[0] = (Float) this.sellLimitMin.getValue();
- cfg.sell_limit[1] = (Float) this.sellLimitMax.getValue();
- cfg.buy_wait[0] = (Long) this.buyWaitMin.getValue();
- cfg.buy_wait[1] = (Long) this.buyWaitMax.getValue();
- cfg.sell_wait[0] = (Long) this.sellWaitMin.getValue();
- cfg.sell_wait[1] = (Long) this.sellWaitMax.getValue();
-
- cfg.wait_after_buy[0] = (Long) this.waitAfterBuyMin.getValue();
- cfg.wait_after_buy[1] = (Long) this.waitAfterBuyMax.getValue();
- cfg.wait_after_sell[0] = (Long) this.waitAfterSellMin.getValue();
- cfg.wait_after_sell[1] = (Long) this.waitAfterSellMax.getValue();
-
-
- // cfg.buy_volume[0] = Float.parseFloat(this.buyVolMin.getText());
- // cfg.buy_volume[1] = Float.parseFloat(this.buyVolMax.getText());
- // cfg.sell_volume[0] = Float.parseFloat(this.sellVolMin.getText());
- // cfg.sell_volume[1] = Float.parseFloat(this.sellVolMax.getText());
- JSONObject j = cfg.getConfig();
- System.out.printf("JSON: %s\n", j.toString(3));
- }
-
- /**
- * This method is called from within the constructor to initialize the form.
- * WARNING: Do NOT modify this code. The content of this method is always
- * regenerated by the Form Editor.
- */
- @SuppressWarnings("unchecked")
- // //GEN-BEGIN:initComponents
- private void initComponents() {
-
- jTextField1 = new javax.swing.JTextField();
- buyWaitMin = new javax.swing.JSpinner();
- sellWaitMin = new javax.swing.JSpinner();
- sellWaitMax = new javax.swing.JSpinner();
- buyWaitMax = new javax.swing.JSpinner();
- buyLimitMin = new javax.swing.JSpinner();
- buyLimitMax = new javax.swing.JSpinner();
- sellLimitMax = new javax.swing.JSpinner();
- sellLimitMin = new javax.swing.JSpinner();
- waitAfterBuyMin = new javax.swing.JSpinner();
- waitAfterSellMin = new javax.swing.JSpinner();
- waitAfterSellMax = new javax.swing.JSpinner();
- waitAfterBuyMax = new javax.swing.JSpinner();
- buyVolMin = new javax.swing.JSpinner();
- buyVolMax = new javax.swing.JSpinner();
- sellVolMax = new javax.swing.JSpinner();
- sellVolMin = new javax.swing.JSpinner();
- jLabel1 = new javax.swing.JLabel();
- jLabel2 = new javax.swing.JLabel();
- jLabel3 = new javax.swing.JLabel();
- jLabel4 = new javax.swing.JLabel();
- jLabel5 = new javax.swing.JLabel();
- jLabel6 = new javax.swing.JLabel();
- jLabel7 = new javax.swing.JLabel();
- jLabel8 = new javax.swing.JLabel();
- jLabel9 = new javax.swing.JLabel();
- jLabel10 = new javax.swing.JLabel();
- jLabel11 = new javax.swing.JLabel();
- jLabel12 = new javax.swing.JLabel();
- jLabel13 = new javax.swing.JLabel();
- jLabel14 = new javax.swing.JLabel();
- jLabel15 = new javax.swing.JLabel();
- jLabel16 = new javax.swing.JLabel();
- jLabel17 = new javax.swing.JLabel();
- jLabel18 = new javax.swing.JLabel();
- jLabel19 = new javax.swing.JLabel();
- jLabel20 = new javax.swing.JLabel();
- jLabel21 = new javax.swing.JLabel();
- jLabel22 = new javax.swing.JLabel();
- jLabel23 = new javax.swing.JLabel();
- jLabel24 = new javax.swing.JLabel();
-
- jTextField1.setText("jTextField1");
-
- setBorder(null);
-
- buyWaitMin.setModel(new javax.swing.SpinnerNumberModel(0L, 0L, null, 1000L));
-
- sellWaitMin.setModel(new javax.swing.SpinnerNumberModel(0L, 0L, null, 1000L));
-
- sellWaitMax.setModel(new javax.swing.SpinnerNumberModel(0L, 0L, null, 1000L));
-
- buyWaitMax.setModel(new javax.swing.SpinnerNumberModel(0L, 0L, null, 1000L));
-
- buyLimitMin.setModel(new javax.swing.SpinnerNumberModel(0.0f, -100.0f, null, 1.0f));
-
- buyLimitMax.setModel(new javax.swing.SpinnerNumberModel(0.0f, -100.0f, null, 1.0f));
-
- sellLimitMax.setModel(new javax.swing.SpinnerNumberModel(0.0f, -100.0f, null, 1.0f));
-
- sellLimitMin.setModel(new javax.swing.SpinnerNumberModel(0.0f, -100.0f, null, 1.0f));
-
- waitAfterBuyMin.setModel(new javax.swing.SpinnerNumberModel(0, 0, null, 1000));
-
- waitAfterSellMin.setModel(new javax.swing.SpinnerNumberModel(0, 0, null, 1000));
-
- waitAfterSellMax.setModel(new javax.swing.SpinnerNumberModel(0, 0, null, 1000));
-
- waitAfterBuyMax.setModel(new javax.swing.SpinnerNumberModel(0, 0, null, 1000));
-
- buyVolMin.setModel(new javax.swing.SpinnerNumberModel(Float.valueOf(0.0f), Float.valueOf(0.0f), Float.valueOf(100.0f), Float.valueOf(1.0f)));
-
- buyVolMax.setModel(new javax.swing.SpinnerNumberModel(Float.valueOf(0.0f), Float.valueOf(0.0f), Float.valueOf(100.0f), Float.valueOf(1.0f)));
-
- sellVolMax.setModel(new javax.swing.SpinnerNumberModel(Float.valueOf(0.0f), Float.valueOf(0.0f), Float.valueOf(100.0f), Float.valueOf(1.0f)));
-
- sellVolMin.setModel(new javax.swing.SpinnerNumberModel(Float.valueOf(0.0f), Float.valueOf(0.0f), Float.valueOf(100.0f), Float.valueOf(1.0f)));
-
- jLabel1.setText("min:");
-
- jLabel2.setText("max:");
- jLabel2.setVerticalAlignment(javax.swing.SwingConstants.BOTTOM);
-
- jLabel3.setText("min:");
-
- jLabel4.setText("max:");
-
- jLabel5.setText("max:");
- jLabel5.setVerticalAlignment(javax.swing.SwingConstants.BOTTOM);
-
- jLabel6.setText("max:");
-
- jLabel7.setText("min:");
-
- jLabel8.setText("min:");
-
- jLabel9.setHorizontalAlignment(javax.swing.SwingConstants.TRAILING);
- jLabel9.setText("Volume to buy (in %):");
-
- jLabel10.setHorizontalAlignment(javax.swing.SwingConstants.TRAILING);
- jLabel10.setText("Volume to sell (in %):");
-
- jLabel11.setHorizontalAlignment(javax.swing.SwingConstants.TRAILING);
- jLabel11.setText("Buy limit (in %):");
-
- jLabel12.setHorizontalAlignment(javax.swing.SwingConstants.TRAILING);
- jLabel12.setText("Sel limit (in %):");
-
- jLabel13.setText("max:");
- jLabel13.setVerticalAlignment(javax.swing.SwingConstants.BOTTOM);
-
- jLabel14.setText("max:");
-
- jLabel15.setHorizontalAlignment(javax.swing.SwingConstants.TRAILING);
- jLabel15.setText("Buy order wait (in ms):");
-
- jLabel16.setText("min:");
-
- jLabel17.setText("min:");
-
- jLabel18.setHorizontalAlignment(javax.swing.SwingConstants.TRAILING);
- jLabel18.setText("Sell order wait (in ms):");
-
- jLabel19.setText("max:");
- jLabel19.setVerticalAlignment(javax.swing.SwingConstants.BOTTOM);
-
- jLabel20.setText("max:");
-
- jLabel21.setText("min:");
-
- jLabel22.setText("min:");
-
- jLabel23.setHorizontalAlignment(javax.swing.SwingConstants.TRAILING);
- jLabel23.setText("Wait after buy (in ms):");
-
- jLabel24.setHorizontalAlignment(javax.swing.SwingConstants.TRAILING);
- jLabel24.setText("Wait after sell (in ms):");
-
- javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
- this.setLayout(layout);
- layout.setHorizontalGroup(
- layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
- .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
- .addContainerGap()
- .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
- .addGroup(layout.createSequentialGroup()
- .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
- .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
- .addComponent(jLabel24, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
- .addGap(18, 18, 18)
- .addComponent(jLabel22))
- .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
- .addComponent(jLabel23, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
- .addGap(18, 18, 18)
- .addComponent(jLabel21)))
- .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
- .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
- .addComponent(waitAfterSellMin, javax.swing.GroupLayout.PREFERRED_SIZE, 98, javax.swing.GroupLayout.PREFERRED_SIZE)
- .addComponent(waitAfterBuyMin, javax.swing.GroupLayout.PREFERRED_SIZE, 98, javax.swing.GroupLayout.PREFERRED_SIZE))
- .addGap(18, 18, 18)
- .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
- .addComponent(jLabel19)
- .addComponent(jLabel20))
- .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
- .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
- .addComponent(waitAfterSellMax, javax.swing.GroupLayout.PREFERRED_SIZE, 98, javax.swing.GroupLayout.PREFERRED_SIZE)
- .addComponent(waitAfterBuyMax, javax.swing.GroupLayout.PREFERRED_SIZE, 98, javax.swing.GroupLayout.PREFERRED_SIZE)))
- .addGroup(layout.createSequentialGroup()
- .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
- .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
- .addComponent(jLabel9, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
- .addGap(18, 18, 18)
- .addComponent(jLabel1))
- .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
- .addComponent(jLabel12, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
- .addGap(18, 18, 18)
- .addComponent(jLabel8))
- .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
- .addComponent(jLabel10, javax.swing.GroupLayout.DEFAULT_SIZE, 175, Short.MAX_VALUE)
- .addGap(18, 18, 18)
- .addComponent(jLabel3))
- .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
- .addComponent(jLabel11, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
- .addGap(18, 18, 18)
- .addComponent(jLabel7))
- .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
- .addComponent(jLabel18, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
- .addGap(18, 18, 18)
- .addComponent(jLabel17))
- .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
- .addComponent(jLabel15, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
- .addGap(18, 18, 18)
- .addComponent(jLabel16)))
- .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
- .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
- .addComponent(sellVolMin, javax.swing.GroupLayout.PREFERRED_SIZE, 98, javax.swing.GroupLayout.PREFERRED_SIZE)
- .addComponent(buyVolMin, javax.swing.GroupLayout.PREFERRED_SIZE, 98, javax.swing.GroupLayout.PREFERRED_SIZE)
- .addComponent(sellLimitMin, javax.swing.GroupLayout.PREFERRED_SIZE, 98, javax.swing.GroupLayout.PREFERRED_SIZE)
- .addComponent(buyLimitMin, javax.swing.GroupLayout.PREFERRED_SIZE, 98, javax.swing.GroupLayout.PREFERRED_SIZE)
- .addComponent(buyWaitMin, javax.swing.GroupLayout.PREFERRED_SIZE, 98, javax.swing.GroupLayout.PREFERRED_SIZE)
- .addComponent(sellWaitMin, javax.swing.GroupLayout.PREFERRED_SIZE, 98, javax.swing.GroupLayout.PREFERRED_SIZE))
- .addGap(18, 18, 18)
- .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
- .addGroup(layout.createSequentialGroup()
- .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
- .addComponent(jLabel13)
- .addComponent(jLabel14))
- .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
- .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
- .addComponent(sellWaitMax, javax.swing.GroupLayout.PREFERRED_SIZE, 98, javax.swing.GroupLayout.PREFERRED_SIZE)
- .addComponent(buyWaitMax, javax.swing.GroupLayout.PREFERRED_SIZE, 98, javax.swing.GroupLayout.PREFERRED_SIZE)))
- .addGroup(layout.createSequentialGroup()
- .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
- .addComponent(jLabel5)
- .addComponent(jLabel6))
- .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
- .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
- .addComponent(sellLimitMax, javax.swing.GroupLayout.PREFERRED_SIZE, 98, javax.swing.GroupLayout.PREFERRED_SIZE)
- .addComponent(buyLimitMax, javax.swing.GroupLayout.PREFERRED_SIZE, 98, javax.swing.GroupLayout.PREFERRED_SIZE)))
- .addGroup(layout.createSequentialGroup()
- .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
- .addComponent(jLabel2)
- .addComponent(jLabel4))
- .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
- .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
- .addComponent(sellVolMax, javax.swing.GroupLayout.PREFERRED_SIZE, 98, javax.swing.GroupLayout.PREFERRED_SIZE)
- .addComponent(buyVolMax, javax.swing.GroupLayout.PREFERRED_SIZE, 98, javax.swing.GroupLayout.PREFERRED_SIZE))))))
- .addGap(43, 43, 43))
- );
- layout.setVerticalGroup(
- layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
- .addGroup(layout.createSequentialGroup()
- .addGap(40, 40, 40)
- .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
- .addComponent(buyVolMin, javax.swing.GroupLayout.PREFERRED_SIZE, 28, javax.swing.GroupLayout.PREFERRED_SIZE)
- .addComponent(buyVolMax, javax.swing.GroupLayout.PREFERRED_SIZE, 28, javax.swing.GroupLayout.PREFERRED_SIZE)
- .addComponent(jLabel1)
- .addComponent(jLabel2)
- .addComponent(jLabel9))
- .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
- .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
- .addComponent(sellVolMin, javax.swing.GroupLayout.PREFERRED_SIZE, 28, javax.swing.GroupLayout.PREFERRED_SIZE)
- .addComponent(sellVolMax, javax.swing.GroupLayout.PREFERRED_SIZE, 28, javax.swing.GroupLayout.PREFERRED_SIZE)
- .addComponent(jLabel3)
- .addComponent(jLabel4)
- .addComponent(jLabel10))
- .addGap(18, 18, 18)
- .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
- .addComponent(buyLimitMin, javax.swing.GroupLayout.PREFERRED_SIZE, 28, javax.swing.GroupLayout.PREFERRED_SIZE)
- .addComponent(buyLimitMax, javax.swing.GroupLayout.PREFERRED_SIZE, 28, javax.swing.GroupLayout.PREFERRED_SIZE)
- .addComponent(jLabel5)
- .addComponent(jLabel7)
- .addComponent(jLabel11))
- .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
- .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
- .addComponent(sellLimitMin, javax.swing.GroupLayout.PREFERRED_SIZE, 28, javax.swing.GroupLayout.PREFERRED_SIZE)
- .addComponent(sellLimitMax, javax.swing.GroupLayout.PREFERRED_SIZE, 28, javax.swing.GroupLayout.PREFERRED_SIZE)
- .addComponent(jLabel6)
- .addComponent(jLabel8)
- .addComponent(jLabel12))
- .addGap(35, 35, 35)
- .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
- .addComponent(buyWaitMax, javax.swing.GroupLayout.PREFERRED_SIZE, 28, javax.swing.GroupLayout.PREFERRED_SIZE)
- .addComponent(jLabel13)
- .addComponent(jLabel16)
- .addComponent(jLabel15)
- .addComponent(buyWaitMin, javax.swing.GroupLayout.PREFERRED_SIZE, 28, javax.swing.GroupLayout.PREFERRED_SIZE))
- .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
- .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
- .addComponent(sellWaitMin, javax.swing.GroupLayout.PREFERRED_SIZE, 28, javax.swing.GroupLayout.PREFERRED_SIZE)
- .addComponent(sellWaitMax, javax.swing.GroupLayout.PREFERRED_SIZE, 28, javax.swing.GroupLayout.PREFERRED_SIZE)
- .addComponent(jLabel14)
- .addComponent(jLabel17)
- .addComponent(jLabel18))
- .addGap(18, 18, 18)
- .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
- .addComponent(waitAfterBuyMin, javax.swing.GroupLayout.PREFERRED_SIZE, 28, javax.swing.GroupLayout.PREFERRED_SIZE)
- .addComponent(waitAfterBuyMax, javax.swing.GroupLayout.PREFERRED_SIZE, 28, javax.swing.GroupLayout.PREFERRED_SIZE)
- .addComponent(jLabel19)
- .addComponent(jLabel21)
- .addComponent(jLabel23))
- .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
- .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
- .addComponent(waitAfterSellMin, javax.swing.GroupLayout.PREFERRED_SIZE, 28, javax.swing.GroupLayout.PREFERRED_SIZE)
- .addComponent(waitAfterSellMax, javax.swing.GroupLayout.PREFERRED_SIZE, 28, javax.swing.GroupLayout.PREFERRED_SIZE)
- .addComponent(jLabel20)
- .addComponent(jLabel22)
- .addComponent(jLabel24))
- .addContainerGap(37, Short.MAX_VALUE))
- );
- }// //GEN-END:initComponents
-
-
- // Variables declaration - do not modify//GEN-BEGIN:variables
- private javax.swing.JSpinner buyLimitMax;
- private javax.swing.JSpinner buyLimitMin;
- private javax.swing.JSpinner buyVolMax;
- private javax.swing.JSpinner buyVolMin;
- private javax.swing.JSpinner buyWaitMax;
- private javax.swing.JSpinner buyWaitMin;
- private javax.swing.JLabel jLabel1;
- private javax.swing.JLabel jLabel10;
- private javax.swing.JLabel jLabel11;
- private javax.swing.JLabel jLabel12;
- private javax.swing.JLabel jLabel13;
- private javax.swing.JLabel jLabel14;
- private javax.swing.JLabel jLabel15;
- private javax.swing.JLabel jLabel16;
- private javax.swing.JLabel jLabel17;
- private javax.swing.JLabel jLabel18;
- private javax.swing.JLabel jLabel19;
- private javax.swing.JLabel jLabel2;
- private javax.swing.JLabel jLabel20;
- private javax.swing.JLabel jLabel21;
- private javax.swing.JLabel jLabel22;
- private javax.swing.JLabel jLabel23;
- private javax.swing.JLabel jLabel24;
- private javax.swing.JLabel jLabel3;
- private javax.swing.JLabel jLabel4;
- private javax.swing.JLabel jLabel5;
- private javax.swing.JLabel jLabel6;
- private javax.swing.JLabel jLabel7;
- private javax.swing.JLabel jLabel8;
- private javax.swing.JLabel jLabel9;
- private javax.swing.JTextField jTextField1;
- private javax.swing.JSpinner sellLimitMax;
- private javax.swing.JSpinner sellLimitMin;
- private javax.swing.JSpinner sellVolMax;
- private javax.swing.JSpinner sellVolMin;
- private javax.swing.JSpinner sellWaitMax;
- private javax.swing.JSpinner sellWaitMin;
- private javax.swing.JSpinner waitAfterBuyMax;
- private javax.swing.JSpinner waitAfterBuyMin;
- private javax.swing.JSpinner waitAfterSellMax;
- private javax.swing.JSpinner waitAfterSellMin;
- // End of variables declaration//GEN-END:variables
-}
diff --git a/src/main/java/traders/RandomTraderGuiA.form b/src/main/java/traders/RandomTraderGuiA.form
index 4b30196..802cec2 100644
--- a/src/main/java/traders/RandomTraderGuiA.form
+++ b/src/main/java/traders/RandomTraderGuiA.form
@@ -60,7 +60,7 @@
-
+
@@ -92,49 +92,61 @@
+
+
+
+
+
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -147,7 +159,15 @@
-
+
+
+
+
+
+
+
+
+
@@ -211,7 +231,7 @@
-
+
@@ -461,5 +481,36 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/main/java/traders/RandomTraderGuiA.java b/src/main/java/traders/RandomTraderGuiA.java
index 6253768..1df5cb8 100644
--- a/src/main/java/traders/RandomTraderGuiA.java
+++ b/src/main/java/traders/RandomTraderGuiA.java
@@ -46,6 +46,9 @@ public class RandomTraderGuiA extends AutoTraderGui {
JDialog d;
+ this.initialDelayMin.setValue(cfg.initial_delay[0]);
+ this.initialDelayMax.setValue(cfg.initial_delay[1]);
+
this.buyVolMin.setValue(cfg.buy_volume[0]);
this.buyVolMax.setValue(cfg.buy_volume[1]);
this.sellVolMin.setValue(cfg.sell_volume[0]);
@@ -71,6 +74,9 @@ public class RandomTraderGuiA extends AutoTraderGui {
@Override
public void save() {
+ cfg.initial_delay[0] = (Float) this.initialDelayMin.getValue();
+ cfg.initial_delay[1] = (Float) this.initialDelayMax.getValue();
+
cfg.buy_volume[0] = (Float) this.buyVolMin.getValue();
cfg.buy_volume[1] = (Float) this.buyVolMax.getValue();
cfg.sell_volume[0] = (Float) this.sellVolMin.getValue();
@@ -83,12 +89,11 @@ public class RandomTraderGuiA extends AutoTraderGui {
cfg.buy_wait[1] = (Long) this.buyWaitMax.getValue();
cfg.sell_wait[0] = (Long) this.sellWaitMin.getValue();
cfg.sell_wait[1] = (Long) this.sellWaitMax.getValue();
-
+
cfg.wait_after_buy[0] = (Long) this.waitAfterBuyMin.getValue();
cfg.wait_after_buy[1] = (Long) this.waitAfterBuyMax.getValue();
cfg.wait_after_sell[0] = (Long) this.waitAfterSellMin.getValue();
cfg.wait_after_sell[1] = (Long) this.waitAfterSellMax.getValue();
-
// cfg.buy_volume[0] = Float.parseFloat(this.buyVolMin.getText());
// cfg.buy_volume[1] = Float.parseFloat(this.buyVolMax.getText());
@@ -148,6 +153,11 @@ public class RandomTraderGuiA extends AutoTraderGui {
jLabel22 = new javax.swing.JLabel();
jLabel23 = new javax.swing.JLabel();
jLabel24 = new javax.swing.JLabel();
+ initialDelayMin = new javax.swing.JSpinner();
+ initialDelayMax = new javax.swing.JSpinner();
+ jLabel25 = new javax.swing.JLabel();
+ jLabel26 = new javax.swing.JLabel();
+ jLabel27 = new javax.swing.JLabel();
jTextField1.setText("jTextField1");
@@ -245,6 +255,18 @@ public class RandomTraderGuiA extends AutoTraderGui {
jLabel24.setHorizontalAlignment(javax.swing.SwingConstants.TRAILING);
jLabel24.setText("Wait after sell (in ms):");
+ initialDelayMin.setModel(new javax.swing.SpinnerNumberModel(0.0f, 0.0f, null, 0.1f));
+
+ initialDelayMax.setModel(new javax.swing.SpinnerNumberModel(0.0f, 0.0f, null, 0.1f));
+
+ jLabel25.setText("max:");
+ jLabel25.setVerticalAlignment(javax.swing.SwingConstants.BOTTOM);
+
+ jLabel26.setText("min:");
+
+ jLabel27.setHorizontalAlignment(javax.swing.SwingConstants.TRAILING);
+ jLabel27.setText("Initial delay (in seconds):");
+
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
this.setLayout(layout);
layout.setHorizontalGroup(
@@ -299,47 +321,63 @@ public class RandomTraderGuiA extends AutoTraderGui {
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
.addComponent(jLabel15, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addGap(18, 18, 18)
- .addComponent(jLabel16)))
+ .addComponent(jLabel16))
+ .addGroup(layout.createSequentialGroup()
+ .addComponent(jLabel27, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
+ .addGap(18, 18, 18)
+ .addComponent(jLabel26)))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
- .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
- .addComponent(sellVolMin, javax.swing.GroupLayout.PREFERRED_SIZE, 98, javax.swing.GroupLayout.PREFERRED_SIZE)
- .addComponent(buyVolMin, javax.swing.GroupLayout.PREFERRED_SIZE, 98, javax.swing.GroupLayout.PREFERRED_SIZE)
- .addComponent(sellLimitMin, javax.swing.GroupLayout.PREFERRED_SIZE, 98, javax.swing.GroupLayout.PREFERRED_SIZE)
- .addComponent(buyLimitMin, javax.swing.GroupLayout.PREFERRED_SIZE, 98, javax.swing.GroupLayout.PREFERRED_SIZE)
- .addComponent(buyWaitMin, javax.swing.GroupLayout.PREFERRED_SIZE, 98, javax.swing.GroupLayout.PREFERRED_SIZE)
- .addComponent(sellWaitMin, javax.swing.GroupLayout.PREFERRED_SIZE, 98, javax.swing.GroupLayout.PREFERRED_SIZE))
- .addGap(18, 18, 18)
- .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
+ .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
+ .addComponent(initialDelayMin, javax.swing.GroupLayout.PREFERRED_SIZE, 98, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGroup(layout.createSequentialGroup()
+ .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
+ .addComponent(sellVolMin, javax.swing.GroupLayout.PREFERRED_SIZE, 98, javax.swing.GroupLayout.PREFERRED_SIZE)
+ .addComponent(buyVolMin, javax.swing.GroupLayout.PREFERRED_SIZE, 98, javax.swing.GroupLayout.PREFERRED_SIZE)
+ .addComponent(sellLimitMin, javax.swing.GroupLayout.PREFERRED_SIZE, 98, javax.swing.GroupLayout.PREFERRED_SIZE)
+ .addComponent(buyLimitMin, javax.swing.GroupLayout.PREFERRED_SIZE, 98, javax.swing.GroupLayout.PREFERRED_SIZE)
+ .addComponent(buyWaitMin, javax.swing.GroupLayout.PREFERRED_SIZE, 98, javax.swing.GroupLayout.PREFERRED_SIZE)
+ .addComponent(sellWaitMin, javax.swing.GroupLayout.PREFERRED_SIZE, 98, javax.swing.GroupLayout.PREFERRED_SIZE))
+ .addGap(18, 18, 18)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
- .addComponent(jLabel13)
- .addComponent(jLabel14))
- .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
- .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
- .addComponent(sellWaitMax, javax.swing.GroupLayout.PREFERRED_SIZE, 98, javax.swing.GroupLayout.PREFERRED_SIZE)
- .addComponent(buyWaitMax, javax.swing.GroupLayout.PREFERRED_SIZE, 98, javax.swing.GroupLayout.PREFERRED_SIZE)))
- .addGroup(layout.createSequentialGroup()
- .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
- .addComponent(jLabel5)
- .addComponent(jLabel6))
- .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
- .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
- .addComponent(sellLimitMax, javax.swing.GroupLayout.PREFERRED_SIZE, 98, javax.swing.GroupLayout.PREFERRED_SIZE)
- .addComponent(buyLimitMax, javax.swing.GroupLayout.PREFERRED_SIZE, 98, javax.swing.GroupLayout.PREFERRED_SIZE)))
- .addGroup(layout.createSequentialGroup()
- .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
- .addComponent(jLabel2)
- .addComponent(jLabel4))
- .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
- .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
- .addComponent(sellVolMax, javax.swing.GroupLayout.PREFERRED_SIZE, 98, javax.swing.GroupLayout.PREFERRED_SIZE)
- .addComponent(buyVolMax, javax.swing.GroupLayout.PREFERRED_SIZE, 98, javax.swing.GroupLayout.PREFERRED_SIZE))))))
+ .addGroup(layout.createSequentialGroup()
+ .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
+ .addComponent(jLabel13)
+ .addComponent(jLabel14))
+ .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
+ .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
+ .addComponent(sellWaitMax, javax.swing.GroupLayout.PREFERRED_SIZE, 98, javax.swing.GroupLayout.PREFERRED_SIZE)
+ .addComponent(buyWaitMax, javax.swing.GroupLayout.PREFERRED_SIZE, 98, javax.swing.GroupLayout.PREFERRED_SIZE)))
+ .addGroup(layout.createSequentialGroup()
+ .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
+ .addComponent(jLabel5)
+ .addComponent(jLabel6))
+ .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
+ .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
+ .addComponent(sellLimitMax, javax.swing.GroupLayout.PREFERRED_SIZE, 98, javax.swing.GroupLayout.PREFERRED_SIZE)
+ .addComponent(buyLimitMax, javax.swing.GroupLayout.PREFERRED_SIZE, 98, javax.swing.GroupLayout.PREFERRED_SIZE)))
+ .addGroup(layout.createSequentialGroup()
+ .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
+ .addComponent(jLabel2)
+ .addComponent(jLabel4)
+ .addComponent(jLabel25))
+ .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
+ .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
+ .addComponent(sellVolMax, javax.swing.GroupLayout.PREFERRED_SIZE, 98, javax.swing.GroupLayout.PREFERRED_SIZE)
+ .addComponent(buyVolMax, javax.swing.GroupLayout.PREFERRED_SIZE, 98, javax.swing.GroupLayout.PREFERRED_SIZE)
+ .addComponent(initialDelayMax, javax.swing.GroupLayout.PREFERRED_SIZE, 98, javax.swing.GroupLayout.PREFERRED_SIZE))))))))
.addGap(43, 43, 43))
);
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
- .addGap(40, 40, 40)
+ .addGap(34, 34, 34)
+ .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
+ .addComponent(initialDelayMin, javax.swing.GroupLayout.PREFERRED_SIZE, 28, javax.swing.GroupLayout.PREFERRED_SIZE)
+ .addComponent(initialDelayMax, javax.swing.GroupLayout.PREFERRED_SIZE, 28, javax.swing.GroupLayout.PREFERRED_SIZE)
+ .addComponent(jLabel25)
+ .addComponent(jLabel26)
+ .addComponent(jLabel27))
+ .addGap(12, 12, 12)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(buyVolMin, javax.swing.GroupLayout.PREFERRED_SIZE, 28, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(buyVolMax, javax.swing.GroupLayout.PREFERRED_SIZE, 28, javax.swing.GroupLayout.PREFERRED_SIZE)
@@ -395,7 +433,7 @@ public class RandomTraderGuiA extends AutoTraderGui {
.addComponent(jLabel20)
.addComponent(jLabel22)
.addComponent(jLabel24))
- .addContainerGap(37, Short.MAX_VALUE))
+ .addContainerGap(41, Short.MAX_VALUE))
);
}// //GEN-END:initComponents
@@ -407,6 +445,8 @@ public class RandomTraderGuiA extends AutoTraderGui {
private javax.swing.JSpinner buyVolMin;
private javax.swing.JSpinner buyWaitMax;
private javax.swing.JSpinner buyWaitMin;
+ private javax.swing.JSpinner initialDelayMax;
+ private javax.swing.JSpinner initialDelayMin;
private javax.swing.JLabel jLabel1;
private javax.swing.JLabel jLabel10;
private javax.swing.JLabel jLabel11;
@@ -424,6 +464,9 @@ public class RandomTraderGuiA extends AutoTraderGui {
private javax.swing.JLabel jLabel22;
private javax.swing.JLabel jLabel23;
private javax.swing.JLabel jLabel24;
+ private javax.swing.JLabel jLabel25;
+ private javax.swing.JLabel jLabel26;
+ private javax.swing.JLabel jLabel27;
private javax.swing.JLabel jLabel3;
private javax.swing.JLabel jLabel4;
private javax.swing.JLabel jLabel5;
diff --git a/src/main/java/traders/SwitchingTrader.java b/src/main/java/traders/SwitchingTrader.java
deleted file mode 100644
index abffa4a..0000000
--- a/src/main/java/traders/SwitchingTrader.java
+++ /dev/null
@@ -1,98 +0,0 @@
-/*
- * Copyright (c) 2016, 7u83 <7u83@mail.ru>
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- *
- * * Redistributions of source code must retain the above copyright notice, this
- * list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright notice,
- * this list of conditions and the following disclaimer in the documentation
- * and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
- * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- */
-package traders;
-
-import sesim.AccountData;
-import sesim.Exchange;
-
-/**
- *
- * @author 7u83 <7u83@mail.ru>
- */
-public class SwitchingTrader extends RandomTrader {
-
- private int mode;
-
- public SwitchingTrader(Exchange se, long id, String name, double money, double shares, RandomTraderConfig config) {
- super(se, id, name, money, shares, config);
- }
-
- Action action = Action.RANDOM;
-
- @Override
- protected Action getAction() {
-
-
-
- if (action == Action.RANDOM) {
- action = super.getAction();
- if ("Bob".equals(name)){
- System.out.print("Bobs Action\n"+action);
-
- }
- return action;
- }
-
- AccountData ad = se.getAccountData(account_id);
-
- if (action == Action.BUY && ad.money <= 0) {
- action = Action.SELL;
- }
-
- if (action == Action.SELL && ad.shares <= 0) {
- action = Action.BUY;
- }
-
- return action;
-
- }
-
-
- @Override
- long doTrade(){
- cancelOrders();
- Action a = getAction();
- long r;
- switch (a){
- case BUY:
- r = doBuy();
- if (r==0)
- action=Action.SELL;
- return r;
- case SELL:
- r= doSell();
- if (r==0)
- action=Action.BUY;
- return r;
-
-
- }
- return 0;
-
- }
-
-
-}
diff --git a/src/main/java/traders/SwitchingTraderConfig.java b/src/main/java/traders/SwitchingTraderConfig.java
deleted file mode 100644
index 89c4a87..0000000
--- a/src/main/java/traders/SwitchingTraderConfig.java
+++ /dev/null
@@ -1,69 +0,0 @@
-/*
- * Copyright (c) 2016, 7u83 <7u83@mail.ru>
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- *
- * * Redistributions of source code must retain the above copyright notice, this
- * list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright notice,
- * this list of conditions and the following disclaimer in the documentation
- * and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
- * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- */
-package traders;
-
-import org.json.JSONObject;
-import sesim.AutoTrader;
-import sesim.AutoTraderConfig;
-import sesim.Exchange;
-
-/**
- *
- * @author 7u83 <7u83@mail.ru>
- */
-public class SwitchingTraderConfig extends RandomTraderConfig implements AutoTraderConfig {
-
- @Override
- public AutoTrader createTrader(Exchange se, JSONObject cfg, long id, String name, double money, double shares) {
-
- return new traders.SwitchingTrader(se, id, name, money, shares, this);
-
- }
-
- public SwitchingTraderConfig() {
-
- sell_volume = new Float[]{17f, 100f};
- sell_limit = new Float[]{-30f, 1f};
- sell_wait = new Long[]{1L, 5L};
- wait_after_sell = new Long[]{1L, 5L};
-
- buy_volume = new Float[]{18f, 100f};
- buy_limit = new Float[]{-1f, 30f};
- buy_wait = new Long[]{1L, 5L};
- wait_after_buy = new Long[]{1L, 5L};
- }
-
- @Override
- public String getDisplayName() {
- return "SwitchingTrader";
- }
-
- @Override
- public boolean getDevelStatus() {
- return true;
- }
-
-}
diff --git a/src/test/java/sesim/Test.java b/src/test/java/sesim/Test.java
index 3e626cf..d0afcb0 100644
--- a/src/test/java/sesim/Test.java
+++ b/src/test/java/sesim/Test.java
@@ -57,17 +57,6 @@ public class Test {
System.out.print("haha\n");
}
- static void print_account(AccountData ad) {
- System.out.print(
- "Account ID:"
- + ad.id
- + " Ballance:"
- + ad.money
- + " Shares:"
- + ad.shares
- + "\n"
- );
- }
static public String getFullClassName(String classFileName) throws IOException {
File file = new File(classFileName);