CyberPunkMetalHead / gateio-crypto-trading-bot-binance-announcements-new-coins

This is a crypto trading bot that scans the Binance Annoucements page for new coins, and places trades on Gateio
MIT License
1.21k stars 303 forks source link

Two issues: Multiple buy orders and Multiple session support #94

Closed busyuqboy closed 2 years ago

busyuqboy commented 2 years ago

Overview

  1. Multiple orders

There is an edge case issue where two orders trying to opperate buy/sells at the same time will create an invalid order. This will be an issue if a second announcement is made while the first announcement has completed and turned into an active order (in order.json).

The second order will create the invalid order issue only when it comes back as cancelled status. This is the edge case. If the order comes back closed the operation isn't impacted. This is due to the order dictionary being "cleared" (all orders) instead of removing just the key (coin) that needs to be re-purchased.

The issue is known by the following log output: Order is initialized but not ready. Continuing.

  1. Multiple session support

The session.json file is used to help with partially filled/multiple orders per coin and to help sum the total fees for all orders produced. This is critical for the sale order to be able to sell 100% of the amount that the bot purchased.

There is an initialization of the session variable that is killing the historical/saved values. This can cause an active order to not be able to sell correctly due to the summed fees being wiped.

These two issues were introduced by code introduced by PR #62

busyuqboy commented 2 years ago

Actually, the second issue (multiple session support) is resolved in the master branch. This issue is in my own fork only.

Only one issue to solve regarding invalid orders (# 1 described above)