Comments (0)

Files changed (12)

File config/sample-options-mini.json Modified

View file
  • Ignore whitespace
  • Hide word diff
   "multiplecustodians":false,
   "mailnotifications":"severe",
   "mailrecipient":"xxx@xxx.xxx",
-  "maxsellvolume" : 0.0,
-  "maxbuyvolume" : 0.0,
+  "bookSellwall" : 0.0,
+  "bookBuywall" : 0.0,
 
   "nubitaddress": "xxx",
   "nudip": "127.0.0.1",

File config/sample-options.json Modified

View file
  • Ignore whitespace
  • Hide word diff
   "mailrecipient":"xxx@xxx.xxx",
   "emergencytimeout":60,
   "keepproceeds":0,
-  "maxsellvolume" : 0.0,
-  "maxbuyvolume" : 0.0,
   "priceincrement": 0.1,
   "bypassStreaming": false,
   "streamingServer" : "stream.tradingbot.nu",
   "wallchangeThreshold": 0.1,
   "spread":0.0,
   "mainfeed":"blockchain",
-  "backupfeeds": ["coinbase", "btce"]
+  "backupfeeds": ["coinbase", "btce"],
+
+  "bookSellwall" : 0.0,
+  "bookBuywall" : 0.0
 }

File config/simulation.json Modified

View file
  • Ignore whitespace
  • Hide word diff
   "priceIncrement": 0.0,
   "emergencyTimeout": 60,
   "keepProceeds": 0.0,
-  "maxSellVolume": 5.0,
-  "maxBuyVolume": 5.0,
+  "bookSellwall": 5.0,
+  "bookBuywall": 5.0,
   "distributeLiquidity": false,
   "wallchangeThreshold": 0.1,
   "webport": 8889,

File docs/SETUP.md Modified

View file
  • Ignore whitespace
  • Hide word diff
  * misc options: miscellaneous configuration parameters ;
  * liquidity-info options: define nubits client communication ;
  * price-tracking options: for non-USD pairs, define price feeds ;
+ * orderbook options: define how liquidity is distributed across orders and tiers;
+
 
 Refer to the file `sample-config.json` or its essential form `sample-config-mini.json` provided with the bot. You can edit the provided sample file or create a new configuration file.
 
   "mailrecipient":"xxx@xxx.xxx",
   "emergencytimeout":60,
   "keepproceeds":0,
-  "maxsellvolume" : 0.0,
-  "maxbuyvolume" : 0.0,
   "priceincrement": 0.1,
   "webport": 8889,
   "submitliquidity":true,
   "wallchangeThreshold": 0.1,
   "spread":0.0,
   "mainfeed":"blockchain",
-  "backupfeeds": ["coinbase", "btce"]
+  "backupfeeds": ["coinbase", "btce"],
+  
+  "bookSellwall" : 0.0,
+  "bookBuywall" : 0.0
 }
 
 ```
 | Parameter      |  Default value  |  Description  |   Admitted values  | 
 | ------------- |:-------------:| -------------:| -------------:| 
 | dualside | true |  If set to true, the bot will behave as a dual side custodian, if false as a sell side custodian.     | true,false |
-| multiplecustodians    | false |  if set to true (and streaming bypassed|offline) , bot will sync with remote NPT and reset orders often.  | boolean |
+| multiplecustodians    | false |  if set to true (and streaming bypassed|offline) bot will sync with remote NPT and reset orders often.  | boolean |
 | executeorders    | true |  if set to false the bot will print a warning instead of executing orders  | boolean |
 | verbosity    | "normal" |  set logging verbosity level | String ("high", "normal", "low") |
 | gitter    | true |  if set to false will disable gitter notifications | boolean |
 | mailrecipient | / |  the email to which emergency email are sent  |  String  |
 | emergencytimeout    | 60 | max amount of minutes of consecutive failure. After those minute elapse, emergency procedure starts |  int (minutes) |
 | keepproceeds    | 0 |  Specific setting for KTm's proposal. Will keep the specified proceeds from sales apart instead of putting 100% of balance on buy . |  double. Expressed in absolute percentage. 10 = 10% , 0.5 = 0.5%|
-| maxsellordervolume | 0 | maximum volume to put on sell walls.  |  double , expressed in NBT . 0=no limit; |
-| maxbuyordervolume | 0 | maximum volume to put on buy walls.  |  double , expressed NBT. 0=no limit;  |
 | priceincrement    | 0.0003 |  if working in sell-side mode, this value (considered USD) will be added to the sell price | double , price increment in expressed USD |
 | webport    | 8889 |  the port for http server and GUI. Can be overriden via CLI launch argument *-port*   | int |
 
 
 Note: Streaming server uses default recommended values for spread and treshold. even while reading prices from streaming server, the local spread setting will be enforced if different from default. 
 
+#### Orderbook options
 ---
+Parameters : 
+
+| Parameter      |  Default value  |  Description  |   Admitted values  | 
+| ------------- |:-------------:| -------------:| -------------:| 
+| bookSellwall | 0 | maximum volume to put on sell walls at best price (tier1) |  double , expressed in NBT . 0=no limit; |
+| bookBuywall | 0 | maximum volume to put on buy walls at best price (tier1)  |  double , expressed NBT. 0=no limit;  |
 
 
 

File res/UI/js/main.js Modified

View file
  • Ignore whitespace
  • Hide word diff
             $("#mailrecipient").attr("value", data["mailRecipient"]);
             $("#emergencytimeout").attr("value", data["emergencyTimeout"]);
             $("#keepproceeds").attr("value", data["keepProceeds"]);
-            $("#maxsellvolume").attr("value", data["maxSellVolume"]);
-            $("#maxbuyvolume").attr("value", data["maxBuyVolume"]);
+            $("#booksellwall").attr("value", data["bookSellwall"]);
+            $("#bookbuywall").attr("value", data["bookBuywall"]);
             $("#priceincrement").attr("value", data["priceIncrement"]);
             $("#submitliquidity").attr("checked", data["submitLiquidity"]);
             $("#nubitaddress").attr("value", data["nubitAddress"]);
     var mailrecipient = $("#mailrecipient").attr("value");
     var emergencytimeout = $("#emergencytimeout").attr("value");
     var keepproceeds = $("#keepproceeds").attr("value");
-    var maxsellvolume = $("#maxsellvolume").attr("value");
-    var maxbuyvolume = $("#maxbuyvolume").attr("value");
+    var booksellwall = $("#booksellwall").attr("value");
+    var bookbuywall = $("#bookbuywall").attr("value");
     var priceincrement = $("#priceincrement").attr("value");
     var submitliquidity = $("#submitliquidity").prop("checked");
     var nubitaddress = $("#nubitaddress").attr("value");
         "mailnotifications": mailnotifications,
         "emergencytimeout": emergencytimeout,
         "keepproceeds": keepproceeds,
-        "maxsellvolume": maxsellvolume,
-        "maxbuyvolume": maxbuyvolume,
+        "booksellwall": booksellwall,
+        "bookbuywall": bookbuywall,
         "priceincrement": priceincrement,
         "submitliquidity": submitliquidity,
         "nubitaddress": nubitaddress,

File res/UI/templates/config.mustache Modified

View file
  • Ignore whitespace
  • Hide word diff
 
                     <tr>
 
-                        <td class="col-md-4">Maximum Buy Volume</td>
+                        <td class="col-md-4">Buy wall (tier1)</td>
 
                         <td class="col-md-2">
                             <div class="input-group">
-                                <input id="maxbuyvolume" size="200" type="text" class="form-control" placeholder="0.0">
+                                <input id="bookbuywall" size="200" type="text" class="form-control" placeholder="0.0">
                         </td>
 
-                        <td class="col-md-4">Maximum Sell Volume</td>
+                        <td class="col-md-4">Sell wall (tier1)</td>
 
                         <td class="col-md-2">
                             <div class="input-group">
-                                <input id="maxsellvolume" size="200" type="text" class="form-control" placeholder="0.0">
+                                <input id="booksellwall" size="200" type="text" class="form-control" placeholder="0.0">
                             </div>
                         </td>
                     </tr>
 
                 </table>
 
+
+
                 <div class="col-xs-12 col-md-8">
 
                     <!--<div class="row">-->

File src/main/java/com/nubits/nubot/options/NuBotOptions.java Modified

View file
  • Ignore whitespace
  • Hide word diff
      */
     public double keepProceeds;
 
+
+    public double wallchangeThreshold;
+
+    public double spread;
+
+    public int webport;
+
+
+    //Parametric order book related parameters
     /**
-     * maximum volume to put on sell walls.
+     * maximum volume to put on sell walls at the best price (tier1).
      */
-    public double maxSellVolume;
+    public double bookSellwall;
 
     /**
-     * maximum volume to put on buy walls.
+     * maximum volume to put on buy walls at the best price (tier1).
      */
-    public double maxBuyVolume;
+    public double bookBuywall;
 
     /**
      * When this flag is true, the bot will put tier2 on orderbook at different price levels
      */
     public boolean distributeLiquidity;
 
-    public double wallchangeThreshold;
-
-    public double spread;
-
-    public int webport;
-
     // feeds
 
     public String mainFeed;
         return multipleCustodians;
     }
 
-    public double getMaxSellVolume() {
-        return maxSellVolume;
+    public double getBookSellwall() {
+        return bookSellwall;
     }
 
-    public double getMaxBuyVolume() {
-        return maxBuyVolume;
+    public double getBookBuywall() {
+        return bookBuywall;
     }
 
     public int getEmergencyTimeout() {

File src/main/java/com/nubits/nubot/options/NuBotOptionsDefault.java Modified

View file
  • Ignore whitespace
  • Hide word diff
 
     public static String[] optionalKeys = {ParseOptions.txfee, ParseOptions.multiplecustodians, ParseOptions.executeorders, ParseOptions.gitter,
             ParseOptions.mailnotifications, ParseOptions.emergencytimeout, ParseOptions.keepproceeds,
-            ParseOptions.maxbuyvolume, ParseOptions.maxsellvolume, ParseOptions.priceincrement, ParseOptions.submitliquidity, ParseOptions.verbosity,
+            ParseOptions.booksellwall, ParseOptions.bookbuywall, ParseOptions.priceincrement, ParseOptions.submitliquidity, ParseOptions.verbosity,
             ParseOptions.nudip, ParseOptions.nudport, ParseOptions.pair, ParseOptions.dualside, ParseOptions.bypassStreaming, ParseOptions.streamingserver, ParseOptions.spread, ParseOptions.webport};
 
     public static String[] compulsoryKeys = {ParseOptions.apikey, ParseOptions.exchangename, ParseOptions.apisecret};
         opt.mailnotifications = MailNotifications.MAIL_LEVEL_SEVERE;
         opt.emergencyTimeout = 60;
         opt.keepProceeds = 0.0;
-        opt.maxSellVolume = 0;
-        opt.maxBuyVolume = 0;
         opt.priceIncrement = 0.0003;
         opt.submitLiquidity = true;
         opt.verbosity = "normal";
         opt.webport = Settings.WEB_DEFAULT_PORT;
         opt.spread = Settings.DEFAULT_SPREAD_HIGHVOLATILITY; //this value is actually never used - since the default value is based on Currency
 
+        //Orderbook related settings //TODO change in  #808
+        opt.bookBuywall = 0;
+        opt.bookSellwall = 0;
+
         //Options that can be blank if submitliuidity:false
         opt.nubitAddress = "";
         opt.rpcPass = "";

File src/main/java/com/nubits/nubot/options/ParseOptions.java Modified

View file
  • Ignore whitespace
  • Hide word diff
     public static String priceincrement = "priceIncrement";
     public static String txfee = "txfee";
     public static String submitliquidity = "submitLiquidity";
-    public static String maxsellvolume = "maxSellVolume";
-    public static String maxbuyvolume = "maxBuyVolume";
+    public static String bookbuywall = "bookBuywall";
+    public static String booksellwall = "bookSellwall";
     public static String executeorders = "executeOrders";
     public static String dualside = "dualSide";
     public static String verbosity = "verbosity";
             priceincrement,
             txfee,
             submitliquidity,
-            maxsellvolume,
-            maxbuyvolume,
+            bookbuywall,
+            booksellwall,
             executeorders,
             dualside,
             verbosity,
         options.mailnotifications = parseMails(optionsJSON);
         options.emergencyTimeout = new Integer("" + JSONUtils.getIgnoreCase(optionsJSON, emergencytimeout)).intValue();
         options.keepProceeds = Utils.getDouble((JSONUtils.getIgnoreCase(optionsJSON, keepproceeds)));
-        options.maxSellVolume = Utils.getDouble(JSONUtils.getIgnoreCase(optionsJSON, maxsellvolume));
-        options.maxBuyVolume = Utils.getDouble(JSONUtils.getIgnoreCase(optionsJSON, maxbuyvolume));
+        options.bookSellwall = Utils.getDouble(JSONUtils.getIgnoreCase(optionsJSON, booksellwall));
+        options.bookBuywall = Utils.getDouble(JSONUtils.getIgnoreCase(optionsJSON, bookbuywall));
         options.priceIncrement = Utils.getDouble(JSONUtils.getIgnoreCase(optionsJSON, priceincrement));
         options.submitLiquidity = (boolean) JSONUtils.getIgnoreCase(optionsJSON, submitliquidity);
         options.verbosity = parseVerbosity(optionsJSON);

File src/main/java/com/nubits/nubot/strategy/Primary/StrategyPrimaryPegTask.java Modified

View file
  • Ignore whitespace
  • Hide word diff
             if (SessionManager.sessionInterrupted()) return; //external interruption
 
 
-            if (balance.getNBTonOrder().getQuantity() < Global.options.getMaxSellVolume())
+            if (balance.getNBTonOrder().getQuantity() < Global.options.getBookSellwall())
                 //Execute sellSide strategy
                 sellSide(balanceNBT);
 
         double sellPrice = TradeUtils.getSellPrice(txFeeUSDNTB);
 
         //There is a cap on the order size
-        if (Global.options.getMaxSellVolume() > 0) {
-            if (balanceNBT.getQuantity() > Global.options.getMaxSellVolume()) {
+        if (Global.options.getBookSellwall() > 0) {
+            if (balanceNBT.getQuantity() > Global.options.getBookSellwall()) {
                 //put the cap
-                balanceNBT.setQuantity(Global.options.getMaxSellVolume());
+                balanceNBT.setQuantity(Global.options.getBookSellwall());
             }
         }
 
 
             ordersAndBalancesOk = bothSides || sellinplace || buyinplace;
 
-            if (balanceFIAT > 1 && !isFirstTime && Global.options.getMaxBuyVolume() == 0) { //TODO this condition should be more complext to take into account froozenBalance
+            if (balanceFIAT > 1 && !isFirstTime && Global.options.getBookBuywall() == 0) { //TODO this condition should be more complext to take into account froozenBalance
                 LOG.warn("The " + balance.getPEGAvailableBalance().getCurrency().getCode() + " balance is not zero (" + balanceFIAT + " ). If the balance represent proceedings "
                         + "from a sale the bot will notice.  On the other hand, If you keep seying this message repeatedly over and over, you should restart the bot. ");
                 proceedsInBalance = true;
                 if (SessionManager.sessionInterrupted()) return false;
                 double amount1 = Utils.round(amount.getQuantity() / 2);
 
-                double maxBuy = Global.options.getMaxBuyVolume();
-                double maxSell = Global.options.getMaxSellVolume();
+                double maxBuy = Global.options.getBookBuywall();
+                double maxSell = Global.options.getBookSellwall();
 
                 LOG.debug("check the calculated amount against the set maximum sell amount");
 

File src/main/java/com/nubits/nubot/strategy/Secondary/StrategySecondaryPegUtils.java Modified

View file
  • Ignore whitespace
  • Hide word diff
         if (SessionManager.sessionInterrupted()) return false;
 
         //short hand variables
-        double maxSell = Global.options.getMaxSellVolume();
-        double maxBuy = Global.options.getMaxBuyVolume();
+        double maxSell = Global.options.getBookSellwall();
+        double maxBuy = Global.options.getBookBuywall();
 
         LOG.debug("balance " + balance + " maxBuy " + maxBuy + ". maxSell " + maxSell);
 
                 if (balancePEG > twoNBT
                         && Global.options.getPair().getPaymentCurrency().isFiat()
                         && !strategy.isFirstTime()
-                        && Global.options.getMaxBuyVolume() != 0) { //Only for EUR...CNY etc
+                        && Global.options.getBookBuywall() != 0) { //Only for EUR...CNY etc
                     LOG.warn("The " + balance.getPEGAvailableBalance().getCurrency().getCode() + " balance is not zero (" + balancePEG + " ). If the balance represent proceedings "
                             + "from a sale the bot will notice.  On the other hand, If you keep seying this message repeatedly over and over, you should restart the bot. ");
                     strategy.setProceedsInBalance(true);

File src/test/java/functions/TestOptions.java Modified

View file
  • Ignore whitespace
  • Hide word diff
 
         assertTrue(!catched);
 
-        /*String nudIp = NuBotOptionsDefault.nudIp;
-        String mailnotifications = NuBotOptionsDefault.mailnotifications;
-        boolean submitLiquidity = NuBotOptionsDefault.submitLiquidity;
-        boolean executeOrders = NuBotOptionsDefault.executeOrders;
-        boolean verbose = NuBotOptionsDefault.verbose;
-        boolean gitter = NuBotOptionsDefault.gitter;
-        boolean multipleCustodians = NuBotOptionsDefault.multipleCustodians;
-        int executeStrategyInterval = NuBotOptionsDefault.executeStrategyInterval;
-        double txFee = NuBotOptionsDefault.txFee;
-        double priceIncrement = NuBotOptionsDefault.priceIncrement;
-        double keepProceeds = NuBotOptionsDefault.keepProceeds;
-        double maxSellVolume = NuBotOptionsDefault.maxSellVolume;
-        double maxBuyVolume = NuBotOptionsDefault.maxBuyVolume;
-        int emergencyTimeout = NuBotOptionsDefault.emergencyTimeout;
-        boolean distributeLiquidity = NuBotOptionsDefault.distributeLiquidity;*/
 
         assertTrue(opt.getPair() != null);
         //assertTrue(opt.getPair().equals("nbt_btc"));
                 "  \"mailrecipient\":\"test@gmail.com\",\n" +
                 "  \"emergencytimeout\":60,\n" +
                 "  \"keepproceeds\":0,\n" +
-                "  \"maxsellvolume\" : 10.0,\n" +
-                "  \"maxbuyvolume\" : 10.0,\n" +
+                "  \"bookSellwall\" : 10.0,\n" +
+                "  \"bookBuywall\" : 10.0,\n" +
                 "  \"priceincrement\": 0.1,\n" +
                 "  \"spread\":0.0,\n" +
                 "  \"bypassStreaming\":false,\n" +
         assertTrue(opt.getSendMailsLevel().equals("ALL"));
         assertTrue(opt.getMailRecipient().equals("test@gmail.com"));
         assertTrue(opt.getEmergencyTimeout() == 60);
-        assertTrue(opt.getMaxBuyVolume() == 10.0);
-        assertTrue(opt.getMaxSellVolume() == 10.0);
+        assertTrue(opt.getBookBuywall() == 10.0);
+        assertTrue(opt.getBookSellwall() == 10.0);
         assertTrue(opt.getPriceIncrement() == 0.1);
         assertTrue(opt.getSpread() == 0.0);
         assertTrue(opt.getWallchangeThreshold() == 0.1);