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.
Owner
Adriance
Adriance
微信支付接口V3版python库

wechatpayv3 介绍 微信支付接口V3版python库。 适用对象 wechatpayv3支持微信支付直连商户,接口说明详见 官网。 特性 平台证书自动更新,无需开发者关注平台证书有效性,无需手动下载更新; 支持本地缓存平台证书,初始化时指定平台证书保存目录即可。 适配进度 微信支付V3版A

chen gang 258 Jan 06, 2023
A python based all-in-one tool for Google Drive

gdrive-tools A python based all-in-one tool for Google Drive Uses For Gdrive-Tools ✓ generate SA ✓ Add the SA and Add them to TD automatically ✓ Gener

XcodersHub 32 Feb 09, 2022
Python wrapper to simplify calls to AncestryDNA API.

AncestryDNA API wrapper Ancestry exposes an undocumented REST API for its DNA features. This Python wrapper inventories the available calls, and expos

Matt 2 Jun 10, 2022
Tracks how much money a profile has in their bank and graphs it, as long as they enable the bank api

Tracks how much money a profile has in their bank and graphs it, as long as they enable the bank api. (you could really use this to track anything from the hypixel api)

1 Feb 08, 2022
A multi exploit instagram exploitation framework

Instagram Exploitation Framework About IEF Is an open source Instagram Exploitation Framework with various Exploits that could be used to mod your pro

Instagram Exploitation Framework - BirdSecurity 1 May 23, 2022
Unauthenticated enumeration of services, roles, and users in an AWS account or in every AWS account in existence.

Quiet Riot 🎶 C'mon, Feel The Noise 🎶 An enumeration tool for scalable, unauthenticated validation of AWS principals; including AWS Acccount IDs, roo

Wes Ladd 89 Jan 05, 2023
Kanata Bot - a modular bot running on python3 with anime theme and have a lot features

Kanata Bot Kanata Bot is a modular bot running on python3 with anime theme and have a lot features. Easiest Way To Deploy On Heroku This Bot is Create

Rikka-Chan 2 Jan 16, 2022
ApiMoedas - This API is a extesion of API

🪙 Api Moeda 🪙 Este projeto é uma extensão da API Awesome API. Basicamente, ele mostra todas as moedas que a Awesome API tem e todas as suas conversõ

Abel 4 May 29, 2022
Satoshi is a discord bot template in python using discord.py that allow you to track some live crypto prices with your own discord bot.

Satoshi ~ DiscordCryptoBot Satoshi is a simple python discord bot using discord.py that allow you to track your favorites cryptos prices with your own

Théo 2 Sep 15, 2022
Kang Sticker bot

Kang Sticker Bot A simple Telegram bot which creates sticker packs from other stickers, images, documents and URLs. Based on kangbot Deploy Credits: s

Hafitz Setya 11 Jan 02, 2023
Remedy when Amazon ECR is not running basic scans for container CVEs.

Welcome to your CDK Python project! This is a blank project for Python development with CDK. The cdk.json file tells the CDK Toolkit how to execute yo

4n6ir 4 Nov 05, 2022
A free tempmail api for your needs!

Tempmail A free tempmail api for your needs! Website · Report Bug · Request Feature Features Add your own private domains Easy to use documentation No

dropout 10 Oct 26, 2021
Signs API calls to SberCloud.Advanced with AK/SK

sbercloud-api-aksk Signs API calls to SberCloud.Advanced with AK/SK This script is a courtesy of @sadpdtchr Description Sometimes there is a need to m

Peter Predtechensky 1 Nov 30, 2021
Upload comma-delimited files to biglocalnews.org in your GitHub Action

Upload comma-delimited files to biglocalnews.org in your GitHub Action Inputs api-key: Your biglocalnews.org API token. project-id: The identifier of

biglocalnews 1 Apr 20, 2022
Simple stock price analytics

mune · Mune is an open source python web application built to analyze stocks, named after Homma Munehisa. Currently, the forecasting component is powe

Richard Hong 14 Aug 30, 2021
Telegram bot to download almost all from Instagram

Instagram Manager Bot The most advanced Instagram Downloader Bot. Please fork this repository don't import code Made with Python3 (C) @subinps Copyrig

SUBIN 300 Dec 30, 2022
This repository is used to simplify the process of cloning the SSM documents across the AWS regions.

SSM Cloner Introduction This module is created in order to simplify the process of copying the SSM documents from one region to another regions. As an

6 Jun 04, 2022
A minimalistic, modern Discord bot for roles and polls using dropdowns

DropBot A minimalistic, modern Discord bot for roles and polls using dropdowns Made by ThatOneCalculator Technologies used Instructions Type /, and na

ModernBots 1 Jun 27, 2022
A CLI tool to transfer, sync, and backup playlists on music streaming services

unitunes A command-line interface tool to manage playlists across music streaming services. Introduction unitunes manages playlists across streaming s

Victor Tao 50 Jan 07, 2023
Texting service to receive current air quality conditions and maps, powered by AirNow, Twilio, and AWS

The Air Quality Bot is generally available by texting a zip code (and optionally the word "map") to (415) 212-4229. The bot will respond with the late

Alex Laird 8 Oct 16, 2022