Quantcast
Channel: Active questions tagged python - Stack Overflow
Viewing all articles
Browse latest Browse all 23189

python trading bot create DCA safety order

$
0
0

I am working on creating a trading bot with Python. The strategy I got working in the bot and it can start a deal, but what I am looking for is the code to activate safety orders like 3commas has.Using the following settings I need a script to calculate the order price and amount to open a safety order:

  • Max safety trades count
  • Max active safety trades count
  • Price deviation to open safety orders (% from initial order)
  • Safety order volume scale
  • Safety order step scale

This is what I have so far:

initial_price=40000safety_order_size=100price_deviation = 1.5max_safety_orders_count=10max_active_safety_orders_count=1safety_order_volume_scale=1.19safety_order_step_scale=0.95safety_order_prices = []price_deviation_list = []current_price = initial_pricefor i in range(max_safety_orders_count):    safety_order_price = initial_price * (1 - price_deviation / 100)    safety_order_prices.append(safety_order_price)    price_deviation_list.append(price_deviation)    print(price_deviation_list)    price_deviation = (price_deviation * safety_order_step_scale)    print(price_deviation)

I have looked on the internet and asked chatgpt for the source code or the formula to calculate, but found nothing.Does anybody hear know how to do this?


Viewing all articles
Browse latest Browse all 23189

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>