Hello,
I am doing an online Udemy Course, Python for Financial Analysis and Algorithmic Trading by Pierian Training. The course was initially supposed to be for Quantopian (*zipline) but now the course instructor has recommended BlueShift. Pierian Training are not supporting the algo trading questions on Blueshift.
Some of the Quantopian code works verbatim in Blueshift, others I have successfully edited by looking at the BlueShift API documentation.
I am stuck on can_trade()
This code does not work in Blueshift, however it did in Quantopian.
from blueshift.api import( symbol,
order_target_percent,
schedule_function,
date_rules,
time_rules,
can_trade,
)
def initialize(context):
# Reference to Tech Stocks
context.amzn = symbol("AMZN")
def handle_data(context,data):
# This insures we don't hit an exception!
if data.can_trade(symbol("AMZN")):
order_target_percent(context.amzn, 1.0)
API Functions — Blueshift 2.0.0 documentation (quantinsti.com)
- scroll down 70% the page to see can-trade() function docs
TradingAlgorithm.
can_trade
(assets)- Can someone give me a working example?
(If anyone else is on the same Udemy course maybe we can start a Thread here to get us through the last 2 Sections 12 & 13. I have been posting answers on there, because I don't think it is fair that we pay for their new QuantConnect Course)