Making POST requests using requests python library

Back

I have to use R code inside my python script. I have made an simple API that accept two arguments, do calculation on digitalocean droplet using R and send back the output. 

I can use the through very simple POST request:

x = {
'x': np.random.rand(500).tolist(),
'adf_lag': 2
}
x = json.dumps(x)

res = requests.post("http://46.101.219.193/plumber_test/radf", data=x)
res_json = json.loads(res.text)
res_json.keys()

This works localy in python, but not in Qauntconnect

I saw this thread from January 2019: 

https://www.quantconnect.com/forum/discussion/7114/post-request-with-header/p1

@Alexendre Caterino said you will allow 'Notify,Web method'. I gound it here 

https://www.quantconnect.com/docs/live-trading/notifications

but it says 'Webhook requests are limited to 20 requests per hour'.

In nutshell, is it possible to send POST requests, as many as I would like. I don't see another way to use my R function inside Quantconnect.

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.


We set a rate limit to prevent exporting of data from the platform, as required by our data licenses to provide the platform at such a low cost. In C# you can tap into the R-Engine which is a bridge from C# to R locally inside the algorithm. This is the only way to call R as many times as you like.

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.


Jared Broad , what about python interface to R? IS this possible? Shouldn't the R been installed on the Quantconnect werver too?

0

R is installed Mislav but Python supported libraries don't include "R2Py" or something like that. I think perhaps that's the best way to get it into Python. Please research the best libraries for accessing R in Python and we can add it to the list of supported libraries. 

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.


If you add R2Py to supported libraries, I think I will beo able to solve the problem. But, can I install R packages on the server? Plain R woudln't help me.

0

No, you cannot make changes to the OS from the algorithm. If you send through a list of packages with the library request we can add it to the foundation. 

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.


Hi Mislav,

To make package requests, please email support@quantconnect.com with the requested packages. The packages will be added to the queue for review and deployment.

Best,
Shile Wen

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.


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