new AutoTraderInterface

This commit is contained in:
7u83 2017-02-11 08:36:45 +01:00
parent 542389b35f
commit dc4806bd64
17 changed files with 1389 additions and 126 deletions

View File

@ -42,7 +42,7 @@ public class Chart extends javax.swing.JPanel implements QuoteReceiver, Scrollab
public final void initChart(){
// data = new OHLCData(60000*30);
data = new OHLCData(60000*1);
data = new OHLCData(60000*15);
}
/**

View File

@ -38,6 +38,7 @@ import org.json.JSONObject;
import sesim.AutoTrader;
import sesim.AutoTraderConfig;
import sesim.AutoTraderGui;
import sesim.AutoTraderInterface;
/**
*
@ -77,11 +78,8 @@ public final class EditStrategies extends javax.swing.JDialog {
}
void setStrategy(String strategy) {
ArrayList<Class<AutoTraderConfig>> s = Globals.tloader.getTraders();
}
final String STRATEGYPREFS = "Strategies";
void reloadStrategyConfigs() {
@ -246,7 +244,7 @@ public final class EditStrategies extends javax.swing.JDialog {
}// </editor-fold>//GEN-END:initComponents
AutoTraderGui acgui;
AutoTraderConfig ac;
AutoTraderInterface ac;
private void jComboBoxStrategySelectorActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jComboBoxStrategySelectorActionPerformed
@ -392,7 +390,7 @@ System.out.printf("The big name: %s\n", ac.getClass().getCanonicalName());
if (sd.result==null)
return;
AutoTraderConfig ac = Globals.tloader.getStrategyBase(sd.result.base);
AutoTraderInterface ac = Globals.tloader.getStrategyBase(sd.result.base);
JSONObject cfg = ac.getConfig();
System.out.printf("Initial cfg %s\n", cfg.toString(2));
cfg.put("base", ac.getClass().getCanonicalName());

View File

@ -41,6 +41,7 @@ import org.json.JSONArray;
import org.json.JSONObject;
import sesim.AutoTrader;
import sesim.AutoTraderConfig;
import sesim.AutoTraderInterface;
import sesim.Exchange;
import traders.RandomTraderConfig;
@ -60,11 +61,11 @@ public class NewMDIApplication extends javax.swing.JFrame {
this.setTitle("SeSim - Stock Exchange Simmulator");
}
AutoTrader createTraderNew(Exchange se,long id,String name, double money, double shares, JSONObject cfg) {
AutoTraderInterface createTraderNew(Exchange se,long id,String name, double money, double shares, JSONObject cfg) {
System.out.printf("!!!! creating new\n");
String base = cfg.getString("base");
AutoTrader ac = (AutoTrader)Globals.tloader.getStrategyBase(base);
((AutoTraderConfig)ac).putConfig(cfg);
AutoTraderInterface ac = Globals.tloader.getStrategyBase(base);
ac.putConfig(cfg);
ac.init(se, id, name, money, shares, cfg);
return ac;
}
@ -81,7 +82,7 @@ public class NewMDIApplication extends javax.swing.JFrame {
String strategy_name = t.getString("Strategy");
JSONObject strategy = Globals.getStrategy(strategy_name);
String base = strategy.getString("base");
AutoTraderConfig ac = Globals.tloader.getStrategyBase(base);
AutoTraderInterface ac = Globals.tloader.getStrategyBase(base);
System.out.printf("Load Strat: %s\n", strategy_name);
System.out.printf("Base %s\n", base);
@ -97,12 +98,13 @@ public class NewMDIApplication extends javax.swing.JFrame {
System.out.printf("Count: %d Shares: %f Money %f\n", count, shares, money);
for (int i1 = 0; i1 < count; i1++) {
AutoTrader trader = ac.createTrader(Globals.se, strategy, id++, t.getString("Name") + i1, money, shares);
if (trader == null) {
AutoTraderInterface trader;
// AutoTrader trader = ac.createTrader(Globals.se, strategy, id++, t.getString("Name") + i1, money, shares);
// if (trader == null) {
System.out.printf("shoudl create new\n");
trader = this.createTraderNew(Globals.se, id, t.getString("Name") + i1, money, shares, strategy);
}
// }
Globals.se.traders.add(trader);
// trader.setName(t.getString("Name")+i1);
@ -117,7 +119,7 @@ public class NewMDIApplication extends javax.swing.JFrame {
Globals.se.fairValue = moneyTotal / sharesTotal;
Globals.se.fairValue = 15.0;
Globals.se.fairValue = 1.0;
for (int i = 0; i < Globals.se.traders.size(); i++) {
Globals.se.traders.get(i).start();
@ -640,50 +642,27 @@ public class NewMDIApplication extends javax.swing.JFrame {
* @throws java.lang.InstantiationException
*/
public static void main(String args[]) throws IllegalAccessException, InstantiationException {
sesim.AutoTraderLoader tl = new sesim.AutoTraderLoader();
tl.getTraders();
//System.exit(0);
Globals.se = new Exchange();
class Tube {
}
Class<?> c = sesim.Exchange.class;
Globals.prefs = Preferences.userNodeForPackage(c);
Globals.setLookAndFeel(Globals.prefs.get("laf", "Nimbus"));
/* try {
// Set cross-platform Java L&F (also called "Metal")
UIManager.setLookAndFeel("com.sun.java.swing.plaf.motif.MotifLookAndFeel");
} catch (UnsupportedLookAndFeelException | ClassNotFoundException |
InstantiationException | IllegalAccessException e) {
}
*/
ArrayList<Class<AutoTraderConfig>> traders;
traders = null;
sesim.AutoTraderLoader tl = new sesim.AutoTraderLoader();
try {
traders = tl.getTraders();
} catch (Exception e) {
System.out.print("Execption\n");
}
for (Class<AutoTraderConfig> at_class : traders) {
System.out.printf("Class = %s\n", at_class.getName());
if (Modifier.isAbstract(at_class.getModifiers())) {
continue;
}
AutoTraderConfig cfg = at_class.newInstance();
System.out.printf("Have a Trader with name: %s\n", cfg.getDisplayName());
}
//System.exit(0);
/* Create and display the form */
java.awt.EventQueue.invokeLater(new Runnable() {
@Override
public void run() {
// Globals.prefs = Preferences.userNodeForPackage(this)
new NewMDIApplication().setVisible(true);
}
});

View File

@ -37,6 +37,7 @@ import javax.swing.SwingUtilities;
import javax.swing.table.AbstractTableModel;
import javax.swing.table.JTableHeader;
import sesim.AutoTrader;
import sesim.AutoTraderInterface;
import sesim.Exchange;
import sesim.Scheduler;
@ -100,10 +101,10 @@ public class TraderListPanel extends javax.swing.JPanel {
sesim.Quote q = se.getLastQuoete();
double price = q == null ? 0 : q.price;
Iterator<AutoTrader> it = se.traders.iterator();
Iterator<AutoTraderInterface> it = se.traders.iterator();
ArrayList<TraderListItem> tlist = new ArrayList<>();
while (it.hasNext()) {
AutoTrader at = it.next();
AutoTraderInterface at = it.next();
Exchange.Account a = at.getAccount();
TraderListItem ti = new TraderListItem();

View File

@ -44,7 +44,7 @@ public abstract class AutoTrader implements Scheduler.TimerTask {
account_id = se.createAccount(money, shares);
Account a = se.getAccount(account_id);
a.owner=this;
// a.owner=this;
this.se = se;
this.config = config;
@ -78,7 +78,7 @@ public abstract class AutoTrader implements Scheduler.TimerTask {
public void init(Exchange se,long id,String name, double money, double shares, JSONObject cfg){
this.account_id=se.createAccount(money, shares);
se.getAccount(account_id).owner=this;
// se.getAccount(account_id).owner=this;
this.se = se;
this.name = name;
this.id=id;

View File

@ -25,15 +25,72 @@
*/
package sesim;
import org.json.JSONObject;
import sesim.Scheduler.TimerTask;
/**
*
* @author 7u83 <7u83@mail.ru>
*/
public abstract class AutoTraderBase extends AutoTrader implements AutoTraderConfig{
public abstract class AutoTraderBase implements AutoTraderInterface, TimerTask{
// public AutoTraderBase(Exchange se, long id, String name, double money, double shares, AutoTraderConfig config) {
// super(se, id, name, money, shares, config);
// }
protected double account_id;
protected Exchange se;
protected AutoTraderConfig config;
protected String name;
public AutoTraderBase(Exchange se, long id, String name, double money, double shares, AutoTraderConfig config) {
account_id = se.createAccount(money, shares);
Exchange.Account a = se.getAccount(account_id);
// a.owner=this;
this.se = se;
this.config = config;
this.name = name;
this.id=id;
}
public AutoTraderBase(){
se=null;
id=0;
}
public void setName(String name) {
this.name = name;
}
public String getName() {
return name;
}
// @Override
public long getID(){
return id;
}
private long id;
public Exchange.Account getAccount(){
return se.getAccount(account_id);
}
public void init(Exchange se,long id,String name, double money, double shares, JSONObject cfg){
this.account_id=se.createAccount(money, shares);
se.getAccount(account_id).owner=this;
this.se = se;
this.name = name;
this.id=id;
}
public Exchange getSE(){
return se;
}
public abstract void start();

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2017, tobias
* Copyright (c) 2017, 7u83 <7u83@mail.ru>
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@ -23,54 +23,32 @@
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
package traders;
package sesim;
import javax.swing.JPanel;
import org.json.JSONObject;
import sesim.AutoTrader;
import sesim.AutoTraderConfig;
import sesim.AutoTraderGui;
import sesim.Exchange;
/**
*
* @author tobias
* @author 7u83 <7u83@mail.ru>
*/
public class SuperTraderConfig implements AutoTraderConfig{
public interface AutoTraderInterface {
@Override
public AutoTrader createTrader(Exchange se, JSONObject cfg, long id, String name,double money, double shares) {
return null;
}
public abstract boolean getDevelStatus();
@Override
public String getDisplayName() {
return "SuperTrader";
}
public abstract String getDisplayName();
public abstract AutoTraderGui getGui();
public abstract JSONObject getConfig();
public abstract void putConfig(JSONObject cfg);
public abstract String getName();
public SuperTraderConfig(){
}
public void init(Exchange se,long id,String name, double money, double shares, JSONObject cfg);
@Override
public AutoTraderGui getGui() {
return null;
}
public Exchange.Account getAccount();
@Override
public JSONObject getConfig() {
return null;
}
public void start();
@Override
public void putConfig(JSONObject cfg) {
}
@Override
public boolean getDevelStatus() {
return true;
}
}

View File

@ -29,6 +29,7 @@ import java.io.File;
import java.io.FileFilter;
import java.io.FileInputStream;
import java.io.IOException;
import java.lang.reflect.Modifier;
import java.net.MalformedURLException;
import java.net.URL;
import java.net.URLClassLoader;
@ -42,17 +43,38 @@ import java.util.jar.JarInputStream;
import java.util.logging.Level;
import java.util.logging.Logger;
/**
*
* @author 7u83 <7u83@mail.ru>
*/
public class AutoTraderLoader {
public void pf(String file) {
System.out.printf("File\n", file);
/**
* Check if a given class can instaciated as AutoTrader.
* @param cls Class to check
* @return true if it is an AutoTrader, otherwise false
*/
public boolean isAutoTrader(Class<?> cls){
if (Modifier.isAbstract(cls.getModifiers()))
return false;
do {
for (Class<?> i : cls.getInterfaces()) {
if (i.equals(AutoTraderInterface.class)) {
return true;
}
}
}while ((cls=cls.getSuperclass())!=null);
return false;
}
Class<AutoTraderConfig> loadClass(String filename, String classname) {
Class<AutoTraderInterface> loadClass(String filename, String classname) {
String clnam = classname.substring(1, classname.length() - 6).replace('/', '.');
File f = new File(filename);
@ -71,24 +93,26 @@ public class AutoTraderLoader {
try {
Class<?> cls = cl.loadClass(clnam);
String kanone = cls.getCanonicalName();
for (Class<?> i : cls.getInterfaces()) {
if (i.equals(AutoTraderConfig.class)) {
return (Class<AutoTraderConfig>) cls;
}
System.out.printf("Check Class: %s\n",cls.getCanonicalName());
if (isAutoTrader(cls)){
System.out.printf("AT: %s\n",cls.getCanonicalName());
return (Class<AutoTraderInterface>) cls;
}
} catch (ClassNotFoundException ex) {
System.out.printf("Outch\n");
}
return null;
}
public ArrayList<Class<AutoTraderConfig>> getTraders() {
public ArrayList<Class<AutoTraderInterface>> getTraders() {
int curlen = 0;
ArrayList<Class<AutoTraderConfig>> traders;
ArrayList<Class<AutoTraderInterface>> traders;
traders = new ArrayList<>();
for (String classpathEntry : System.getProperty("java.class.path").split(System.getProperty("path.separator"))) {
@ -98,7 +122,7 @@ public class AutoTraderLoader {
public void accept(Object t) {
String fn = ((Path) t).toString();
if (fn.toLowerCase().endsWith(".class")) {
Class<AutoTraderConfig> cls = loadClass(fn, fn.substring(classpathEntry.length()));
Class<AutoTraderInterface> cls = loadClass(fn, fn.substring(classpathEntry.length()));
if (cls == null) {
return;
}
@ -147,7 +171,7 @@ public class AutoTraderLoader {
}
public ArrayList<String> getDefaultStrategyNames(boolean devel) {
ArrayList<Class<AutoTraderConfig>> trclasses;
ArrayList<Class<AutoTraderInterface>> trclasses;
trclasses = this.getTraders();
ArrayList<String> ret = new ArrayList<>();
trclasses = getTraders();
@ -155,12 +179,13 @@ public class AutoTraderLoader {
for (int i = 0; i < trclasses.size(); i++) {
try {
AutoTraderConfig ac = trclasses.get(i).newInstance();
AutoTraderInterface ac = trclasses.get(i).newInstance();
if (ac.getDevelStatus() && devel==false){
continue;
}
ret.add(ac.getClass().getCanonicalName());
} catch (InstantiationException | IllegalAccessException ex) {
} catch (Exception e) {
System.out.printf("Can't load \n");
}
@ -173,11 +198,11 @@ public class AutoTraderLoader {
return this.getDefaultStrategyNames(true);
}
public AutoTraderConfig getStrategyBase(String name) {
ArrayList<Class<AutoTraderConfig>> traders = this.getTraders();
public AutoTraderInterface getStrategyBase(String name) {
ArrayList<Class<AutoTraderInterface>> traders = this.getTraders();
for (int i = 0; i < traders.size(); i++) {
try {
AutoTraderConfig ac = traders.get(i).newInstance();
AutoTraderInterface ac = traders.get(i).newInstance();
System.out.printf("Looking for in %s == %s\n", ac.getClass().getCanonicalName(),name);

View File

@ -58,7 +58,7 @@ public class Exchange {
public Scheduler timer; // = new Scheduler();
public ArrayList<AutoTrader> traders;
public ArrayList<AutoTraderInterface> traders;
/**
* Implements a trading account
@ -68,7 +68,7 @@ public class Exchange {
private final double id;
private double shares;
private double money;
protected AutoTrader owner;
protected AutoTraderInterface owner;
private final HashMap<Long, Order> orders;
@ -97,7 +97,7 @@ public class Exchange {
return money;
}
public AutoTrader getOwner() {
public AutoTraderInterface getOwner() {
return owner;
}

View File

@ -110,7 +110,7 @@ public class Scheduler extends Thread {
long diff = System.currentTimeMillis() - last_time_millis;
// diff = 12199999L;
// diff = 12199999L;
last_time_millis += diff;
if (pause) {

View File

@ -39,7 +39,7 @@ import sesim.Exchange;
*
* @author 7u83 <7u83@mail.ru>
*/
public class ManTrader extends AutoTraderBase implements AutoTraderConfig {
public class ManTrader extends AutoTraderBase {
public ManTrader(Exchange se, long id, String name, double money, double shares, AutoTraderConfig config) {
// super(se, id, name, money, shares, null);
@ -74,11 +74,12 @@ public class ManTrader extends AutoTraderBase implements AutoTraderConfig {
return 1000;
}
@Override
/* @Override
public AutoTrader createTrader(Exchange se, JSONObject cfg, long id, String name, double money, double shares) {
return null;
}
*/
@Override
public String getDisplayName() {
return null;

View File

@ -48,10 +48,6 @@ public class ManTraderConfig extends AutoTraderBase{
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
}
@Override
public AutoTrader createTrader(Exchange se, JSONObject cfg, long id, String name, double money, double shares) {
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
}
@Override
public String getDisplayName() {

View File

@ -28,6 +28,7 @@ package traders.ManTrader;
import gui.OrdersList;
import javax.swing.JTable;
import sesim.AutoTrader;
import sesim.AutoTraderInterface;
import sesim.Exchange;
/**
@ -36,7 +37,7 @@ import sesim.Exchange;
*/
public class ManTraderConsole extends javax.swing.JPanel {
public AutoTrader trader;
public ManTrader trader;
public OrdersList getOrderListPanel(){
return this.ordersList1;

View File

@ -28,6 +28,7 @@ package traders;
import gui.Globals;
import java.util.*;
import java.util.Random;
import org.json.JSONObject;
//import java.util.TimerTask;
/*import sesim.AccountData;*/
@ -42,15 +43,19 @@ import sesim.*;
* @author 7u83
*/
public class RandomTrader extends AutoTrader {
long event() {
/* 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) {
@ -73,6 +78,8 @@ public class RandomTrader extends AutoTrader {
// return this.event();
}
protected enum Action {
BUY, SELL, RANDOM
}

View File

@ -0,0 +1,309 @@
/*
* 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 gui.Globals;
import java.util.Iterator;
import org.json.JSONArray;
import org.json.JSONObject;
import sesim.AccountData;
import sesim.AutoTrader;
import sesim.AutoTraderBase;
import sesim.AutoTraderConfig;
import sesim.AutoTraderGui;
import sesim.Exchange;
import sesim.OrderData;
import sesim.Quote;
/**
*
* @author 7u83 <7u83@mail.ru>
*/
public class RandomTraderA extends AutoTraderBase {
public Float[] sell_volume = {100f, 100f};
public Float[] sell_limit = {-2f, 2f};
public Long[] sell_wait = {10000L, 50000L};
public Long[] wait_after_sell = {1000L, 30000L};
public Float[] buy_volume = {100f, 100f};
public Float[] buy_limit = {-2f, 2f};
public Long[] buy_wait = {10000L, 50000L};
public Long[] wait_after_buy = {10L, 30L};
final String SELL_VOLUME = "sell_volume";
final String BUY_VOLUME = "buy_volume";
final String SELL_LIMIT = "sell_limit";
final String BUY_LIMIT = "buy_limit";
final String SELL_WAIT = "sell_wait";
final String BUY_WAIT = "buy_wait";
final String WAIT_AFTER_SELL = "sell_wait_after";
final String WAIT_AFTER_BUY = "buy_wait_after";
@Override
public void start() {
se.timer.startTimerEvent(this, 0);
}
@Override
public long timerTask() {
sesim.Exchange.Account a = se.getAccount(account_id);
long rc = this.doTrade();
return rc;
}
/* @Override
public AutoTrader createTrader(Exchange se, JSONObject cfg, long id, String name, double money, double shares) {
return null;
}
*/
@Override
public String getDisplayName() {
return null;
}
@Override
public AutoTraderGui getGui() {
return new RandomTraderGuiA(this);
}
@Override
public JSONObject getConfig() {
JSONObject jo = new JSONObject();
jo.put(SELL_VOLUME, sell_volume);
jo.put(BUY_VOLUME, buy_volume);
jo.put(SELL_LIMIT, sell_limit);
jo.put(BUY_LIMIT, buy_limit);
jo.put(SELL_WAIT, sell_wait);
jo.put(BUY_WAIT, buy_wait);
jo.put(WAIT_AFTER_SELL, wait_after_sell);
jo.put(WAIT_AFTER_BUY, wait_after_buy);
jo.put("base", this.getClass().getCanonicalName());
return jo;
}
private Float[] to_float(JSONArray a) {
Float[] ret = new Float[a.length()];
for (int i = 0; i < a.length(); i++) {
ret[i] = new Float(a.getDouble(i));
}
return ret;
}
private Long[] to_long(JSONArray a) {
Long[] ret = new Long[a.length()];
for (int i = 0; i < a.length(); i++) {
ret[i] = a.getLong(i);
}
return ret;
}
@Override
public void putConfig(JSONObject cfg) {
if (cfg == null) {
return;
}
String cname = cfg.get(SELL_VOLUME).getClass().getName();
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));
}
@Override
public boolean getDevelStatus() {
return false;
}
public long cancelOrders() {
int n = se.getNumberOfOpenOrders(account_id);
if (n > 0) {
AccountData ad = se.getAccountData(account_id);
Iterator<OrderData> it = ad.orders.iterator();
while (it.hasNext()) {
OrderData od = it.next();
boolean rc = se.cancelOrder(account_id, od.id);
}
}
return n;
}
protected enum Action {
BUY, SELL, RANDOM
}
protected Action getAction() {
if (se.randNextInt(2) == 0) {
return Action.BUY;
} else {
return Action.SELL;
}
}
long doTrade() {
cancelOrders();
Action a = getAction();
switch (a) {
case BUY:
return doBuy() + 1;
case SELL:
return doSell() + 1;
}
return 0;
}
/**
* 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]));
}
double getStart() {
return Globals.se.fairValue;
}
/**
*
* @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 doBuy() {
// RandomTraderConfig myoldconfig = (RandomTraderConfig) this.oldconfig;
AccountData ad = this.se.getAccountData(account_id);
Exchange.OrderType type = Exchange.OrderType.BUYLIMIT;
if (ad == null) {
//System.out.printf("%s: myconf = 0 \n", this.getName());
return 0;
}
// how much money we ant to invest?
double money = getRandomAmmount(ad.money, buy_volume);
Quote q = se.getCurrentPrice();
double lp = q == null ? getStart() : q.price;
double limit;
limit = lp + getRandomAmmount(lp, 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(buy_wait);
}
public long doSell() {
// RandomTraderConfig myoldconfig = (RandomTraderConfig) this.oldconfig;
AccountData ad = this.se.getAccountData(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);
// double lp = 100.0; //se.getBestLimit(type);
Quote q = se.getCurrentPrice();
double lp = q == null ? getStart() : q.price;
double limit;
limit = lp + getRandomAmmount(lp, 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(sell_wait);
}
}

View File

@ -0,0 +1,465 @@
<?xml version="1.0" encoding="UTF-8" ?>
<Form version="1.5" maxVersion="1.9" type="org.netbeans.modules.form.forminfo.JPanelFormInfo">
<NonVisualComponents>
<Component class="javax.swing.JTextField" name="jTextField1">
<Properties>
<Property name="text" type="java.lang.String" value="jTextField1"/>
</Properties>
</Component>
</NonVisualComponents>
<Properties>
<Property name="border" type="javax.swing.border.Border" editor="org.netbeans.modules.form.editors2.BorderEditor">
<Border info="null"/>
</Property>
</Properties>
<AuxValues>
<AuxValue name="FormSettings_autoResourcing" type="java.lang.Integer" value="0"/>
<AuxValue name="FormSettings_autoSetComponentName" type="java.lang.Boolean" value="false"/>
<AuxValue name="FormSettings_generateFQN" type="java.lang.Boolean" value="true"/>
<AuxValue name="FormSettings_generateMnemonicsCode" type="java.lang.Boolean" value="false"/>
<AuxValue name="FormSettings_i18nAutoMode" type="java.lang.Boolean" value="false"/>
<AuxValue name="FormSettings_layoutCodeTarget" type="java.lang.Integer" value="1"/>
<AuxValue name="FormSettings_listenerGenerationStyle" type="java.lang.Integer" value="0"/>
<AuxValue name="FormSettings_variablesLocal" type="java.lang.Boolean" value="false"/>
<AuxValue name="FormSettings_variablesModifier" type="java.lang.Integer" value="2"/>
</AuxValues>
<Layout>
<DimensionLayout dim="0">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="1" attributes="0">
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="1" attributes="0">
<Group type="102" attributes="0">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="1" attributes="0">
<Component id="jLabel24" max="32767" attributes="0"/>
<EmptySpace type="separate" max="-2" attributes="0"/>
<Component id="jLabel22" min="-2" max="-2" attributes="0"/>
</Group>
<Group type="102" alignment="1" attributes="0">
<Component id="jLabel23" max="32767" attributes="0"/>
<EmptySpace type="separate" max="-2" attributes="0"/>
<Component id="jLabel21" min="-2" max="-2" attributes="0"/>
</Group>
</Group>
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" attributes="0">
<Component id="waitAfterSellMin" alignment="0" min="-2" pref="98" max="-2" attributes="0"/>
<Component id="waitAfterBuyMin" alignment="0" min="-2" pref="98" max="-2" attributes="0"/>
</Group>
<EmptySpace type="separate" max="-2" attributes="0"/>
<Group type="103" groupAlignment="1" attributes="0">
<Component id="jLabel19" alignment="1" min="-2" max="-2" attributes="0"/>
<Component id="jLabel20" alignment="1" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" attributes="0">
<Component id="waitAfterSellMax" alignment="0" min="-2" pref="98" max="-2" attributes="0"/>
<Component id="waitAfterBuyMax" alignment="0" min="-2" pref="98" max="-2" attributes="0"/>
</Group>
</Group>
<Group type="102" attributes="0">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="1" attributes="0">
<Component id="jLabel9" max="32767" attributes="0"/>
<EmptySpace type="separate" max="-2" attributes="0"/>
<Component id="jLabel1" min="-2" max="-2" attributes="0"/>
</Group>
<Group type="102" alignment="1" attributes="0">
<Component id="jLabel12" max="32767" attributes="0"/>
<EmptySpace type="separate" max="-2" attributes="0"/>
<Component id="jLabel8" min="-2" max="-2" attributes="0"/>
</Group>
<Group type="102" alignment="1" attributes="0">
<Component id="jLabel10" pref="175" max="32767" attributes="0"/>
<EmptySpace min="-2" pref="18" max="-2" attributes="0"/>
<Component id="jLabel3" min="-2" max="-2" attributes="0"/>
</Group>
<Group type="102" alignment="1" attributes="0">
<Component id="jLabel11" max="32767" attributes="0"/>
<EmptySpace min="-2" pref="18" max="-2" attributes="0"/>
<Component id="jLabel7" min="-2" max="-2" attributes="0"/>
</Group>
<Group type="102" alignment="1" attributes="0">
<Component id="jLabel18" max="32767" attributes="0"/>
<EmptySpace min="-2" pref="18" max="-2" attributes="0"/>
<Component id="jLabel17" min="-2" max="-2" attributes="0"/>
</Group>
<Group type="102" alignment="1" attributes="0">
<Component id="jLabel15" max="32767" attributes="0"/>
<EmptySpace type="separate" max="-2" attributes="0"/>
<Component id="jLabel16" min="-2" max="-2" attributes="0"/>
</Group>
</Group>
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="1" max="-2" attributes="0">
<Component id="sellVolMin" alignment="1" min="-2" pref="98" max="-2" attributes="0"/>
<Component id="buyVolMin" alignment="1" min="-2" pref="98" max="-2" attributes="0"/>
<Component id="sellLimitMin" alignment="1" min="-2" pref="98" max="-2" attributes="0"/>
<Component id="buyLimitMin" alignment="1" min="-2" pref="98" max="-2" attributes="0"/>
<Component id="buyWaitMin" alignment="1" min="-2" pref="98" max="-2" attributes="0"/>
<Component id="sellWaitMin" alignment="1" min="-2" pref="98" max="-2" attributes="0"/>
</Group>
<EmptySpace type="separate" max="-2" attributes="0"/>
<Group type="103" groupAlignment="1" attributes="0">
<Group type="102" alignment="1" attributes="0">
<Group type="103" groupAlignment="1" attributes="0">
<Component id="jLabel13" alignment="1" min="-2" max="-2" attributes="0"/>
<Component id="jLabel14" alignment="1" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" attributes="0">
<Component id="sellWaitMax" min="-2" pref="98" max="-2" attributes="0"/>
<Component id="buyWaitMax" min="-2" pref="98" max="-2" attributes="0"/>
</Group>
</Group>
<Group type="102" alignment="1" attributes="0">
<Group type="103" groupAlignment="1" attributes="0">
<Component id="jLabel5" alignment="1" min="-2" max="-2" attributes="0"/>
<Component id="jLabel6" alignment="1" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" attributes="0">
<Component id="sellLimitMax" alignment="0" min="-2" pref="98" max="-2" attributes="0"/>
<Component id="buyLimitMax" alignment="0" min="-2" pref="98" max="-2" attributes="0"/>
</Group>
</Group>
<Group type="102" alignment="1" attributes="0">
<Group type="103" groupAlignment="1" attributes="0">
<Component id="jLabel2" min="-2" max="-2" attributes="0"/>
<Component id="jLabel4" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" attributes="0">
<Component id="sellVolMax" alignment="0" min="-2" pref="98" max="-2" attributes="0"/>
<Component id="buyVolMax" alignment="0" min="-2" pref="98" max="-2" attributes="0"/>
</Group>
</Group>
</Group>
</Group>
</Group>
<EmptySpace min="43" pref="43" max="-2" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
<DimensionLayout dim="1">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="0" attributes="0">
<EmptySpace min="-2" pref="40" max="-2" attributes="0"/>
<Group type="103" groupAlignment="3" attributes="0">
<Component id="buyVolMin" alignment="3" min="-2" pref="28" max="-2" attributes="0"/>
<Component id="buyVolMax" alignment="3" min="-2" pref="28" max="-2" attributes="0"/>
<Component id="jLabel1" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="jLabel2" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="jLabel9" alignment="3" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="3" attributes="0">
<Component id="sellVolMin" alignment="3" min="-2" pref="28" max="-2" attributes="0"/>
<Component id="sellVolMax" alignment="3" min="-2" pref="28" max="-2" attributes="0"/>
<Component id="jLabel3" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="jLabel4" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="jLabel10" alignment="3" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace type="separate" max="-2" attributes="0"/>
<Group type="103" groupAlignment="3" attributes="0">
<Component id="buyLimitMin" alignment="3" min="-2" pref="28" max="-2" attributes="0"/>
<Component id="buyLimitMax" alignment="3" min="-2" pref="28" max="-2" attributes="0"/>
<Component id="jLabel5" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="jLabel7" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="jLabel11" alignment="3" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="3" attributes="0">
<Component id="sellLimitMin" alignment="3" min="-2" pref="28" max="-2" attributes="0"/>
<Component id="sellLimitMax" alignment="3" min="-2" pref="28" max="-2" attributes="0"/>
<Component id="jLabel6" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="jLabel8" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="jLabel12" alignment="3" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace min="-2" pref="35" max="-2" attributes="0"/>
<Group type="103" groupAlignment="3" attributes="0">
<Component id="buyWaitMax" alignment="3" min="-2" pref="28" max="-2" attributes="0"/>
<Component id="jLabel13" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="jLabel16" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="jLabel15" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="buyWaitMin" alignment="3" min="-2" pref="28" max="-2" attributes="0"/>
</Group>
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="3" attributes="0">
<Component id="sellWaitMin" alignment="3" min="-2" pref="28" max="-2" attributes="0"/>
<Component id="sellWaitMax" alignment="3" min="-2" pref="28" max="-2" attributes="0"/>
<Component id="jLabel14" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="jLabel17" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="jLabel18" alignment="3" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace type="separate" max="-2" attributes="0"/>
<Group type="103" groupAlignment="3" attributes="0">
<Component id="waitAfterBuyMin" alignment="3" min="-2" pref="28" max="-2" attributes="0"/>
<Component id="waitAfterBuyMax" alignment="3" min="-2" pref="28" max="-2" attributes="0"/>
<Component id="jLabel19" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="jLabel21" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="jLabel23" alignment="3" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="3" attributes="0">
<Component id="waitAfterSellMin" alignment="3" min="-2" pref="28" max="-2" attributes="0"/>
<Component id="waitAfterSellMax" alignment="3" min="-2" pref="28" max="-2" attributes="0"/>
<Component id="jLabel20" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="jLabel22" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="jLabel24" alignment="3" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace pref="37" max="32767" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
</Layout>
<SubComponents>
<Component class="javax.swing.JSpinner" name="buyWaitMin">
<Properties>
<Property name="model" type="javax.swing.SpinnerModel" editor="org.netbeans.modules.form.editors2.SpinnerModelEditor">
<SpinnerModel initial="0" minimum="0" numberType="java.lang.Long" stepSize="1000" type="number"/>
</Property>
</Properties>
</Component>
<Component class="javax.swing.JSpinner" name="sellWaitMin">
<Properties>
<Property name="model" type="javax.swing.SpinnerModel" editor="org.netbeans.modules.form.editors2.SpinnerModelEditor">
<SpinnerModel initial="0" minimum="0" numberType="java.lang.Long" stepSize="1000" type="number"/>
</Property>
</Properties>
</Component>
<Component class="javax.swing.JSpinner" name="sellWaitMax">
<Properties>
<Property name="model" type="javax.swing.SpinnerModel" editor="org.netbeans.modules.form.editors2.SpinnerModelEditor">
<SpinnerModel initial="0" minimum="0" numberType="java.lang.Long" stepSize="1000" type="number"/>
</Property>
</Properties>
</Component>
<Component class="javax.swing.JSpinner" name="buyWaitMax">
<Properties>
<Property name="model" type="javax.swing.SpinnerModel" editor="org.netbeans.modules.form.editors2.SpinnerModelEditor">
<SpinnerModel initial="0" minimum="0" numberType="java.lang.Long" stepSize="1000" type="number"/>
</Property>
</Properties>
</Component>
<Component class="javax.swing.JSpinner" name="buyLimitMin">
<Properties>
<Property name="model" type="javax.swing.SpinnerModel" editor="org.netbeans.modules.form.editors2.SpinnerModelEditor">
<SpinnerModel initial="0.0" minimum="-100.0" numberType="java.lang.Float" stepSize="1.0" type="number"/>
</Property>
</Properties>
</Component>
<Component class="javax.swing.JSpinner" name="buyLimitMax">
<Properties>
<Property name="model" type="javax.swing.SpinnerModel" editor="org.netbeans.modules.form.editors2.SpinnerModelEditor">
<SpinnerModel initial="0.0" minimum="-100.0" numberType="java.lang.Float" stepSize="1.0" type="number"/>
</Property>
</Properties>
</Component>
<Component class="javax.swing.JSpinner" name="sellLimitMax">
<Properties>
<Property name="model" type="javax.swing.SpinnerModel" editor="org.netbeans.modules.form.editors2.SpinnerModelEditor">
<SpinnerModel initial="0.0" minimum="-100.0" numberType="java.lang.Float" stepSize="1.0" type="number"/>
</Property>
</Properties>
</Component>
<Component class="javax.swing.JSpinner" name="sellLimitMin">
<Properties>
<Property name="model" type="javax.swing.SpinnerModel" editor="org.netbeans.modules.form.editors2.SpinnerModelEditor">
<SpinnerModel initial="0.0" minimum="-100.0" numberType="java.lang.Float" stepSize="1.0" type="number"/>
</Property>
</Properties>
</Component>
<Component class="javax.swing.JSpinner" name="waitAfterBuyMin">
<Properties>
<Property name="model" type="javax.swing.SpinnerModel" editor="org.netbeans.modules.form.editors2.SpinnerModelEditor">
<SpinnerModel initial="0" minimum="0" numberType="java.lang.Integer" stepSize="1000" type="number"/>
</Property>
</Properties>
</Component>
<Component class="javax.swing.JSpinner" name="waitAfterSellMin">
<Properties>
<Property name="model" type="javax.swing.SpinnerModel" editor="org.netbeans.modules.form.editors2.SpinnerModelEditor">
<SpinnerModel initial="0" minimum="0" numberType="java.lang.Integer" stepSize="1000" type="number"/>
</Property>
</Properties>
</Component>
<Component class="javax.swing.JSpinner" name="waitAfterSellMax">
<Properties>
<Property name="model" type="javax.swing.SpinnerModel" editor="org.netbeans.modules.form.editors2.SpinnerModelEditor">
<SpinnerModel initial="0" minimum="0" numberType="java.lang.Integer" stepSize="1000" type="number"/>
</Property>
</Properties>
</Component>
<Component class="javax.swing.JSpinner" name="waitAfterBuyMax">
<Properties>
<Property name="model" type="javax.swing.SpinnerModel" editor="org.netbeans.modules.form.editors2.SpinnerModelEditor">
<SpinnerModel initial="0" minimum="0" numberType="java.lang.Integer" stepSize="1000" type="number"/>
</Property>
</Properties>
</Component>
<Component class="javax.swing.JSpinner" name="buyVolMin">
<Properties>
<Property name="model" type="javax.swing.SpinnerModel" editor="org.netbeans.modules.form.editors2.SpinnerModelEditor">
<SpinnerModel initial="0.0" maximum="100.0" minimum="0.0" numberType="java.lang.Float" stepSize="1.0" type="number"/>
</Property>
</Properties>
</Component>
<Component class="javax.swing.JSpinner" name="buyVolMax">
<Properties>
<Property name="model" type="javax.swing.SpinnerModel" editor="org.netbeans.modules.form.editors2.SpinnerModelEditor">
<SpinnerModel initial="0.0" maximum="100.0" minimum="0.0" numberType="java.lang.Float" stepSize="1.0" type="number"/>
</Property>
</Properties>
</Component>
<Component class="javax.swing.JSpinner" name="sellVolMax">
<Properties>
<Property name="model" type="javax.swing.SpinnerModel" editor="org.netbeans.modules.form.editors2.SpinnerModelEditor">
<SpinnerModel initial="0.0" maximum="100.0" minimum="0.0" numberType="java.lang.Float" stepSize="1.0" type="number"/>
</Property>
</Properties>
</Component>
<Component class="javax.swing.JSpinner" name="sellVolMin">
<Properties>
<Property name="model" type="javax.swing.SpinnerModel" editor="org.netbeans.modules.form.editors2.SpinnerModelEditor">
<SpinnerModel initial="0.0" maximum="100.0" minimum="0.0" numberType="java.lang.Float" stepSize="1.0" type="number"/>
</Property>
</Properties>
</Component>
<Component class="javax.swing.JLabel" name="jLabel1">
<Properties>
<Property name="text" type="java.lang.String" value="min:"/>
</Properties>
</Component>
<Component class="javax.swing.JLabel" name="jLabel2">
<Properties>
<Property name="text" type="java.lang.String" value="max:"/>
<Property name="verticalAlignment" type="int" value="3"/>
</Properties>
</Component>
<Component class="javax.swing.JLabel" name="jLabel3">
<Properties>
<Property name="text" type="java.lang.String" value="min:"/>
</Properties>
</Component>
<Component class="javax.swing.JLabel" name="jLabel4">
<Properties>
<Property name="text" type="java.lang.String" value="max:"/>
</Properties>
</Component>
<Component class="javax.swing.JLabel" name="jLabel5">
<Properties>
<Property name="text" type="java.lang.String" value="max:"/>
<Property name="verticalAlignment" type="int" value="3"/>
</Properties>
</Component>
<Component class="javax.swing.JLabel" name="jLabel6">
<Properties>
<Property name="text" type="java.lang.String" value="max:"/>
</Properties>
</Component>
<Component class="javax.swing.JLabel" name="jLabel7">
<Properties>
<Property name="text" type="java.lang.String" value="min:"/>
</Properties>
</Component>
<Component class="javax.swing.JLabel" name="jLabel8">
<Properties>
<Property name="text" type="java.lang.String" value="min:"/>
</Properties>
</Component>
<Component class="javax.swing.JLabel" name="jLabel9">
<Properties>
<Property name="horizontalAlignment" type="int" value="11"/>
<Property name="text" type="java.lang.String" value="Volume to buy (in %):"/>
</Properties>
</Component>
<Component class="javax.swing.JLabel" name="jLabel10">
<Properties>
<Property name="horizontalAlignment" type="int" value="11"/>
<Property name="text" type="java.lang.String" value="Volume to sell (in %):"/>
</Properties>
</Component>
<Component class="javax.swing.JLabel" name="jLabel11">
<Properties>
<Property name="horizontalAlignment" type="int" value="11"/>
<Property name="text" type="java.lang.String" value="Buy limit (in %):"/>
</Properties>
</Component>
<Component class="javax.swing.JLabel" name="jLabel12">
<Properties>
<Property name="horizontalAlignment" type="int" value="11"/>
<Property name="text" type="java.lang.String" value="Sel limit (in %):"/>
</Properties>
</Component>
<Component class="javax.swing.JLabel" name="jLabel13">
<Properties>
<Property name="text" type="java.lang.String" value="max:"/>
<Property name="verticalAlignment" type="int" value="3"/>
</Properties>
</Component>
<Component class="javax.swing.JLabel" name="jLabel14">
<Properties>
<Property name="text" type="java.lang.String" value="max:"/>
</Properties>
</Component>
<Component class="javax.swing.JLabel" name="jLabel15">
<Properties>
<Property name="horizontalAlignment" type="int" value="11"/>
<Property name="text" type="java.lang.String" value="Buy order wait (in ms):"/>
</Properties>
</Component>
<Component class="javax.swing.JLabel" name="jLabel16">
<Properties>
<Property name="text" type="java.lang.String" value="min:"/>
</Properties>
</Component>
<Component class="javax.swing.JLabel" name="jLabel17">
<Properties>
<Property name="text" type="java.lang.String" value="min:"/>
</Properties>
</Component>
<Component class="javax.swing.JLabel" name="jLabel18">
<Properties>
<Property name="horizontalAlignment" type="int" value="11"/>
<Property name="text" type="java.lang.String" value="Sell order wait (in ms):"/>
</Properties>
</Component>
<Component class="javax.swing.JLabel" name="jLabel19">
<Properties>
<Property name="text" type="java.lang.String" value="max:"/>
<Property name="verticalAlignment" type="int" value="3"/>
</Properties>
</Component>
<Component class="javax.swing.JLabel" name="jLabel20">
<Properties>
<Property name="text" type="java.lang.String" value="max:"/>
</Properties>
</Component>
<Component class="javax.swing.JLabel" name="jLabel21">
<Properties>
<Property name="text" type="java.lang.String" value="min:"/>
</Properties>
</Component>
<Component class="javax.swing.JLabel" name="jLabel22">
<Properties>
<Property name="text" type="java.lang.String" value="min:"/>
</Properties>
</Component>
<Component class="javax.swing.JLabel" name="jLabel23">
<Properties>
<Property name="horizontalAlignment" type="int" value="11"/>
<Property name="text" type="java.lang.String" value="Wait after buy (in ms):"/>
</Properties>
</Component>
<Component class="javax.swing.JLabel" name="jLabel24">
<Properties>
<Property name="horizontalAlignment" type="int" value="11"/>
<Property name="text" type="java.lang.String" value="Wait after sell (in ms):"/>
</Properties>
</Component>
</SubComponents>
</Form>

View File

@ -0,0 +1,446 @@
/*
* 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 RandomTraderGuiA extends AutoTraderGui {
private RandomTraderA cfg;
/**
* Creates new form RandomTraderConfigForm
*/
public RandomTraderGuiA(RandomTraderA 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")
// <editor-fold defaultstate="collapsed" desc="Generated Code">//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))
);
}// </editor-fold>//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
}