Madaline  Mertz

Madaline Mertz

1622787780

Algorithmic Trading in Python with Alpaca

Agenda

  1. Introduction and Recap
  2. What is a Trading Strategy?
  3. Outline of Our Strategy
  4. Writing the Strategy in Python
  5. Conclusion

Introduction and Recap

This is the second part of a blog series on algorithmic trading in Python using Alpaca. This series will cover the development of a fully automatic algorithmic trading program implementing a simple trading strategy. In the first blog, we covered the Alpaca platform, setting up the Alpaca API, and a few sample API calls in Python. Reading Part 1 will give you a basic understanding of how to interface Alpaca with Python and will serve as the foundation for developing our trading program, which is the topic of this blog.

_I will be uploading all code into a single repository, which will get updated with each blog. The repository can be found _here.

#python #algorithmic-trading #trading-strategy #api #trading

What is GEEK

Buddha Community

Algorithmic Trading in Python with Alpaca
Ray  Patel

Ray Patel

1619518440

top 30 Python Tips and Tricks for Beginners

Welcome to my Blog , In this article, you are going to learn the top 10 python tips and tricks.

1) swap two numbers.

2) Reversing a string in Python.

3) Create a single string from all the elements in list.

4) Chaining Of Comparison Operators.

5) Print The File Path Of Imported Modules.

6) Return Multiple Values From Functions.

7) Find The Most Frequent Value In A List.

8) Check The Memory Usage Of An Object.

#python #python hacks tricks #python learning tips #python programming tricks #python tips #python tips and tricks #python tips and tricks advanced #python tips and tricks for beginners #python tips tricks and techniques #python tutorial #tips and tricks in python #tips to learn python #top 30 python tips and tricks for beginners

Ray  Patel

Ray Patel

1619510796

Lambda, Map, Filter functions in python

Welcome to my Blog, In this article, we will learn python lambda function, Map function, and filter function.

Lambda function in python: Lambda is a one line anonymous function and lambda takes any number of arguments but can only have one expression and python lambda syntax is

Syntax: x = lambda arguments : expression

Now i will show you some python lambda function examples:

#python #anonymous function python #filter function in python #lambda #lambda python 3 #map python #python filter #python filter lambda #python lambda #python lambda examples #python map

August  Larson

August Larson

1624365480

Algorithmic Trading with the Keltner Channel in Python

A must-know indicator for all the traders out there

Introduction

While you’re studying technical indicators, you would definitely come across a list comprising curated indicators that are widely considered as ‘must-know’ indicators that need to be learned by you before getting your hands dirty in the real-world market. The indicator we are going to explore today adds to this list given its performance in the market. It’s none other than the Keltner Channel (KC).

In this article, we will first discuss what the Keltner Channel is all about, and the mathematics behind the indicator. Then, we will proceed to the programming part where we will use Python to build the indicator from scratch, construct a simple trading strategy based on the indicator, backtest the strategy on Intel stocks, and finally, compare the strategy returns with those of the SPY ETF (an ETF particularly designed to track the movements of the S&P 500 market index).

#finance #python #algorithmic trading with the keltner channel in python #algorithmic trading #the keltner channel #algorithmic trading with the keltner channel

August  Larson

August Larson

1624372980

Algorithmic Trading with Williams %R in Python

Learn to build a killer trading strategy with a powerful technical indicator in python

Introduction

While having a look at the list of most popular momentum indicators that consists of the Relative Strength Index, and the Stochastic Oscillator, the one we are going to discuss today also joins the list when considering its usage and efficiency in the real world market. It’s none other than the Williams %R.

In this article, we are going to explore what Williams %R is all about, the math behind this indicator, and how a trading strategy based on it can be built with the help of python. As a bonus step, we will compare the returns of our Williams %R strategy returns with the returns of SPY ETF (an ETF specifically designed to track the movement of the S&P 500 Index) to get an idea of how well our strategy performs in the real-world market and can be considered as a step to evaluate the strategy. Considering your curiosity piqued, let’s dive into the article!

#python #algorithmic trading with williams %r in python #algorithmic trading with williams %r #algorithmic trading #williams %r

How I Made a 65% ROI with this Boeing Trading Algorithm

Since the market crashed in March of 2020 the rebound has been swift and irrational.

Boeing, for example, is in many ways worse off than it was in March.

It’s clear air travel has plummeted and that airlines will be impacted for

years. Where will airlines get the money to purchase planes?

An example of one headline in April: “Boeing customers cancel staggering 150 Max plane orders”.

Buy the dip?

One thing I’ve noticed is that since the end of March you can

basically just buy every dip and expect a pop, selling the next day. I

mentioned this to a friend on Friday and decided to backtest it.

Well, sure enough it works!

I’ll mention I made one modification. Originally I wrote the system like so:

1. Check if Boeing is down more than 3% 15 minutes from close

2. If yes, buy with 100% of portfolio

3. The next day, 15 minutes from open liquidate the portfolio.

This worked OK. Great actually! It returned about 25%. But want to know what really kicked it up a notch?

Instead of just selling the next day, I only sell if the position is

sitting at a realized gain. So e.g. if the next day its flat or drops

another 1%, don’t sell it, just keep holding on until its up and THEN

sell. Of course, this is completely insane and you would have to expect

the market to only go up, but that’s what has been happening.

Guess what? This simple system returned a whopping 65% in two-ish months. Yeah, I know, crazy.

Check out the backtest screenshot:

And here are the raw trading logs for those that want to see the dates the trades were made:

Here is the code!

Before we look at the code, I’ll just mention here are the details of the backtest:

  • start with 100k in cash

  • start at April first and go until last Friday (June 19th 2020)

  • end up with about 165k or a 65% return.

I wrote this little script on Quant Connect. The screenshot at the

top of the page is the backtest result, and the code below is everything you need to try this out.

Note the place I mentioned in the code you should comment if you want this to be a little bit less insane.

#algorithmic-trading #trading #python #algorithms #trading-algorithms