More work on Strategy editor

This commit is contained in:
7u83
2017-01-28 15:34:24 +01:00
parent bd10e72756
commit c6c5ed2931
22 changed files with 927 additions and 173 deletions

View File

@ -113,7 +113,7 @@ public class RandomTrader extends AutoTrader {
return (max - min) * r + min;
}
protected int getRandom(int[] minmax) {
protected int getRandom(Integer[] minmax) {
return (int) Math.round(getRandom(minmax[0], minmax[1]));
}
@ -123,7 +123,7 @@ public class RandomTrader extends AutoTrader {
* @param minmax
* @return
*/
protected double getRandomAmmount(double val, float[] minmax) {
protected double getRandomAmmount(double val, Float[] minmax) {
double min = val * minmax[0] / 100.0;
double max = val * minmax[1] / 100.0;
return getRandom(min, max);
@ -181,7 +181,7 @@ public class RandomTrader extends AutoTrader {
se.createOrder(account_id, type, volume, limit);
return getRandom(myconfig.buy_order_wait);
return getRandom(myconfig.buy_wait);
}
@ -211,7 +211,7 @@ public class RandomTrader extends AutoTrader {
// System.out.print("My Ammount is: "+volume+" My limit si:"+limit+ "\n");
se.createOrder(account_id, type, volume, limit);
return getRandom(myconfig.sell_order_wait);
return getRandom(myconfig.sell_wait);
}

View File

@ -26,8 +26,11 @@
package traders;
import javax.swing.JPanel;
import org.json.JSONArray;
import org.json.JSONObject;
import sesim.AutoTrader;
import sesim.AutoTraderConfig;
import sesim.AutoTraderGui;
import sesim.Exchange;
/**
@ -36,18 +39,21 @@ import sesim.Exchange;
*/
public class RandomTraderConfig implements AutoTraderConfig {
public float[] sell_volume = {100, 100};
public float[] sell_limit = {-5f, 5f};
public int[] sell_order_wait = {10000, 50000};
public int[] wait_after_sell = {10, 30};
public Float[] sell_volume = {77f, 100f};
public Float[] sell_limit = {-5.3f, 5f};
public Integer[] sell_wait = {10000, 50000};
public Integer[] wait_after_sell = {10, 30};
public float[] buy_volume = {100, 100};
public float[] buy_limit = {-5f, 5f};
public int[] buy_order_wait = {10000, 50000};
public int[] wait_after_buy = {10, 30};
public Float[] buy_volume = {100f, 100f};
public Float[] buy_limit = {-5f, 5f};
public Integer[] buy_wait = {10000, 50000};
public Integer[] wait_after_buy = {10, 30};
@Override
public AutoTrader createTrader(Exchange se, double money, double shares) {
public AutoTrader createTrader(Exchange se, JSONObject cfg, double money, double shares) {
if (cfg != null) {
this.putConfig(cfg);
}
return new traders.RandomTrader(se, money, shares, this);
}
@ -57,7 +63,36 @@ public class RandomTraderConfig implements AutoTraderConfig {
}
@Override
public JPanel getGui() {
return new RandomTraderConfigForm();
public AutoTraderGui getGui() {
return new RandomTraderGui(this);
}
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 = "wait_wait";
@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);
return jo;
}
public void putConfig(JSONObject cfg) {
sell_volume = (Float[]) cfg.get(SELL_VOLUME);
buy_volume = (Float[]) cfg.get(BUY_VOLUME);
sell_limit = (Float[]) cfg.get(SELL_LIMIT);
buy_limit = (Float[]) cfg.get(BUY_LIMIT);
sell_wait = (Integer[]) cfg.get(SELL_WAIT);
buy_wait = (Integer[]) cfg.get(SELL_WAIT);
}
}

View File

@ -1,46 +0,0 @@
<?xml version="1.0" encoding="UTF-8" ?>
<Form version="1.5" maxVersion="1.9" type="org.netbeans.modules.form.forminfo.JPanelFormInfo">
<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="0" attributes="0">
<EmptySpace min="-2" pref="115" max="-2" attributes="0"/>
<Component id="jFormattedTextField1" min="-2" pref="94" max="-2" attributes="0"/>
<EmptySpace pref="197" max="32767" 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="24" max="-2" attributes="0"/>
<Component id="jFormattedTextField1" min="-2" max="-2" attributes="0"/>
<EmptySpace pref="249" max="32767" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
</Layout>
<SubComponents>
<Component class="javax.swing.JFormattedTextField" name="jFormattedTextField1">
<Properties>
<Property name="formatterFactory" type="javax.swing.JFormattedTextField$AbstractFormatterFactory" editor="org.netbeans.modules.form.editors.AbstractFormatterFactoryEditor">
<Format format="#0.00%" subtype="-1" type="3"/>
</Property>
<Property name="horizontalAlignment" type="int" value="4"/>
</Properties>
</Component>
</SubComponents>
</Form>

View File

@ -1,77 +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;
/**
*
* @author 7u83 <7u83@mail.ru>
*/
public class RandomTraderConfigForm extends javax.swing.JPanel {
/**
* Creates new form RandomTraderConfigForm
*/
public RandomTraderConfigForm() {
initComponents();
}
/**
* 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() {
jFormattedTextField1 = new javax.swing.JFormattedTextField();
jFormattedTextField1.setFormatterFactory(new javax.swing.text.DefaultFormatterFactory(new javax.swing.text.NumberFormatter(new java.text.DecimalFormat("#0.00%"))));
jFormattedTextField1.setHorizontalAlignment(javax.swing.JTextField.RIGHT);
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
this.setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addGap(115, 115, 115)
.addComponent(jFormattedTextField1, javax.swing.GroupLayout.PREFERRED_SIZE, 94, javax.swing.GroupLayout.PREFERRED_SIZE)
.addContainerGap(197, Short.MAX_VALUE))
);
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addGap(24, 24, 24)
.addComponent(jFormattedTextField1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addContainerGap(249, Short.MAX_VALUE))
);
}// </editor-fold>//GEN-END:initComponents
// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JFormattedTextField jFormattedTextField1;
// End of variables declaration//GEN-END:variables
}

View File

@ -0,0 +1,126 @@
<?xml version="1.0" encoding="UTF-8" ?>
<Form version="1.5" maxVersion="1.9" type="org.netbeans.modules.form.forminfo.JPanelFormInfo">
<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" attributes="0">
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" max="-2" attributes="0">
<Component id="jLabel2" max="32767" attributes="0"/>
<Component id="jLabel1" max="32767" attributes="0"/>
</Group>
<EmptySpace min="-2" pref="12" max="-2" attributes="0"/>
<Group type="103" groupAlignment="1" attributes="0">
<Group type="102" alignment="1" attributes="0">
<Component id="jLabel6" min="-2" max="-2" attributes="0"/>
<EmptySpace min="-2" pref="108" max="-2" attributes="0"/>
<Component id="jLabel4" min="-2" max="-2" attributes="0"/>
<EmptySpace min="-2" pref="96" max="-2" attributes="0"/>
</Group>
<Group type="102" alignment="1" attributes="0">
<Component id="jLabel5" min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="buy_volume_min" min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="jLabel3" min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="buy_volume_max" min="-2" max="-2" attributes="0"/>
<EmptySpace min="0" pref="93" max="32767" attributes="0"/>
</Group>
</Group>
</Group>
</Group>
</DimensionLayout>
<DimensionLayout dim="1">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" attributes="0">
<EmptySpace min="-2" pref="35" max="-2" attributes="0"/>
<Group type="103" groupAlignment="3" attributes="0">
<Component id="jLabel1" alignment="3" min="-2" pref="27" max="-2" attributes="0"/>
<Component id="jLabel3" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="jLabel5" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="buy_volume_min" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="buy_volume_max" alignment="3" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="3" attributes="0">
<Component id="jLabel2" alignment="3" min="-2" pref="27" max="-2" attributes="0"/>
<Component id="jLabel6" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="jLabel4" alignment="3" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace pref="205" max="32767" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
</Layout>
<SubComponents>
<Component class="javax.swing.JLabel" name="jLabel1">
<Properties>
<Property name="text" type="java.lang.String" value="Volume to buy (in percent)"/>
</Properties>
</Component>
<Component class="javax.swing.JLabel" name="jLabel2">
<Properties>
<Property name="text" type="java.lang.String" value="Volume to sell (in percent):"/>
</Properties>
</Component>
<Component class="javax.swing.JLabel" name="jLabel3">
<Properties>
<Property name="text" type="java.lang.String" value="max."/>
</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="min."/>
</Properties>
</Component>
<Component class="javax.swing.JLabel" name="jLabel6">
<Properties>
<Property name="text" type="java.lang.String" value="min."/>
</Properties>
</Component>
<Component class="javax.swing.JTextField" name="buy_volume_min">
<Properties>
<Property name="horizontalAlignment" type="int" value="4"/>
<Property name="text" type="java.lang.String" value="100.5"/>
<Property name="toolTipText" type="java.lang.String" value=""/>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="buy_volume_minActionPerformed"/>
</Events>
</Component>
<Component class="javax.swing.JTextField" name="buy_volume_max">
<Properties>
<Property name="horizontalAlignment" type="int" value="4"/>
<Property name="text" type="java.lang.String" value="100.5"/>
<Property name="toolTipText" type="java.lang.String" value=""/>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="buy_volume_maxActionPerformed"/>
</Events>
</Component>
</SubComponents>
</Form>

View File

@ -0,0 +1,177 @@
/*
* 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.buy_volume_min.setText(cfg.buy_volume[0].toString());
this.buy_volume_max.setText(cfg.buy_volume[1].toString());
// .secfg.buy_volume[0];
}
@Override
public void save() {
cfg.buy_volume[0] = Float.parseFloat(this.buy_volume_min.getText());
cfg.buy_volume[1] = Float.parseFloat(this.buy_volume_max.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() {
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();
buy_volume_min = new javax.swing.JTextField();
buy_volume_max = new javax.swing.JTextField();
setBorder(null);
jLabel1.setText("Volume to buy (in percent)");
jLabel2.setText("Volume to sell (in percent):");
jLabel3.setText("max.");
jLabel4.setText("max.");
jLabel5.setText("min.");
jLabel6.setText("min.");
buy_volume_min.setHorizontalAlignment(javax.swing.JTextField.RIGHT);
buy_volume_min.setText("100.5");
buy_volume_min.setToolTipText("");
buy_volume_min.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
buy_volume_minActionPerformed(evt);
}
});
buy_volume_max.setHorizontalAlignment(javax.swing.JTextField.RIGHT);
buy_volume_max.setText("100.5");
buy_volume_max.setToolTipText("");
buy_volume_max.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
buy_volume_maxActionPerformed(evt);
}
});
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
this.setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addContainerGap()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
.addComponent(jLabel2, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(jLabel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
.addGap(12, 12, 12)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
.addGroup(layout.createSequentialGroup()
.addComponent(jLabel6)
.addGap(108, 108, 108)
.addComponent(jLabel4)
.addGap(96, 96, 96))
.addGroup(layout.createSequentialGroup()
.addComponent(jLabel5)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(buy_volume_min, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jLabel3)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(buy_volume_max, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(0, 93, Short.MAX_VALUE))))
);
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addGap(35, 35, 35)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel1, javax.swing.GroupLayout.PREFERRED_SIZE, 27, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jLabel3)
.addComponent(jLabel5)
.addComponent(buy_volume_min, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(buy_volume_max, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel2, javax.swing.GroupLayout.PREFERRED_SIZE, 27, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jLabel6)
.addComponent(jLabel4))
.addContainerGap(205, Short.MAX_VALUE))
);
}// </editor-fold>//GEN-END:initComponents
private void buy_volume_minActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_buy_volume_minActionPerformed
// TODO add your handling code here:
}//GEN-LAST:event_buy_volume_minActionPerformed
private void buy_volume_maxActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_buy_volume_maxActionPerformed
// TODO add your handling code here:
}//GEN-LAST:event_buy_volume_maxActionPerformed
// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JTextField buy_volume_max;
private javax.swing.JTextField buy_volume_min;
private javax.swing.JLabel jLabel1;
private javax.swing.JLabel jLabel2;
private javax.swing.JLabel jLabel3;
private javax.swing.JLabel jLabel4;
private javax.swing.JLabel jLabel5;
private javax.swing.JLabel jLabel6;
// End of variables declaration//GEN-END:variables
}

View File

@ -26,8 +26,10 @@
package traders;
import javax.swing.JPanel;
import org.json.JSONObject;
import sesim.AutoTrader;
import sesim.AutoTraderConfig;
import sesim.AutoTraderGui;
import sesim.Exchange;
/**
@ -37,7 +39,7 @@ import sesim.Exchange;
public class SuperTraderConfig implements AutoTraderConfig{
@Override
public AutoTrader createTrader(Exchange se, double money, double shares) {
public AutoTrader createTrader(Exchange se, JSONObject cfg, double money, double shares) {
return null;
}
@ -52,7 +54,12 @@ public class SuperTraderConfig implements AutoTraderConfig{
}
@Override
public JPanel getGui() {
public AutoTraderGui getGui() {
return null;
}
@Override
public JSONObject getConfig() {
return null;
}

View File

@ -25,6 +25,7 @@
*/
package traders;
import org.json.JSONObject;
import sesim.AutoTrader;
import sesim.AutoTraderConfig;
import sesim.Exchange;
@ -36,7 +37,7 @@ import sesim.Exchange;
public class SwitchingTraderConfig extends RandomTraderConfig implements AutoTraderConfig{
@Override
public AutoTrader createTrader(Exchange se, double money, double shares) {
public AutoTrader createTrader(Exchange se, JSONObject cfg, double money, double shares) {
return new traders.SwitchingTrader(se, money, shares, this);
@ -44,15 +45,15 @@ public class SwitchingTraderConfig extends RandomTraderConfig implements AutoTra
public SwitchingTraderConfig() {
sell_volume = new float[]{100, 100};
sell_limit = new float[]{-30, 1};
sell_order_wait = new int[]{1, 5};
wait_after_sell = new int[]{1, 5};
sell_volume = new Float[]{17f, 100f};
sell_limit = new Float[]{-30f, 1f};
sell_wait = new Integer[]{1, 5};
wait_after_sell = new Integer[]{1, 5};
buy_volume = new float[]{100, 100};
buy_limit = new float[]{-1, 30};
buy_order_wait = new int[]{1, 5};
wait_after_buy = new int[]{1, 5};
buy_volume = new Float[]{18f, 100f};
buy_limit = new Float[]{-1f, 30f};
buy_wait = new Integer[]{1, 5};
wait_after_buy = new Integer[]{1, 5};
}
@Override