Binance leverage futures Hook

Overview

Simple binance futures

Attention

  • Just use leverage. The fee difference between futures and spot is not considered. For example, funding rate, etc.
  • Only support binance
  • Only support isolated
  • Only long, Short is not supported
  • Not support increasing margin
  • Not support adjusting leverage when holding positions,This is a limitation of Binance
  • Please use the 2021.07 version of FT. There is no guarantee that the previous or later versions will support.Don't forget pip install -r requirements.txt after updating FT

Prepare

  • New binance users only support 20x leverage, please confirm whether your account supports higher leverage! Make sure your API is enabled and have Futures permissions Open futures after created the API, the created API still does not support futres, you must create a new API
  • When the script starts, it will initialize Leverage, PositionsideDual, Isolated, so your position needs to be empty
  • Make sure that the following methods are not customized ohlcvdata_to_dataframe custom_stake_amount custom_stoploss confirm_trade_entry bot_loop_start or use super().xxx() first

Modify config.json

  • Must set order_types.stoploss_on_exchange to true.
  • Muset set bid_strategy.use_order_book to true.
  • Muset set ask_strategy.use_order_book to true.
  • Highly recommended set ccxt_config.enableRateLimit to true.
  • exchange.ccxt_config add "options": {"defaultType": "future"}
  • exchange.ccxt_async_config add "options": {"defaultType": "future"}

Modify strategy

from pandas import DataFrame

from freqtrade.strategy import stoploss_from_open
from pathlib import Path
import sys

sys.path.append(str(Path(__file__).parent))
import importlib

interface_futures_binance = importlib.import_module("interface_futures_binance")
importlib.reload(interface_futures_binance)


class SimpleBinanceFutures(interface_futures_binance.IFutures):
    use_custom_stoploss = True

    # Futures config
    # New binance users only support 20x leverage, please confirm whether your account supports higher leverage!
    # Make sure your API is enabled and have Futures permissions
    # (open futures after created the API, the created API still does not support futres, you must create a new API)
    _leverage = 10

    def custom_stoploss(
        self, pair: str, trade: 'Trade', current_time: 'datetime', current_rate: float, current_profit: float, **kwargs
    ) -> float:
        """
        Must! Must! Must use custom_stoploss, and turn on stoploss_on_exchange

        FT spot does not handle the logic of forced liquidation.
        Therefore, stoploss_on_exchange must be used to manually liquidate the position before the forced liquidation
        """
        p = locals()
        del p["self"], p["__class__"]
        parent_stoploss = super().custom_stoploss(**p)

        return max(stoploss_from_open(parent_stoploss, current_profit), -1)

Other

  • If you want to change the strategy, it is recommended to restart instead of using web reload.
You might also like...
This is a cryptocurrency trading bot that analyses Reddit sentiment and places trades on Binance based on reddit post and comment sentiment. If you like this project please consider donating via brave. Thanks.

This is a cryptocurrency trading bot that analyses Reddit sentiment and places trades on Binance based on reddit post and comment sentiment. The bot f

Monitor your Binance portfolio

Binance Report Bot The intent of this bot is to take a snapshot of your binance wallet, e.g. the current balances and store it for further plotting. I

a simple python script that monitors the binance hotwallet and refunds the withdrawal fee to encourage people to withdraw their Nano and help decentralisation

Nano_Binance_Refund_Bot a simple python script that monitors the binance hotwallet and refunds the withdrawal fee to encourage people to withdraw thei

A muti pairs martingle trading bot for Binance exchange.

multi_pairs_martingle_bot English Documentation A muti pairs martingle trading bot for Binance exchange. Configuration { "platform": "binance_futur

Bot for automated buying boxes on Binance

V 1.0 Bot for automated buying boxes on Binance В settings.py выставляем свои COOKIE и свой CSRFTOKEN В settings.py для headers выставляем свои параме

Trading through Binance's API using Python & sqlite

pycrypt Automate trading crypto using Python to pull data from Binance's API and analyse trends. May or may not consistently lose money but oh well it

This is a crypto trading bot that scans the Binance Annoucements page for new coins, and places trades on Gateio
This is a crypto trading bot that scans the Binance Annoucements page for new coins, and places trades on Gateio

gateio-trading-bot-binance-announcements This Gateio x Binance cryptocurrency trading bot scans the Binance Announcements page and picks up on new coi

A new coin listing alert bot using Python, Flask, MongoDB, Telegram API and Binance API
A new coin listing alert bot using Python, Flask, MongoDB, Telegram API and Binance API

Bzzmans New Coin Listing Detection Bot Architecture About Project Work in progress. This bot basically gets new coin listings from Binance using Binan

McTrade is a bot exploiting Binance API, open source! built in python !

Open Source Crypto Trading Bot using Binance API Report Bug · Request Feature Table of Contents About The Project Built With Getting Started Prerequis

Owner
Adriance
Adriance
Binance Futures Client

Binance Futures Client

null 4 Aug 2, 2022
Andrei 1.4k Dec 24, 2022
Aio-binance-library - Async library for connecting to the Binance API on Python

aio-binance-library Async library for connecting to the Binance API on Python Th

GRinvest 10 Nov 21, 2022
Python based Algo trading bot for Nifty / Banknifty futures and options

Fully automated Alice Blue Algo Trading with Python on NSE and MCX for Nifty / Crude / Banknifty futures and options , absolutely FREE ! This algo tra

Rajesh Sivadasan 49 Dec 31, 2022
Market calendar RESTful API with holiday, late open, and early close. Over 50+ unique exchange calendars for global equity and futures markets.

Trading Calendar Market calendar RESTful API with holiday, late open, and early close. Over 50+ unique exchange calendars for global equity and future

Apptastic Software 1 Feb 3, 2022
A Telegram bot for remotely managing Binance Trade Bot

Binance Trade Bot Manager Telegram A Telegram bot for remotely managing Binance Trade Bot. If you have feature requests please open an issue on this r

Lorenzo Callegari 乐子睿 350 Jan 1, 2023
A python API for BSCScan (Binance Smart Chain Explorer), available on PyPI.

bscscan-python A complete Python API for BscScan.com, available on PyPI. Powered by BscScan.com APIs. This is a gently modified fork of the etherscan-

Panagiotis Kotsias 246 Dec 31, 2022
Terminal-Trade(Panel API) For Binance

Binance-Trade-Project Binance Futures Terminal-Trade(API) & Binance This Project Worth Around 500 Bucks. **I Did This Project For SomeOne And He

Cyber 9 Dec 30, 2021
PancakeTrade - Limit orders and more for PancakeSwap on Binance Smart Chain

PancakeTrade helps you create limit orders and more for your BEP-20 tokens that swap against BNB on PancakeSwap. The bot is controlled by Telegram so you can interact from anywhere.

Valentin Bersier 187 Dec 20, 2022