Algorithmic Trading Explained

Choose a study mode

Play Quiz
Study Flashcards
Spaced Repetition
Chat to Lesson

Podcast

Play an AI-generated podcast conversation about this lesson
Download our mobile app to listen on the go
Get App

Questions and Answers

What position locks the transmission and prevents wheels from turning?

  • Park (correct)
  • Neutral
  • Reverse
  • Drive

In a vehicle with an automatic transmission, which gear is used for normal forward driving?

  • Neutral
  • Reverse
  • Drive (correct)
  • Park

When is the Neutral gear typically used in a vehicle with an automatic transmission?

  • When backing up the vehicle
  • When driving at higher speeds to save fuel
  • When requiring more power but less speed
  • When the transmission is not locked and there is no power to the wheels (correct)

What is the purpose of the clutch pedal in a manual transmission vehicle?

<p>To connect and disconnect the engine and transmission (A)</p> Signup and view all the answers

In a manual transmission vehicle, what should the gear shift lever be in when starting the engine?

<p>Neutral (A)</p> Signup and view all the answers

What is 'riding the clutch'?

<p>Leaving your foot on the clutch pedal unnecessarily (B)</p> Signup and view all the answers

What does perception time refer to regarding stopping distance?

<p>The time it takes to recognize a situation and understand the need to stop (D)</p> Signup and view all the answers

What is the average reaction time?

<p>Three-quarters of a second (A)</p> Signup and view all the answers

What should you do before reversing?

<p>Look behind the vehicle and only drive in reverse when your path is clear of traffic, pedestrians, and obstacles (C)</p> Signup and view all the answers

When driving, what should you use your signal light for?

<p>To signal other drivers what you are going to do (B)</p> Signup and view all the answers

Flashcards

Reaction Time

Time it takes to respond to a situation by moving your foot to the brake; averages 3/4 of a second.

Braking Time

Time it takes for the brakes to stop a vehicle after being applied; distance varies with speed.

Reversing Safely

Looking behind the vehicle and only drive in reverse when your path is clear of traffic, pedestrians and obstacles

Signalling

Drivers must use signal lights to indicate moving away from a curb, turning, or changing lanes.

Signup and view all the flashcards

Smooth Acceleration

Adjust speed gradually, considering weather, road, and traffic; avoid abrupt changes.

Signup and view all the flashcards

Perception time

Time to recognize a situation and understand the need to stop; roughly 3/4 of a second.

Signup and view all the flashcards

Friction Point

At the friction point slowly release the clutch pedal and use the gas pedal to avoid stalling

Signup and view all the flashcards

Clutch pedal use

Used to connect and disconnect the vehicle's engine and transmisssion

Signup and view all the flashcards

Neutral in Automatic

Position where there is no gear selected. The wheels are not locked and there is no power to the wheels.

Signup and view all the flashcards

Park

Position is used when starting the engine or when vehicle is parked. It locks the transmission

Signup and view all the flashcards

Study Notes

Algorithmic Trading

  • Employs automated, pre-programmed trading instructions based on price, timing, and volume variables
  • Also called automated trading, black-box trading, or algo-trading

How Algorithmic Trading Works

  • A trader uses an algorithm that defines a set of instructions
  • The algorithm connects to an exchange or broker
  • The trade is automatically executed when the algorithm’s criteria are met

Example

  • Buy 100 shares of AAPL if the price is less than $150
  • Sell 100 shares of AAPL if the price is greater than $160

Benefits of Algorithmic Trading

  • Faster monitoring and trade execution than humans
  • Removes emotional biases from trading decisions
  • Enables order execution at the best price
  • Reduces transaction costs
  • Allows for simultaneous order execution across multiple markets

Disadvantages of Algorithmic Trading

  • Algorithms can malfunction
  • Requires constant monitoring
  • Can lead to market manipulation
  • Is only as good as the code it is based on

Common Algorithmic Trading Strategies

  • Trend Following: Identifies and trades trends using moving averages and Bollinger Bands
  • Mean Reversion: Identifies and trades price extremes with pairs trading and statistical arbitrage
  • Arbitrage: Exploits price differences across markets
  • Execution Algorithms: Executes large orders without market impact using VWAP (volume weighted average price) and TWAP (time weighted average price)
  • High-Frequency Trading (HFT): Uses high-speed computers to make many orders in fractions of a second

Trees

Definition of a Tree

  • A tree is a collection of nodes this collection can be empty
  • A non-empty tree has a root node r and zero or more non-empty subtrees $T_1, T_2,... , T_k$
  • Each root is connected by a directed edge from r
  • The root of each subtree is a child of r
  • r is the parent of each subtree root
  • Nodes without children are called leaves
  • The depth of a node n is the length of the unique path from the root to n
  • The height of a node n is the length of the longest path from n to a leaf
  • The height of a tree is the height of its root
  • A collection of trees is called a forest

Implementing a Tree

  • One implementation method involves each node having a pointer to each of its children, in addition to the data
  • Another solution is to keep the children of each node in a linked list
  • Instead of links to each child there is a link to the first child, and links between siblings

Tree Traversal Types

  • Preorder
  • Postorder
  • Inorder
  • Level order
  • The first three traversals are defined recursively

Preorder Traversal

  • Visits the root first, then the children recursively (from left to right)
template 
void preorder(BinaryNode *t) {
  if (t != nullptr) {
    cout element left); // Visit the left child
    preorder(t->right); // Visit the right child
  }
}

Postorder Traversal

  • Visits the children recursively (from left to right) first, then the root
template 
void postorder(BinaryNode *t) {
  if (t != nullptr) {
    postorder(t->left); // Visit the left child
    postorder(t->right); // Visit the right child
    cout element right); // Visit the right child
  }
}

Inorder Traversal

  • Visits the left child, then the root, and then the right child
template 
void inorder(BinaryNode *t) {
  if (t != nullptr) {
    inorder(t->left); // Visit the left child
    cout element right); // Visit the right child
  }
}

Level Order Traversal

  • Visits nodes level by level, from left to right
  • Visits the root first, then the root's children from left to right, then the root's grandchildren from left to right, and so on
  • Uses a queue
template 
void levelOrder(BinaryNode *t) {
  if (t == nullptr) return;

  queue q;
  q.push(t);

  while (!q.empty()) {
    BinaryNode *node = q.front();
    q.pop();

    cout element left != nullptr)
      q.push(node->left); // Enqueue the left child

    if (node->right != nullptr)
      q.push(node->right); // Enqueue the right child
  }
}

Lab 1: Introduction to Quantum Computing

Course Information

  • Instructor: Frederik Wilde
  • Email: [email protected]
  • Office: QNC 3125
  • Office Hours: Tuesdays 10:00 AM - 11:00 AM, or by appointment
  • TA: Abhimanyu (Abhi) Sharma
  • Email: [email protected]
  • Office: Virtual
  • Office Hours: See LEARN

Lab Introduction

  • Introduces fundamental concepts of quantum computing
  • Explores single-qubit gates, their matrix representations, and how to apply them using Python and the Qiskit library

Learning Objectives

  • Understand basics of single-qubit gates
  • Represent quantum gates as matrices
  • Apply quantum gates to qubits using Qiskit
  • Simulate quantum circuits and visualize outputs

Prerequisites

  • Basic knowledge of linear algebra (vectors, matrices)
  • Familiarity with Python programming
  • Qiskit installed in your Python environment

Single-Qubit Gates

Pauli-X Gate

  • A fundamental quantum gate analogous to the classical NOT gate which flips the state of a qubit
  • Matrix representation:

$X = \begin{bmatrix} 0 & 1 \ 1 & 0 \end{bmatrix}$

  • If the input state is $|0\rangle$, the output state is $|1\rangle$
  • If the input state is $|1\rangle$, the output state is $|0\rangle$

Pauli-Z Gate

  • Applies a phase flip if the qubit is in the $|1\rangle$ state
  • Matrix representation:

$Z = \begin{bmatrix} 1 & 0 \ 0 & -1 \end{bmatrix}$

  • If the input state is $|0\rangle$, the output state is $|0\rangle$
  • If the input state is $|1\rangle$, the output state is $-|1\rangle$

Hadamard Gate

  • Creates a superposition of $|0\rangle$ and $|1\rangle$
  • Matrix representation:

$H = \frac{1}{\sqrt{2}} \begin{bmatrix} 1 & 1 \ 1 & -1 \end{bmatrix}$

  • If the input state is $|0\rangle$, the output state is $\frac{|0\rangle + |1\rangle}{\sqrt{2}}$
  • If the input state is $|1\rangle$, the output state is $\frac{|0\rangle - |1\rangle}{\sqrt{2}}$

Qiskit Implementation

Setting up the Environment

  • Import the necessary modules from Qiskit
import numpy as np
from qiskit import QuantumCircuit, transpile, Aer, execute
from qiskit.visualization import plot_histogram

Creating a Quantum Circuit

  • Create a quantum circuit with one qubit and one classical bit
qc = QuantumCircuit(1, 1) # 1 qubit, 1 classical bit

Applying Gates

  • Apply a Hadamard gate to the qubit
qc.h(0) # Apply H-gate to qubit 0

Measuring the Qubit

  • Measure the qubit and store the result in the classical bit
qc.measure(, ) # Measure qubit 0 and store in bit 0

Running the Simulation

  • Simulate the circuit using the Aer simulator
simulator = Aer.get_backend('qasm_simulator')
compiled_circuit = transpile(qc, simulator)
job = execute(compiled_circuit, simulator, shots=1000)
result = job.result()
counts = result.get_counts(qc)
print(counts) # Print the results
plot_histogram(counts) # Visualize the results

Exercises

  • Exercise 1: Create a quantum circuit that applies a Pauli-X gate followed by a Hadamard gate to a qubit initially in the $|0\rangle$ state then, measure and display the measurement results.
  • Exercise 2: Implement a circuit that applies a Pauli-Z gate to a qubit, followed by a Hadamard gate and predict the output
  • Exercise 3: Create a quantum circuit with two qubits then, apply a Hadamard gate to the first qubit and apply a CNOT gate with the first qubit as control and the second qubit as target before measuring both qubits.

Report

  • Write a brief report (1-2 pages) summarizing your findings from the exercises.
  • Include code snippets for each exercise.
  • Include measurement results and histogram plots.
  • Include an explanation of the observed outcomes.
  • Include a discussion of the concepts learned.

Submission

  • Submit your report and Python code files in a zip folder named "Lab1_YourName.zip" to the LEARN dropbox by the due date.

Function Logarithme Népérien

Definition

  • The function logarithme népérien, noted ln, is defined on $]0; +\infty[$
  • It is the reciprocal of the exponential function

$\forall x \in ]0; +\infty[, \forall y \in \mathbb{R}, y = \ln(x) \Leftrightarrow x = e^y$

  • $\ln(e) = 1$
  • $\ln(1) = 0$

Consequences

  • $\forall x \in ]0; +\infty[, e^{\ln(x)} = x$
  • $\forall x \in \mathbb{R}, \ln(e^x) = x$

Algebraic Properties

  • For all strictly positive reals $a$ and $b$, and for all relative integers $n$:
    • $\ln(ab) = \ln(a) + \ln(b)$
    • $\ln(\frac{1}{b}) = -\ln(b)$
    • $\ln(\frac{a}{b}) = \ln(a) - \ln(b)$
    • $\ln(a^n) = n\ln(a)$
    • $\ln(\sqrt{a}) = \frac{1}{2}\ln(a)$

Function Study

  • The function $\ln$ is defined and derivable on $]0; +\infty[$
  • $(\ln(x))' = \frac{1}{x}$
  • The function $\ln$ is strictly increasing on $]0; +\infty[$

Limits

  • $\lim_{x \to +\infty} \ln(x) = +\infty$
  • $\lim_{x \to 0} \ln(x) = -\infty$
  • $\lim_{x \to +\infty} \frac{\ln(x)}{x} = 0$
  • $\lim_{x \to 0} x\ln(x) = 0$

Variation Table

$x$ 0 1 $+\infty$
$\ln(x)$ $-\infty$ $\nearrow$ 0 $+\infty$

Graphical Representation

  • Shows a graph of $y = \ln(x)$ on the Cartesian plane
  • The x-axis ranges from -1 to 9, and the y-axis ranges from -5 to 5
  • The curve starts from negative infinity and increases monotonically, crossing the x-axis at x = 1
  • The function approaches positive infinity as x approaches positive infinity
  • The curve is asymptotic to the y-axis as x approaches 0

Studying That Suits You

Use AI to generate personalized quizzes and flashcards to suit your learning preferences.

Quiz Team

More Like This

Algorithmic Trading: An Overview
10 questions
Algorithmic Trading Strategies
15 questions

Algorithmic Trading Strategies

UsableDarmstadtium1392 avatar
UsableDarmstadtium1392
Algorithmic Trading
15 questions

Algorithmic Trading

StimulativeAgate6885 avatar
StimulativeAgate6885
Algorithmic Trading Explained
15 questions
Use Quizgecko on...
Browser
Browser