Code Monkey home page Code Monkey logo

freqdydx-tp-sl's Introduction

README

Freqtrade as of today does not support DYDX, this repo contains an implementation of a minimal API endpoint to connect with Freqtrade webhooks.

Setup

Populate a file called private_config.py with your data.

Change the values at the start of the main.py file to fit your needs.

Start the API by running :

# python3 main.py 

A logging file will be created at the same dir called log.txt.

Freqtrade config

First step is enable webhooks in your Freqtrade config. We are only using status, entry and exit webhooks for now.

Freqtrade posts form encoded to our API.

"webhook": {
    "enabled": true,
    "url": "http://127.0.0.1:7000/api",
    "webhookentry": {
        "command": "Entry",
        "pair": "{pair}",
        "trade_id": "{trade_id}",
        "direction": "{direction}",
        "amount": "{amount}",
        "stake_amount": "{stake_amount}",
        "open_rate": "{open_rate}",
    },
    "webhookexit": {
        "command": "Exit",
        "pair": "{pair}",
        "trade_id": "{trade_id}",
        "direction": "{direction}",
        "amount": "{amount}",
        "stake_amount": "{stake_amount}",
        "open_rate": "{open_rate}",
        "limit": "{limit}",
    },
    "webhookstatus": {
        "command": "Status",
        "status": "{status}",
    },
},

Testing with CURL

Test the status command :

curl -X POST http://127.0.0.1:7000/api -F command=Status

Test an entry order :

curl -X POST http://127.0.0.1:7000/api -F command=Entry \
    -F pair="BTC/USDT" \
    -F trade_id=10 \
    -F direction=Long \
    -F amount=0.001 \
    -F stake_amount=10 \
    -F open_rate=100 
curl -X POST http://127.0.0.1:7000/api -F command=Exit \
    -F pair="ETH/USDT" \
    -F trade_id=10 \
    -F direction=Long \
    -F amount=0.1 \
    -F stake_amount=20 \
    -F limit=120.111 

Note that data must be formatted as if it was sent by Freqtrade. Change the values according to what you want to test.

Security

lol

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.