Quantopian & Finance Flashcards

You may prefer our related Brainscape-certified flashcards:
1
Q

Quantopian: What does the initialize function do?

A

The initialize function runs once when the script starts.

It takes in one parameter which is context.

Context is a python dictionary that stores a bunch of data on your strategy (your protfolio, your performace, leverage, other info about you, etc).

When using quantopian the initialize function needs to be defined but it does not need to be called in the script.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

Quantopian: what is the history() method and what are its input parameters?

A

The history() module returns the price (or volume, etc) for the specified asset for x time back depending on the bar_count and frequency chosen.

Note: that the module is based on a pandas dataframe.

Input parameters: asset (e.g. the stock), field (type of data, price or volume?), bar_count (how many bars do you want), frequency (time period).

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

Quantopian: How can you pull price data?

A

you can get price data using data.history()

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

Finance: What does alpha represent?

A

Alpha represents the performance of a portfolio relative to a benchmark.

In other words, alpha is a measure of the return on investment that is not a result of general movement in the market.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

Finance: What is beta?

A

Beta is a measurement of the volatility of an asset’s returns.

It is used as a measurement of risk.

A higher beta means greater risk, but also greater expected returns.

β = 1, exactly as volatile as the market.

β > 1, more volatile than the market.

β < 1 > 0, less volatile than the market.

β = 0, uncorrelated to the market.

β < 0, negatively correlated to the market.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

Quantopian: How do you run your own function in quantopian?

A

Using schedule_function() written under initialize function.

You need to place your function as a parameter within schedule_function().

You can also define how often it runs, hourly, weekly, monthly, etc.

Also, when it runs relative to the market open. For example, you can make it offset so that it only runs 1 hour after the market opens.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

What does the blaze ecosystem allow for?

A

It provides python users high-level access to efficient computation on inconveniently large data.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

Qunatopian: what does blaze.compute() do?

A

It returns a pandas dataframe from a blaze.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

What should you always remember about applying functions to dataframes in quantopian?

A

You need to use pipeline.

Applying functions to dataframes outside out pipeline is going to be a lot slower.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

How do you import pipeline?

What do you need to remember?

A

from quantopian.pipeline import Pipeline

That the first pipeline is lower case p and the second pipeline (the import) is upper case.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

In quantopian if you get,

AttributeError: ‘function’ object has no attribute ‘to_execution_plan’

what does this mean?

A

It happens when you forget to put the parentheses on a function to convert it into a method.

By not putting parentheses you are just passing through the function code,

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

When using pipeline what does it mean to add a ‘factor’ and/or ‘filter’ represent?

A

Adding factors means that you’re adding numerical values.

Adding filters means adding a boolean value.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

What pipeline method do you need to use to stop certain securities from entering the pipeline you have defined?

A

your_pipeline_name.set_screen()

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

Why are pipelines used in quantopian?

A

Pipelines query all the data at the beginning of the backtest.

Using a pipeline improves data fetch and calculation performance.

The output of a pipeline is pandas dataframe with columns for each piece of data.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

What does alphalens do?

A

It is a python package to analyze the performance of alpha factors.

Using alphalens will help make your strategies more robust and less prone to overfitting.

Alphalens needs to applied to signal not the strategy!

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

Alphalens: What is a tear sheet?

Why would you use it?

A

Gives a graphical and statistical breakdown of an alpha factor and its signals.

You would use it to see if it is worth making an algorithm out of the signals.

17
Q

What is the Sharpe Ratio?

A

“It is a measure that indicates the average return minus the risk-free return divided by the standard deviation of the return.”

Standard deviation: seen as the measure of volatility

risk-free return: although no risk-free asset exists this refers to the return received for lowest risk assets in the market, such as treasury bonds.

Another way of viewing the Sharpe Ratio is that the ratio describes how much excess return you are receiving for the extra volatility that you have for holding a riskier asset.

18
Q

What is the Sortino Ratio?

A

The Sortino Ratio is a variation on the Sharpe Ratio. It differentiates between volatility and harmful volatility. While the Sharpe Ratio penalizes upside and downside volatility equally, the Sortino Ratio only penalizes downside.

In other words, the Sortino Ratio is the expected return minus the risk-free return divided by the downside deviation.

19
Q

What is ‘net margin’?

A

‘Net Margin’ or ‘Net Profit Margin’ is the ratio between the net income (profits) divided by total revenue.

The ‘Net Margin’ tells us how much profit each dollar of revenue generates.

20
Q

Why does sentdex use all the tradable stocks available on quantopian?

A

To minimise sector exposure.

21
Q

What are specific returns and common returns?

A

The specific returns plot tell us how much of the returns are down to the strategy (can be attributed to the strategy code).

Specific return: “The part of the excess return not explained by common factors. The specific return is independent of (uncorrelated with) the common factors and the specific returns of other assets.”

Common returns are the opposite, it tells us how much of the returns are coming from exposure to common risk factors.

Common factors: “ An element of return that influences many assets. According to multiple factor risk models, the factors determine correlations between asset returns.”