Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SELL/BUY loop #13

Closed
igalita opened this issue Apr 30, 2018 · 10 comments
Closed

SELL/BUY loop #13

igalita opened this issue Apr 30, 2018 · 10 comments
Assignees
Labels
bug Something isn't working

Comments

@igalita
Copy link
Collaborator

igalita commented Apr 30, 2018

This needs a fix :)

photo_2018-04-30_22-39-45

@andresilvasantos
Copy link
Owner

Yes, will be fixed in the next commit. 👍

@andresilvasantos andresilvasantos added the bug Something isn't working label Apr 30, 2018
@itsjNathan
Copy link

im on the latest version of Bitprophet v0.6.7 and this bug is not already solved

image

@andresilvasantos
Copy link
Owner

Are you using buydip.js? If yes, exactly from the 0.6.7?

@itsjNathan
Copy link

yes, buydip from the version 0.6.7
i already tried to uninstall the BitProphet then install it again but the bug is still there.

@itsjNathan
Copy link

by the way this is my configuration in index.js

module.exports = {
strategies: {
alertsrsi: {
name: "Alerts RSI",
targetMarket: "BTC"
},
alertsichimoku: {
name: "Alerts Ichimoku",
targetMarket: "BTC"
},
buydip: {
name: "Buy Dip",
paperTrading: false,
buyAmountMarket: 0.002,
profitTarget: 10.0,
maxLoss: 0.8,
maxTradingPairs: 10,
targetMarket: "BTC"
}
}
}

@andresilvasantos
Copy link
Owner

Did you install from NPM? Do you have a custom strategiesDir option?

@andresilvasantos
Copy link
Owner

The problem, that I believe was solved, was in the strategy buydip.js itself. If you have a strategiesDir directory and copied there buydip.js before 0.6.5, even if you update to the latest version, the bug will still happen, because it will be present in your copied version of the buydip.js.

@itsjNathan
Copy link

itsjNathan commented May 4, 2018

i dont have any custom strategies. i only use the default buydip.js

this is the code of my index.js i didnt set any strategiesDir

const bitprophet = require('bitprophet')
bitprophet.options({
binance: {
key: "XXXXXX",
secret: "XXXXXXX*"
},
telegram: {
chatId: "XXXXXX",
token: "XXXXXX"
},
discord: {
chatId: "YOUR_DISCORD_CHANNEL_ID",
token: "YOUR_DISCORD_BOT_TOKEN"
}
})

bitprophet.start()

@andresilvasantos
Copy link
Owner

Strange, it was happening for me and after the fix it never happened again. I'll take a look this.
In the meantime, you can fix it by copying the strategies into a custom dir, adding the strategiesDir option and commenting the problematic part from buydip.js like this:

       /*var sellDiff = pair.amountToSell - order.amount * (1 - order.partFill)

        //Sell order price or amount mismatch
        if(order.price.toFixed(8) != pair.sellTarget.toFixed(8) || sellDiff >= parseFloat(bp.vars.pairsInfo[pair.name].filters.stepSize)) {
            if(pair.trySellTimestamp && Date.now() - pair.trySellTimestamp < 5 * 1000) return
            pair.trySellTimestamp = Date.now()
            recreateSellOrder()
        }
        else {*/
            var chart5m = pair.functions.chart(intervalsWatch[1]).ticks
            var lastClose = parseFloat(chart5m[chart5m.length - 1].close)

            var activateStopLoss = strategy.manageStopLoss(pair, lastClose)
            if(activateStopLoss) recreateSellOrder()
        //}

The commented part is just a safe procedure in case the price or the amount of the sell order mismatchs what it should be.

@itsjNathan
Copy link

okay thanks i will try it

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants