Moved OrderType from Exchnage class to Order class
This commit is contained in:
parent
08c4c5e91d
commit
201709b053
@ -3,49 +3,16 @@
|
||||
<editor-bookmarks xmlns="http://www.netbeans.org/ns/editor-bookmarks/2" lastBookmarkId="0"/>
|
||||
<open-files xmlns="http://www.netbeans.org/ns/projectui-open-files/2">
|
||||
<group>
|
||||
<file>file:/home/tube/NetBeansProjects/SeSim/src/traders/RandomTraderA.java</file>
|
||||
<file>file:/home/tube/NetBeansProjects/SeSim/test/sesim/Test.java</file>
|
||||
<file>file:/home/tube/NetBeansProjects/SeSim/src/chart/MasterChart.java</file>
|
||||
<file>file:/home/tube/NetBeansProjects/SeSim/src/chart/painter/ChartCrossPainter.java</file>
|
||||
<file>file:/home/tube/NetBeansProjects/SeSim/src/gui/StatisticsPanel.java</file>
|
||||
<file>file:/home/tube/NetBeansProjects/SeSim/src/gui/tools/NummericCellRenderer.java</file>
|
||||
<file>file:/home/tube/NetBeansProjects/SeSim/src/sesim/AutoTraderInterface.java</file>
|
||||
<file>file:/home/tube/NetBeansProjects/SeSim/src/traders/ManTrader/ManTraderConsoleDialog.java</file>
|
||||
<file>file:/home/tube/NetBeansProjects/SeSim/src/sesim/AutoTraderLoader.java</file>
|
||||
<file>file:/home/tube/NetBeansProjects/SeSim/src/traders/ManTrader/ManTrader.java</file>
|
||||
<file>file:/home/tube/NetBeansProjects/SeSim/src/gui/SeSimApplication.java</file>
|
||||
<file>file:/home/tube/NetBeansProjects/SeSim/src/gui/Globals.java</file>
|
||||
<file>file:/home/tube/NetBeansProjects/SeSim/src/chart/painter/ChartPainter.java</file>
|
||||
<file>file:/home/tube/NetBeansProjects/SeSim/src/chart/painter/OHLCChartPainter.java</file>
|
||||
<file>file:/home/tube/NetBeansProjects/SeSim/src/traders/RandomTraderB.java</file>
|
||||
<file>file:/home/tube/NetBeansProjects/SeSim/src/sesim/Logger.java</file>
|
||||
<file>file:/home/tube/NetBeansProjects/SeSim/src/gui/EditPreferencesDialog.java</file>
|
||||
<file>file:/home/tube/NetBeansProjects/SeSim/src/gui/QuotePanel.java</file>
|
||||
<file>file:/home/tube/NetBeansProjects/SeSim/src/sesim/AutoTraderBase.java</file>
|
||||
<file>file:/home/tube/NetBeansProjects/SeSim/src/gui/Statistics.java</file>
|
||||
<file>file:/home/tube/NetBeansProjects/SeSim/src/gui/EditStrategies.java</file>
|
||||
<file>file:/home/tube/NetBeansProjects/SeSim/src/gui/MainChart.java</file>
|
||||
<file>file:/home/tube/NetBeansProjects/SeSim/src/chart/Chart.java</file>
|
||||
<file>file:/home/tube/NetBeansProjects/SeSim/src/sesim/Clock.java</file>
|
||||
<file>file:/home/tube/NetBeansProjects/SeSim/src/chart/ChartDef.java</file>
|
||||
<file>file:/home/tube/NetBeansProjects/SeSim/src/sesim/OHLCData.java</file>
|
||||
<file>file:/home/tube/NetBeansProjects/SeSim/src/sesim/IDGenerator.java</file>
|
||||
<file>file:/home/tube/NetBeansProjects/SeSim/src/sesim/MinMax.java</file>
|
||||
<file>file:/home/tube/NetBeansProjects/SeSim/src/chart/painter/XLegendPainter.java</file>
|
||||
<file>file:/home/tube/NetBeansProjects/SeSim/src/chart/painter/LineChartPainter.java</file>
|
||||
<file>file:/home/tube/NetBeansProjects/SeSim/src/sesim/AutoTraderGui.java</file>
|
||||
<file>file:/home/tube/NetBeansProjects/SeSim/src/sesim/Exchange.java</file>
|
||||
<file>file:/home/tube/NetBeansProjects/SeSim/src/gui/jp99.java</file>
|
||||
<file>file:/home/tube/NetBeansProjects/SeSim/src/sesim/Locker.java</file>
|
||||
<file>file:/home/tube/NetBeansProjects/SeSim/src/chart/ChartPanel.java</file>
|
||||
<file>file:/home/tube/NetBeansProjects/SeSim/src/gui/orderbook/OrderBook.java</file>
|
||||
<file>file:/home/tube/NetBeansProjects/SeSim/src/sesim/OHLCDataItem.java</file>
|
||||
<file>file:/home/tube/NetBeansProjects/SeSim/src/gui/AboutDialog.java</file>
|
||||
<file>file:/home/tube/NetBeansProjects/SeSim/src/chart/painter/CandleStickChartPainter.java</file>
|
||||
<file>file:/home/tube/NetBeansProjects/SeSim/src/chart/painter/YLegendPainter.java</file>
|
||||
<file>file:/home/tube/NetBeansProjects/SeSim/src/chart/SuperDlg.java</file>
|
||||
<file>file:/home/tube/NetBeansProjects/SeSim/README.md</file>
|
||||
<file>file:/home/tube/NetBeansProjects/SeSim/src/gui/TestChartdialog.java</file>
|
||||
<file>file:/home/tobias/v/SeSim/src/chart/ChartDef.java</file>
|
||||
<file>file:/home/tobias/v/SeSim/src/chart/painter/ChartCrossPainter.java</file>
|
||||
<file>file:/home/tobias/v/SeSim/src/sesim/OHLCData.java</file>
|
||||
<file>file:/home/tobias/v/SeSim/src/chart/painter/ChartPainter.java</file>
|
||||
<file>file:/home/tobias/v/SeSim/src/sesim/MinMax.java</file>
|
||||
<file>file:/home/tobias/v/SeSim/src/sesim/OHLCDataItem.java</file>
|
||||
<file>file:/home/tobias/v/SeSim/src/chart/Chart.java</file>
|
||||
<file>file:/home/tobias/v/SeSim/src/gui/MainChart.java</file>
|
||||
<file>file:/home/tobias/v/SeSim/src/chart/ChartPanel.java</file>
|
||||
<file>file:/home/tobias/v/SeSim/src/chart/painter/OHLCChartPainter.java</file>
|
||||
</group>
|
||||
</open-files>
|
||||
</project-private>
|
||||
|
@ -1,4 +1,4 @@
|
||||
#Sun, 08 Oct 2017 21:13:57 +0200
|
||||
#Mon, 09 Oct 2017 14:13:25 +0200
|
||||
annotation.processing.enabled=true
|
||||
annotation.processing.enabled.in.editor=false
|
||||
annotation.processing.processors.list=
|
||||
|
@ -26,7 +26,7 @@
|
||||
package gui;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import sesim.Exchange.OrderType;
|
||||
import sesim.Order.OrderType;
|
||||
import sesim.Order;
|
||||
|
||||
|
||||
|
@ -26,8 +26,9 @@
|
||||
package gui;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import sesim.Exchange.*;
|
||||
|
||||
import sesim.Order;
|
||||
import sesim.Order.OrderType;
|
||||
|
||||
/**
|
||||
*
|
||||
|
@ -25,18 +25,18 @@
|
||||
*/
|
||||
package gui;
|
||||
|
||||
import java.awt.Frame;
|
||||
|
||||
import java.awt.MouseInfo;
|
||||
import java.awt.Point;
|
||||
import java.util.Iterator;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.function.BiConsumer;
|
||||
|
||||
|
||||
import javax.swing.table.DefaultTableModel;
|
||||
import sesim.Exchange;
|
||||
|
||||
import sesim.Exchange.Account;
|
||||
import sesim.Order;
|
||||
import sesim.Exchange.OrderType;
|
||||
import sesim.Order.OrderType;
|
||||
import traders.ManTrader.CreateOrderDialog;
|
||||
|
||||
/**
|
||||
|
@ -42,7 +42,7 @@ import javax.swing.table.TableColumn;
|
||||
import javax.swing.table.TableColumnModel;
|
||||
import sesim.Exchange;
|
||||
import sesim.Order;
|
||||
import sesim.Exchange.OrderType;
|
||||
import sesim.Order.OrderType;
|
||||
|
||||
/**
|
||||
*
|
||||
|
@ -109,4 +109,4 @@
|
||||
</SubComponents>
|
||||
</Container>
|
||||
</SubComponents>
|
||||
</Form>
|
||||
</Form>
|
||||
|
@ -27,6 +27,7 @@ package gui.orderbook;
|
||||
|
||||
import gui.Globals;
|
||||
import sesim.Exchange;
|
||||
import sesim.Order.OrderType;
|
||||
|
||||
/**
|
||||
*
|
||||
@ -42,8 +43,8 @@ public class OrderBooksHorizontal extends javax.swing.JPanel {
|
||||
if (Globals.se==null)
|
||||
return;
|
||||
|
||||
bidBook.setType(Exchange.OrderType.BUYLIMIT);
|
||||
askBook.setType(Exchange.OrderType.SELLLIMIT);
|
||||
bidBook.setType(OrderType.BUYLIMIT);
|
||||
askBook.setType(OrderType.SELLLIMIT);
|
||||
}
|
||||
|
||||
public void setDepth(int depth){
|
||||
|
@ -37,6 +37,7 @@ import java.util.logging.Logger;
|
||||
import org.json.JSONArray;
|
||||
import org.json.JSONObject;
|
||||
import sesim.Order.OrderStatus;
|
||||
import sesim.Order.OrderType;
|
||||
|
||||
/**
|
||||
* @desc Echchange class
|
||||
@ -110,12 +111,6 @@ public class Exchange {
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Definition of order types
|
||||
*/
|
||||
public enum OrderType {
|
||||
BUYLIMIT, SELLLIMIT, STOPLOSS, STOPBUY, BUY, SELL
|
||||
}
|
||||
|
||||
IDGenerator account_id = new IDGenerator();
|
||||
//public static Timer timer = new Timer();
|
||||
|
@ -38,9 +38,16 @@ public class Order {
|
||||
CANCELED
|
||||
}
|
||||
|
||||
/**
|
||||
* Definition of order types
|
||||
*/
|
||||
public enum OrderType {
|
||||
BUYLIMIT, SELLLIMIT, STOPLOSS, STOPBUY, BUY, SELL
|
||||
}
|
||||
|
||||
Stock stock;
|
||||
OrderStatus status;
|
||||
Exchange.OrderType type;
|
||||
OrderType type;
|
||||
protected double limit;
|
||||
protected double volume;
|
||||
|
||||
@ -52,7 +59,7 @@ public class Order {
|
||||
|
||||
double cost;
|
||||
|
||||
Order(long id, long created, Exchange.Account account, Exchange.OrderType type, double volume, double limit) {
|
||||
Order(long id, long created, Exchange.Account account, OrderType type, double volume, double limit) {
|
||||
//id = order_id_generator.getNext();
|
||||
this.id = id;
|
||||
this.account = account;
|
||||
@ -77,7 +84,7 @@ public class Order {
|
||||
return limit;
|
||||
}
|
||||
|
||||
public Exchange.OrderType getType() {
|
||||
public OrderType getType() {
|
||||
return type;
|
||||
}
|
||||
|
||||
|
@ -26,10 +26,9 @@
|
||||
package traders.ManTrader;
|
||||
|
||||
import gui.Globals;
|
||||
import java.util.ArrayList;
|
||||
import sesim.Exchange;
|
||||
|
||||
import sesim.Exchange.Account;
|
||||
import sesim.Exchange.OrderType;
|
||||
import sesim.Order.OrderType;
|
||||
import sesim.Quote;
|
||||
|
||||
/**
|
||||
|
@ -165,4 +165,4 @@
|
||||
</SubComponents>
|
||||
</Container>
|
||||
</SubComponents>
|
||||
</Form>
|
||||
</Form>
|
||||
|
@ -28,6 +28,7 @@ package traders.ManTrader;
|
||||
import gui.OpenOrdersList;
|
||||
|
||||
import sesim.Exchange;
|
||||
import sesim.Order.OrderType;
|
||||
|
||||
/**
|
||||
*
|
||||
@ -175,7 +176,7 @@ public class ManTraderConsole extends javax.swing.JPanel {
|
||||
|
||||
System.out.printf("Should buy: %f %f\n",volume,limit);
|
||||
|
||||
long createOrder = trader.getSE().createOrder(trader.getAccount().getID(), Exchange.OrderType.BUYLIMIT, volume, limit);
|
||||
long createOrder = trader.getSE().createOrder(trader.getAccount().getID(), OrderType.BUYLIMIT, volume, limit);
|
||||
System.out.printf("The retval is %d",createOrder);
|
||||
|
||||
// this.ordersList.account=this.trader.getAccount();
|
||||
@ -190,7 +191,7 @@ public class ManTraderConsole extends javax.swing.JPanel {
|
||||
|
||||
System.out.printf("Should sell: %f %f\n",volume,limit);
|
||||
|
||||
long createOrder = trader.getSE().createOrder(trader.getAccount().getID(), Exchange.OrderType.SELLLIMIT, volume, limit);
|
||||
long createOrder = trader.getSE().createOrder(trader.getAccount().getID(), OrderType.SELLLIMIT, volume, limit);
|
||||
System.out.printf("The retval is %d",createOrder);
|
||||
}//GEN-LAST:event_sellButtonActionPerformed
|
||||
|
||||
@ -200,7 +201,7 @@ public class ManTraderConsole extends javax.swing.JPanel {
|
||||
|
||||
System.out.printf("Should stoploss: %f %f\n",volume,limit);
|
||||
|
||||
long createOrder = trader.getSE().createOrder(trader.getAccount().getID(), Exchange.OrderType.STOPLOSS, volume, limit);
|
||||
long createOrder = trader.getSE().createOrder(trader.getAccount().getID(), OrderType.STOPLOSS, volume, limit);
|
||||
System.out.printf("The retval is %d",createOrder);
|
||||
}//GEN-LAST:event_stopLossButtonActionPerformed
|
||||
|
||||
|
@ -37,7 +37,7 @@ import sesim.Exchange;
|
||||
import sesim.Exchange.Account;
|
||||
import sesim.Exchange.AccountListener;
|
||||
|
||||
import sesim.Exchange.OrderType;
|
||||
import sesim.Order.OrderType;
|
||||
import sesim.Order;
|
||||
import sesim.Order.OrderStatus;
|
||||
import sesim.Quote;
|
||||
@ -377,7 +377,7 @@ public class RandomTraderA extends AutoTraderBase implements AccountListener {
|
||||
// AccountData ad = this.se.getAccountData(account_id);
|
||||
Account ad = se.getAccount(account_id);
|
||||
|
||||
Exchange.OrderType type = Exchange.OrderType.BUYLIMIT;
|
||||
OrderType type = OrderType.BUYLIMIT;
|
||||
|
||||
if (ad == null) {
|
||||
return false;
|
||||
@ -424,7 +424,7 @@ public class RandomTraderA extends AutoTraderBase implements AccountListener {
|
||||
|
||||
Account ad = se.getAccount(account_id);
|
||||
|
||||
Exchange.OrderType type = Exchange.OrderType.SELLLIMIT;
|
||||
OrderType type = OrderType.SELLLIMIT;
|
||||
|
||||
// how much shares we ant to sell?
|
||||
double volume = getRandomAmmount(ad.getShares(), sell_volume);
|
||||
|
@ -38,6 +38,7 @@ import sesim.AutoTraderBase;
|
||||
import sesim.AutoTraderGui;
|
||||
import sesim.Exchange;
|
||||
import sesim.Exchange.Account;
|
||||
import sesim.Order.OrderType;
|
||||
import sesim.Quote;
|
||||
|
||||
/**
|
||||
@ -269,7 +270,7 @@ public class RandomTraderB extends AutoTraderBase {
|
||||
|
||||
Account ad = se.getAccount(account_id);
|
||||
|
||||
Exchange.OrderType type = Exchange.OrderType.BUYLIMIT;
|
||||
OrderType type = OrderType.BUYLIMIT;
|
||||
|
||||
if (ad == null) {
|
||||
return false;
|
||||
@ -309,7 +310,7 @@ public class RandomTraderB extends AutoTraderBase {
|
||||
|
||||
Account ad = se.getAccount(account_id);
|
||||
|
||||
Exchange.OrderType type = Exchange.OrderType.SELLLIMIT;
|
||||
OrderType type = OrderType.SELLLIMIT;
|
||||
|
||||
|
||||
// how much shares we ant to sell?
|
||||
|
Loading…
Reference in New Issue
Block a user