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

feat: Manual trade #216

Merged
merged 12 commits into from
Jun 5, 2021
Merged

feat: Manual trade #216

merged 12 commits into from
Jun 5, 2021

Conversation

chrisleekr
Copy link
Owner

@chrisleekr chrisleekr commented Jun 3, 2021

Description

The bot is doing automated transactions; however, was raised a suggestion to have a manual buy/sell trade feature by @chopeta.

This PR is to cover that feature.

How to test:

$ git pull
$ git checkout feature-manual-trade
$ npm run docker:build
$ docker-compose -f docker-compose.server.yml up -d
$ docker ps -a
$ docker logs binance-bot -f --tail=1000 | bunyan

Related Issue

#100

Motivation and Context

To provide the feature, I had to refactor and add extra steps to the bot.
In addition, I have added the feature to display the frontend notifications.

The feature outlines as below:

  • The last buy price
    • The current last buy price is a simple value, it should expand to record the quantity and price.
    • If there is the last buy price recorded, it should calculate the new last buy price based on the quantity and price.
  • Add buy/sell per symbol
    • It should confirm market/limit order.
    • It should show a similar layout as Binance.
    • It should pre-fill with the current price and make adjustable and some percentages -10%, -5%, 0%, +5%, +10%.
    • The orders now can be cancelled from the frontend.
    • It also notifies any action/result to Slack.
  • [Not developed with this PR] Add buy/sell for all symbols
    • Same as symbol buy/sell.
    • For buying, list up all monitoring coins.
    • For selling, list up the coins that are more than the minimum notional value.
    • For the limit order, cannot set the price, just give percentage option: -10%, -5%, 0%, +5%, +10%
    • Due to the API limit, it cannot be processed at the same time. Give 10 seconds buffer for each trade.
  • [Not developed with this PR] Add dust transfer, converting to BNB

How Has This Been Tested?

I have been placed multiple orders in the live mode.

Screenshots (if appropriate):

image
image
image
image

@chrisleekr chrisleekr changed the title Feature manual trade feat: Feature manual trade Jun 3, 2021
@chrisleekr chrisleekr changed the title feat: Feature manual trade feat: Manual trade Jun 3, 2021
@chrisleekr chrisleekr linked an issue Jun 3, 2021 that may be closed by this pull request
@chrisleekr chrisleekr linked an issue Jun 3, 2021 that may be closed by this pull request
@piscui
Copy link

piscui commented Jun 3, 2021

Ok, I tried placing a market SELL order, 100%. First time around it failed (see detail below), then I tried again with the exact same parameters and it went through fine.

EDIT: I tried again with BNBUSDT, same thing happened except subsequent attempts failed as well.

XLMBNB Manual SELL Action (19:07:25.059): MARKET - TOTAL

  • Order Params:
{
  "symbol": "XLMBNB",
  "side": "sell",
  "type": "MARKET",
  "quoteOrderQty": 0.293049
}
  • Current API Usage: 182

Execution failed (19:07:25.334)
Job: Trailing Trade
Code: -2010
Message:
Account has insufficient balance for requested action.
Stack:

Error: Account has insufficient balance for requested action.
    at /srv/node_modules/binance-api-node/dist/http-client.js:93:17
    at runMicrotasks (<anonymous>)
    at processTicksAndRejections (internal/process/task_queues.js:95:5)
    at async execute (/srv/dist/server.js:1:27393)
    at async /srv/dist/server.js:1:3023
    at async Promise.all (index 3)
    at async execute (/srv/dist/server.js:1:1712)
    at async /srv/dist/server.js:1:64678
    at async CronJob.<anonymous> (/srv/dist/server.js:1:64516)
  • Current API Usage: 193

@chrisleekr
Copy link
Owner Author

@piscui

Hey, thanks for testing.

I found a precision calculation for the amount is slightly wrong.
I checked the Binance app and the bot calculation. It should be now corrected.

@chrisleekr
Copy link
Owner Author

Since the PR is getting larger with the changes, I will merge this PR first and then develop extra features

  • Add buy/sell for all symbols
  • Add dust transfer, converting to BNB

@chrisleekr chrisleekr merged commit 9c8c99c into master Jun 5, 2021
@chrisleekr chrisleekr deleted the feature-manual-trade branch June 5, 2021 07:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Help wanted to test PR - Manual trade Buy/Sell manually
2 participants