SwitchingTrader + Chart
This commit is contained in:
parent
7025647166
commit
4f30bcbc30
@ -7,11 +7,13 @@
|
||||
<file>file:/home/tube/NetBeansProjects/SeSim/src/SeSim/Trader.java</file>
|
||||
<file>file:/home/tube/NetBeansProjects/SeSim/src/SeSim/Order.java</file>
|
||||
<file>file:/home/tube/NetBeansProjects/SeSim/src/Gui/ControlPanel.java</file>
|
||||
<file>file:/home/tube/NetBeansProjects/SeSim/src/SeSim/Quote.java</file>
|
||||
<file>file:/home/tube/NetBeansProjects/SeSim/src/Gui/MainWin.java</file>
|
||||
<file>file:/home/tube/NetBeansProjects/SeSim/src/Gui/OrderBook.java</file>
|
||||
<file>file:/home/tube/NetBeansProjects/SeSim/manifest.mf</file>
|
||||
<file>file:/home/tube/NetBeansProjects/SeSim/src/SeSim/TraderConfig.java</file>
|
||||
<file>file:/home/tube/NetBeansProjects/SeSim/src/SeSim/Account.java</file>
|
||||
<file>file:/home/tube/NetBeansProjects/SeSim/src/Gui/QuotePanel.java</file>
|
||||
<file>file:/home/tube/NetBeansProjects/SeSim/src/SeSim/Exchange.java</file>
|
||||
<file>file:/home/tube/NetBeansProjects/SeSim/src/Gui/NewPanel.java</file>
|
||||
<file>file:/home/tube/NetBeansProjects/SeSim/src/Gui/Chart.java</file>
|
||||
|
@ -40,7 +40,7 @@ public class BidBook extends OrderBook {
|
||||
return MainWin.se.getOrderBook(OrderType.bid, 40);
|
||||
}
|
||||
|
||||
BidBook() {
|
||||
public BidBook() {
|
||||
if (MainWin.se == null) {
|
||||
return;
|
||||
}
|
||||
|
@ -50,6 +50,8 @@ import org.jfree.data.xy.OHLCDataItem;
|
||||
import org.jfree.data.xy.XYDataset;
|
||||
|
||||
import SeSim.Exchange.*;
|
||||
import SeSim.Quote;
|
||||
import java.util.SortedSet;
|
||||
|
||||
/**
|
||||
*
|
||||
@ -63,8 +65,7 @@ public class Chart extends javax.swing.JPanel implements QuoteReceiver{
|
||||
public Chart() {
|
||||
initComponents();
|
||||
|
||||
|
||||
String stockSymbol = "MSFT";
|
||||
String stockSymbol = "Schliemanz Koch AG";
|
||||
|
||||
DateAxis domainAxis = new DateAxis("Date");
|
||||
NumberAxis rangeAxis = new NumberAxis("Price");
|
||||
@ -87,14 +88,14 @@ public class Chart extends javax.swing.JPanel implements QuoteReceiver{
|
||||
add(chartPanel);
|
||||
System.out.print("Hallo Welt\n");
|
||||
|
||||
if (MainWin.se == null)
|
||||
if (MainWin.se == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
MainWin.se.addQuoteReceiver(this);
|
||||
|
||||
}
|
||||
|
||||
|
||||
protected AbstractXYDataset getDataSet(String stockSymbol) {
|
||||
//This is the dataset we are going to create
|
||||
DefaultOHLCDataset result = null;
|
||||
@ -102,15 +103,25 @@ public class Chart extends javax.swing.JPanel implements QuoteReceiver{
|
||||
OHLCDataItem[] data;
|
||||
|
||||
//This is where we go get the data, replace with your own data source
|
||||
data = getData(stockSymbol);
|
||||
data = getData();
|
||||
|
||||
//Create a dataset, an Open, High, Low, Close dataset
|
||||
result = new DefaultOHLCDataset(stockSymbol, data);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
protected OHLCDataItem[] getData() {
|
||||
List<OHLCDataItem> data = new ArrayList<>();
|
||||
|
||||
//return data.toArray(new <OHLCDataItem> rdata[]);
|
||||
return data.toArray(new OHLCDataItem[data.size()]);
|
||||
|
||||
}
|
||||
|
||||
//This method uses yahoo finance to get the OHLC data
|
||||
protected OHLCDataItem[] getData(String stockSymbol) {
|
||||
protected OHLCDataItem[] getData_old() {
|
||||
String stockSymbol = "Schliemanz Koch AG";
|
||||
List<OHLCDataItem> dataItems = new ArrayList<OHLCDataItem>();
|
||||
try {
|
||||
String strUrl = "http://ichart.finance.yahoo.com/table.csv?s=" + stockSymbol + "&a=0&b=1&c=2008&d=3&e=30&f=2008&ignore=.csv";
|
||||
@ -135,8 +146,7 @@ public class Chart extends javax.swing.JPanel implements QuoteReceiver{
|
||||
dataItems.add(item);
|
||||
}
|
||||
in.close();
|
||||
}
|
||||
catch (Exception e) {
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
//Data from Yahoo is from newest to oldest. Reverse so it is oldest to newest
|
||||
@ -172,7 +182,14 @@ public class Chart extends javax.swing.JPanel implements QuoteReceiver{
|
||||
|
||||
@Override
|
||||
public void UpdateQuote(Quote q) {
|
||||
q.print();
|
||||
|
||||
return;
|
||||
//q.print();
|
||||
/* SortedSet s = MainWin.se.getQuoteHistory(60);
|
||||
System.out.print(
|
||||
"SortedSet size:"
|
||||
+ s.size()
|
||||
+ "\n"
|
||||
);
|
||||
*/
|
||||
}
|
||||
}
|
||||
|
@ -156,7 +156,11 @@ public class MainWin extends javax.swing.JFrame {
|
||||
|
||||
AutoTraderLIst at = new AutoTraderLIst();
|
||||
RandomTraderConfig rcfg = new RandomTraderConfig();
|
||||
at.add(500, rcfg, se, 1000, 10000);
|
||||
at.add(1000, rcfg, se, 1000, 10000);
|
||||
|
||||
SwitchingTraderConfig scfg = new SwitchingTraderConfig();
|
||||
at.add(1, scfg, se, 1000000, 0);
|
||||
|
||||
|
||||
// at.add(10, rcfg, se, 1000000, 0);
|
||||
|
||||
|
@ -16,10 +16,8 @@
|
||||
<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,1,-127,0,0,0,-72"/>
|
||||
<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,41,0,0,2,75"/>
|
||||
</AuxValues>
|
||||
|
||||
<Layout class="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout"/>
|
||||
<SubComponents>
|
||||
<Component class="Gui.AskBook" name="askBook1">
|
||||
<Properties>
|
||||
@ -29,20 +27,7 @@
|
||||
</Properties>
|
||||
<Constraints>
|
||||
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout" value="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout$GridBagConstraintsDescription">
|
||||
<GridBagConstraints gridX="-1" gridY="-1" gridWidth="1" gridHeight="1" fill="1" ipadX="0" ipadY="0" insetsTop="0" insetsLeft="0" insetsBottom="0" insetsRight="0" anchor="10" weightX="1.0" weightY="1.0"/>
|
||||
</Constraint>
|
||||
</Constraints>
|
||||
</Component>
|
||||
<Component class="javax.swing.JLabel" name="jLabel4">
|
||||
<Properties>
|
||||
<Property name="text" type="java.lang.String" value="123.00"/>
|
||||
<Property name="preferredSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
|
||||
<Dimension value="[150, 25]"/>
|
||||
</Property>
|
||||
</Properties>
|
||||
<Constraints>
|
||||
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout" value="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout$GridBagConstraintsDescription">
|
||||
<GridBagConstraints gridX="0" gridY="1" gridWidth="1" gridHeight="3" fill="1" ipadX="0" ipadY="0" insetsTop="0" insetsLeft="0" insetsBottom="0" insetsRight="0" anchor="10" weightX="0.0" weightY="1.0"/>
|
||||
<GridBagConstraints gridX="0" gridY="0" gridWidth="1" gridHeight="1" fill="1" ipadX="0" ipadY="0" insetsTop="0" insetsLeft="0" insetsBottom="0" insetsRight="0" anchor="10" weightX="1.0" weightY="1.0"/>
|
||||
</Constraint>
|
||||
</Constraints>
|
||||
</Component>
|
||||
@ -58,5 +43,417 @@
|
||||
</Constraint>
|
||||
</Constraints>
|
||||
</Component>
|
||||
<Container class="Gui.QuotePanel" name="quotePanel2">
|
||||
<Properties>
|
||||
<Property name="opaque" type="boolean" value="false"/>
|
||||
<Property name="preferredSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
|
||||
<Dimension value="[587, 200]"/>
|
||||
</Property>
|
||||
</Properties>
|
||||
<Constraints>
|
||||
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout" value="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout$GridBagConstraintsDescription">
|
||||
<GridBagConstraints gridX="0" gridY="2" gridWidth="1" gridHeight="1" fill="1" ipadX="0" ipadY="0" insetsTop="0" insetsLeft="0" insetsBottom="0" insetsRight="0" anchor="10" weightX="0.5" weightY="0.5"/>
|
||||
</Constraint>
|
||||
</Constraints>
|
||||
<LayoutCode>
|
||||
<CodeStatement>
|
||||
<CodeExpression id="1_quotePanel2Layout">
|
||||
<CodeVariable name="quotePanel2Layout" type="4096" declaredType="java.awt.GridBagLayout"/>
|
||||
<ExpressionOrigin>
|
||||
<ExpressionProvider type="CodeConstructor">
|
||||
<CodeConstructor class="java.awt.GridBagLayout" parameterTypes=""/>
|
||||
</ExpressionProvider>
|
||||
</ExpressionOrigin>
|
||||
</CodeExpression>
|
||||
<StatementProvider type="CodeExpression">
|
||||
<CodeExpression id="1_quotePanel2Layout"/>
|
||||
</StatementProvider>
|
||||
</CodeStatement>
|
||||
<CodeStatement>
|
||||
<CodeExpression id="1_quotePanel2Layout"/>
|
||||
<StatementProvider type="CodeField">
|
||||
<CodeField name="columnWidths" class="java.awt.GridBagLayout"/>
|
||||
</StatementProvider>
|
||||
<Parameters>
|
||||
<CodeExpression id="2">
|
||||
<ExpressionOrigin>
|
||||
<Value type="[I" editor="org.netbeans.modules.form.layoutsupport.delegates.GridBagLayoutSupport$IntArrayPropertyEditor">
|
||||
<PropertyValue value="[0, 5, 0, 5, 0]"/>
|
||||
</Value>
|
||||
</ExpressionOrigin>
|
||||
</CodeExpression>
|
||||
</Parameters>
|
||||
</CodeStatement>
|
||||
<CodeStatement>
|
||||
<CodeExpression id="1_quotePanel2Layout"/>
|
||||
<StatementProvider type="CodeField">
|
||||
<CodeField name="rowHeights" class="java.awt.GridBagLayout"/>
|
||||
</StatementProvider>
|
||||
<Parameters>
|
||||
<CodeExpression id="3">
|
||||
<ExpressionOrigin>
|
||||
<Value type="[I" editor="org.netbeans.modules.form.layoutsupport.delegates.GridBagLayoutSupport$IntArrayPropertyEditor">
|
||||
<PropertyValue value="[0]"/>
|
||||
</Value>
|
||||
</ExpressionOrigin>
|
||||
</CodeExpression>
|
||||
</Parameters>
|
||||
</CodeStatement>
|
||||
<CodeStatement>
|
||||
<CodeExpression id="4_quotePanel2">
|
||||
<CodeVariable name="quotePanel2" type="8194" declaredType="Gui.QuotePanel"/>
|
||||
<ExpressionOrigin>
|
||||
<ExpressionProvider type="ComponentRef">
|
||||
<ComponentRef name="quotePanel2"/>
|
||||
</ExpressionProvider>
|
||||
</ExpressionOrigin>
|
||||
</CodeExpression>
|
||||
<StatementProvider type="CodeMethod">
|
||||
<CodeMethod name="setLayout" class="java.awt.Container" parameterTypes="java.awt.LayoutManager"/>
|
||||
</StatementProvider>
|
||||
<Parameters>
|
||||
<CodeExpression id="1_quotePanel2Layout"/>
|
||||
</Parameters>
|
||||
</CodeStatement>
|
||||
</LayoutCode>
|
||||
</Container>
|
||||
</SubComponents>
|
||||
<LayoutCode>
|
||||
<CodeStatement>
|
||||
<CodeExpression id="5_layout">
|
||||
<CodeVariable name="layout" type="4096" declaredType="java.awt.GridBagLayout"/>
|
||||
<ExpressionOrigin>
|
||||
<ExpressionProvider type="CodeConstructor">
|
||||
<CodeConstructor class="java.awt.GridBagLayout" parameterTypes=""/>
|
||||
</ExpressionProvider>
|
||||
</ExpressionOrigin>
|
||||
</CodeExpression>
|
||||
<StatementProvider type="CodeExpression">
|
||||
<CodeExpression id="5_layout"/>
|
||||
</StatementProvider>
|
||||
</CodeStatement>
|
||||
<CodeStatement>
|
||||
<CodeExpression id="5_layout"/>
|
||||
<StatementProvider type="CodeField">
|
||||
<CodeField name="columnWidths" class="java.awt.GridBagLayout"/>
|
||||
</StatementProvider>
|
||||
<Parameters>
|
||||
<CodeExpression id="6">
|
||||
<ExpressionOrigin>
|
||||
<Value type="[I" editor="org.netbeans.modules.form.layoutsupport.delegates.GridBagLayoutSupport$IntArrayPropertyEditor">
|
||||
<PropertyValue value="[0]"/>
|
||||
</Value>
|
||||
</ExpressionOrigin>
|
||||
</CodeExpression>
|
||||
</Parameters>
|
||||
</CodeStatement>
|
||||
<CodeStatement>
|
||||
<CodeExpression id="5_layout"/>
|
||||
<StatementProvider type="CodeField">
|
||||
<CodeField name="rowHeights" class="java.awt.GridBagLayout"/>
|
||||
</StatementProvider>
|
||||
<Parameters>
|
||||
<CodeExpression id="7">
|
||||
<ExpressionOrigin>
|
||||
<Value type="[I" editor="org.netbeans.modules.form.layoutsupport.delegates.GridBagLayoutSupport$IntArrayPropertyEditor">
|
||||
<PropertyValue value="[0, 5, 0, 5, 0]"/>
|
||||
</Value>
|
||||
</ExpressionOrigin>
|
||||
</CodeExpression>
|
||||
</Parameters>
|
||||
</CodeStatement>
|
||||
<CodeStatement>
|
||||
<CodeExpression id="8">
|
||||
<ExpressionOrigin>
|
||||
<ExpressionProvider type="ComponentRef">
|
||||
<ComponentRef name="."/>
|
||||
</ExpressionProvider>
|
||||
</ExpressionOrigin>
|
||||
</CodeExpression>
|
||||
<StatementProvider type="CodeMethod">
|
||||
<CodeMethod name="setLayout" class="java.awt.Container" parameterTypes="java.awt.LayoutManager"/>
|
||||
</StatementProvider>
|
||||
<Parameters>
|
||||
<CodeExpression id="5_layout"/>
|
||||
</Parameters>
|
||||
</CodeStatement>
|
||||
<CodeStatement>
|
||||
<CodeExpression id="9_gridBagConstraints">
|
||||
<CodeVariable name="gridBagConstraints" type="20480" declaredType="java.awt.GridBagConstraints"/>
|
||||
<ExpressionOrigin>
|
||||
<ExpressionProvider type="CodeConstructor">
|
||||
<CodeConstructor class="java.awt.GridBagConstraints" parameterTypes=""/>
|
||||
</ExpressionProvider>
|
||||
</ExpressionOrigin>
|
||||
</CodeExpression>
|
||||
<StatementProvider type="CodeExpression">
|
||||
<CodeExpression id="9_gridBagConstraints"/>
|
||||
</StatementProvider>
|
||||
</CodeStatement>
|
||||
<CodeStatement>
|
||||
<CodeExpression id="9_gridBagConstraints"/>
|
||||
<StatementProvider type="CodeField">
|
||||
<CodeField name="gridx" class="java.awt.GridBagConstraints"/>
|
||||
</StatementProvider>
|
||||
<Parameters>
|
||||
<CodeExpression id="10">
|
||||
<ExpressionOrigin>
|
||||
<Value type="int" value="0"/>
|
||||
</ExpressionOrigin>
|
||||
</CodeExpression>
|
||||
</Parameters>
|
||||
</CodeStatement>
|
||||
<CodeStatement>
|
||||
<CodeExpression id="9_gridBagConstraints"/>
|
||||
<StatementProvider type="CodeField">
|
||||
<CodeField name="gridy" class="java.awt.GridBagConstraints"/>
|
||||
</StatementProvider>
|
||||
<Parameters>
|
||||
<CodeExpression id="11">
|
||||
<ExpressionOrigin>
|
||||
<Value type="int" value="0"/>
|
||||
</ExpressionOrigin>
|
||||
</CodeExpression>
|
||||
</Parameters>
|
||||
</CodeStatement>
|
||||
<CodeStatement>
|
||||
<CodeExpression id="9_gridBagConstraints"/>
|
||||
<StatementProvider type="CodeField">
|
||||
<CodeField name="fill" class="java.awt.GridBagConstraints"/>
|
||||
</StatementProvider>
|
||||
<Parameters>
|
||||
<CodeExpression id="12">
|
||||
<ExpressionOrigin>
|
||||
<Value type="int" value="1"/>
|
||||
</ExpressionOrigin>
|
||||
</CodeExpression>
|
||||
</Parameters>
|
||||
</CodeStatement>
|
||||
<CodeStatement>
|
||||
<CodeExpression id="9_gridBagConstraints"/>
|
||||
<StatementProvider type="CodeField">
|
||||
<CodeField name="weightx" class="java.awt.GridBagConstraints"/>
|
||||
</StatementProvider>
|
||||
<Parameters>
|
||||
<CodeExpression id="13">
|
||||
<ExpressionOrigin>
|
||||
<Value type="double" value="1.0"/>
|
||||
</ExpressionOrigin>
|
||||
</CodeExpression>
|
||||
</Parameters>
|
||||
</CodeStatement>
|
||||
<CodeStatement>
|
||||
<CodeExpression id="9_gridBagConstraints"/>
|
||||
<StatementProvider type="CodeField">
|
||||
<CodeField name="weighty" class="java.awt.GridBagConstraints"/>
|
||||
</StatementProvider>
|
||||
<Parameters>
|
||||
<CodeExpression id="14">
|
||||
<ExpressionOrigin>
|
||||
<Value type="double" value="1.0"/>
|
||||
</ExpressionOrigin>
|
||||
</CodeExpression>
|
||||
</Parameters>
|
||||
</CodeStatement>
|
||||
<CodeStatement>
|
||||
<CodeExpression id="8"/>
|
||||
<StatementProvider type="CodeMethod">
|
||||
<CodeMethod name="add" class="java.awt.Container" parameterTypes="java.awt.Component, java.lang.Object"/>
|
||||
</StatementProvider>
|
||||
<Parameters>
|
||||
<CodeExpression id="15_askBook1">
|
||||
<CodeVariable name="askBook1" type="8194" declaredType="Gui.AskBook"/>
|
||||
<ExpressionOrigin>
|
||||
<ExpressionProvider type="ComponentRef">
|
||||
<ComponentRef name="askBook1"/>
|
||||
</ExpressionProvider>
|
||||
</ExpressionOrigin>
|
||||
</CodeExpression>
|
||||
<CodeExpression id="9_gridBagConstraints"/>
|
||||
</Parameters>
|
||||
</CodeStatement>
|
||||
<CodeStatement>
|
||||
<CodeExpression id="16_gridBagConstraints">
|
||||
<CodeVariable name="gridBagConstraints"/>
|
||||
<ExpressionOrigin>
|
||||
<ExpressionProvider type="CodeConstructor">
|
||||
<CodeConstructor class="java.awt.GridBagConstraints" parameterTypes=""/>
|
||||
</ExpressionProvider>
|
||||
</ExpressionOrigin>
|
||||
</CodeExpression>
|
||||
<StatementProvider type="CodeExpression">
|
||||
<CodeExpression id="16_gridBagConstraints"/>
|
||||
</StatementProvider>
|
||||
</CodeStatement>
|
||||
<CodeStatement>
|
||||
<CodeExpression id="16_gridBagConstraints"/>
|
||||
<StatementProvider type="CodeField">
|
||||
<CodeField name="gridx" class="java.awt.GridBagConstraints"/>
|
||||
</StatementProvider>
|
||||
<Parameters>
|
||||
<CodeExpression id="17">
|
||||
<ExpressionOrigin>
|
||||
<Value type="int" value="0"/>
|
||||
</ExpressionOrigin>
|
||||
</CodeExpression>
|
||||
</Parameters>
|
||||
</CodeStatement>
|
||||
<CodeStatement>
|
||||
<CodeExpression id="16_gridBagConstraints"/>
|
||||
<StatementProvider type="CodeField">
|
||||
<CodeField name="gridy" class="java.awt.GridBagConstraints"/>
|
||||
</StatementProvider>
|
||||
<Parameters>
|
||||
<CodeExpression id="18">
|
||||
<ExpressionOrigin>
|
||||
<Value type="int" value="4"/>
|
||||
</ExpressionOrigin>
|
||||
</CodeExpression>
|
||||
</Parameters>
|
||||
</CodeStatement>
|
||||
<CodeStatement>
|
||||
<CodeExpression id="16_gridBagConstraints"/>
|
||||
<StatementProvider type="CodeField">
|
||||
<CodeField name="fill" class="java.awt.GridBagConstraints"/>
|
||||
</StatementProvider>
|
||||
<Parameters>
|
||||
<CodeExpression id="19">
|
||||
<ExpressionOrigin>
|
||||
<Value type="int" value="1"/>
|
||||
</ExpressionOrigin>
|
||||
</CodeExpression>
|
||||
</Parameters>
|
||||
</CodeStatement>
|
||||
<CodeStatement>
|
||||
<CodeExpression id="16_gridBagConstraints"/>
|
||||
<StatementProvider type="CodeField">
|
||||
<CodeField name="weightx" class="java.awt.GridBagConstraints"/>
|
||||
</StatementProvider>
|
||||
<Parameters>
|
||||
<CodeExpression id="20">
|
||||
<ExpressionOrigin>
|
||||
<Value type="double" value="1.0"/>
|
||||
</ExpressionOrigin>
|
||||
</CodeExpression>
|
||||
</Parameters>
|
||||
</CodeStatement>
|
||||
<CodeStatement>
|
||||
<CodeExpression id="16_gridBagConstraints"/>
|
||||
<StatementProvider type="CodeField">
|
||||
<CodeField name="weighty" class="java.awt.GridBagConstraints"/>
|
||||
</StatementProvider>
|
||||
<Parameters>
|
||||
<CodeExpression id="21">
|
||||
<ExpressionOrigin>
|
||||
<Value type="double" value="1.0"/>
|
||||
</ExpressionOrigin>
|
||||
</CodeExpression>
|
||||
</Parameters>
|
||||
</CodeStatement>
|
||||
<CodeStatement>
|
||||
<CodeExpression id="8"/>
|
||||
<StatementProvider type="CodeMethod">
|
||||
<CodeMethod name="add" class="java.awt.Container" parameterTypes="java.awt.Component, java.lang.Object"/>
|
||||
</StatementProvider>
|
||||
<Parameters>
|
||||
<CodeExpression id="22_bidBook1">
|
||||
<CodeVariable name="bidBook1" type="8194" declaredType="Gui.BidBook"/>
|
||||
<ExpressionOrigin>
|
||||
<ExpressionProvider type="ComponentRef">
|
||||
<ComponentRef name="bidBook1"/>
|
||||
</ExpressionProvider>
|
||||
</ExpressionOrigin>
|
||||
</CodeExpression>
|
||||
<CodeExpression id="16_gridBagConstraints"/>
|
||||
</Parameters>
|
||||
</CodeStatement>
|
||||
<CodeStatement>
|
||||
<CodeExpression id="23_gridBagConstraints">
|
||||
<CodeVariable name="gridBagConstraints"/>
|
||||
<ExpressionOrigin>
|
||||
<ExpressionProvider type="CodeConstructor">
|
||||
<CodeConstructor class="java.awt.GridBagConstraints" parameterTypes=""/>
|
||||
</ExpressionProvider>
|
||||
</ExpressionOrigin>
|
||||
</CodeExpression>
|
||||
<StatementProvider type="CodeExpression">
|
||||
<CodeExpression id="23_gridBagConstraints"/>
|
||||
</StatementProvider>
|
||||
</CodeStatement>
|
||||
<CodeStatement>
|
||||
<CodeExpression id="23_gridBagConstraints"/>
|
||||
<StatementProvider type="CodeField">
|
||||
<CodeField name="gridx" class="java.awt.GridBagConstraints"/>
|
||||
</StatementProvider>
|
||||
<Parameters>
|
||||
<CodeExpression id="24">
|
||||
<ExpressionOrigin>
|
||||
<Value type="int" value="0"/>
|
||||
</ExpressionOrigin>
|
||||
</CodeExpression>
|
||||
</Parameters>
|
||||
</CodeStatement>
|
||||
<CodeStatement>
|
||||
<CodeExpression id="23_gridBagConstraints"/>
|
||||
<StatementProvider type="CodeField">
|
||||
<CodeField name="gridy" class="java.awt.GridBagConstraints"/>
|
||||
</StatementProvider>
|
||||
<Parameters>
|
||||
<CodeExpression id="25">
|
||||
<ExpressionOrigin>
|
||||
<Value type="int" value="2"/>
|
||||
</ExpressionOrigin>
|
||||
</CodeExpression>
|
||||
</Parameters>
|
||||
</CodeStatement>
|
||||
<CodeStatement>
|
||||
<CodeExpression id="23_gridBagConstraints"/>
|
||||
<StatementProvider type="CodeField">
|
||||
<CodeField name="fill" class="java.awt.GridBagConstraints"/>
|
||||
</StatementProvider>
|
||||
<Parameters>
|
||||
<CodeExpression id="26">
|
||||
<ExpressionOrigin>
|
||||
<Value type="int" value="1"/>
|
||||
</ExpressionOrigin>
|
||||
</CodeExpression>
|
||||
</Parameters>
|
||||
</CodeStatement>
|
||||
<CodeStatement>
|
||||
<CodeExpression id="23_gridBagConstraints"/>
|
||||
<StatementProvider type="CodeField">
|
||||
<CodeField name="weightx" class="java.awt.GridBagConstraints"/>
|
||||
</StatementProvider>
|
||||
<Parameters>
|
||||
<CodeExpression id="27">
|
||||
<ExpressionOrigin>
|
||||
<Value type="double" value="0.5"/>
|
||||
</ExpressionOrigin>
|
||||
</CodeExpression>
|
||||
</Parameters>
|
||||
</CodeStatement>
|
||||
<CodeStatement>
|
||||
<CodeExpression id="23_gridBagConstraints"/>
|
||||
<StatementProvider type="CodeField">
|
||||
<CodeField name="weighty" class="java.awt.GridBagConstraints"/>
|
||||
</StatementProvider>
|
||||
<Parameters>
|
||||
<CodeExpression id="28">
|
||||
<ExpressionOrigin>
|
||||
<Value type="double" value="0.5"/>
|
||||
</ExpressionOrigin>
|
||||
</CodeExpression>
|
||||
</Parameters>
|
||||
</CodeStatement>
|
||||
<CodeStatement>
|
||||
<CodeExpression id="8"/>
|
||||
<StatementProvider type="CodeMethod">
|
||||
<CodeMethod name="add" class="java.awt.Container" parameterTypes="java.awt.Component, java.lang.Object"/>
|
||||
</StatementProvider>
|
||||
<Parameters>
|
||||
<CodeExpression id="4_quotePanel2"/>
|
||||
<CodeExpression id="23_gridBagConstraints"/>
|
||||
</Parameters>
|
||||
</CodeStatement>
|
||||
</LayoutCode>
|
||||
</Form>
|
||||
|
@ -64,29 +64,24 @@ public class OrderBookPanel extends javax.swing.JPanel {
|
||||
java.awt.GridBagConstraints gridBagConstraints;
|
||||
|
||||
askBook1 = new Gui.AskBook();
|
||||
jLabel4 = new javax.swing.JLabel();
|
||||
bidBook1 = new Gui.BidBook();
|
||||
quotePanel2 = new Gui.QuotePanel();
|
||||
|
||||
setPreferredSize(new java.awt.Dimension(220, 262));
|
||||
setLayout(new java.awt.GridBagLayout());
|
||||
java.awt.GridBagLayout layout = new java.awt.GridBagLayout();
|
||||
layout.columnWidths = new int[] {0};
|
||||
layout.rowHeights = new int[] {0, 5, 0, 5, 0};
|
||||
setLayout(layout);
|
||||
|
||||
askBook1.setPreferredSize(new java.awt.Dimension(200, 200));
|
||||
gridBagConstraints = new java.awt.GridBagConstraints();
|
||||
gridBagConstraints.gridx = 0;
|
||||
gridBagConstraints.gridy = 0;
|
||||
gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
|
||||
gridBagConstraints.weightx = 1.0;
|
||||
gridBagConstraints.weighty = 1.0;
|
||||
add(askBook1, gridBagConstraints);
|
||||
|
||||
jLabel4.setText("123.00");
|
||||
jLabel4.setPreferredSize(new java.awt.Dimension(150, 25));
|
||||
gridBagConstraints = new java.awt.GridBagConstraints();
|
||||
gridBagConstraints.gridx = 0;
|
||||
gridBagConstraints.gridy = 1;
|
||||
gridBagConstraints.gridheight = 3;
|
||||
gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
|
||||
gridBagConstraints.weighty = 1.0;
|
||||
add(jLabel4, gridBagConstraints);
|
||||
|
||||
bidBook1.setPreferredSize(new java.awt.Dimension(200, 200));
|
||||
gridBagConstraints = new java.awt.GridBagConstraints();
|
||||
gridBagConstraints.gridx = 0;
|
||||
@ -95,12 +90,22 @@ public class OrderBookPanel extends javax.swing.JPanel {
|
||||
gridBagConstraints.weightx = 1.0;
|
||||
gridBagConstraints.weighty = 1.0;
|
||||
add(bidBook1, gridBagConstraints);
|
||||
|
||||
quotePanel2.setOpaque(false);
|
||||
quotePanel2.setPreferredSize(new java.awt.Dimension(587, 200));
|
||||
gridBagConstraints = new java.awt.GridBagConstraints();
|
||||
gridBagConstraints.gridx = 0;
|
||||
gridBagConstraints.gridy = 2;
|
||||
gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
|
||||
gridBagConstraints.weightx = 0.5;
|
||||
gridBagConstraints.weighty = 0.5;
|
||||
add(quotePanel2, gridBagConstraints);
|
||||
}// </editor-fold>//GEN-END:initComponents
|
||||
|
||||
|
||||
// Variables declaration - do not modify//GEN-BEGIN:variables
|
||||
private Gui.AskBook askBook1;
|
||||
private Gui.BidBook bidBook1;
|
||||
private javax.swing.JLabel jLabel4;
|
||||
private Gui.QuotePanel quotePanel2;
|
||||
// End of variables declaration//GEN-END:variables
|
||||
}
|
||||
|
326
src/Gui/QuotePanel.form
Normal file
326
src/Gui/QuotePanel.form
Normal file
@ -0,0 +1,326 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
|
||||
<Form version="1.8" 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"/>
|
||||
<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,0,66,0,0,1,99"/>
|
||||
</AuxValues>
|
||||
<SubComponents>
|
||||
<Component class="javax.swing.JLabel" name="jLabel2">
|
||||
<Constraints>
|
||||
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout" value="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout$GridBagConstraintsDescription">
|
||||
<GridBagConstraints gridX="0" gridY="0" gridWidth="1" gridHeight="1" fill="0" ipadX="0" ipadY="0" insetsTop="0" insetsLeft="0" insetsBottom="0" insetsRight="0" anchor="10" weightX="0.0" weightY="0.0"/>
|
||||
</Constraint>
|
||||
</Constraints>
|
||||
</Component>
|
||||
<Component class="javax.swing.JLabel" name="lastPrice">
|
||||
<Properties>
|
||||
<Property name="font" type="java.awt.Font" editor="org.netbeans.modules.form.editors2.FontEditor">
|
||||
<FontInfo relative="true">
|
||||
<Font bold="true" component="lastPrice" property="font" relativeSize="true" size="4"/>
|
||||
</FontInfo>
|
||||
</Property>
|
||||
<Property name="horizontalAlignment" type="int" value="0"/>
|
||||
<Property name="text" type="java.lang.String" value="0.00"/>
|
||||
<Property name="opaque" type="boolean" value="true"/>
|
||||
</Properties>
|
||||
<Constraints>
|
||||
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout" value="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout$GridBagConstraintsDescription">
|
||||
<GridBagConstraints gridX="2" gridY="0" gridWidth="1" gridHeight="1" fill="1" ipadX="0" ipadY="0" insetsTop="0" insetsLeft="0" insetsBottom="0" insetsRight="0" anchor="10" weightX="0.9" weightY="0.9"/>
|
||||
</Constraint>
|
||||
</Constraints>
|
||||
</Component>
|
||||
<Component class="javax.swing.JLabel" name="jLabel3">
|
||||
<Properties>
|
||||
<Property name="preferredSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
|
||||
<Dimension value="[30, 18]"/>
|
||||
</Property>
|
||||
</Properties>
|
||||
<Constraints>
|
||||
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout" value="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout$GridBagConstraintsDescription">
|
||||
<GridBagConstraints gridX="4" gridY="0" gridWidth="1" gridHeight="1" fill="0" ipadX="0" ipadY="0" insetsTop="0" insetsLeft="0" insetsBottom="0" insetsRight="0" anchor="10" weightX="0.0" weightY="0.0"/>
|
||||
</Constraint>
|
||||
</Constraints>
|
||||
</Component>
|
||||
</SubComponents>
|
||||
<LayoutCode>
|
||||
<CodeStatement>
|
||||
<CodeExpression id="1_layout">
|
||||
<CodeVariable name="layout" type="4096" declaredType="java.awt.GridBagLayout"/>
|
||||
<ExpressionOrigin>
|
||||
<ExpressionProvider type="CodeConstructor">
|
||||
<CodeConstructor class="java.awt.GridBagLayout" parameterTypes=""/>
|
||||
</ExpressionProvider>
|
||||
</ExpressionOrigin>
|
||||
</CodeExpression>
|
||||
<StatementProvider type="CodeExpression">
|
||||
<CodeExpression id="1_layout"/>
|
||||
</StatementProvider>
|
||||
</CodeStatement>
|
||||
<CodeStatement>
|
||||
<CodeExpression id="1_layout"/>
|
||||
<StatementProvider type="CodeField">
|
||||
<CodeField name="columnWidths" class="java.awt.GridBagLayout"/>
|
||||
</StatementProvider>
|
||||
<Parameters>
|
||||
<CodeExpression id="2">
|
||||
<ExpressionOrigin>
|
||||
<Value type="[I" editor="org.netbeans.modules.form.layoutsupport.delegates.GridBagLayoutSupport$IntArrayPropertyEditor">
|
||||
<PropertyValue value="[0, 5, 0, 5, 0]"/>
|
||||
</Value>
|
||||
</ExpressionOrigin>
|
||||
</CodeExpression>
|
||||
</Parameters>
|
||||
</CodeStatement>
|
||||
<CodeStatement>
|
||||
<CodeExpression id="1_layout"/>
|
||||
<StatementProvider type="CodeField">
|
||||
<CodeField name="rowHeights" class="java.awt.GridBagLayout"/>
|
||||
</StatementProvider>
|
||||
<Parameters>
|
||||
<CodeExpression id="3">
|
||||
<ExpressionOrigin>
|
||||
<Value type="[I" editor="org.netbeans.modules.form.layoutsupport.delegates.GridBagLayoutSupport$IntArrayPropertyEditor">
|
||||
<PropertyValue value="[0]"/>
|
||||
</Value>
|
||||
</ExpressionOrigin>
|
||||
</CodeExpression>
|
||||
</Parameters>
|
||||
</CodeStatement>
|
||||
<CodeStatement>
|
||||
<CodeExpression id="4">
|
||||
<ExpressionOrigin>
|
||||
<ExpressionProvider type="ComponentRef">
|
||||
<ComponentRef name="."/>
|
||||
</ExpressionProvider>
|
||||
</ExpressionOrigin>
|
||||
</CodeExpression>
|
||||
<StatementProvider type="CodeMethod">
|
||||
<CodeMethod name="setLayout" class="java.awt.Container" parameterTypes="java.awt.LayoutManager"/>
|
||||
</StatementProvider>
|
||||
<Parameters>
|
||||
<CodeExpression id="1_layout"/>
|
||||
</Parameters>
|
||||
</CodeStatement>
|
||||
<CodeStatement>
|
||||
<CodeExpression id="5_gridBagConstraints">
|
||||
<CodeVariable name="gridBagConstraints" type="20480" declaredType="java.awt.GridBagConstraints"/>
|
||||
<ExpressionOrigin>
|
||||
<ExpressionProvider type="CodeConstructor">
|
||||
<CodeConstructor class="java.awt.GridBagConstraints" parameterTypes=""/>
|
||||
</ExpressionProvider>
|
||||
</ExpressionOrigin>
|
||||
</CodeExpression>
|
||||
<StatementProvider type="CodeExpression">
|
||||
<CodeExpression id="5_gridBagConstraints"/>
|
||||
</StatementProvider>
|
||||
</CodeStatement>
|
||||
<CodeStatement>
|
||||
<CodeExpression id="5_gridBagConstraints"/>
|
||||
<StatementProvider type="CodeField">
|
||||
<CodeField name="gridx" class="java.awt.GridBagConstraints"/>
|
||||
</StatementProvider>
|
||||
<Parameters>
|
||||
<CodeExpression id="6">
|
||||
<ExpressionOrigin>
|
||||
<Value type="int" value="0"/>
|
||||
</ExpressionOrigin>
|
||||
</CodeExpression>
|
||||
</Parameters>
|
||||
</CodeStatement>
|
||||
<CodeStatement>
|
||||
<CodeExpression id="5_gridBagConstraints"/>
|
||||
<StatementProvider type="CodeField">
|
||||
<CodeField name="gridy" class="java.awt.GridBagConstraints"/>
|
||||
</StatementProvider>
|
||||
<Parameters>
|
||||
<CodeExpression id="7">
|
||||
<ExpressionOrigin>
|
||||
<Value type="int" value="0"/>
|
||||
</ExpressionOrigin>
|
||||
</CodeExpression>
|
||||
</Parameters>
|
||||
</CodeStatement>
|
||||
<CodeStatement>
|
||||
<CodeExpression id="4"/>
|
||||
<StatementProvider type="CodeMethod">
|
||||
<CodeMethod name="add" class="java.awt.Container" parameterTypes="java.awt.Component, java.lang.Object"/>
|
||||
</StatementProvider>
|
||||
<Parameters>
|
||||
<CodeExpression id="8_jLabel2">
|
||||
<CodeVariable name="jLabel2" type="8194" declaredType="javax.swing.JLabel"/>
|
||||
<ExpressionOrigin>
|
||||
<ExpressionProvider type="ComponentRef">
|
||||
<ComponentRef name="jLabel2"/>
|
||||
</ExpressionProvider>
|
||||
</ExpressionOrigin>
|
||||
</CodeExpression>
|
||||
<CodeExpression id="5_gridBagConstraints"/>
|
||||
</Parameters>
|
||||
</CodeStatement>
|
||||
<CodeStatement>
|
||||
<CodeExpression id="9_gridBagConstraints">
|
||||
<CodeVariable name="gridBagConstraints"/>
|
||||
<ExpressionOrigin>
|
||||
<ExpressionProvider type="CodeConstructor">
|
||||
<CodeConstructor class="java.awt.GridBagConstraints" parameterTypes=""/>
|
||||
</ExpressionProvider>
|
||||
</ExpressionOrigin>
|
||||
</CodeExpression>
|
||||
<StatementProvider type="CodeExpression">
|
||||
<CodeExpression id="9_gridBagConstraints"/>
|
||||
</StatementProvider>
|
||||
</CodeStatement>
|
||||
<CodeStatement>
|
||||
<CodeExpression id="9_gridBagConstraints"/>
|
||||
<StatementProvider type="CodeField">
|
||||
<CodeField name="gridx" class="java.awt.GridBagConstraints"/>
|
||||
</StatementProvider>
|
||||
<Parameters>
|
||||
<CodeExpression id="10">
|
||||
<ExpressionOrigin>
|
||||
<Value type="int" value="2"/>
|
||||
</ExpressionOrigin>
|
||||
</CodeExpression>
|
||||
</Parameters>
|
||||
</CodeStatement>
|
||||
<CodeStatement>
|
||||
<CodeExpression id="9_gridBagConstraints"/>
|
||||
<StatementProvider type="CodeField">
|
||||
<CodeField name="gridy" class="java.awt.GridBagConstraints"/>
|
||||
</StatementProvider>
|
||||
<Parameters>
|
||||
<CodeExpression id="11">
|
||||
<ExpressionOrigin>
|
||||
<Value type="int" value="0"/>
|
||||
</ExpressionOrigin>
|
||||
</CodeExpression>
|
||||
</Parameters>
|
||||
</CodeStatement>
|
||||
<CodeStatement>
|
||||
<CodeExpression id="9_gridBagConstraints"/>
|
||||
<StatementProvider type="CodeField">
|
||||
<CodeField name="fill" class="java.awt.GridBagConstraints"/>
|
||||
</StatementProvider>
|
||||
<Parameters>
|
||||
<CodeExpression id="12">
|
||||
<ExpressionOrigin>
|
||||
<Value type="int" value="1"/>
|
||||
</ExpressionOrigin>
|
||||
</CodeExpression>
|
||||
</Parameters>
|
||||
</CodeStatement>
|
||||
<CodeStatement>
|
||||
<CodeExpression id="9_gridBagConstraints"/>
|
||||
<StatementProvider type="CodeField">
|
||||
<CodeField name="weightx" class="java.awt.GridBagConstraints"/>
|
||||
</StatementProvider>
|
||||
<Parameters>
|
||||
<CodeExpression id="13">
|
||||
<ExpressionOrigin>
|
||||
<Value type="double" value="0.9"/>
|
||||
</ExpressionOrigin>
|
||||
</CodeExpression>
|
||||
</Parameters>
|
||||
</CodeStatement>
|
||||
<CodeStatement>
|
||||
<CodeExpression id="9_gridBagConstraints"/>
|
||||
<StatementProvider type="CodeField">
|
||||
<CodeField name="weighty" class="java.awt.GridBagConstraints"/>
|
||||
</StatementProvider>
|
||||
<Parameters>
|
||||
<CodeExpression id="14">
|
||||
<ExpressionOrigin>
|
||||
<Value type="double" value="0.9"/>
|
||||
</ExpressionOrigin>
|
||||
</CodeExpression>
|
||||
</Parameters>
|
||||
</CodeStatement>
|
||||
<CodeStatement>
|
||||
<CodeExpression id="4"/>
|
||||
<StatementProvider type="CodeMethod">
|
||||
<CodeMethod name="add" class="java.awt.Container" parameterTypes="java.awt.Component, java.lang.Object"/>
|
||||
</StatementProvider>
|
||||
<Parameters>
|
||||
<CodeExpression id="15_lastPrice">
|
||||
<CodeVariable name="lastPrice" type="8194" declaredType="javax.swing.JLabel"/>
|
||||
<ExpressionOrigin>
|
||||
<ExpressionProvider type="ComponentRef">
|
||||
<ComponentRef name="lastPrice"/>
|
||||
</ExpressionProvider>
|
||||
</ExpressionOrigin>
|
||||
</CodeExpression>
|
||||
<CodeExpression id="9_gridBagConstraints"/>
|
||||
</Parameters>
|
||||
</CodeStatement>
|
||||
<CodeStatement>
|
||||
<CodeExpression id="16_gridBagConstraints">
|
||||
<CodeVariable name="gridBagConstraints"/>
|
||||
<ExpressionOrigin>
|
||||
<ExpressionProvider type="CodeConstructor">
|
||||
<CodeConstructor class="java.awt.GridBagConstraints" parameterTypes=""/>
|
||||
</ExpressionProvider>
|
||||
</ExpressionOrigin>
|
||||
</CodeExpression>
|
||||
<StatementProvider type="CodeExpression">
|
||||
<CodeExpression id="16_gridBagConstraints"/>
|
||||
</StatementProvider>
|
||||
</CodeStatement>
|
||||
<CodeStatement>
|
||||
<CodeExpression id="16_gridBagConstraints"/>
|
||||
<StatementProvider type="CodeField">
|
||||
<CodeField name="gridx" class="java.awt.GridBagConstraints"/>
|
||||
</StatementProvider>
|
||||
<Parameters>
|
||||
<CodeExpression id="17">
|
||||
<ExpressionOrigin>
|
||||
<Value type="int" value="4"/>
|
||||
</ExpressionOrigin>
|
||||
</CodeExpression>
|
||||
</Parameters>
|
||||
</CodeStatement>
|
||||
<CodeStatement>
|
||||
<CodeExpression id="16_gridBagConstraints"/>
|
||||
<StatementProvider type="CodeField">
|
||||
<CodeField name="gridy" class="java.awt.GridBagConstraints"/>
|
||||
</StatementProvider>
|
||||
<Parameters>
|
||||
<CodeExpression id="18">
|
||||
<ExpressionOrigin>
|
||||
<Value type="int" value="0"/>
|
||||
</ExpressionOrigin>
|
||||
</CodeExpression>
|
||||
</Parameters>
|
||||
</CodeStatement>
|
||||
<CodeStatement>
|
||||
<CodeExpression id="4"/>
|
||||
<StatementProvider type="CodeMethod">
|
||||
<CodeMethod name="add" class="java.awt.Container" parameterTypes="java.awt.Component, java.lang.Object"/>
|
||||
</StatementProvider>
|
||||
<Parameters>
|
||||
<CodeExpression id="19_jLabel3">
|
||||
<CodeVariable name="jLabel3" type="8194" declaredType="javax.swing.JLabel"/>
|
||||
<ExpressionOrigin>
|
||||
<ExpressionProvider type="ComponentRef">
|
||||
<ComponentRef name="jLabel3"/>
|
||||
</ExpressionProvider>
|
||||
</ExpressionOrigin>
|
||||
</CodeExpression>
|
||||
<CodeExpression id="16_gridBagConstraints"/>
|
||||
</Parameters>
|
||||
</CodeStatement>
|
||||
</LayoutCode>
|
||||
</Form>
|
142
src/Gui/QuotePanel.java
Normal file
142
src/Gui/QuotePanel.java
Normal file
@ -0,0 +1,142 @@
|
||||
/*
|
||||
* 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 SeSim.Quote;
|
||||
import java.awt.Color;
|
||||
import javax.swing.SwingUtilities;
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author 7u83 <7u83@mail.ru>
|
||||
*/
|
||||
public class QuotePanel extends javax.swing.JPanel implements SeSim.Exchange.QuoteReceiver{
|
||||
|
||||
/**
|
||||
* Creates new form QuotePanel
|
||||
*/
|
||||
public QuotePanel() {
|
||||
initComponents();
|
||||
if (MainWin.se==null)
|
||||
return;
|
||||
MainWin.se.addQuoteReceiver(this);
|
||||
}
|
||||
|
||||
/**
|
||||
* 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() {
|
||||
java.awt.GridBagConstraints gridBagConstraints;
|
||||
|
||||
jLabel2 = new javax.swing.JLabel();
|
||||
lastPrice = new javax.swing.JLabel();
|
||||
jLabel3 = new javax.swing.JLabel();
|
||||
|
||||
setBorder(null);
|
||||
java.awt.GridBagLayout layout = new java.awt.GridBagLayout();
|
||||
layout.columnWidths = new int[] {0, 5, 0, 5, 0};
|
||||
layout.rowHeights = new int[] {0};
|
||||
setLayout(layout);
|
||||
gridBagConstraints = new java.awt.GridBagConstraints();
|
||||
gridBagConstraints.gridx = 0;
|
||||
gridBagConstraints.gridy = 0;
|
||||
add(jLabel2, gridBagConstraints);
|
||||
|
||||
lastPrice.setFont(lastPrice.getFont().deriveFont(lastPrice.getFont().getStyle() | java.awt.Font.BOLD, lastPrice.getFont().getSize()+4));
|
||||
lastPrice.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
|
||||
lastPrice.setText("0.00");
|
||||
lastPrice.setOpaque(true);
|
||||
gridBagConstraints = new java.awt.GridBagConstraints();
|
||||
gridBagConstraints.gridx = 2;
|
||||
gridBagConstraints.gridy = 0;
|
||||
gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
|
||||
gridBagConstraints.weightx = 0.9;
|
||||
gridBagConstraints.weighty = 0.9;
|
||||
add(lastPrice, gridBagConstraints);
|
||||
|
||||
jLabel3.setPreferredSize(new java.awt.Dimension(30, 18));
|
||||
gridBagConstraints = new java.awt.GridBagConstraints();
|
||||
gridBagConstraints.gridx = 4;
|
||||
gridBagConstraints.gridy = 0;
|
||||
add(jLabel3, gridBagConstraints);
|
||||
}// </editor-fold>//GEN-END:initComponents
|
||||
|
||||
|
||||
// Variables declaration - do not modify//GEN-BEGIN:variables
|
||||
private javax.swing.JLabel jLabel2;
|
||||
private javax.swing.JLabel jLabel3;
|
||||
private javax.swing.JLabel lastPrice;
|
||||
// End of variables declaration//GEN-END:variables
|
||||
|
||||
@Override
|
||||
public void UpdateQuote(Quote q) {
|
||||
class Updater implements Runnable {
|
||||
QuotePanel qp;
|
||||
String text="";
|
||||
Color color = Color.BLUE;
|
||||
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
qp.lastPrice.setText(text);
|
||||
qp.lastPrice.setForeground(color);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
Updater u= new Updater();
|
||||
u.qp=this;
|
||||
|
||||
if (q.price==q.bid){
|
||||
u.color=new Color(172,0,0);
|
||||
}
|
||||
if (q.price==q.ask){
|
||||
u.color=new Color(0,120,0); //.; //new Color(30,0,0);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
u.text = String.format("%.2f\n(%d)", q.price,q.volume);
|
||||
|
||||
SwingUtilities.invokeLater(u);
|
||||
|
||||
// SortedSet s = MainWin.se.getQuoteHistory(5);
|
||||
|
||||
// System.out.print(
|
||||
// "SortedSet size:"
|
||||
// +s.size()
|
||||
// +"\n"
|
||||
// );
|
||||
|
||||
//this.lastPrice.setText(lp);
|
||||
}
|
||||
}
|
@ -15,7 +15,7 @@ public class Exchange extends Thread {
|
||||
/**
|
||||
* Histrory of quotes
|
||||
*/
|
||||
public ArrayList<Quote> quoteHistory;
|
||||
public TreeSet<Quote> quoteHistory = new TreeSet<>();
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
@ -24,35 +24,20 @@ public class Exchange extends Thread {
|
||||
this.ask = new TreeSet<>();
|
||||
this.bid = new TreeSet<>();
|
||||
this.qrlist = new ArrayList<>();
|
||||
this.quoteHistory = new ArrayList<>();
|
||||
|
||||
}
|
||||
|
||||
public SortedSet <Quote> getQuoteHistory(int seconds){
|
||||
long ct = System.currentTimeMillis() - seconds * 1000;
|
||||
Quote e = new Quote();
|
||||
e.time=ct;
|
||||
SortedSet<Quote> l = quoteHistory.tailSet(e);
|
||||
return l;
|
||||
|
||||
}
|
||||
|
||||
// Class to describe an executed order
|
||||
public class Quote {
|
||||
|
||||
double bid;
|
||||
double bid_volume;
|
||||
double ask;
|
||||
double ask_volume;
|
||||
|
||||
public double price;
|
||||
public long volume;
|
||||
public long time;
|
||||
|
||||
public void print(){
|
||||
System.out.print("Quite ("
|
||||
+time
|
||||
+") :"
|
||||
+price
|
||||
+" / "
|
||||
+volume
|
||||
+"\n"
|
||||
);
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
// QuoteReceiver has to be implemented by objects that wants
|
||||
// to receive quote updates
|
||||
@ -97,7 +82,7 @@ public class Exchange extends Thread {
|
||||
i.next().UpdateOrderBook();
|
||||
}
|
||||
try {
|
||||
sleep(0);
|
||||
sleep(10);
|
||||
} catch (InterruptedException e) {
|
||||
System.out.println("I was Interrupted");
|
||||
}
|
||||
@ -315,6 +300,10 @@ public class Exchange extends Thread {
|
||||
q.price = price;
|
||||
q.time = System.currentTimeMillis();
|
||||
|
||||
q.ask=a.limit;
|
||||
q.bid=b.limit;
|
||||
|
||||
|
||||
this.UpdateQuoteReceivers(q);
|
||||
this.updateBookReceivers(OrderType.bid);
|
||||
this.updateBookReceivers(OrderType.ask);
|
||||
@ -328,7 +317,7 @@ public class Exchange extends Thread {
|
||||
);
|
||||
*/
|
||||
|
||||
//quoteHistory.add(q);
|
||||
quoteHistory.add(q);
|
||||
continue;
|
||||
|
||||
}
|
||||
|
60
src/SeSim/Quote.java
Normal file
60
src/SeSim/Quote.java
Normal file
@ -0,0 +1,60 @@
|
||||
/*
|
||||
* 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 SeSim;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author 7u83 <7u83@mail.ru>
|
||||
*/
|
||||
public class Quote implements Comparable {
|
||||
|
||||
public double bid;
|
||||
public double bid_volume;
|
||||
public double ask;
|
||||
public double ask_volume;
|
||||
|
||||
public double price;
|
||||
public long volume;
|
||||
public long time;
|
||||
|
||||
public void print() {
|
||||
System.out.print("Quote ("
|
||||
+ time
|
||||
+ ") :"
|
||||
+ price
|
||||
+ " / "
|
||||
+ volume
|
||||
+ "\n"
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public int compareTo(Object o) {
|
||||
Quote q = (Quote)o;
|
||||
return (int)(this.time-q.time);
|
||||
}
|
||||
}
|
@ -33,6 +33,10 @@ import SeSim.TraderConfig;
|
||||
|
||||
public class RandomTrader extends AutoTrader {
|
||||
|
||||
protected enum Action {
|
||||
sell,buy
|
||||
}
|
||||
|
||||
// config for this trader
|
||||
final private RandomTraderConfig myconfig;
|
||||
|
||||
@ -75,7 +79,6 @@ public class RandomTrader extends AutoTrader {
|
||||
return getRandom(min, max);
|
||||
}
|
||||
|
||||
|
||||
public boolean waitForOrder(long seconds) {
|
||||
|
||||
for (int i = 0; (i < seconds) && (0 != account.pending.size()); i++) {
|
||||
@ -90,8 +93,6 @@ public class RandomTrader extends AutoTrader {
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
|
||||
public boolean doBuy() {
|
||||
|
||||
double money = getRandomAmmount(account.money, myconfig.sell_volume);
|
||||
@ -100,16 +101,14 @@ public class RandomTrader extends AutoTrader {
|
||||
double limit;
|
||||
limit = lp + getRandomAmmount(lp, myconfig.buy_limit);
|
||||
|
||||
|
||||
long volume = (int) (money / (limit * 1));
|
||||
if (volume<=0)
|
||||
if (volume <= 0) {
|
||||
return false;
|
||||
|
||||
}
|
||||
|
||||
buy(volume, limit);
|
||||
return waitForOrder(getRandom(myconfig.buy_order_wait));
|
||||
|
||||
|
||||
}
|
||||
|
||||
public boolean doSell() {
|
||||
@ -149,7 +148,6 @@ public class RandomTrader extends AutoTrader {
|
||||
return true;
|
||||
}
|
||||
*/
|
||||
|
||||
public void trade() {
|
||||
|
||||
float am[] = {-10, 200};
|
||||
@ -187,12 +185,24 @@ public class RandomTrader extends AutoTrader {
|
||||
*/
|
||||
}
|
||||
|
||||
protected Action getAction() {
|
||||
if (rand.nextInt(2)==0){
|
||||
return Action.buy;
|
||||
}
|
||||
else{
|
||||
return Action.sell;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
// System.out.print("Starting Random Trader\n");
|
||||
while (true) {
|
||||
// What next to do? (0=sell, 1=buy)
|
||||
int action = rand.nextInt(2);
|
||||
|
||||
// What next to do?
|
||||
Action action = getAction();
|
||||
|
||||
if (account.isRuined()) {
|
||||
// System.out.print("I'm ruined\n");
|
||||
@ -202,28 +212,30 @@ public class RandomTrader extends AutoTrader {
|
||||
// action=1;
|
||||
switch (action) {
|
||||
|
||||
case 0: //sell
|
||||
case sell:
|
||||
if (account.shares <= 0) {
|
||||
// we have no shares
|
||||
continue;
|
||||
}
|
||||
// System.out.print("Sell\n");
|
||||
rc = doSell();
|
||||
if (!rc)
|
||||
if (!rc) {
|
||||
continue;
|
||||
}
|
||||
// System.out.print("Sold\n");
|
||||
doSleep(getRandom(myconfig.wait_after_sell));
|
||||
// System.out.print("Next\n");
|
||||
break;
|
||||
case 1: //sell
|
||||
case buy:
|
||||
if (account.money <= 0) {
|
||||
// we have no money
|
||||
continue;
|
||||
}
|
||||
// System.out.print("Sell\n");
|
||||
rc = doBuy();
|
||||
if (!rc)
|
||||
if (!rc) {
|
||||
continue;
|
||||
}
|
||||
// System.out.print("Bought\n");
|
||||
doSleep(getRandom(myconfig.wait_after_buy));
|
||||
// System.out.print("Next\n");
|
||||
@ -232,7 +244,6 @@ public class RandomTrader extends AutoTrader {
|
||||
}
|
||||
// doSleep(1);
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -50,12 +50,12 @@ public class RandomTraderConfig extends TraderConfig {
|
||||
public float[] sell_volume= {100,100};
|
||||
public float[] sell_limit = {-15,100};
|
||||
public int[] sell_order_wait = {5,33};
|
||||
public int[] wait_after_sell = {20,33};
|
||||
public int[] wait_after_sell = {2,10};
|
||||
|
||||
|
||||
public float[] buy_volume={100,100};
|
||||
public float[] buy_limit = {-50,5};
|
||||
public int[] buy_order_wait = {5,33};
|
||||
public float[] buy_limit = {-5,115};
|
||||
public int[] buy_order_wait = {15,33};
|
||||
public int[] wait_after_buy = {20,33};
|
||||
|
||||
|
||||
|
107
src/Traders/SwitchingTrader.java
Normal file
107
src/Traders/SwitchingTrader.java
Normal file
@ -0,0 +1,107 @@
|
||||
/*
|
||||
* Copyright (c) 2016, 7u83 <7u83@mail.ru>
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
*
|
||||
* * Redistributions of source code must retain the above copyright notice, this
|
||||
* list of conditions and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright notice,
|
||||
* this list of conditions and the following disclaimer in the documentation
|
||||
* and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
|
||||
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
package Traders;
|
||||
|
||||
import SeSim.Account;
|
||||
import SeSim.TraderConfig;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author 7u83 <7u83@mail.ru>
|
||||
*/
|
||||
public class SwitchingTrader extends RandomTrader{
|
||||
|
||||
|
||||
private Action mode;
|
||||
|
||||
public SwitchingTrader(Account account, TraderConfig config) {
|
||||
|
||||
super(account, config);
|
||||
System.out.print("SWTrader Created\n");
|
||||
|
||||
if (account.shares>0)
|
||||
mode=Action.sell;
|
||||
else
|
||||
mode=Action.buy;
|
||||
printstartus();
|
||||
|
||||
}
|
||||
|
||||
|
||||
private void printstartus(){
|
||||
|
||||
System.out.print("SWTrader:");
|
||||
switch (mode){
|
||||
case buy:
|
||||
System.out.print("buy"
|
||||
+account.shares
|
||||
+" "
|
||||
+account.money
|
||||
);
|
||||
break;
|
||||
case sell:
|
||||
System.out.print("sell"
|
||||
+account.shares
|
||||
+" "
|
||||
+account.money
|
||||
);
|
||||
break;
|
||||
|
||||
|
||||
}
|
||||
System.out.print("\n");
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Action getAction(){
|
||||
|
||||
|
||||
|
||||
|
||||
if ( (account.shares>0) && (mode==Action.sell)){
|
||||
printstartus();
|
||||
return mode;
|
||||
}
|
||||
if ( (account.shares<=0 && mode==Action.sell)){
|
||||
mode=Action.buy;
|
||||
printstartus();
|
||||
return mode;
|
||||
}
|
||||
if (account.money>100.0 && mode==Action.buy){
|
||||
printstartus();
|
||||
return mode;
|
||||
}
|
||||
if (account.money<=100.0 && mode==Action.buy){
|
||||
mode=Action.sell;
|
||||
printstartus();
|
||||
return mode;
|
||||
}
|
||||
printstartus();
|
||||
return mode;
|
||||
}
|
||||
|
||||
}
|
57
src/Traders/SwitchingTraderConfig.java
Normal file
57
src/Traders/SwitchingTraderConfig.java
Normal file
@ -0,0 +1,57 @@
|
||||
/*
|
||||
* Copyright (c) 2016, 7u83 <7u83@mail.ru>
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
*
|
||||
* * Redistributions of source code must retain the above copyright notice, this
|
||||
* list of conditions and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright notice,
|
||||
* this list of conditions and the following disclaimer in the documentation
|
||||
* and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
|
||||
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
package Traders;
|
||||
|
||||
import SeSim.Account;
|
||||
import SeSim.AutoTrader;
|
||||
import SeSim.Exchange;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author 7u83 <7u83@mail.ru>
|
||||
*/
|
||||
public class SwitchingTraderConfig extends RandomTraderConfig {
|
||||
|
||||
@Override
|
||||
public AutoTrader createTrader(Exchange se, long shares, double money) {
|
||||
Account a = new Account(se, shares, money);
|
||||
System.out.print("Returning a new sw trader\n");
|
||||
return new SwitchingTrader(a, this);
|
||||
}
|
||||
|
||||
public SwitchingTraderConfig() {
|
||||
|
||||
sell_volume = new float[]{100, 100};
|
||||
sell_limit = new float[]{-15, 1};
|
||||
sell_order_wait = new int[]{5, 10};
|
||||
wait_after_sell = new int[]{2, 10};
|
||||
|
||||
buy_volume = new float[]{100, 100};
|
||||
buy_limit = new float[]{-5, 115};
|
||||
buy_order_wait = new int[]{15, 33};
|
||||
wait_after_buy = new int[]{20, 33};
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user