SenseTecnic / node-red-contrib-binance

A Node-RED node wrapper to make API calls to the Binance exchange
Apache License 2.0
4 stars 8 forks source link

binance buy node #1

Closed mcbittech closed 6 years ago

mcbittech commented 6 years ago

Hello @tedhuang , i'm not able to send my value on the node in object. Have you got any example with a function to send any variable to this node please?

Thank you, mcbittech

tedhuang commented 6 years ago

msg.payload should contain quantity, price and orderType. msg.topic should contain the tickerPair (i.e. "BNBBTC").

Here's an example, just fill in with your own credentials:

[
    {
        "id": "7fa6fbd7.9227f4",
        "type": "function",
        "z": "554b988a.e55fc8",
        "name": "",
        "func": "msg.topic = \"BNBBTC\";\nmsg.payload = {};\nmsg.payload.quantity = 1;\nmsg.payload.price = 0.0015;\nmsg.payload.orderType = 'LIMIT';\n\nreturn msg;",
        "outputs": 1,
        "noerr": 0,
        "x": 510,
        "y": 360,
        "wires": [
            [
                "a404809d.9cb"
            ]
        ]
    },
    {
        "id": "48ccede1.62abc4",
        "type": "inject",
        "z": "554b988a.e55fc8",
        "name": "",
        "topic": "",
        "payload": "",
        "payloadType": "date",
        "repeat": "",
        "crontab": "",
        "once": false,
        "onceDelay": 0.1,
        "x": 380,
        "y": 440,
        "wires": [
            [
                "7fa6fbd7.9227f4"
            ]
        ]
    },
    {
        "id": "a404809d.9cb",
        "type": "binance-buy",
        "z": "554b988a.e55fc8",
        "binance": "7c330a13.a9ef44",
        "name": "",
        "ticker": "",
        "orderType": "LIMIT",
        "quantity": "",
        "price": "",
        "x": 600,
        "y": 440,
        "wires": [
            [
                "1bb16385.a5dbcc"
            ]
        ]
    },
    {
        "id": "1bb16385.a5dbcc",
        "type": "debug",
        "z": "554b988a.e55fc8",
        "name": "",
        "active": true,
        "tosidebar": true,
        "console": false,
        "tostatus": false,
        "complete": "false",
        "x": 740,
        "y": 360,
        "wires": []
    },
    {
        "id": "7c330a13.a9ef44",
        "type": "binance-credentials",
        "z": "",
        "name": "credentials"
    }
]
mcbittech commented 6 years ago

Thank you very much! And about stop-loss order? Isn’t implemented yet?

tedhuang commented 6 years ago

Nope that hasn't been implemented yet but it's not hard to add.

mcbittech commented 6 years ago

And you plan to do this or it’s not planned ? It will be great to have!

tedhuang commented 6 years ago

Yes I agree it's great to have. I am planning on adding it, just a bit busy at the moment. Pull requests are welcome.

sdoherty0 commented 2 years ago

TedHuang - How would one implement a stop-loss or OCO order if one wanted to do it? I want to do it.