work on webstart

This commit is contained in:
7u83 2017-03-21 07:53:06 +01:00
parent 589b75800f
commit 924a9c059c
14 changed files with 79 additions and 555 deletions

View File

@ -1 +0,0 @@
config=JWS_generated

View File

@ -3,5 +3,7 @@ do.depend=false
do.jar=true
javac.debug=true
javadoc.preview=true
jnlp.signing.keypass=123456
jnlp.signing.storepass=123456
user.properties.file=/home/tube/.netbeans/8.1/build.properties
ivy.home=/usr/share/java/

View File

@ -1,4 +1,4 @@
#Mon, 20 Mar 2017 08:20:11 +0100
#Tue, 21 Mar 2017 02:08:14 +0100
annotation.processing.enabled=true
annotation.processing.enabled.in.editor=false
annotation.processing.processors.list=
@ -33,7 +33,7 @@ endorsed.classpath=
excludes=
includes=**
jar.archive.disabled=${jnlp.enabled}
jar.compress=false
jar.compress=true
jar.index=${jnlp.enabled}
javac.classpath=${ivy.classpath}
# Space-separated list of extra javac options
@ -58,16 +58,16 @@ javadoc.version=false
javadoc.windowtitle=
jnlp.applet.height=300
jnlp.applet.width=300
jnlp.codebase.type=local
jnlp.codebase.type=no.codebase
jnlp.descriptor=application
jnlp.enabled=false
jnlp.enabled=true
jnlp.icon=
jnlp.mixed.code=default
jnlp.offline-allowed=false
jnlp.signed=true
jnlp.signing=generated
jnlp.signing=key
jnlp.signing.alias=SeSim
jnlp.signing.keystore=
jnlp.signing.keystore=/home/tube/jkeystore
main.class=gui.NewMDIApplication
# Optional override of default Application-Library-Allowable-Codebase attribute identifying the locations where your signed RIA is expected to be found.
manifest.custom.application.library.allowable.codebase=

View File

@ -37,7 +37,7 @@ public class AboutDialog extends javax.swing.JDialog {
public AboutDialog(java.awt.Frame parent, boolean modal) {
super(parent, modal);
initComponents();
this.setLocationRelativeTo(MainWin.instance);
// this.setLocationRelativeTo(MainWin.instance);
}
/**

View File

@ -25,6 +25,7 @@
*/
package gui;
import static gui.Globals.LOGGER;
import java.awt.Frame;
import java.util.ArrayList;
import java.util.HashMap;
@ -72,9 +73,21 @@ public final class EditStrategies extends javax.swing.JDialog {
public EditStrategies(java.awt.Frame parent, boolean modal) {
super(parent, modal);
initComponents();
String dp = new java.io.File(NewMDIApplication.class.getProtectionDomain()
.getCodeSource()
.getLocation()
.getPath()).toString();
LOGGER.info(String.format("Path %s",dp));
this.setLocationRelativeTo(this.getParent());
initComboBox();
}

View File

@ -29,6 +29,7 @@ import java.io.File;
import java.io.FileNotFoundException;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Iterator;
import java.util.TreeMap;
import java.util.logging.Level;
@ -46,49 +47,48 @@ import sesim.AutoTraderLoader;
* @author 7u83 <7u83@mail.ru>
*/
public class Globals {
public interface CfgListener{
public interface CfgListener {
void cfgChanged();
}
static ArrayList <CfgListener> cfg_listeners = new ArrayList<>();
public static void notifyCfgListeners(){
for (CfgListener l : cfg_listeners){
static ArrayList<CfgListener> cfg_listeners = new ArrayList<>();
public static void notifyCfgListeners() {
for (CfgListener l : cfg_listeners) {
l.cfgChanged();
}
}
public static void addCfgListener(CfgListener l){
public static void addCfgListener(CfgListener l) {
cfg_listeners.add(l);
}
public static JFrame frame;
static final String STRATEGYPREFS = "Strategies";
static final String TRADERPREFS = "Traders";
static final String DEVELSTATUS = "devel_status";
public static final String GODMODE = "godmode";
static public sesim.Exchange se;
static public Preferences prefs;
public static class CfgStrings{
public static final String GODMODE = "godmode";
public static class CfgStrings {
public static final String GODMODE = "godmode";
}
public static String DEFAULT_EXCHANGE_CFG =
"{"
public static String DEFAULT_EXCHANGE_CFG
= "{"
+ " money_decimals: 2,"
+ " shares_decimals: 0"
+ "}";
//CfgStrings
//CfgStrings
static void setLookAndFeel(String selected) {
try {
@ -113,9 +113,26 @@ public class Globals {
}
}
static AutoTraderLoader tloader = new AutoTraderLoader();
static AutoTraderLoader tloader;
static final Logger LOGGER = Logger.getLogger("com.cauwersin.sesim");
static void initGlobals() {
String[] a = System.getProperty("java.class.path").split(System.getProperty("path.separator"));
ArrayList pathlist = new ArrayList<>(Arrays.asList(a));
System.out.printf("Init tloader\n");
pathlist = new ArrayList<>();
String dp = new java.io.File(NewMDIApplication.class.getProtectionDomain()
.getCodeSource()
.getLocation()
.getPath()).toString();
pathlist.add(dp);
LOGGER.info(String.format("Path %s",dp));
tloader = new AutoTraderLoader(pathlist);
}
static public final Logger LOGGER = Logger.getLogger("com.cauwersin.sesim");
static public final JSONArray getTraders() {
String traders_json = Globals.prefs.get(TRADERPREFS, "[]");

View File

@ -24,21 +24,11 @@
<DimensionLayout dim="0">
<Group type="103" groupAlignment="0" attributes="0">
<Component id="jScrollPane1" alignment="1" pref="586" max="32767" attributes="0"/>
<Group type="102" alignment="0" attributes="0">
<EmptySpace min="-2" pref="63" max="-2" attributes="0"/>
<Component id="orderBookNew1" min="-2" max="-2" attributes="0"/>
<EmptySpace max="32767" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
<DimensionLayout dim="1">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="0" attributes="0">
<Component id="jScrollPane1" min="-2" pref="160" max="-2" attributes="0"/>
<EmptySpace type="unrelated" max="-2" attributes="0"/>
<Component id="orderBookNew1" min="-2" max="-2" attributes="0"/>
<EmptySpace min="0" pref="9" max="32767" attributes="0"/>
</Group>
<Component id="jScrollPane1" alignment="0" pref="465" max="32767" attributes="0"/>
</Group>
</DimensionLayout>
</Layout>
@ -59,7 +49,5 @@
</Component>
</SubComponents>
</Container>
<Component class="gui.orderbook.OrderBook" name="orderBookNew1">
</Component>
</SubComponents>
</Form>
</Form>

View File

@ -85,7 +85,6 @@ public class LoggerDialog extends javax.swing.JDialog {
jScrollPane1 = new javax.swing.JScrollPane();
logArea = new javax.swing.JTextArea();
orderBookNew1 = new gui.orderbook.OrderBook();
setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
@ -99,18 +98,10 @@ public class LoggerDialog extends javax.swing.JDialog {
layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jScrollPane1, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, 586, Short.MAX_VALUE)
.addGroup(layout.createSequentialGroup()
.addGap(63, 63, 63)
.addComponent(orderBookNew1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
);
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 160, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(orderBookNew1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(0, 9, Short.MAX_VALUE))
.addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 465, Short.MAX_VALUE)
);
pack();
@ -161,6 +152,5 @@ public class LoggerDialog extends javax.swing.JDialog {
// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JScrollPane jScrollPane1;
private javax.swing.JTextArea logArea;
private gui.orderbook.OrderBook orderBookNew1;
// End of variables declaration//GEN-END:variables
}

View File

@ -1,152 +0,0 @@
<?xml version="1.0" encoding="UTF-8" ?>
<Form version="1.9" maxVersion="1.9" type="org.netbeans.modules.form.forminfo.JFrameFormInfo">
<NonVisualComponents>
<Component class="javax.swing.JButton" name="jButton1">
<Properties>
<Property name="text" type="java.lang.String" value="jButton1"/>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="jButton1ActionPerformed"/>
</Events>
</Component>
<Component class="javax.swing.JMenuItem" name="jMenuItem1">
<Properties>
<Property name="text" type="java.lang.String" value="jMenuItem1"/>
</Properties>
</Component>
<Menu class="javax.swing.JMenuBar" name="MainMenu">
<SubComponents>
<Menu class="javax.swing.JMenu" name="FileMenu">
<Properties>
<Property name="background" type="java.awt.Color" editor="org.netbeans.beaninfo.editors.ColorEditor">
<Color blue="1" green="cb" red="fe" type="rgb"/>
</Property>
<Property name="text" type="java.lang.String" value="File"/>
</Properties>
<SubComponents>
<MenuItem class="javax.swing.JMenuItem" name="FileNew">
<Properties>
<Property name="text" type="java.lang.String" value="New"/>
<Property name="border" type="javax.swing.border.Border" editor="org.netbeans.modules.form.editors2.BorderEditor">
<Border info="null"/>
</Property>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="FileNewActionPerformed"/>
</Events>
</MenuItem>
<MenuItem class="javax.swing.JMenuItem" name="FileRun">
<Properties>
<Property name="text" type="java.lang.String" value="Run"/>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="FileRunActionPerformed"/>
</Events>
</MenuItem>
</SubComponents>
</Menu>
<Menu class="javax.swing.JMenu" name="editjMenu">
<Properties>
<Property name="mnemonic" type="int" value="101"/>
<Property name="text" type="java.lang.String" value="Edit"/>
</Properties>
<SubComponents>
<MenuItem class="javax.swing.JMenuItem" name="editPrefernces">
<Properties>
<Property name="mnemonic" type="int" value="112"/>
<Property name="text" type="java.lang.String" value="Preferences"/>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="editPreferncesActionPerformed"/>
</Events>
</MenuItem>
</SubComponents>
</Menu>
<Menu class="javax.swing.JMenu" name="viewMenu">
<Properties>
<Property name="mnemonic" type="int" value="118"/>
<Property name="text" type="java.lang.String" value="View"/>
</Properties>
<SubComponents>
<MenuItem class="javax.swing.JMenuItem" name="traderList">
<Properties>
<Property name="mnemonic" type="int" value="116"/>
<Property name="text" type="java.lang.String" value="Traders"/>
<Property name="toolTipText" type="java.lang.String" value=""/>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="traderListActionPerformed"/>
</Events>
</MenuItem>
</SubComponents>
</Menu>
<Menu class="javax.swing.JMenu" name="helpMenu">
<Properties>
<Property name="text" type="java.lang.String" value="Help"/>
</Properties>
<SubComponents>
<MenuItem class="javax.swing.JMenuItem" name="helpAbout">
<Properties>
<Property name="mnemonic" type="int" value="97"/>
<Property name="text" type="java.lang.String" value="About"/>
<Property name="toolTipText" type="java.lang.String" value="About this Software"/>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="helpAboutActionPerformed"/>
</Events>
</MenuItem>
</SubComponents>
</Menu>
</SubComponents>
</Menu>
</NonVisualComponents>
<Properties>
<Property name="defaultCloseOperation" type="int" value="3"/>
<Property name="minimumSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
<Dimension value="[640, 480]"/>
</Property>
</Properties>
<SyntheticProperties>
<SyntheticProperty name="menuBar" type="java.lang.String" value="MainMenu"/>
<SyntheticProperty name="formSizePolicy" type="int" value="1"/>
<SyntheticProperty name="generateCenter" type="boolean" value="false"/>
</SyntheticProperties>
<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"/>
<AuxValue name="designerSize" type="java.awt.Dimension" value="-84,-19,0,5,115,114,0,18,106,97,118,97,46,97,119,116,46,68,105,109,101,110,115,105,111,110,65,-114,-39,-41,-84,95,68,20,2,0,2,73,0,6,104,101,105,103,104,116,73,0,5,119,105,100,116,104,120,112,0,0,2,93,0,0,3,-30"/>
</AuxValues>
<Layout class="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout"/>
<SubComponents>
<Component class="gui.ControlPanel" name="controlPanel2">
<Constraints>
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout" value="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout$BorderConstraintsDescription">
<BorderConstraints direction="After"/>
</Constraint>
</Constraints>
</Component>
<Component class="gui.OrderBookPanel" name="orderBookPanel1">
<Constraints>
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout" value="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout$BorderConstraintsDescription">
<BorderConstraints direction="Before"/>
</Constraint>
</Constraints>
</Component>
<Component class="chart.FullChart" name="fullChart2">
<Constraints>
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout" value="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout$BorderConstraintsDescription">
<BorderConstraints direction="Center"/>
</Constraint>
</Constraints>
</Component>
</SubComponents>
</Form>

View File

@ -1,335 +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 gui;
import javax.swing.UIManager;
import javax.swing.UnsupportedLookAndFeelException;
import sesim.Exchange;
import traders.*;
/**
*
* @author 7u83 <7u83@mail.ru>
*/
public class MainWin extends javax.swing.JFrame {
static MainWin instance;
//static public sesim.Exchange se;
//static sesim.Account_old myAccount;
/**
* Creates new form MainWin
*/
public MainWin() {
initComponents();
this.setLocationRelativeTo(this);
double aid1 = Globals.se.createAccount(100, 100);
double aid2 = Globals.se.createAccount(1000, 100);
/* AccountData a1 = se.getAccountData(aid1);
AccountData a2 = se.getAccountData(aid2);
se.createOrder(aid2, Exchange.OrderType.ASK, 20, 11.9);
se.createOrder(aid2, Exchange.OrderType.ASK, 20, 11);
se.createOrder(aid2, Exchange.OrderType.ASK, 10, 10);
se.createOrder(aid2, Exchange.OrderType.ASK, 10, 9);
se.createOrder(aid1, Exchange.OrderType.BID, 50, 11);
*/
/*
System.out.print("Exec Orders\n");
se.executeOrders();
System.out.print("Executed Orders\n");
a1 = se.getAccountData(aid1);
a2 = se.getAccountData(aid2);
*/
/*
AutoTraderLIst at = new AutoTraderLIst();
// RandomTraderConfig_old rcfg = new RandomTraderConfig_old();
SwitchingTraderConfig rcfg = new SwitchingTraderConfig();
at.add(1000, rcfg, se, 100, 0);
at.add(1000, rcfg, se, 0, 10000);
SwitchingTraderConfig scfg = new SwitchingTraderConfig();
at.add(1, scfg, se, 1000000, 0);
*/
}
/**
* 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() {
jButton1 = new javax.swing.JButton();
jMenuItem1 = new javax.swing.JMenuItem();
controlPanel2 = new gui.ControlPanel();
orderBookPanel1 = new gui.OrderBookPanel();
fullChart2 = new chart.FullChart();
MainMenu = new javax.swing.JMenuBar();
FileMenu = new javax.swing.JMenu();
FileNew = new javax.swing.JMenuItem();
FileRun = new javax.swing.JMenuItem();
editjMenu = new javax.swing.JMenu();
editPrefernces = new javax.swing.JMenuItem();
viewMenu = new javax.swing.JMenu();
traderList = new javax.swing.JMenuItem();
helpMenu = new javax.swing.JMenu();
helpAbout = new javax.swing.JMenuItem();
jButton1.setText("jButton1");
jButton1.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton1ActionPerformed(evt);
}
});
jMenuItem1.setText("jMenuItem1");
setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
setMinimumSize(new java.awt.Dimension(640, 480));
getContentPane().add(controlPanel2, java.awt.BorderLayout.LINE_END);
getContentPane().add(orderBookPanel1, java.awt.BorderLayout.LINE_START);
getContentPane().add(fullChart2, java.awt.BorderLayout.CENTER);
FileMenu.setBackground(new java.awt.Color(254, 203, 1));
FileMenu.setText("File");
FileNew.setText("New");
FileNew.setBorder(null);
FileNew.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
FileNewActionPerformed(evt);
}
});
FileMenu.add(FileNew);
FileRun.setText("Run");
FileRun.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
FileRunActionPerformed(evt);
}
});
FileMenu.add(FileRun);
MainMenu.add(FileMenu);
editjMenu.setMnemonic('e');
editjMenu.setText("Edit");
editPrefernces.setMnemonic('p');
editPrefernces.setText("Preferences");
editPrefernces.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
editPreferncesActionPerformed(evt);
}
});
editjMenu.add(editPrefernces);
MainMenu.add(editjMenu);
viewMenu.setMnemonic('v');
viewMenu.setText("View");
traderList.setMnemonic('t');
traderList.setText("Traders");
traderList.setToolTipText("");
traderList.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
traderListActionPerformed(evt);
}
});
viewMenu.add(traderList);
MainMenu.add(viewMenu);
helpMenu.setText("Help");
helpAbout.setMnemonic('a');
helpAbout.setText("About");
helpAbout.setToolTipText("About this Software");
helpAbout.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
helpAboutActionPerformed(evt);
}
});
helpMenu.add(helpAbout);
MainMenu.add(helpMenu);
setJMenuBar(MainMenu);
pack();
}// </editor-fold>//GEN-END:initComponents
private void FileNewActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_FileNewActionPerformed
}//GEN-LAST:event_FileNewActionPerformed
private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed
// TODO add your handling code here:
}//GEN-LAST:event_jButton1ActionPerformed
private void FileRunActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_FileRunActionPerformed
Globals.se.timer.start();
}//GEN-LAST:event_FileRunActionPerformed
private void helpAboutActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_helpAboutActionPerformed
AboutDialog d=new AboutDialog(this,true);
d.show();
}//GEN-LAST:event_helpAboutActionPerformed
private void traderListActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_traderListActionPerformed
TraderListDialog tl = new TraderListDialog(this,false);
tl.setVisible(true);
}//GEN-LAST:event_traderListActionPerformed
private void editPreferncesActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_editPreferncesActionPerformed
EditPreferencesDialog d = new EditPreferencesDialog(this,true);
d.setVisible(true);
}//GEN-LAST:event_editPreferncesActionPerformed
/**
* @param args the command line arguments
*/
public static void main(String args[]) {
Globals.se = new Exchange();
//se.timer.start();
//RandomTraderConfig rcfg = new RandomTraderConfig();
//RandomTrader rt = rcfg.createTrader(se, 1000, 100);
//rt.start();
// SwitchingTraderConfig rcfg1 = new SwitchingTraderConfig();
// SwitchingTraderConfig rcfg1 = new SwitchingTraderConfig();
RandomTraderConfig rcfg1 = new RandomTraderConfig();
// rcfg1.sell_limit[0]=-1;
// rcfg1.sell_limit[1]=1;
/*
AutoTrader rt1 = rcfg1.createTrader(Globals.se,0,"", null, 1000000, 1000000);
Globals.se.traders.add(rt1);
rt1.setName("Alice");
rt1.start();
//AutoTrader rt2 = rcfg1.createTrader(se, 1, 100);
//rt2.start();
// SwitchingTraderConfig cfg = new SwitchingTraderConfig();
RandomTraderConfig cfg= new RandomTraderConfig();
*
for (int i=0; i<30; i++){
AutoTrader randt = cfg.createTrader(Globals.se,null, 100000, 100000);
Globals.se.traders.add(randt);
randt.setName("Bob");
randt.start();
}
*/
// at.add(10, rcfg, se, 1000000, 0);
/* 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) {
}
*/
/* Set the Nimbus look and feel */
//<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
/* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
* For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html
*/
/* try {
for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
if ("Motif".equals(info.getDisplayName())) {
javax.swing.UIManager.setLookAndFeel(info.getClassName());
break;
}
}
} catch (ClassNotFoundException ex) {
java.util.logging.Logger.getLogger(MainWin.class.getDisplayName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (InstantiationException ex) {
java.util.logging.Logger.getLogger(MainWin.class.getDisplayName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (IllegalAccessException ex) {
java.util.logging.Logger.getLogger(MainWin.class.getDisplayName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (javax.swing.UnsupportedLookAndFeelException ex) {
java.util.logging.Logger.getLogger(MainWin.class.getDisplayName()).log(java.util.logging.Level.SEVERE, null, ex);
}
*/
//</editor-fold>
/* Create and display the form */
java.awt.EventQueue.invokeLater(() -> {
MainWin.instance=new MainWin();
MainWin.instance.setVisible(true);
});
}
// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JMenu FileMenu;
private javax.swing.JMenuItem FileNew;
private javax.swing.JMenuItem FileRun;
private javax.swing.JMenuBar MainMenu;
private gui.ControlPanel controlPanel2;
private javax.swing.JMenuItem editPrefernces;
private javax.swing.JMenu editjMenu;
private chart.FullChart fullChart2;
private javax.swing.JMenuItem helpAbout;
private javax.swing.JMenu helpMenu;
private javax.swing.JButton jButton1;
private javax.swing.JMenuItem jMenuItem1;
private gui.OrderBookPanel orderBookPanel1;
private javax.swing.JMenuItem traderList;
private javax.swing.JMenu viewMenu;
// End of variables declaration//GEN-END:variables
}

View File

@ -68,7 +68,7 @@ public class NewMDIApplication extends javax.swing.JFrame {
}
AutoTraderInterface createTraderNew(Exchange se, long id, String name, double money, double shares, JSONObject cfg) {
String base = cfg.getString("base");
AutoTraderInterface ac = Globals.tloader.getStrategyBase(base);
if (ac == null) {
@ -127,10 +127,9 @@ public class NewMDIApplication extends javax.swing.JFrame {
Globals.se.fairValue = moneyTotal / sharesTotal;
// Globals.se.fairValue = 1.0;
System.out.printf("Failr Value is %f\n", Globals.se.fairValue);
// Globals.se.fairValue = 1.0;
System.out.printf("Failr Value is %f\n", Globals.se.fairValue);
for (int i = 0; i < Globals.se.traders.size(); i++) {
Globals.se.traders.get(i).start();
}
@ -739,9 +738,7 @@ public class NewMDIApplication extends javax.swing.JFrame {
*/
public static void main(String args[]) throws IllegalAccessException, InstantiationException {
sesim.AutoTraderLoader tl = new sesim.AutoTraderLoader();
tl.getTraders();
Globals.initGlobals();
//System.exit(0);
Globals.se = new Exchange();
@ -753,6 +750,11 @@ public class NewMDIApplication extends javax.swing.JFrame {
java.awt.EventQueue.invokeLater(new Runnable() {
@Override
public void run() {
String x = new java.io.File(NewMDIApplication.class.getProtectionDomain()
.getCodeSource()
.getLocation()
.getPath()).toString(); //.getName();
new NewMDIApplication().setVisible(true);
}
});

View File

@ -456,4 +456,4 @@
</Parameters>
</CodeStatement>
</LayoutCode>
</Form>
</Form>

View File

@ -37,11 +37,11 @@ import static java.lang.Thread.sleep;
*
* @author 7u83 <7u83@mail.ru>
*/
public class OrderBookPanel extends javax.swing.JPanel {
public class OrderBookPanel_old extends javax.swing.JPanel {
sesim.Exchange se;
public OrderBookPanel() {
public OrderBookPanel_old() {
this.se = Globals.se;
initComponents();

View File

@ -40,7 +40,7 @@ public class TraderListDialog extends javax.swing.JDialog {
public TraderListDialog(java.awt.Frame parent, boolean modal) {
super(parent, modal);
initComponents();
this.setLocationRelativeTo(MainWin.instance);
// this.setLocationRelativeTo(MainWin.instance);
}
/**