Skip to content

Commit

Permalink
adding limitDepth option
Browse files Browse the repository at this point in the history
  • Loading branch information
andreihq committed May 31, 2019
1 parent bf77075 commit 02d3a0e
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 7 deletions.
9 changes: 5 additions & 4 deletions config.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
{
"apiKey": "YOUR_API_KEY",
"apiKey": "YOU_API_KEY",
"apiSecret": "YOUR_API_SECRET",
"symbol": "BTCUSDT",
"tradingStartTime": 1556510400000,
"tradingStartTime": 1559408400000,
"sellQuantity": 1,
"minSellPrice": 3000,
"minSellPrice": 12000,
"startingPrice": 10000,
"priceDelta": 0.03
"priceDelta": 0.05,
"limitDepth": 0
}
4 changes: 2 additions & 2 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ const confirmConfig = (config) => {
warning: 'Confirm by [y]es or [n]o.',
};

console.log(`\n----------`);
console.log(`----------`);
console.log(`Symbol:\t\t\t${config.symbol}`);
console.log(`Quantity:\t\t${config.sellQuantity}`);
console.log(`Starting Price:\t\t${config.startingPrice}`);
Expand Down Expand Up @@ -139,7 +139,7 @@ const testApi = async (api) => {
let filledQuantity = parseFloat(cancelResponse.data.executedQty);
state.orderId = null;
state.orderQuantity = state.orderQuantity - filledQuantity;
state.orderPrice = bestPrice;
state.orderPrice = bestPrice * (1 - CONFIG.limitDepth);
log("Placing new order...");
let newOrder = await binanceApi.placeOrder(Object.assign(
{},
Expand Down
3 changes: 2 additions & 1 deletion readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,4 +25,5 @@ tradingStartTime | NUMBER | start time (in miliseconds) when trading is suppose
sellQuantity | DECIMAL | The size of your position you are trying to sell.
minSellPrice | DECIMAL | The minimum price. Script won't place orders below this price.
startingPrice | DECIMAL | The first order price. Script uses this price to place the first order when trading opens and order book is empty.
priceDelta | DECIMAL | Price difference (expressed in percentage) between order price and current best price when script adjusts order price to match current bid. Example: If we set *priceDelta = 0.03* and current order price is 100$, when best bid price moves below 97$ (3%), the old order will be cancelled and new order will be created with the price set to current bid.
priceDelta | DECIMAL | Price difference (expressed in percentage) between order price and current best price when script adjusts order price to match current bid. Example: If we set *priceDelta = 0.03* and current order price is 100$, when best bid price moves below 97$ (3%), the old order will be cancelled and new order will be created with the price set to current bid.
limitDepth | DECIMAL | Defines how deep into order book the limit order sell price is set. For example, if current best bid is 100, setting limitDepth to 0.05, will place limit order with sell price of 95. (5% deep into the order book from the best bid)

0 comments on commit 02d3a0e

Please sign in to comment.