Quantopian's community platform is shutting down. Please read this post for more information and download your code.
Back to Community
Run Quantopian algo from Cloud for paper trading on Alpaca

Still new to Quant world & Quantopian.

I am looking to run my quantopian algos from a cloud (AWS/Google Cloud) environment to execute paper traders on Alpaca.

I found a few posts that talk about converting quantopian packages to run on alpaca like https://alpaca.markets/docs/alpaca-works-with/quantopian-to-pipeline-live/, but how can I integrate functions like algo.schedule_function, before_trading_start() etc to schedule my code run at certain times.

5 responses

Use Zipline.

Pylivetrader allows you to do that too.

Last year I build and example using Pylivetrader and deployed the framework using Amazon Beanstalk. The code is probably deprecated now. At that point I had to build a backend for paper-trading with Pylivetrader but I think there is an official version now.

Generally I would not rely on any library for scheduling because you would need the script to run in definitely. If the server is down for just a second your script would stop, so you would constantly need to check if it's still running.

I don't have any experience with AWS or Google Cloud but I think they run on linux, then you can set up cron jobs for your script to run (just google 'linux cron job', it's quite simple). The schedule methods from Zipline libraries should still work if your cron jobs start before the scheduled time.

Out of curiousity, are AWS and/or Google Cloud free?
Because I recently set up an algo for alpaca on PythonAnywhere and allthough their free version is sufficient for me right now, it's quite limited.

@Tentor if you don't need to load a lot of info in memory, a micro instance will work and it's free. If it's not enough you might need a small one and it's around 15 usd per month working 24/7. I guess that you can manage to get it for even less reserving instances or using spot instances.

Did anyone used Blueshift from quantinsti? They are integrated with alpaca and wondering if anyone tried and curious about the experience?