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

Maximum purchase amount set to % #76

Open
Dutchblue020 opened this issue Apr 2, 2021 · 8 comments
Open

Maximum purchase amount set to % #76

Dutchblue020 opened this issue Apr 2, 2021 · 8 comments
Labels
enhancement New feature or request

Comments

@Dutchblue020
Copy link

Hi,

I have a feature request special for the "maximum purchase amount" that you can set.
It will be nice to set a % value of the balance in place of a fixed amount.

With this option you gan use the profit with the next trade (for example when you set it to 100% of the balance).

@Dutchblue020 Dutchblue020 added the enhancement New feature or request label Apr 2, 2021
@chopeta
Copy link

chopeta commented Apr 2, 2021

+1 here... Would be a nice addition, specially once #52 gets implemented.

@chrisleekr
Copy link
Owner

Hey @Dutchblue020

Thanks for your suggestion.

As I mentioned in issue #12, percentage buy calculation is tricky.

For instance, if you have a $100 USDT and I set 50%, then the first purchase would be $50 USDT. And for 2nd purchase, it would be $25 of left $50. So I just decided to go with a simple maximum purchase.

@chopeta
Copy link

chopeta commented Apr 4, 2021

Good point Chris. You're absolutely right. Unless @Dutchblue020 has another suggestion on how to go about this, I think we can close it.

Do you agree @Dutchblue020 ?

@fqueis
Copy link

fqueis commented Apr 6, 2021

@chrisleekr @chopeta

const percent = process.env.PERCENT_PER_TRADE
const use = openOrders == 0 ? (percent/100) * balance : balance / (100/percent - openOrders)

@chrisleekr
Copy link
Owner

chrisleekr commented Apr 7, 2021

@fqueis
Interesting point.

Although, your formula is just accounted for the case that you have open orders.

So for example,

Trade 1:

  • Opening balance $100, Percentage 50%
  • Purchased BTCUSDT $50, the order is executed, no open orders.
  • Closing balance $50

Trade 2:

  • Opening balance $50, Percentage 50%
  • Purchased ETHUSDT $25, the order is executed
  • Closing balance $25

As you can see above case, the buying amount is not consistent.

How can we overcome this inconsistency?

@fqueis
Copy link

fqueis commented Apr 7, 2021

@chrisleekr yeah it keeps the open trades to split the entering amount by a certain percentage.

Btw your example is wrong. See:

Trade 1:

  • Open trades: 0
  • Balance: $100, percent: 50%
  • Balance used in this trade: $50

Trade 2 (if the first one is not closed yet):

  • Open trades: 1
  • Balance: $50, percent: 50%
  • Balance used in this trade: $50

Edit: Maybe the var name (openOrders) left you in doubt, I should have used openTrades

@chrisleekr
Copy link
Owner

Oh, so you meant, we should track trade history for the coin?

@fqueis
Copy link

fqueis commented Apr 9, 2021

Oh, so you meant, we should track trade history for the coin?

Not exactly.

From your documentation:

Buy signal: The bot will continuously monitor the lowest value for the period of the candles. Once the current price reaches the lowest price, then the bot will place a STOP-LOSS-LIMIT order to buy.

When this order get filled you'll have one openTrade

Sell signal: If there is enough balance for selling and the last buy price is recorded in the bot, then the bot will start monitoring the sell signal. Once the current price reaches the trigger price, then the bot will place a STOP-LOSS-LIMIT order to sell.

When this same coin get sold and the order is filled, the openTrade goes back to zero

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

4 participants