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

adds proper sell rounding to avoid LOT errors #79

Open
wants to merge 6 commits into
base: main
Choose a base branch
from
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Merge branch 'main' into implementing-step-size
hExPY authored May 14, 2021

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
commit 9e4d2f3ccc527bb2d478c5b153271ac232f4ab36
109 changes: 5 additions & 104 deletions Binance Detect Moonings.py
Original file line number Diff line number Diff line change
@@ -22,122 +22,23 @@
# used to store trades and sell assets
import json

# Switch between testnet and mainnet
# Setting this to False will use REAL funds, use at your own risk
# Define your API keys below in order for the toggle to work
TESTNET = True

# Get binance key and secret for TEST and MAINNET
# The keys below are pulled from environment variables using os.getenv
# Simply remove this and use the following format instead: api_key_test = 'YOUR_API_KEY'
api_key_test = os.getenv('binance_api_stalkbot_testnet')
api_secret_test = os.getenv('binance_secret_stalkbot_testnet')

api_key_live = os.getenv('binance_api_stalkbot_live')
api_secret_live = os.getenv('binance_secret_stalkbot_live')


# Authenticate with the client
if TESTNET:
client = Client(api_key_test, api_secret_test)

# The API URL needs to be manually changed in the library to work on the TESTNET
client.API_URL = 'https://testnet.binance.vision/api'

else:
client = Client(api_key_live, api_secret_live)

####################################################
# USER INPUTS #
# You may edit to adjust the parameters of the bot #
####################################################


# select what to pair the coins to and pull all coins paired with PAIR_WITH
PAIR_WITH = 'USDT'

# Define the size of each trade, by default in USDT
QUANTITY = 15

# Define max numbers of coins to hold
MAX_COINS = 10

# List of pairs to exclude
# by default we're excluding the most popular fiat pairs
# and some margin keywords, as we're only working on the SPOT account
FIATS = ['EURUSDT', 'GBPUSDT', 'JPYUSDT', 'USDUSDT', 'DOWN', 'UP']

# the amount of time in SECONDS to calculate the differnce from the current price
TIME_DIFFERENCE = 30

# Numer of times to check for TP/SL during each TIME_DIFFERENCE Minimum 1
RECHECK_INTERVAL = 6

# the difference in % between the first and second checks for the price.
CHANGE_IN_PRICE = 1.25

# define in % when to sell a coin that's not making a profit
STOP_LOSS = 1.75

# define in % when to take profit on a profitable coin
TAKE_PROFIT = 3

# whether to use trailing stop loss or not; default is True
USE_TRAILING_STOP_LOSS = True

# when hit TAKE_PROFIT, move STOP_LOSS to TRAILING_STOP_LOSS percentage points below TAKE_PROFIT hence locking in profit
# when hit TAKE_PROFIT, move TAKE_PROFIT up by TRAILING_TAKE_PROFIT percentage points
TRAILING_STOP_LOSS = 2
TRAILING_TAKE_PROFIT = 2

# Use custom tickers.txt list for filtering pairs
CUSTOM_LIST = False

# Use log file for trades
LOG_TRADES = True
LOG_FILE = 'trades.txt'

# Debug for additional console output
DEBUG = True


####################################################
# END OF USER INPUTS #
# Edit with care #
####################################################

# Load helper modules
from helpers.parameters import (
parse_args, load_config
)

# Load creds modules
from helpers.handle_creds import (
load_correct_creds
)

# for colourful logging to the console
class txcolors:
BUY = '\033[92m'
WARNING = '\033[93m'
SELL = '\033[91m'
DEFAULT = '\033[39m'


# Use CUSTOM_LIST symbols if CUSTOM_LIST is set to True
if CUSTOM_LIST: tickers = [line.strip() for line in open('tickers.txt')]

# try to load all the coins bought by the bot if the file exists and is not empty
coins_bought = {}

# path to the saved coins_bought file
coins_bought_file_path = 'coins_bought.json'

# use separate files for testnet and live
if TESTNET:
coins_bought_file_path = 'testnet_' + coins_bought_file_path

# if saved coins_bought json file exists and it's not empty then load it
if os.path.isfile(coins_bought_file_path) and os.stat(coins_bought_file_path).st_size != 0:
with open(coins_bought_file_path) as file:
coins_bought = json.load(file)


def get_price():
'''Return the current price for all coins on binance'''

You are viewing a condensed version of this merge commit. You can view the full changes here.