Back

Webhook data body

Quick question, when using the notify web hook the data has to be json, or url encoded or like this?

string data = "direction=buy&price=999.99";  
Notify.Web("http://api.com/", data);

I can't specify application/json content-type header or dont know how to, any examples? thanks.

Update Backtest








Figured it out, just create a class for your object then pass it along to your webhook like so:

public class Signal
{
public decimal price;
public string exchange;
public int timestamp;

public Signal()
{
price = 0;
exchange = "";
timestamp = 0;
}
}


Signal _signal = new Signal();
_signal.timestamp= 123456789;
_signal.exchange = "GDAX";
_signal.price= 999.99M;

Notify.Web("https://apidomain.com", _signal);

then on your server receive an application/json POST request.

thanks.

0

Update Backtest





0

The material on this website is provided for informational purposes only and does not constitute an offer to sell, a solicitation to buy, or a recommendation or endorsement for any security or strategy, nor does it constitute an offer to provide investment advisory services by QuantConnect. In addition, the material offers no opinion with respect to the suitability of any security or specific investment. QuantConnect makes no guarantees as to the accuracy or completeness of the views expressed in the website. The views are subject to change, and may have become unreliable for various reasons, including changes in market conditions or economic circumstances. All investments involve risk, including loss of principal. You should consult with an investment professional before making any investment decisions.


Loading...

This discussion is closed