nickpagz / 3commas-ftx-triggers Goto Github PK
View Code? Open in Web Editor NEWPython script to send buy and sell triggers to 3Commas trading bots setup to trade FTX perpetual futures
Python script to send buy and sell triggers to 3Commas trading bots setup to trade FTX perpetual futures
HI, I just came across this project and thought it was pretty cool. I noticed that bot creation through Py3c_create.py is not working anymore likely because of a new CCXT naming convention here.
Occasionally the FTX connection will fail/timeout, causing the script to stop execution. The initial call is properly try/error wrapped and handled using a loop with multiple tries, but other calls to FTX are not wrapped. Need to add these, and asses the number of tries and the delay between tries.
Hi,
When I'm using 1x leverage the calculated max bot usage is correct. When I set it to 3 it's wrong.
My settings:
UPDATE_BASE_ORDER_VOLUME = 33 #IN USD
UPDATE_TAKE_PROFIT = 1.25
UPDATE_SAFETY_ORDER_VOLUME = 60
UPDATE_MARTINGALE_VOLUME_COEFFICIENT = 1.2
UPDATE_MARTINGALE_STEP_COEFFICIENT = 1.1
UPDATE_MAX_SAFETY_ORERS = 10
UPDATE_ACTIVE_SAFETY_ORDERS_COUNT = 3
UPDATE_SAFETY_ORDER_STEP_PERCENTAGE = 2.0
UPDATE_LEVERAGE_CUSTOM_VALUE = 3
UPDATE_STOP_LOSS_TYPE = 'stop_loss' # or stop_loss_and_disable_bot
UPDATE_STOP_LOSS_PERCENTAGE = 0
UPDATE_STOP_LOSS_TIMEOUT_ENABLED = False
UPDATE_STOP_LOSS_TIMEOUT_IN_SECONDS = 300
UPDATE_START_ORDER_TYPE = 'market'
Dear Nic,.
When I run the "Py3c_create.py" i got the "object is not subscriptable " error. Could you please help me for solution .
Best Regards
Config File
TC_ACCOUNT_ID = '31369776'
TC_API_KEY = 'xxxxx'
TC_API_SECRET = 'xxxxxx'
BASE_URL = 'https://api.3commas.io'
API_KEY = 'xxxxx'
SECRET_KEY = 'xxxxx'
SUB_ACCOUNT = ''
PAIRS_BLACKLIST = ['DMG-PERP', 'BRZ-PERP', 'PERP/USD', 'SRN-PERP', 'PRIV-PERP']
LTF_DELAY = 60 #seconds between getting latest market data, processing orders.
LTF_INTERVALS = 5 # Delay * Intervals gives us the total time before the first order
LTF_BULL_CHANGE = 2.0
LTF_BEAR_CHANGE = -2.0
MAX_OPEN_POSITIONS = 20
ORDER_VALUE = 10
TAKE_PROFIT = '0.06'
STOP_LOSS = '0.03'
FUNDS_USAGE = 0.9
SWITCH_PERCENT = -7.0
TREND_STRENGTH = 65 # Percentage of longs vs shorts to consider not trading against a trend.
OPEN_POSITION_PRIORITY = True # True for max open positions, False for order size #not used in 3Commas, atm
ERROR
runfile('E:/malibot/Py3c_create.py', wdir='E:/malibot')
Reloaded modules: config
no existing bot ID files found, proceeding....
Error: {'error': True, 'msg': 'Other error occurred: not_found Not Found None.'}
Traceback (most recent call last):
File "E:\malibot\Py3c_create.py", line 175, in
build_bots()
File "E:\malibot\Py3c_create.py", line 150, in build_bots
longbot_list, no_long_bots = generate_long_bots(pairs_list, min_price)
File "E:\malibot\Py3c_create.py", line 81, in generate_long_bots
bot_list[key] = data["id"]
TypeError: 'NoneType' object is not subscriptable
This might be a fork, or separate version since this would handle the capturing of prices in a very different way - ie polling ftx for candle data and processing it on the fly instead of just grabbing the latest price in each loop.
Add an ema check on a 15 minute time frame, don't trade against (above/below) ema.
As a bonus, add a config switch to choose between crowd or ema.
Hi! Noob here! May I ask how to set it up for paper trading on 3commas? Thank's a lot!
3commas-ftx-triggers/Py3c_create.py
Line 170 in cc56524
this should read if shortbots_file.is_file....
Code is missing some context. Add a readme file to explain what it does, and how to use it.
In the \example.config.py
file, the TAKE_PROFIT
var is duplicated:
...
TAKE_PROFIT = '0.06'
...
TAKE_PROFIT = 1.5
Add a function in the updater script to check for newly listed or delisted perps/tokens/coins, create/delete the bots, and update the bot id lists.
Have read your latest blog post on bot settings for trending markets and saw comments about using Lunacrush for finding trending coins.
As I'm using your Python work as the basis for my own thing and implemented that Lunacrush stuff already, I thought giving back would be a nice idea. Below is what you would need to do to use your framework with Lunacrush.
Two new variables in config.py
:
# script sorts by Lunacrush alt rank starting deals with the lowest. Set the maximum alt rank below to not chase any losers.
LUNACRUSH_MAX_ALT_RANK = 20
# API key can be found in the profile settings
LUNACRUSH_API_KEY = ""
A new function that replaces your top_pairs()
one.
def lunacrush_top_pairs():
ssl._create_default_https_context = ssl._create_unverified_context
# Get all pairs of lbotid_list.txt
coin_list = []
with open("lbotid_list.txt") as f:
for line in f:
(key, val) = line.split(':')
key = key.replace("USD_","").replace("-PERP","")
coin_list.append(key)
coins = ','.join(coin_list)
# query lunacrush for all coins
url = "https://api.lunarcrush.com/v2?data=assets&key=" + config.LUNACRUSH_API_KEY + "&symbol=" + coins
assets = json.loads(urllib.request.urlopen(url).read())
# sort coins by lowest ( = best) alt rank
ranked_symbols = {}
for asset in assets['data']:
if 'alt_rank' in asset:
if asset['alt_rank'] <= config.LUNACRUSH_MAX_ALT_RANK:
ranked_symbols[asset['symbol']] = asset['alt_rank']
ranked_symbols = sorted(ranked_symbols.items(), key=lambda item: item[1])
ranked_symbols = {k: v for k, v in ranked_symbols}
return ranked_symbols
top_bull_pairs = lunacrush_top_pairs()
Exchange row 385 with:
highest_bull_pair = get_nth_key(top_bull_pairs, n) + "-PERP"
That's it :-)
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.