crypto-trading-bot
crypto-trading-bot copied to clipboard
Sells all assets instead of specified amount
Hey, I've been playing around with the bot and I love it! Only problem is that every time I specify an amount (be it "currency" or "currency_capital", the bot ignores this completely and sells the entire amount of crypto available for the specified pair (in this example SHIBUSDT, sells all of the SHIBA tokens available) and doesn't spit out any errors. I have even tried specifying "currency" and "currency_capital" at the same time which obviously didn't work and ended up giving me some errors. I am sure this isn't the expected behavior, is it? Here's my instance.js
var c = module.exports = {}
c.symbols = []
let l = [
'SHIBUSDT'
]
l.forEach((pair) => {
c.symbols.push({
'symbol': pair,
'periods': ['1m', '15m', '1h'],
'exchange': 'binance',
'state': 'trade',
'trade': {
'currency_capital': 160,
'strategies': [
{
'strategy': 'macd',
'interval': '15m',
'options': {
'period': '15m',
'default_ma_type': 'EMA',
'fast_period': 12,
'slow_period': 26,
'signal_period': 9
}
},
]
},
'strategies': [
{
'strategy': 'macd',
'interval': '15m',
'options': {
'period': '15m',
'default_ma_type': 'EMA',
'fast_period': 12,
'slow_period': 26,
'signal_period': 9
}
},
]
})
})
I believe you missed the point. Capital parameters are only used for opening positions. Closing position always sells/buys all open position amount. This is good then you adjust parameters for pair which has open position, you don't have to close position manually. It will close automatically next time strategy returns signal.
I may not have explained myself correctly, basically I want to open positions of the same amount every time. The bot did not open any positions in the amount I specified and instead sold the total amount in my wallet. Example: I have 100USDT and I want to only open positions worth 10USDT, but instead the bot opened a position worth 100USDT if that makes sense :p
Your instance.js file looks OK, except I don't put key values in quotes. I also don't repeat 'strategies', only provide in 'trade' object. It trades exact amount as set in instance.js.
Thanks I'll try it out !